suricata
app-layer-htp-range.h File Reference
#include "util-file.h"
#include "util-streaming-buffer.h"
#include "util-thash.h"
Include dependency graph for app-layer-htp-range.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HttpRangeContainerBlock
 
struct  HttpRangeContainerBuffer
 
struct  HttpRangeContainerFile
 

Typedefs

typedef struct HttpRangeContainerBuffer HttpRangeContainerBuffer
 
typedef struct HttpRangeContainerFile HttpRangeContainerFile
 
typedef struct HTTPContentRange HTTPContentRange
 
typedef struct HttpRangeContainerBlock HttpRangeContainerBlock
 

Functions

void SCHttpRangeFreeBlock (HttpRangeContainerBlock *b)
 
HttpRangeContainerBlockSCHttpRangeContainerOpenFile (const unsigned char *key, uint32_t keylen, const Flow *f, const HTTPContentRange *cr, const StreamingBufferConfig *sbcfg, const unsigned char *name, uint16_t name_len, uint16_t flags, const unsigned char *data, uint32_t data_len)
 
int SCHttpRangeAppendData (const StreamingBufferConfig *sbcfg, HttpRangeContainerBlock *c, const uint8_t *data, uint32_t len)
 
void HttpRangeContainersInit (void)
 
void HttpRangeContainersDestroy (void)
 
uint32_t HttpRangeContainersTimeoutHash (const SCTime_t ts)
 
int HttpRangeContainerBufferCompare (HttpRangeContainerBuffer *a, HttpRangeContainerBuffer *b)
 
 RB_HEAD (HTTP_RANGES, HttpRangeContainerBuffer)
 
 RB_PROTOTYPE (HTTP_RANGES, HttpRangeContainerBuffer, rb, HttpRangeContainerBufferCompare)
 
FileHttpRangeClose (const StreamingBufferConfig *sbcfg, HttpRangeContainerBlock *c, uint16_t flags)
 
uint64_t HTPByteRangeMemcapGlobalCounter (void)
 
uint64_t HTPByteRangeMemuseGlobalCounter (void)
 
int HTPByteRangeSetMemcap (uint64_t)
 

Typedef Documentation

◆ HTTPContentRange

Definition at line 1 of file app-layer-htp-range.h.

◆ HttpRangeContainerBlock

A structure representing a single range request : either skipping, buffering, or appending As this belongs to a flow, appending data to it is ensured to be thread-safe Only one block per file has the pointer to the container

◆ HttpRangeContainerBuffer

Definition at line 1 of file app-layer-htp-range.h.

◆ HttpRangeContainerFile

Item in hash table for a file in multiple ranges Thread-safety is ensured with the thread-safe hash table cf THashData The number of use is increased for each flow opening a new HttpRangeContainerBlock until it closes this HttpRangeContainerBlock The design goal is to have concurrency only on opening and closing a range request and have a lock-free data structure belonging to one Flow (see HttpRangeContainerBlock below) for every append in between (we suppose we have many appends per range request)

Definition at line 1 of file app-layer-htp-range.h.

Function Documentation

◆ HTPByteRangeMemcapGlobalCounter()

uint64_t HTPByteRangeMemcapGlobalCounter ( void  )

Definition at line 56 of file app-layer-htp-range.c.

References THashTableContext_::config, ContainerUrlRangeList, ContainerTHashTable::ht, and SC_ATOMIC_GET.

Referenced by AppLayerRegisterGlobalCounters().

Here is the caller graph for this function:

◆ HTPByteRangeMemuseGlobalCounter()

uint64_t HTPByteRangeMemuseGlobalCounter ( void  )

Definition at line 62 of file app-layer-htp-range.c.

References ContainerUrlRangeList, ContainerTHashTable::ht, and SC_ATOMIC_GET.

Referenced by AppLayerRegisterGlobalCounters().

Here is the caller graph for this function:

◆ HTPByteRangeSetMemcap()

int HTPByteRangeSetMemcap ( uint64_t  )

◆ HttpRangeClose()

File* HttpRangeClose ( const StreamingBufferConfig sbcfg,
HttpRangeContainerBlock c,
uint16_t  flags 
)
Note
if f is non-NULL, the ownership of the file is transferred to the caller.

Definition at line 451 of file app-layer-htp-range.c.

◆ HttpRangeContainerBufferCompare()

◆ HttpRangeContainersDestroy()

void HttpRangeContainersDestroy ( void  )

Definition at line 205 of file app-layer-htp-range.c.

References ContainerUrlRangeList, ContainerTHashTable::ht, and THashShutdown().

Here is the call graph for this function:

◆ HttpRangeContainersInit()

void HttpRangeContainersInit ( void  )

Definition at line 172 of file app-layer-htp-range.c.

References ContainerUrlRangeList, ContainerTHashTable::ht, HTTP_RANGE_DEFAULT_MEMCAP, HTTP_RANGE_DEFAULT_TIMEOUT, ParseSizeStringU64(), SCConfGet(), SCLogDebug, SCLogWarning, str, StringParseUint32(), and THashInit().

Referenced by PreRunInit().

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

◆ HttpRangeContainersTimeoutHash()

uint32_t HttpRangeContainersTimeoutHash ( const SCTime_t  ts)

Definition at line 210 of file app-layer-htp-range.c.

References ContainerUrlRangeList, ContainerTHashTable::ht, THashExpire(), and ts.

Here is the call graph for this function:

◆ RB_HEAD()

RB_HEAD ( HTTP_RANGES  ,
HttpRangeContainerBuffer   
)

◆ RB_PROTOTYPE()

RB_PROTOTYPE ( HTTP_RANGES  ,
HttpRangeContainerBuffer  ,
rb  ,
HttpRangeContainerBufferCompare   
)

◆ SCHttpRangeAppendData()

int SCHttpRangeAppendData ( const StreamingBufferConfig sbcfg,
HttpRangeContainerBlock c,
const uint8_t *  data,
uint32_t  len 
)

Definition at line 378 of file app-layer-htp-range.c.

Referenced by HTPFileStoreChunk().

Here is the caller graph for this function:

◆ SCHttpRangeContainerOpenFile()

HttpRangeContainerBlock* SCHttpRangeContainerOpenFile ( const unsigned char *  key,
uint32_t  keylen,
const Flow f,
const HTTPContentRange cr,
const StreamingBufferConfig sbcfg,
const unsigned char *  name,
uint16_t  name_len,
uint16_t  flags,
const unsigned char *  data,
uint32_t  data_len 
)

◆ SCHttpRangeFreeBlock()

void SCHttpRangeFreeBlock ( HttpRangeContainerBlock b)

Definition at line 608 of file app-layer-htp-range.c.

References HttpRangeContainerBlock::container, DEBUG_VALIDATE_BUG_ON, and HttpRangeContainerBlock::files.

Referenced by HTPFileClose().

Here is the caller graph for this function: