suricata
app-layer-htp-body.c File Reference
#include "suricata-common.h"
#include "app-layer-htp.h"
#include "app-layer-htp-mem.h"
#include "app-layer-htp-body.h"
#include "util-streaming-buffer.h"
#include "util-print.h"
Include dependency graph for app-layer-htp-body.c:

Go to the source code of this file.

Functions

int HtpBodyAppendChunk (const HTPCfgDir *hcfg, HtpBody *body, const uint8_t *data, uint32_t len)
 Append a chunk of body to the HtpBody struct. More...
 
void HtpBodyPrint (HtpBody *body)
 Print the information and chunks of a Body. More...
 
void HtpBodyFree (const HTPCfgDir *hcfg, HtpBody *body)
 Free the information held in the request body. More...
 
void HtpBodyPrune (HtpState *state, HtpBody *body, int direction)
 Free request body chunks that are already fully parsed. More...
 

Variables

StreamingBufferConfig htp_sbcfg
 

Detailed Description

Function Documentation

◆ HtpBodyAppendChunk()

int HtpBodyAppendChunk ( const HTPCfgDir hcfg,
HtpBody body,
const uint8_t *  data,
uint32_t  len 
)

Append a chunk of body to the HtpBody struct.

Parameters
bodypointer to the HtpBody holding the list
datapointer to the data of the chunk
lenlength of the chunk pointed by data
Return values
0ok
-1error

Definition at line 48 of file app-layer-htp-body.c.

References HtpBody_::content_len_so_far, HtpBody_::first, htp_sbcfg, HTPCalloc(), HTPFree(), HtpBody_::last, len, HtpBodyChunk_::next, HtpBody_::sb, HtpBodyChunk_::sbseg, SCEnter, SCLogDebug, SCReturnInt, StreamingBufferAppend(), and StreamingBufferInit().

Here is the call graph for this function:

◆ HtpBodyFree()

void HtpBodyFree ( const HTPCfgDir hcfg,
HtpBody body 
)

Free the information held in the request body.

Parameters
bodypointer to the HtpBody holding the list
Return values
none

Definition at line 122 of file app-layer-htp-body.c.

References HtpBody_::first, htp_sbcfg, HTPFree(), HtpBody_::last, HtpBodyChunk_::next, HtpBody_::sb, SCEnter, SCLogDebug, and StreamingBufferFree().

Here is the call graph for this function:

◆ HtpBodyPrint()

void HtpBodyPrint ( HtpBody body)

Print the information and chunks of a Body.

Parameters
bodypointer to the HtpBody holding the list
Return values
none

Definition at line 94 of file app-layer-htp-body.c.

References HtpBody_::first, HtpBodyChunk_::next, PrintRawDataFp(), HtpBody_::sb, HtpBodyChunk_::sbseg, SCEnter, SCLogDebug, SCLogDebugEnabled(), and StreamingBufferSegmentGetData().

Here is the call graph for this function:

◆ HtpBodyPrune()

void HtpBodyPrune ( HtpState state,
HtpBody body,
int  direction 
)

Free request body chunks that are already fully parsed.

Parameters
statehtp_state, with reference to our config
bodythe body to prune
directionSTREAM_TOSERVER (request), STREAM_TOCLIENT (response)
Return values
none

Definition at line 151 of file app-layer-htp-body.c.

References HtpBody_::body_inspected, HtpBody_::body_parsed, HtpState_::cfg, HtpBody_::content_len_so_far, HtpBody_::first, htp_sbcfg, HTPFree(), HTPCfgDir_::inspect_min_size, HTPCfgDir_::inspect_window, HtpBody_::last, next, HtpBodyChunk_::next, HTPCfgRec_::request, HTPCfgRec_::response, HtpBody_::sb, HtpBodyChunk_::sbseg, SCEnter, SCLogDebug, SCReturn, StreamingBufferSegmentIsBeforeWindow(), and StreamingBufferSlideToOffset().

Here is the call graph for this function:

Variable Documentation

◆ htp_sbcfg

Definition at line 96 of file app-layer-htp.c.

Referenced by HtpBodyAppendChunk(), HtpBodyFree(), and HtpBodyPrune().