suricata
|
#include "tree.h"
Go to the source code of this file.
Data Structures | |
struct | StreamingBufferConfig_ |
struct | StreamingBufferRegion_ |
struct | StreamingBufferBlock |
block of continues data More... | |
struct | StreamingBuffer_ |
struct | StreamingBufferSegment_ |
Macros | |
#define | STREAMING_BUFFER_REGION_GAP_DEFAULT 262144 |
#define | STREAMING_BUFFER_CONFIG_INITIALIZER |
#define | STREAMING_BUFFER_REGION_INIT |
#define | STREAMING_BUFFER_INITIALIZER |
Typedefs | |
typedef struct StreamingBufferConfig_ | StreamingBufferConfig |
typedef struct StreamingBufferRegion_ | StreamingBufferRegion |
typedef struct StreamingBuffer_ | StreamingBuffer |
Functions | |
struct StreamingBufferBlock | __attribute__ ((__packed__)) StreamingBufferBlock |
block of continues data More... | |
RB_ENTRY (StreamingBufferBlock) rb | |
int | SBBCompare (struct StreamingBufferBlock *a, struct StreamingBufferBlock *b) |
RB_HEAD (SBB, StreamingBufferBlock) | |
RB_PROTOTYPE (SBB, StreamingBufferBlock, rb, SBBCompare) | |
StreamingBufferBlock * | SBB_RB_FIND_INCLUSIVE (struct SBB *head, StreamingBufferBlock *elm) |
StreamingBuffer * | StreamingBufferInit (const StreamingBufferConfig *cfg) |
void | StreamingBufferClear (StreamingBuffer *sb, const StreamingBufferConfig *cfg) |
void | StreamingBufferFree (StreamingBuffer *sb, const StreamingBufferConfig *cfg) |
void | StreamingBufferSlideToOffset (StreamingBuffer *sb, const StreamingBufferConfig *cfg, uint64_t offset) |
slide to absolute offset More... | |
int | StreamingBufferAppend (StreamingBuffer *sb, const StreamingBufferConfig *cfg, StreamingBufferSegment *seg, const uint8_t *data, uint32_t data_len) WARN_UNUSED |
int | StreamingBufferAppendNoTrack (StreamingBuffer *sb, const StreamingBufferConfig *cfg, const uint8_t *data, uint32_t data_len) WARN_UNUSED |
add data w/o tracking a segment More... | |
int | StreamingBufferInsertAt (StreamingBuffer *sb, const StreamingBufferConfig *cfg, StreamingBufferSegment *seg, const uint8_t *data, uint32_t data_len, uint64_t offset) WARN_UNUSED |
void | StreamingBufferSegmentGetData (const StreamingBuffer *sb, const StreamingBufferSegment *seg, const uint8_t **data, uint32_t *data_len) |
void | StreamingBufferSBBGetData (const StreamingBuffer *sb, const StreamingBufferBlock *sbb, const uint8_t **data, uint32_t *data_len) |
get the data for one SBB More... | |
void | StreamingBufferSBBGetDataAtOffset (const StreamingBuffer *sb, const StreamingBufferBlock *sbb, const uint8_t **data, uint32_t *data_len, uint64_t offset) |
get the data for one SBB More... | |
int | StreamingBufferSegmentCompareRawData (const StreamingBuffer *sb, const StreamingBufferSegment *seg, const uint8_t *rawdata, uint32_t rawdata_len) |
int | StreamingBufferCompareRawData (const StreamingBuffer *sb, const uint8_t *rawdata, uint32_t rawdata_len) |
int | StreamingBufferGetData (const StreamingBuffer *sb, const uint8_t **data, uint32_t *data_len, uint64_t *stream_offset) |
int | StreamingBufferGetDataAtOffset (const StreamingBuffer *sb, const uint8_t **data, uint32_t *data_len, uint64_t offset) |
int | StreamingBufferSegmentIsBeforeWindow (const StreamingBuffer *sb, const StreamingBufferSegment *seg) |
void | StreamingBufferRegisterTests (void) |
Variables | |
uint64_t | offset |
uint32_t | len |
uint32_t | segment_len |
uint64_t | stream_offset |
#define STREAMING_BUFFER_CONFIG_INITIALIZER |
Definition at line 75 of file util-streaming-buffer.h.
#define STREAMING_BUFFER_INITIALIZER |
Definition at line 138 of file util-streaming-buffer.h.
#define STREAMING_BUFFER_REGION_GAP_DEFAULT 262144 |
Definition at line 64 of file util-streaming-buffer.h.
#define STREAMING_BUFFER_REGION_INIT |
Definition at line 80 of file util-streaming-buffer.h.
typedef struct StreamingBuffer_ StreamingBuffer |
typedef struct StreamingBufferConfig_ StreamingBufferConfig |
typedef struct StreamingBufferRegion_ StreamingBufferRegion |
__attribute__::RB_ENTRY | ( | StreamingBufferBlock | ) |
RB_HEAD | ( | SBB | , |
StreamingBufferBlock | |||
) |
RB_PROTOTYPE | ( | SBB | , |
StreamingBufferBlock | , | ||
rb | , | ||
SBBCompare | |||
) |
StreamingBufferBlock* SBB_RB_FIND_INCLUSIVE | ( | struct SBB * | head, |
StreamingBufferBlock * | elm | ||
) |
Definition at line 104 of file util-streaming-buffer.c.
References head, StreamingBufferBlock::len, StreamingBufferBlock::offset, RB_ROOT, and SCLogDebug.
int SBBCompare | ( | struct StreamingBufferBlock * | a, |
struct StreamingBufferBlock * | b | ||
) |
Definition at line 73 of file util-streaming-buffer.c.
References StreamingBufferBlock::len, StreamingBufferBlock::offset, SCLogDebug, and SCReturnInt.
int StreamingBufferAppend | ( | StreamingBuffer * | sb, |
const StreamingBufferConfig * | cfg, | ||
StreamingBufferSegment * | seg, | ||
const uint8_t * | data, | ||
uint32_t | data_len | ||
) |
Definition at line 1081 of file util-streaming-buffer.c.
References BIT_U32, StreamingBufferRegion_::buf, DEBUG_VALIDATE_BUG_ON, and StreamingBuffer_::region.
Referenced by HtpBodyAppendChunk(), and UTHAddStreamToFlow().
int StreamingBufferAppendNoTrack | ( | StreamingBuffer * | sb, |
const StreamingBufferConfig * | cfg, | ||
const uint8_t * | data, | ||
uint32_t | data_len | ||
) |
add data w/o tracking a segment
Definition at line 1125 of file util-streaming-buffer.c.
References BIT_U32, StreamingBufferRegion_::buf, DEBUG_VALIDATE_BUG_ON, and StreamingBuffer_::region.
void StreamingBufferClear | ( | StreamingBuffer * | sb, |
const StreamingBufferConfig * | cfg | ||
) |
Definition at line 274 of file util-streaming-buffer.c.
References StreamingBufferRegion_::buf_size, StreamingBuffer_::region, and SCLogDebug.
Referenced by StreamingBufferFree(), StreamTcpPruneSession(), and StreamTcpStreamCleanup().
int StreamingBufferCompareRawData | ( | const StreamingBuffer * | sb, |
const uint8_t * | rawdata, | ||
uint32_t | rawdata_len | ||
) |
1 | data is the same |
0 | data is different |
Definition at line 1825 of file util-streaming-buffer.c.
References offset, PrintRawDataFp(), SCLogDebug, and StreamingBufferGetData().
void StreamingBufferFree | ( | StreamingBuffer * | sb, |
const StreamingBufferConfig * | cfg | ||
) |
Definition at line 297 of file util-streaming-buffer.c.
References FREE, and StreamingBufferClear().
Referenced by HtpBodyFree().
int StreamingBufferGetData | ( | const StreamingBuffer * | sb, |
const uint8_t ** | data, | ||
uint32_t * | data_len, | ||
uint64_t * | stream_offset | ||
) |
Definition at line 1786 of file util-streaming-buffer.c.
References StreamingBufferRegion_::buf, StreamingBufferRegion_::buf_offset, StreamingBuffer_::region, stream_offset, and StreamingBufferRegion_::stream_offset.
Referenced by StreamingBufferCompareRawData().
int StreamingBufferGetDataAtOffset | ( | const StreamingBuffer * | sb, |
const uint8_t ** | data, | ||
uint32_t * | data_len, | ||
uint64_t | offset | ||
) |
Definition at line 1803 of file util-streaming-buffer.c.
StreamingBuffer* StreamingBufferInit | ( | const StreamingBufferConfig * | cfg | ) |
Definition at line 251 of file util-streaming-buffer.c.
References StreamingBufferConfig_::buf_size, StreamingBufferRegion_::buf_size, CALLOC, StreamingBuffer_::max_regions, StreamingBuffer_::region, and StreamingBuffer_::regions.
Referenced by HtpBodyAppendChunk().
int StreamingBufferInsertAt | ( | StreamingBuffer * | sb, |
const StreamingBufferConfig * | cfg, | ||
StreamingBufferSegment * | seg, | ||
const uint8_t * | data, | ||
uint32_t | data_len, | ||
uint64_t | offset | ||
) |
offset | offset relative to StreamingBuffer::stream_offset |
Definition at line 1509 of file util-streaming-buffer.c.
References BIT_U32, DEBUG_VALIDATE_BUG_ON, SC_EINVAL, and StreamingBufferRegion_::stream_offset.
void StreamingBufferRegisterTests | ( | void | ) |
Definition at line 2412 of file util-streaming-buffer.c.
References UtRegisterTest().
void StreamingBufferSBBGetData | ( | const StreamingBuffer * | sb, |
const StreamingBufferBlock * | sbb, | ||
const uint8_t ** | data, | ||
uint32_t * | data_len | ||
) |
get the data for one SBB
Definition at line 1660 of file util-streaming-buffer.c.
Referenced by UTHCheckDataAtPosition().
void StreamingBufferSBBGetDataAtOffset | ( | const StreamingBuffer * | sb, |
const StreamingBufferBlock * | sbb, | ||
const uint8_t ** | data, | ||
uint32_t * | data_len, | ||
uint64_t | offset | ||
) |
get the data for one SBB
Definition at line 1696 of file util-streaming-buffer.c.
References DEBUG_VALIDATE_BUG_ON, StreamingBufferBlock::len, offset, and StreamingBufferBlock::offset.
int StreamingBufferSegmentCompareRawData | ( | const StreamingBuffer * | sb, |
const StreamingBufferSegment * | seg, | ||
const uint8_t * | rawdata, | ||
uint32_t | rawdata_len | ||
) |
1 | data is the same |
0 | data is different |
Definition at line 1770 of file util-streaming-buffer.c.
References StreamingBufferSegmentGetData().
void StreamingBufferSegmentGetData | ( | const StreamingBuffer * | sb, |
const StreamingBufferSegment * | seg, | ||
const uint8_t ** | data, | ||
uint32_t * | data_len | ||
) |
Definition at line 1737 of file util-streaming-buffer.c.
Referenced by StreamingBufferSegmentCompareRawData(), StreamTcpInlineSegmentCompare(), StreamTcpSegmentForEach(), and StreamTcpSegmentForSession().
int StreamingBufferSegmentIsBeforeWindow | ( | const StreamingBuffer * | sb, |
const StreamingBufferSegment * | seg | ||
) |
Definition at line 1628 of file util-streaming-buffer.c.
References StreamingBuffer_::region, and StreamingBufferRegion_::stream_offset.
Referenced by HtpBodyPrune().
void StreamingBufferSlideToOffset | ( | StreamingBuffer * | sb, |
const StreamingBufferConfig * | cfg, | ||
uint64_t | offset | ||
) |
slide to absolute offset
Definition at line 1004 of file util-streaming-buffer.c.
References offset, and SCLogDebug.
Referenced by HtpBodyPrune().
uint32_t len |
Definition at line 2 of file util-streaming-buffer.h.
uint64_t offset |
Definition at line 0 of file util-streaming-buffer.h.
Referenced by DetectAsn1Match(), DetectEngineInspectBufferGeneric(), DetectIsdataatSetup(), DetectLuaMatchBuffer(), EveFTPLogCommand(), FileSwfDecompression(), MpmAddPatternCI(), MpmAddPatternCS(), PacketCopyDataOffset(), PrintBufferRawLineHex(), PrintRawLineHexBuf(), PrintRawUriBuf(), PrintRawUriFp(), ROHashInitFinalize(), ROHashLookup(), SCACAddPatternCI(), SCACAddPatternCS(), SCACSearch(), SCACTileAddPatternCI(), SCACTileAddPatternCS(), SCJsonString(), SigParseMaxRequiredDsize(), SigParseRequiredContentSize(), StreamingBufferCompareRawData(), StreamingBufferSBBGetDataAtOffset(), StreamingBufferSlideToOffset(), UTHCheckDataAtPosition(), and UTHCheckGapAtPosition().
uint32_t segment_len |
Definition at line 0 of file util-streaming-buffer.h.
uint64_t stream_offset |
Definition at line 1 of file util-streaming-buffer.h.
Referenced by StreamingBufferGetData().