suricata
app-layer-parser.c File Reference
#include "suricata-common.h"
#include "app-layer-parser.h"
#include "flow.h"
#include "flow-private.h"
#include "flow-util.h"
#include "app-layer-frames.h"
#include "stream-tcp.h"
#include "util-validate.h"
#include "app-layer.h"
#include "app-layer-detect-proto.h"
#include "app-layer-ftp.h"
#include "app-layer-smtp.h"
#include "app-layer-smb.h"
#include "app-layer-htp.h"
#include "app-layer-ssl.h"
#include "app-layer-ssh.h"
#include "app-layer-modbus.h"
#include "app-layer-enip.h"
#include "app-layer-dnp3.h"
#include "app-layer-nfs-tcp.h"
#include "app-layer-nfs-udp.h"
#include "app-layer-ntp.h"
#include "app-layer-tftp.h"
#include "app-layer-ike.h"
#include "app-layer-krb5.h"
#include "app-layer-sip.h"
#include "app-layer-rfb.h"
#include "app-layer-snmp.h"
#include "app-layer-quic.h"
#include "app-layer-rdp.h"
#include "app-layer-http2.h"
#include "util-unittest-helper.h"
Include dependency graph for app-layer-parser.c:

Go to the source code of this file.

Data Structures

struct  AppLayerParserThreadCtx_
 
struct  AppLayerParserProtoCtx_
 App layer protocol parser context. More...
 
struct  AppLayerParserCtx_
 
struct  AppLayerParserState_
 
struct  TestState_
 

Macros

#define IS_DISRUPTED(flags)   ((flags) & (STREAM_DEPTH | STREAM_GAP))
 
#define BOTH_SET(a, b)   ((a) != NULL && (b) != NULL)
 
#define BOTH_SET_OR_BOTH_UNSET(a, b)   (((a) == NULL && (b) == NULL) || ((a) != NULL && (b) != NULL))
 
#define THREE_SET_OR_THREE_UNSET(a, b, c)   (((a) == NULL && (b) == NULL && (c) == NULL) || ((a) != NULL && (b) != NULL && (c) != NULL))
 
#define THREE_SET(a, b, c)   ((a) != NULL && (b) != NULL && (c) != NULL)
 

Typedefs

typedef struct AppLayerParserProtoCtx_ AppLayerParserProtoCtx
 App layer protocol parser context. More...
 
typedef struct AppLayerParserCtx_ AppLayerParserCtx
 
typedef struct TestState_ TestState
 

Functions

void AppLayerFramesFreeContainer (Flow *f)
 
FramesContainerAppLayerFramesGetContainer (Flow *f)
 
FramesContainerAppLayerFramesSetupContainer (Flow *f)
 
void UTHAppLayerParserStateGetIds (void *ptr, uint64_t *i1, uint64_t *i2, uint64_t *log, uint64_t *min)
 
int AppLayerParserProtoIsRegistered (uint8_t ipproto, AppProto alproto)
 
AppLayerParserStateAppLayerParserStateAlloc (void)
 
void AppLayerParserStateFree (AppLayerParserState *pstate)
 
int AppLayerParserSetup (void)
 
void AppLayerParserPostStreamSetup (void)
 
int AppLayerParserDeSetup (void)
 
AppLayerParserThreadCtxAppLayerParserThreadCtxAlloc (void)
 Gets a new app layer protocol's parser thread context. More...
 
void AppLayerParserThreadCtxFree (AppLayerParserThreadCtx *tctx)
 Destroys the app layer parser thread context obtained using AppLayerParserThreadCtxAlloc(). More...
 
int AppLayerParserConfParserEnabled (const char *ipproto, const char *alproto_name)
 check if a parser is enabled in the config Returns enabled always if: were running unittests More...
 
int AppLayerParserRegisterParser (uint8_t ipproto, AppProto alproto, uint8_t direction, AppLayerParserFPtr Parser)
 Register app layer parser for the protocol. More...
 
void AppLayerParserRegisterParserAcceptableDataDirection (uint8_t ipproto, AppProto alproto, uint8_t direction)
 
void AppLayerParserRegisterOptionFlags (uint8_t ipproto, AppProto alproto, uint32_t flags)
 
uint32_t AppLayerParserGetOptionFlags (uint8_t protomap, AppProto alproto)
 
void AppLayerParserRegisterStateFuncs (uint8_t ipproto, AppProto alproto, void *(*StateAlloc)(void *, AppProto), void(*StateFree)(void *))
 
void AppLayerParserRegisterLocalStorageFunc (uint8_t ipproto, AppProto alproto, void *(*LocalStorageAlloc)(void), void(*LocalStorageFree)(void *))
 
void AppLayerParserRegisterGetTxFilesFunc (uint8_t ipproto, AppProto alproto, AppLayerGetFileState(*GetTxFiles)(void *, void *, uint8_t))
 
void AppLayerParserRegisterLoggerBits (uint8_t ipproto, AppProto alproto, LoggerId bits)
 
void AppLayerParserRegisterLogger (uint8_t ipproto, AppProto alproto)
 
void AppLayerParserRegisterTruncateFunc (uint8_t ipproto, AppProto alproto, void(*Truncate)(void *, uint8_t))
 
void AppLayerParserRegisterGetStateProgressFunc (uint8_t ipproto, AppProto alproto, int(*StateGetProgress)(void *alstate, uint8_t direction))
 
void AppLayerParserRegisterTxFreeFunc (uint8_t ipproto, AppProto alproto, void(*StateTransactionFree)(void *, uint64_t))
 
void AppLayerParserRegisterGetTxCnt (uint8_t ipproto, AppProto alproto, uint64_t(*StateGetTxCnt)(void *alstate))
 
void AppLayerParserRegisterGetTx (uint8_t ipproto, AppProto alproto, void *(StateGetTx)(void *alstate, uint64_t tx_id))
 
void AppLayerParserRegisterGetTxIterator (uint8_t ipproto, AppProto alproto, AppLayerGetTxIteratorFunc Func)
 
void AppLayerParserRegisterStateProgressCompletionStatus (AppProto alproto, const int ts, const int tc)
 
void AppLayerParserRegisterGetEventInfoById (uint8_t ipproto, AppProto alproto, int(*StateGetEventInfoById)(int event_id, const char **event_name, AppLayerEventType *event_type))
 
void AppLayerParserRegisterGetFrameFuncs (uint8_t ipproto, AppProto alproto, AppLayerParserGetFrameIdByNameFn GetIdByNameFunc, AppLayerParserGetFrameNameByIdFn GetNameByIdFunc)
 
void AppLayerParserRegisterGetEventInfo (uint8_t ipproto, AppProto alproto, int(*StateGetEventInfo)(const char *event_name, int *event_id, AppLayerEventType *event_type))
 
void AppLayerParserRegisterTxDataFunc (uint8_t ipproto, AppProto alproto, AppLayerTxData *(*GetTxData)(void *tx))
 
void AppLayerParserRegisterStateDataFunc (uint8_t ipproto, AppProto alproto, AppLayerStateData *(*GetStateData)(void *state))
 
void AppLayerParserRegisterApplyTxConfigFunc (uint8_t ipproto, AppProto alproto, bool(*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig))
 
void AppLayerParserRegisterSetStreamDepthFlag (uint8_t ipproto, AppProto alproto, void(*SetStreamDepthFlag)(void *tx, uint8_t flags))
 
void * AppLayerParserGetProtocolParserLocalStorage (uint8_t ipproto, AppProto alproto)
 
void AppLayerParserDestroyProtocolParserLocalStorage (uint8_t ipproto, AppProto alproto, void *local_data)
 
AppLayerGetTxIteratorFunc AppLayerGetTxIterator (const uint8_t ipproto, const AppProto alproto)
 
uint64_t AppLayerParserGetTransactionLogId (AppLayerParserState *pstate)
 
void AppLayerParserSetTransactionLogId (AppLayerParserState *pstate, uint64_t tx_id)
 
uint64_t AppLayerParserGetTransactionInspectId (AppLayerParserState *pstate, uint8_t direction)
 
uint64_t AppLayerParserGetTxDetectFlags (AppLayerTxData *txd, const uint8_t dir)
 
void AppLayerParserSetTransactionInspectId (const Flow *f, AppLayerParserState *pstate, void *alstate, const uint8_t flags, bool tag_txs_as_inspected)
 
AppLayerDecoderEventsAppLayerParserGetDecoderEvents (AppLayerParserState *pstate)
 
void AppLayerParserSetDecoderEvents (AppLayerParserState *pstate, AppLayerDecoderEvents *devents)
 
AppLayerDecoderEventsAppLayerParserGetEventsByTx (uint8_t ipproto, AppProto alproto, void *tx)
 
AppLayerGetFileState AppLayerParserGetTxFiles (const Flow *f, void *state, void *tx, const uint8_t direction)
 
void AppLayerParserTransactionsCleanup (Flow *f, const uint8_t pkt_dir)
 remove obsolete (inspected and logged) transactions More...
 
int AppLayerParserGetStateProgress (uint8_t ipproto, AppProto alproto, void *alstate, uint8_t flags)
 get the progress value for a tx/protocol More...
 
uint64_t AppLayerParserGetTxCnt (const Flow *f, void *alstate)
 
void * AppLayerParserGetTx (uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
 
int AppLayerParserGetStateProgressCompletionStatus (AppProto alproto, uint8_t direction)
 
int AppLayerParserGetEventInfo (uint8_t ipproto, AppProto alproto, const char *event_name, int *event_id, AppLayerEventType *event_type)
 
int AppLayerParserGetEventInfoById (uint8_t ipproto, AppProto alproto, int event_id, const char **event_name, AppLayerEventType *event_type)
 
uint8_t AppLayerParserGetFirstDataDir (uint8_t ipproto, AppProto alproto)
 
uint64_t AppLayerParserGetTransactionActive (const Flow *f, AppLayerParserState *pstate, uint8_t direction)
 
bool AppLayerParserSupportsFiles (uint8_t ipproto, AppProto alproto)
 
AppLayerTxDataAppLayerParserGetTxData (uint8_t ipproto, AppProto alproto, void *tx)
 
AppLayerStateData * AppLayerParserGetStateData (uint8_t ipproto, AppProto alproto, void *state)
 
void AppLayerParserApplyTxConfig (uint8_t ipproto, AppProto alproto, void *state, void *tx, enum ConfigAction mode, AppLayerTxConfig config)
 
int AppLayerParserParse (ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto, uint8_t flags, const uint8_t *input, uint32_t input_len)
 
void AppLayerParserSetEOF (AppLayerParserState *pstate)
 
bool AppLayerParserHasDecoderEvents (AppLayerParserState *pstate)
 
int AppLayerParserIsEnabled (AppProto alproto)
 simple way to globally test if a alproto is registered and fully enabled in the configuration. More...
 
int AppLayerParserProtocolHasLogger (uint8_t ipproto, AppProto alproto)
 
LoggerId AppLayerParserProtocolGetLoggerBits (uint8_t ipproto, AppProto alproto)
 
void AppLayerParserTriggerRawStreamReassembly (Flow *f, int direction)
 
void AppLayerParserSetStreamDepth (uint8_t ipproto, AppProto alproto, uint32_t stream_depth)
 
uint32_t AppLayerParserGetStreamDepth (const Flow *f)
 
void AppLayerParserSetStreamDepthFlag (uint8_t ipproto, AppProto alproto, void *state, uint64_t tx_id, uint8_t flags)
 
int AppLayerParserGetFrameIdByName (uint8_t ipproto, AppProto alproto, const char *name)
 
const char * AppLayerParserGetFrameNameById (uint8_t ipproto, AppProto alproto, const uint8_t id)
 
void AppLayerParserStateProtoCleanup (uint8_t protomap, AppProto alproto, void *alstate, AppLayerParserState *pstate)
 
void AppLayerParserStateCleanup (const Flow *f, void *alstate, AppLayerParserState *pstate)
 
void AppLayerParserRegisterProtocolParsers (void)
 
void AppLayerParserStateSetFlag (AppLayerParserState *pstate, uint16_t flag)
 
uint16_t AppLayerParserStateIssetFlag (AppLayerParserState *pstate, uint16_t flag)
 
void AppLayerParserRegisterProtocolUnittests (uint8_t ipproto, AppProto alproto, void(*RegisterUnittests)(void))
 
void AppLayerParserBackupParserTable (void)
 
void AppLayerParserRestoreParserTable (void)
 
void AppLayerParserRegisterUnittests (void)
 

Variables

enum ExceptionPolicy g_applayerparser_error_policy = EXCEPTION_POLICY_NOT_SET
 
int g_detect_disabled
 
bool g_file_logger_enabled
 
bool g_filedata_logger_enabled
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Generic App-layer parsing functions.

Definition in file app-layer-parser.c.

Macro Definition Documentation

◆ BOTH_SET

#define BOTH_SET (   a,
 
)    ((a) != NULL && (b) != NULL)

Definition at line 1679 of file app-layer-parser.c.

◆ BOTH_SET_OR_BOTH_UNSET

#define BOTH_SET_OR_BOTH_UNSET (   a,
 
)    (((a) == NULL && (b) == NULL) || ((a) != NULL && (b) != NULL))

Definition at line 1680 of file app-layer-parser.c.

◆ IS_DISRUPTED

#define IS_DISRUPTED (   flags)    ((flags) & (STREAM_DEPTH | STREAM_GAP))

Definition at line 911 of file app-layer-parser.c.

◆ THREE_SET

#define THREE_SET (   a,
  b,
 
)    ((a) != NULL && (b) != NULL && (c) != NULL)

Definition at line 1682 of file app-layer-parser.c.

◆ THREE_SET_OR_THREE_UNSET

#define THREE_SET_OR_THREE_UNSET (   a,
  b,
 
)    (((a) == NULL && (b) == NULL && (c) == NULL) || ((a) != NULL && (b) != NULL && (c) != NULL))

Definition at line 1681 of file app-layer-parser.c.

Typedef Documentation

◆ AppLayerParserCtx

◆ AppLayerParserProtoCtx

App layer protocol parser context.

◆ TestState

typedef struct TestState_ TestState

Function Documentation

◆ AppLayerFramesFreeContainer()

void AppLayerFramesFreeContainer ( Flow f)

Definition at line 174 of file app-layer-parser.c.

References Flow_::alparser, and AppLayerParserState_::frames.

◆ AppLayerFramesGetContainer()

FramesContainer* AppLayerFramesGetContainer ( Flow f)

Definition at line 182 of file app-layer-parser.c.

References Flow_::alparser, and AppLayerParserState_::frames.

Referenced by AppLayerFrameDump(), AppLayerFrameGetById(), AppLayerFramesSlide(), and FramesPrune().

Here is the caller graph for this function:

◆ AppLayerFramesSetupContainer()

◆ AppLayerGetTxIterator()

AppLayerGetTxIteratorFunc AppLayerGetTxIterator ( const uint8_t  ipproto,
const AppProto  alproto 
)

Definition at line 702 of file app-layer-parser.c.

Referenced by AppLayerParserSetTransactionInspectId().

Here is the caller graph for this function:

◆ AppLayerParserApplyTxConfig()

void AppLayerParserApplyTxConfig ( uint8_t  ipproto,
AppProto  alproto,
void *  state,
void *  tx,
enum ConfigAction  mode,
AppLayerTxConfig  config 
)

Definition at line 1213 of file app-layer-parser.c.

References FlowGetProtoMapping(), and SCEnter.

Here is the call graph for this function:

◆ AppLayerParserBackupParserTable()

void AppLayerParserBackupParserTable ( void  )

Definition at line 1917 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserConfParserEnabled()

int AppLayerParserConfParserEnabled ( const char *  ipproto,
const char *  alproto_name 
)

check if a parser is enabled in the config Returns enabled always if: were running unittests

Given a protocol name, checks if the parser is enabled in the conf file.

Definition at line 332 of file app-layer-parser.c.

References ConfGetNode(), ConfValIsFalse(), ConfValIsTrue(), FatalError, RunmodeIsUnittests(), SCEnter, SCLogDebug, SCLogError, SCReturnInt, and ConfNode_::val.

Referenced by HTPFreeConfig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppLayerParserDeSetup()

int AppLayerParserDeSetup ( void  )

Definition at line 281 of file app-layer-parser.c.

References FTPParserCleanup(), SCEnter, SCReturnInt, and SMTPParserCleanup().

Referenced by AppLayerDeSetup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppLayerParserDestroyProtocolParserLocalStorage()

void AppLayerParserDestroyProtocolParserLocalStorage ( uint8_t  ipproto,
AppProto  alproto,
void *  local_data 
)

Definition at line 652 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerParserThreadCtxFree().

Here is the caller graph for this function:

◆ AppLayerParserGetDecoderEvents()

AppLayerDecoderEvents* AppLayerParserGetDecoderEvents ( AppLayerParserState pstate)

Definition at line 859 of file app-layer-parser.c.

References AppLayerParserState_::decoder_events, SCEnter, and SCReturnPtr.

Referenced by AppLayerParserHasDecoderEvents().

Here is the caller graph for this function:

◆ AppLayerParserGetEventInfo()

int AppLayerParserGetEventInfo ( uint8_t  ipproto,
AppProto  alproto,
const char *  event_name,
int *  event_id,
AppLayerEventType *  event_type 
)

Definition at line 1140 of file app-layer-parser.c.

References FlowGetProtoMapping(), and SCEnter.

Here is the call graph for this function:

◆ AppLayerParserGetEventInfoById()

int AppLayerParserGetEventInfoById ( uint8_t  ipproto,
AppProto  alproto,
int  event_id,
const char **  event_name,
AppLayerEventType *  event_type 
)

Definition at line 1150 of file app-layer-parser.c.

References FlowGetProtoMapping(), and SCEnter.

Here is the call graph for this function:

◆ AppLayerParserGetEventsByTx()

AppLayerDecoderEvents* AppLayerParserGetEventsByTx ( uint8_t  ipproto,
AppProto  alproto,
void *  tx 
)

Definition at line 872 of file app-layer-parser.c.

References AppLayerParserGetTxData(), AppLayerDecoderEvents_::events, SCEnter, and SCReturnPtr.

Here is the call graph for this function:

◆ AppLayerParserGetFirstDataDir()

uint8_t AppLayerParserGetFirstDataDir ( uint8_t  ipproto,
AppProto  alproto 
)

Definition at line 1161 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserGetFrameIdByName()

int AppLayerParserGetFrameIdByName ( uint8_t  ipproto,
AppProto  alproto,
const char *  name 
)

Definition at line 1614 of file app-layer-parser.c.

◆ AppLayerParserGetFrameNameById()

const char* AppLayerParserGetFrameNameById ( uint8_t  ipproto,
AppProto  alproto,
const uint8_t  id 
)

Definition at line 1623 of file app-layer-parser.c.

Referenced by DetectRunFrameInspectRule(), and FrameJsonLogOneFrame().

Here is the caller graph for this function:

◆ AppLayerParserGetOptionFlags()

uint32_t AppLayerParserGetOptionFlags ( uint8_t  protomap,
AppProto  alproto 
)

Definition at line 423 of file app-layer-parser.c.

References SCEnter, and SCReturnUInt.

◆ AppLayerParserGetProtocolParserLocalStorage()

void* AppLayerParserGetProtocolParserLocalStorage ( uint8_t  ipproto,
AppProto  alproto 
)

Definition at line 637 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerParserThreadCtxAlloc().

Here is the caller graph for this function:

◆ AppLayerParserGetStateData()

AppLayerStateData* AppLayerParserGetStateData ( uint8_t  ipproto,
AppProto  alproto,
void *  state 
)

Definition at line 1202 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserGetStateProgress()

int AppLayerParserGetStateProgress ( uint8_t  ipproto,
AppProto  alproto,
void *  alstate,
uint8_t  flags 
)

get the progress value for a tx/protocol

If the stream is disrupted, we return the 'completion' value.

Definition at line 1103 of file app-layer-parser.c.

References flags, IS_DISRUPTED, SCEnter, and unlikely.

Referenced by AppLayerParserSetTransactionInspectId(), and DetectEngineInspectBufferGeneric().

Here is the caller graph for this function:

◆ AppLayerParserGetStateProgressCompletionStatus()

int AppLayerParserGetStateProgressCompletionStatus ( AppProto  alproto,
uint8_t  direction 
)

Definition at line 1132 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerParserSetTransactionInspectId(), and OutputRegisterTxLogger().

Here is the caller graph for this function:

◆ AppLayerParserGetStreamDepth()

uint32_t AppLayerParserGetStreamDepth ( const Flow f)

Definition at line 1595 of file app-layer-parser.c.

References SCReturnInt.

◆ AppLayerParserGetTransactionActive()

uint64_t AppLayerParserGetTransactionActive ( const Flow f,
AppLayerParserState pstate,
uint8_t  direction 
)

Definition at line 1168 of file app-layer-parser.c.

References AppLayerParserState_::inspect_id, AppLayerParserState_::log_id, and SCEnter.

Referenced by FlowForceReassemblyNeedReassembly().

Here is the caller graph for this function:

◆ AppLayerParserGetTransactionInspectId()

uint64_t AppLayerParserGetTransactionInspectId ( AppLayerParserState pstate,
uint8_t  direction 
)

Definition at line 727 of file app-layer-parser.c.

References AppLayerParserState_::inspect_id, SCEnter, and SCReturnCT.

Referenced by AppLayerParserSetTransactionInspectId().

Here is the caller graph for this function:

◆ AppLayerParserGetTransactionLogId()

uint64_t AppLayerParserGetTransactionLogId ( AppLayerParserState pstate)

Definition at line 710 of file app-layer-parser.c.

References AppLayerParserState_::log_id, SCEnter, and SCReturnCT.

◆ AppLayerParserGetTx()

void* AppLayerParserGetTx ( uint8_t  ipproto,
AppProto  alproto,
void *  alstate,
uint64_t  tx_id 
)

Definition at line 1125 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerParserSetStreamDepthFlag().

Here is the caller graph for this function:

◆ AppLayerParserGetTxCnt()

uint64_t AppLayerParserGetTxCnt ( const Flow f,
void *  alstate 
)

Definition at line 1118 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerParserSetTransactionInspectId(), and FlowForceReassemblyNeedReassembly().

Here is the caller graph for this function:

◆ AppLayerParserGetTxData()

AppLayerTxData* AppLayerParserGetTxData ( uint8_t  ipproto,
AppProto  alproto,
void *  tx 
)

Definition at line 1195 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerParserGetEventsByTx(), AppLayerParserSetTransactionInspectId(), and DetectRunStoreStateTx().

Here is the caller graph for this function:

◆ AppLayerParserGetTxDetectFlags()

uint64_t AppLayerParserGetTxDetectFlags ( AppLayerTxData txd,
const uint8_t  dir 
)
inline

Definition at line 737 of file app-layer-parser.c.

Referenced by AppLayerParserSetTransactionInspectId().

Here is the caller graph for this function:

◆ AppLayerParserGetTxFiles()

AppLayerGetFileState AppLayerParserGetTxFiles ( const Flow f,
void *  state,
void *  tx,
const uint8_t  direction 
)

Definition at line 888 of file app-layer-parser.c.

References SCEnter.

Referenced by DetectEngineInspectFiledata(), and DetectFileInspectGeneric().

Here is the caller graph for this function:

◆ AppLayerParserHasDecoderEvents()

bool AppLayerParserHasDecoderEvents ( AppLayerParserState pstate)

Definition at line 1529 of file app-layer-parser.c.

References AppLayerParserGetDecoderEvents(), AppLayerDecoderEvents_::cnt, AppLayerParserState_::decoder_events, and SCEnter.

Here is the call graph for this function:

◆ AppLayerParserIsEnabled()

int AppLayerParserIsEnabled ( AppProto  alproto)

simple way to globally test if a alproto is registered and fully enabled in the configuration.

Definition at line 1547 of file app-layer-parser.c.

References FLOW_PROTO_APPLAYER_MAX.

Referenced by OutputRegisterTxLogger().

Here is the caller graph for this function:

◆ AppLayerParserParse()

int AppLayerParserParse ( ThreadVars tv,
AppLayerParserThreadCtx alp_tctx,
Flow f,
AppProto  alproto,
uint8_t  flags,
const uint8_t *  input,
uint32_t  input_len 
)
Return values
int-1 in case of unrecoverable error. App-layer tracking stops for this flow.
int0 ok: we did not update app_progress
int1 ok: we updated app_progress

Definition at line 1303 of file app-layer-parser.c.

References Flow_::alparser, BUG_ON, FlowGetProtoMapping(), Flow_::proto, Flow_::protomap, and SCEnter.

Referenced by LLVMFuzzerTestOneInput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppLayerParserPostStreamSetup()

void AppLayerParserPostStreamSetup ( void  )

Definition at line 267 of file app-layer-parser.c.

References ALPROTO_MAX, and FLOW_PROTO_DEFAULT.

Referenced by PreRunInit().

Here is the caller graph for this function:

◆ AppLayerParserProtocolGetLoggerBits()

LoggerId AppLayerParserProtocolGetLoggerBits ( uint8_t  ipproto,
AppProto  alproto 
)

Definition at line 1565 of file app-layer-parser.c.

References FlowGetProtoMapping(), and SCEnter.

Here is the call graph for this function:

◆ AppLayerParserProtocolHasLogger()

int AppLayerParserProtocolHasLogger ( uint8_t  ipproto,
AppProto  alproto 
)

Definition at line 1557 of file app-layer-parser.c.

References FlowGetProtoMapping(), and SCEnter.

Here is the call graph for this function:

◆ AppLayerParserProtoIsRegistered()

int AppLayerParserProtoIsRegistered ( uint8_t  ipproto,
AppProto  alproto 
)

Definition at line 229 of file app-layer-parser.c.

References FlowGetProtoMapping().

Here is the call graph for this function:

◆ AppLayerParserRegisterApplyTxConfigFunc()

void AppLayerParserRegisterApplyTxConfigFunc ( uint8_t  ipproto,
AppProto  alproto,
bool(*)(void *state, void *tx, int mode, AppLayerTxConfig)  ApplyTxConfig 
)

Definition at line 615 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterGetEventInfo()

void AppLayerParserRegisterGetEventInfo ( uint8_t  ipproto,
AppProto  alproto,
int(*)(const char *event_name, int *event_id, AppLayerEventType *event_type)  StateGetEventInfo 
)

Definition at line 583 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterGetEventInfoById()

void AppLayerParserRegisterGetEventInfoById ( uint8_t  ipproto,
AppProto  alproto,
int(*)(int event_id, const char **event_name, AppLayerEventType *event_type)  StateGetEventInfoById 
)

Definition at line 561 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterGetFrameFuncs()

void AppLayerParserRegisterGetFrameFuncs ( uint8_t  ipproto,
AppProto  alproto,
AppLayerParserGetFrameIdByNameFn  GetIdByNameFunc,
AppLayerParserGetFrameNameByIdFn  GetNameByIdFunc 
)

Definition at line 573 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterGetStateProgressFunc()

void AppLayerParserRegisterGetStateProgressFunc ( uint8_t  ipproto,
AppProto  alproto,
int(*)(void *alstate, uint8_t direction)  StateGetProgress 
)

Definition at line 494 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterGetTx()

void AppLayerParserRegisterGetTx ( uint8_t  ipproto,
AppProto  alproto,
void *  StateGetTx)(void *alstate, uint64_t tx_id 
)

Definition at line 527 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterGetTxCnt()

void AppLayerParserRegisterGetTxCnt ( uint8_t  ipproto,
AppProto  alproto,
uint64_t(*)(void *alstate)  StateGetTxCnt 
)

Definition at line 516 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterGetTxFilesFunc()

void AppLayerParserRegisterGetTxFilesFunc ( uint8_t  ipproto,
AppProto  alproto,
AppLayerGetFileState(*)(void *, void *, uint8_t)  GetTxFiles 
)

Definition at line 456 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterGetTxIterator()

void AppLayerParserRegisterGetTxIterator ( uint8_t  ipproto,
AppProto  alproto,
AppLayerGetTxIteratorFunc  Func 
)

Definition at line 538 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterLocalStorageFunc()

void AppLayerParserRegisterLocalStorageFunc ( uint8_t  ipproto,
AppProto  alproto,
void *(*)(void)  LocalStorageAlloc,
void(*)(void *)  LocalStorageFree 
)

Definition at line 442 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterLogger()

void AppLayerParserRegisterLogger ( uint8_t  ipproto,
AppProto  alproto 
)

Definition at line 475 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterLoggerBits()

void AppLayerParserRegisterLoggerBits ( uint8_t  ipproto,
AppProto  alproto,
LoggerId  bits 
)

Definition at line 466 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterOptionFlags()

void AppLayerParserRegisterOptionFlags ( uint8_t  ipproto,
AppProto  alproto,
uint32_t  flags 
)

Definition at line 413 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterParser()

int AppLayerParserRegisterParser ( uint8_t  ipproto,
AppProto  alproto,
uint8_t  direction,
AppLayerParserFPtr  Parser 
)

Register app layer parser for the protocol.

Return values
0On success.
-1On failure.

Definition at line 390 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterParserAcceptableDataDirection()

void AppLayerParserRegisterParserAcceptableDataDirection ( uint8_t  ipproto,
AppProto  alproto,
uint8_t  direction 
)

Definition at line 402 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterProtocolParsers()

void AppLayerParserRegisterProtocolParsers ( void  )

IMAP

Definition at line 1737 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerSetup(), and LLVMFuzzerTestOneInput().

Here is the caller graph for this function:

◆ AppLayerParserRegisterProtocolUnittests()

void AppLayerParserRegisterProtocolUnittests ( uint8_t  ipproto,
AppProto  alproto,
void(*)(void)  RegisterUnittests 
)

Definition at line 1908 of file app-layer-parser.c.

Referenced by RegisterIKEParsers(), RegisterKRB5Parsers(), RegisterModbusParsers(), and RegisterNTPParsers().

Here is the caller graph for this function:

◆ AppLayerParserRegisterSetStreamDepthFlag()

void AppLayerParserRegisterSetStreamDepthFlag ( uint8_t  ipproto,
AppProto  alproto,
void(*)(void *tx, uint8_t flags SetStreamDepthFlag 
)

Definition at line 625 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterStateDataFunc()

void AppLayerParserRegisterStateDataFunc ( uint8_t  ipproto,
AppProto  alproto,
AppLayerStateData *(*)(void *state)  GetStateData 
)

Definition at line 605 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterStateFuncs()

void AppLayerParserRegisterStateFuncs ( uint8_t  ipproto,
AppProto  alproto,
void *(*)(void *, AppProto StateAlloc,
void(*)(void *)  StateFree 
)

Definition at line 429 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterStateProgressCompletionStatus()

void AppLayerParserRegisterStateProgressCompletionStatus ( AppProto  alproto,
const int  ts,
const int  tc 
)

Definition at line 546 of file app-layer-parser.c.

References BUG_ON, and ts.

◆ AppLayerParserRegisterTruncateFunc()

void AppLayerParserRegisterTruncateFunc ( uint8_t  ipproto,
AppProto  alproto,
void(*)(void *, uint8_t)  Truncate 
)

Definition at line 484 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterTxDataFunc()

void AppLayerParserRegisterTxDataFunc ( uint8_t  ipproto,
AppProto  alproto,
AppLayerTxData *(*)(void *tx)  GetTxData 
)

Definition at line 595 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterTxFreeFunc()

void AppLayerParserRegisterTxFreeFunc ( uint8_t  ipproto,
AppProto  alproto,
void(*)(void *, uint64_t)  StateTransactionFree 
)

Definition at line 505 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserRegisterUnittests()

void AppLayerParserRegisterUnittests ( void  )

Definition at line 2020 of file app-layer-parser.c.

References ALPROTO_MAX, FLOW_PROTO_DEFAULT, and SCEnter.

◆ AppLayerParserRestoreParserTable()

void AppLayerParserRestoreParserTable ( void  )

Definition at line 1925 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserSetDecoderEvents()

void AppLayerParserSetDecoderEvents ( AppLayerParserState pstate,
AppLayerDecoderEvents devents 
)

Definition at line 867 of file app-layer-parser.c.

References AppLayerParserState_::decoder_events.

◆ AppLayerParserSetEOF()

void AppLayerParserSetEOF ( AppLayerParserState pstate)

Definition at line 1513 of file app-layer-parser.c.

References APP_LAYER_PARSER_EOF_TC, APP_LAYER_PARSER_EOF_TS, AppLayerParserStateSetFlag(), SCEnter, SCLogDebug, and SCReturn.

Here is the call graph for this function:

◆ AppLayerParserSetStreamDepth()

void AppLayerParserSetStreamDepth ( uint8_t  ipproto,
AppProto  alproto,
uint32_t  stream_depth 
)

Definition at line 1584 of file app-layer-parser.c.

References SCEnter.

◆ AppLayerParserSetStreamDepthFlag()

void AppLayerParserSetStreamDepthFlag ( uint8_t  ipproto,
AppProto  alproto,
void *  state,
uint64_t  tx_id,
uint8_t  flags 
)

Definition at line 1600 of file app-layer-parser.c.

References AppLayerParserGetTx(), and SCEnter.

Here is the call graph for this function:

◆ AppLayerParserSetTransactionInspectId()

void AppLayerParserSetTransactionInspectId ( const Flow f,
AppLayerParserState pstate,
void *  alstate,
const uint8_t  flags,
bool  tag_txs_as_inspected 
)

◆ AppLayerParserSetTransactionLogId()

void AppLayerParserSetTransactionLogId ( AppLayerParserState pstate,
uint64_t  tx_id 
)

Definition at line 717 of file app-layer-parser.c.

References AppLayerParserState_::log_id, SCEnter, and SCReturn.

◆ AppLayerParserSetup()

int AppLayerParserSetup ( void  )

Definition at line 260 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerSetup(), and LLVMFuzzerTestOneInput().

Here is the caller graph for this function:

◆ AppLayerParserStateAlloc()

AppLayerParserState* AppLayerParserStateAlloc ( void  )

Definition at line 236 of file app-layer-parser.c.

References SCCalloc, SCEnter, and SCReturnPtr.

◆ AppLayerParserStateCleanup()

void AppLayerParserStateCleanup ( const Flow f,
void *  alstate,
AppLayerParserState pstate 
)

Definition at line 1651 of file app-layer-parser.c.

References Flow_::alproto, AppLayerParserStateProtoCleanup(), and Flow_::protomap.

Referenced by FlowCleanupAppLayer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppLayerParserStateFree()

void AppLayerParserStateFree ( AppLayerParserState pstate)

Definition at line 248 of file app-layer-parser.c.

References AppLayerDecoderEventsFreeEvents(), AppLayerParserState_::decoder_events, and SCEnter.

Here is the call graph for this function:

◆ AppLayerParserStateIssetFlag()

uint16_t AppLayerParserStateIssetFlag ( AppLayerParserState pstate,
uint16_t  flag 
)

Definition at line 1804 of file app-layer-parser.c.

References AppLayerParserState_::flags, SCEnter, and SCReturnUInt.

Referenced by LLVMFuzzerTestOneInput().

Here is the caller graph for this function:

◆ AppLayerParserStateProtoCleanup()

void AppLayerParserStateProtoCleanup ( uint8_t  protomap,
AppProto  alproto,
void *  alstate,
AppLayerParserState pstate 
)

Definition at line 1634 of file app-layer-parser.c.

References SCEnter.

Referenced by AppLayerParserStateCleanup().

Here is the caller graph for this function:

◆ AppLayerParserStateSetFlag()

void AppLayerParserStateSetFlag ( AppLayerParserState pstate,
uint16_t  flag 
)

Definition at line 1796 of file app-layer-parser.c.

References AppLayerParserState_::flags, SCEnter, and SCReturn.

Referenced by AppLayerParserSetEOF(), and StreamTcpDisableAppLayer().

Here is the caller graph for this function:

◆ AppLayerParserSupportsFiles()

bool AppLayerParserSupportsFiles ( uint8_t  ipproto,
AppProto  alproto 
)

Definition at line 1185 of file app-layer-parser.c.

References ALPROTO_HTTP, ALPROTO_HTTP1, ALPROTO_HTTP2, and AppLayerParserSupportsFiles().

Referenced by AppLayerParserSupportsFiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppLayerParserThreadCtxAlloc()

AppLayerParserThreadCtx* AppLayerParserThreadCtxAlloc ( void  )

Gets a new app layer protocol's parser thread context.

Return values
Non-NULLpointer on success. NULL pointer on failure.

Definition at line 291 of file app-layer-parser.c.

References AppLayerParserThreadCtx_::alproto_local_storage, ALPROTO_MAX, AppLayerParserGetProtocolParserLocalStorage(), FLOW_PROTO_DEFAULT, FlowGetReverseProtoMapping(), SCCalloc, SCEnter, and SCReturnPtr.

Referenced by AppLayerGetCtxThread(), and LLVMFuzzerTestOneInput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppLayerParserThreadCtxFree()

void AppLayerParserThreadCtxFree ( AppLayerParserThreadCtx tctx)

Destroys the app layer parser thread context obtained using AppLayerParserThreadCtxAlloc().

Parameters
tctxPointer to the thread context to be destroyed.

Definition at line 312 of file app-layer-parser.c.

References AppLayerParserThreadCtx_::alproto_local_storage, ALPROTO_MAX, AppLayerParserDestroyProtocolParserLocalStorage(), FLOW_PROTO_DEFAULT, FlowGetReverseProtoMapping(), SCEnter, SCFree, and SCReturn.

Referenced by AppLayerDestroyCtxThread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppLayerParserTransactionsCleanup()

void AppLayerParserTransactionsCleanup ( Flow f,
const uint8_t  pkt_dir 
)

remove obsolete (inspected and logged) transactions

Definition at line 919 of file app-layer-parser.c.

References DEBUG_ASSERT_FLOW_LOCKED, and SCEnter.

Referenced by LLVMFuzzerTestOneInput().

Here is the caller graph for this function:

◆ AppLayerParserTriggerRawStreamReassembly()

void AppLayerParserTriggerRawStreamReassembly ( Flow f,
int  direction 
)

Definition at line 1573 of file app-layer-parser.c.

References Flow_::protoctx, SCEnter, SCLogDebug, SCReturn, and StreamTcpReassembleTriggerRawReassembly().

Here is the call graph for this function:

◆ UTHAppLayerParserStateGetIds()

void UTHAppLayerParserStateGetIds ( void *  ptr,
uint64_t *  i1,
uint64_t *  i2,
uint64_t *  log,
uint64_t *  min 
)

Variable Documentation

◆ g_applayerparser_error_policy

enum ExceptionPolicy g_applayerparser_error_policy = EXCEPTION_POLICY_NOT_SET

Definition at line 1 of file app-layer-parser.c.

◆ g_detect_disabled

int g_detect_disabled

global indicating if detection is enabled

Definition at line 190 of file suricata.c.

◆ g_file_logger_enabled

bool g_file_logger_enabled

Definition at line 39 of file output-file.c.

◆ g_filedata_logger_enabled

bool g_filedata_logger_enabled

Definition at line 37 of file output-filedata.c.