suricata
app-layer-htp-file.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int HTPFileOpen (HtpState *, HtpTxUserData *, const uint8_t *, uint16_t, const uint8_t *, uint32_t, uint64_t, uint8_t)
 Open the file with "filename" and pass the first chunk of data if any. More...
 
int HTPParseContentRange (bstr *rawvalue, HTTPContentRange *range)
 
int HTPFileOpenWithRange (HtpState *, HtpTxUserData *, const uint8_t *, uint16_t, const uint8_t *, uint32_t, uint64_t, bstr *rawvalue, HtpTxUserData *htud)
 Sets range for a file. More...
 
void HTPFileCloseHandleRange (FileContainer *, const uint16_t, HttpRangeContainerBlock *, const uint8_t *, uint32_t)
 
int HTPFileStoreChunk (HtpState *, const uint8_t *, uint32_t, uint8_t)
 Store a chunk of data in the flow. More...
 
int HTPFileClose (HtpState *, const uint8_t *, uint32_t, uint8_t, uint8_t)
 Close the file in the flow. More...
 
void HTPFileParserRegisterTests (void)
 

Detailed Description

Function Documentation

◆ HTPFileClose()

int HTPFileClose ( HtpState s,
const uint8_t *  data,
uint32_t  data_len,
uint8_t  flags,
uint8_t  direction 
)

Close the file in the flow.

Parameters
shttp state
datadata chunk if any
data_lenlength of the data portion
flagsflags to indicate events
directionflow direction

Currently on the FLOW_FILE_TRUNCATED flag is implemented, indicating that the file isn't complete but we're stopping storing it.

Return values
0ok
-1error
-2not storing files on this flow/tx

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

References HtpState_::file_range, FileCloseFile(), HtpState_::files_tc, HtpState_::files_ts, flags, HTPFileCloseHandleRange(), HttpRangeFreeBlock(), SCEnter, SCReturnInt, and STREAM_TOCLIENT.

Here is the call graph for this function:

◆ HTPFileCloseHandleRange()

void HTPFileCloseHandleRange ( FileContainer ,
const uint16_t  ,
HttpRangeContainerBlock ,
const uint8_t *  ,
uint32_t   
)

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

References HttpRangeContainerBlock::container, HttpRangeAppendData(), and SCLogDebug.

Referenced by HTPFileClose(), and InitGlobal().

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

◆ HTPFileOpen()

int HTPFileOpen ( HtpState s,
HtpTxUserData tx,
const uint8_t *  filename,
uint16_t  filename_len,
const uint8_t *  data,
uint32_t  data_len,
uint64_t  txid,
uint8_t  direction 
)

Open the file with "filename" and pass the first chunk of data if any.

Parameters
shttp state
filenamename of the file
filename_lenlength of the name
datadata chunk (if any)
data_lenlength of the data portion
directionflow direction
Return values
0ok
-1error
-2not handling files on this flow

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

References flags.

◆ HTPFileOpenWithRange()

int HTPFileOpenWithRange ( HtpState s,
HtpTxUserData txud,
const uint8_t *  filename,
uint16_t  filename_len,
const uint8_t *  data,
uint32_t  data_len,
uint64_t  txid,
bstr *  rawvalue,
HtpTxUserData htud 
)

Sets range for a file.

Parameters
shttp state
rawvalueraw header value
Return values
0ok
-1error

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

References DEBUG_VALIDATE_BUG_ON, flags, and SCEnter.

◆ HTPFileParserRegisterTests()

void HTPFileParserRegisterTests ( void  )

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

References UtRegisterTest().

Here is the call graph for this function:

◆ HTPFileStoreChunk()

int HTPFileStoreChunk ( HtpState s,
const uint8_t *  data,
uint32_t  data_len,
uint8_t  direction 
)

Store a chunk of data in the flow.

Parameters
shttp state
datadata chunk (if any)
data_lenlength of the data portion
directionflow direction
Return values
0ok
-1error
-2file doesn't need storing

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

References HtpState_::file_range, FileAppendData(), HtpState_::files_tc, HtpState_::files_ts, HttpRangeAppendData(), SCEnter, SCLogDebug, SCReturnInt, and STREAM_TOCLIENT.

Here is the call graph for this function:

◆ HTPParseContentRange()

int HTPParseContentRange ( bstr *  rawvalue,
HTTPContentRange *  range 
)

Performs parsing of the content-range value

Parameters
[in]rawvalue
[out]range
Returns
HTP_OK on success, HTP_ERROR on failure.

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

References len.