suricata
app-layer.h File Reference
#include "threadvars.h"
#include "decode.h"
#include "flow.h"
#include "stream-tcp-private.h"
#include "stream-tcp-reassemble.h"
#include "rust.h"
Include dependency graph for app-layer.h:

Go to the source code of this file.

Macros

#define APP_LAYER_DATA_ALREADY_SENT_TO_APP_LAYER    (~STREAM_TOSERVER & ~STREAM_TOCLIENT)
 
#define AppLayerProfilingReset(app_tctx)   AppLayerProfilingResetInternal(app_tctx)
 
#define AppLayerProfilingStore(app_tctx, p)   AppLayerProfilingStoreInternal(app_tctx, p)
 

Functions

int AppLayerHandleTCPData (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, Packet *p, Flow *f, TcpSession *ssn, TcpStream **stream, uint8_t *data, uint32_t data_len, uint8_t flags, enum StreamUpdateDir dir)
 Handles reassembled tcp stream.
 
int AppLayerHandleUdp (ThreadVars *tv, AppLayerThreadCtx *app_tctx, Packet *p, Flow *f)
 Handles an udp chunk.
 
AppProto AppLayerGetProtoByName (const char *alproto_name)
 Given a protocol string, returns the corresponding internal protocol id.
 
const char * AppLayerGetProtoName (AppProto alproto)
 Given the internal protocol id, returns a string representation of the protocol.
 
void AppLayerListSupportedProtocols (void)
 
int AppLayerSetup (void)
 Setup the app layer.
 
int AppLayerDeSetup (void)
 De initializes the app layer.
 
AppLayerThreadCtxAppLayerGetCtxThread (void)
 Creates a new app layer thread context.
 
void AppLayerDestroyCtxThread (AppLayerThreadCtx *tctx)
 Destroys the context created by AppLayerGetCtxThread().
 
void AppLayerRegisterThreadCounters (ThreadVars *tv)
 Registers per flow counters for all protocols.
 
void AppLayerProfilingResetInternal (AppLayerThreadCtx *app_tctx)
 
void AppLayerProfilingStoreInternal (AppLayerThreadCtx *app_tctx, Packet *p)
 
void AppLayerRegisterGlobalCounters (void)
 HACK to work around our broken unix manager (re)init loop.
 
void AppLayerUnittestsRegister (void)
 
void AppLayerIncTxCounter (ThreadVars *tv, Flow *f, uint64_t step)
 
void AppLayerIncGapErrorCounter (ThreadVars *tv, Flow *f)
 
void AppLayerIncAllocErrorCounter (ThreadVars *tv, Flow *f)
 
void AppLayerIncParserErrorCounter (ThreadVars *tv, Flow *f)
 
void AppLayerIncInternalErrorCounter (ThreadVars *tv, Flow *f)
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t
Anoop Saldanha anoop.nosp@m.sald.nosp@m.anha@.nosp@m.gmai.nosp@m.l.com

Application layer handling and protocols implementation

Definition in file app-layer.h.

Macro Definition Documentation

◆ APP_LAYER_DATA_ALREADY_SENT_TO_APP_LAYER

#define APP_LAYER_DATA_ALREADY_SENT_TO_APP_LAYER    (~STREAM_TOSERVER & ~STREAM_TOCLIENT)

Definition at line 40 of file app-layer.h.

◆ AppLayerProfilingReset

#define AppLayerProfilingReset (   app_tctx)    AppLayerProfilingResetInternal(app_tctx)

Definition at line 127 of file app-layer.h.

◆ AppLayerProfilingStore

#define AppLayerProfilingStore (   app_tctx,
 
)    AppLayerProfilingStoreInternal(app_tctx, p)

Definition at line 128 of file app-layer.h.

Function Documentation

◆ AppLayerDeSetup()

int AppLayerDeSetup ( void  )

De initializes the app layer.

   Includes de initializing protocol detection and the protocol parser.

Definition at line 1095 of file app-layer.c.

References AppLayerDeSetupCounters(), AppLayerParserDeSetup(), AppLayerProtoDetectDeSetup(), FrameConfigDeInit(), SCEnter, and SCReturnInt.

Referenced by GlobalsDestroy().

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

◆ AppLayerDestroyCtxThread()

void AppLayerDestroyCtxThread ( AppLayerThreadCtx tctx)

Destroys the context created by AppLayerGetCtxThread().

Parameters
tctxPointer to the thread context to destroy.

Definition at line 1129 of file app-layer.c.

References AppLayerThreadCtx_::alp_tctx, AppLayerThreadCtx_::alpd_tctx, AppLayerParserThreadCtxFree(), AppLayerProtoDetectDestroyCtxThread(), SCEnter, SCFree, and SCReturn.

Referenced by AppLayerGetCtxThread(), DecodeThreadVarsFree(), and StreamTcpReassembleFreeThreadCtx().

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

◆ AppLayerGetCtxThread()

AppLayerThreadCtx * AppLayerGetCtxThread ( void  )

Creates a new app layer thread context.

Return values
Pointerto the newly create thread context, on success; NULL, on failure.

Definition at line 1108 of file app-layer.c.

References AppLayerThreadCtx_::alp_tctx, AppLayerThreadCtx_::alpd_tctx, AppLayerDestroyCtxThread(), AppLayerParserThreadCtxAlloc(), AppLayerProtoDetectGetCtxThread(), SCCalloc, SCEnter, and SCReturnPtr.

Referenced by DecodeThreadVarsAlloc(), and StreamTcpReassembleInitThreadCtx().

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

◆ AppLayerGetProtoByName()

AppProto AppLayerGetProtoByName ( const char *  alproto_name)

Given a protocol string, returns the corresponding internal protocol id.

Parameters
Theinternal protocol id.

Definition at line 1002 of file app-layer.c.

References AppLayerProtoDetectGetProtoByName(), SCEnter, and SCReturnCT.

Here is the call graph for this function:

◆ AppLayerGetProtoName()

const char * AppLayerGetProtoName ( AppProto  alproto)

Given the internal protocol id, returns a string representation of the protocol.

Parameters
alprotoThe internal protocol id.
Return values
Stringrepresentation of the protocol.

Definition at line 1009 of file app-layer.c.

References AppLayerProtoDetectGetProtoName(), SCEnter, and SCReturnCT.

Referenced by AppLayerListSupportedProtocols(), AppLayerParserParse(), and AppLayerSetupCounters().

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

◆ AppLayerHandleTCPData()

int AppLayerHandleTCPData ( ThreadVars tv,
TcpReassemblyThreadCtx ra_ctx,
Packet p,
Flow f,
TcpSession ssn,
TcpStream **  stream,
uint8_t *  data,
uint32_t  data_len,
uint8_t  flags,
enum StreamUpdateDir  app_update_dir 
)

◆ AppLayerHandleUdp()

◆ AppLayerIncAllocErrorCounter()

void AppLayerIncAllocErrorCounter ( ThreadVars tv,
Flow f 
)

Definition at line 171 of file app-layer.c.

References AppLayerCounters_::alloc_error_id, Flow_::alproto, applayer_counters, likely, Flow_::protomap, StatsIncr(), and tv.

Referenced by AppLayerParserParse().

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

◆ AppLayerIncGapErrorCounter()

void AppLayerIncGapErrorCounter ( ThreadVars tv,
Flow f 
)

Definition at line 163 of file app-layer.c.

References Flow_::alproto, applayer_counters, AppLayerCounters_::gap_error_id, likely, Flow_::protomap, StatsIncr(), and tv.

Referenced by AppLayerParserParse().

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

◆ AppLayerIncInternalErrorCounter()

void AppLayerIncInternalErrorCounter ( ThreadVars tv,
Flow f 
)

Definition at line 187 of file app-layer.c.

References Flow_::alproto, applayer_counters, AppLayerCounters_::internal_error_id, likely, Flow_::protomap, StatsIncr(), and tv.

Referenced by AppLayerParserParse().

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

◆ AppLayerIncParserErrorCounter()

void AppLayerIncParserErrorCounter ( ThreadVars tv,
Flow f 
)

Definition at line 179 of file app-layer.c.

References Flow_::alproto, applayer_counters, likely, AppLayerCounters_::parser_error_id, Flow_::protomap, StatsIncr(), and tv.

Referenced by AppLayerParserParse().

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

◆ AppLayerIncTxCounter()

void AppLayerIncTxCounter ( ThreadVars tv,
Flow f,
uint64_t  step 
)

Definition at line 155 of file app-layer.c.

References Flow_::alproto, applayer_counters, AppLayerCounters_::counter_tx_id, likely, Flow_::protomap, StatsAddUI64(), and tv.

Referenced by AppLayerParserParse().

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

◆ AppLayerListSupportedProtocols()

void AppLayerListSupportedProtocols ( void  )

Definition at line 1016 of file app-layer.c.

References AppLayerGetProtoName(), AppLayerProtoDetectSupportedAppProtocols(), g_alproto_max, SCEnter, and SCReturn.

Referenced by ListAppLayerProtocols().

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

◆ AppLayerProfilingResetInternal()

void AppLayerProfilingResetInternal ( AppLayerThreadCtx app_tctx)

Definition at line 1146 of file app-layer.c.

References PACKET_PROFILING_APP_RESET.

◆ AppLayerProfilingStoreInternal()

void AppLayerProfilingStoreInternal ( AppLayerThreadCtx app_tctx,
Packet p 
)

Definition at line 1151 of file app-layer.c.

References PACKET_PROFILING_APP_STORE.

◆ AppLayerRegisterGlobalCounters()

void AppLayerRegisterGlobalCounters ( void  )

HACK to work around our broken unix manager (re)init loop.

Definition at line 1159 of file app-layer.c.

References ExpectationGetCounter(), FTPMemcapGlobalCounter(), FTPMemuseGlobalCounter(), HostGetMemcap(), HostGetMemuse(), HTPByteRangeMemcapGlobalCounter(), HTPByteRangeMemuseGlobalCounter(), HTPMemcapGlobalCounter(), HTPMemuseGlobalCounter(), IPPairGetMemuse(), and StatsRegisterGlobalCounter().

Referenced by PreRunInit().

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

◆ AppLayerRegisterThreadCounters()

◆ AppLayerSetup()

int AppLayerSetup ( void  )

Setup the app layer.

   Includes protocol detection setup and the protocol parser setup.
Return values
0On success.
-1On failure.

Definition at line 1078 of file app-layer.c.

References AppLayerParserRegisterProtocolParsers(), AppLayerParserSetup(), AppLayerProtoDetectPrepareState(), AppLayerProtoDetectSetup(), AppLayerSetupCounters(), FrameConfigInit(), SCEnter, and SCReturnInt.

Referenced by ListAppLayerHooks(), ListAppLayerProtocols(), ListKeywords(), LLVMFuzzerTestOneInput(), PostConfLoadedSetup(), and RunUnittests().

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

◆ AppLayerUnittestsRegister()

void AppLayerUnittestsRegister ( void  )

Definition at line 2891 of file app-layer.c.

References SCEnter, SCReturn, and UtRegisterTest().

Here is the call graph for this function: