suricata
app-layer-htp-range.c File Reference
#include "suricata-common.h"
#include "app-layer-htp-range.h"
#include "util-misc.h"
#include "util-thash.h"
#include "util-memcmp.h"
#include "util-hash-lookup3.h"
#include "util-validate.h"
#include "util-byte.h"
Include dependency graph for app-layer-htp-range.c:

Go to the source code of this file.

Data Structures

struct  ContainerTHashTable
 

Macros

#define CONTAINER_URLRANGE_HASH_SIZE   256
 
#define HTTP_RANGE_DEFAULT_TIMEOUT   60
 
#define HTTP_RANGE_DEFAULT_MEMCAP   100 * 1024 * 1024
 

Typedefs

typedef struct ContainerTHashTable ContainerTHashTable
 

Functions

int HTPByteRangeSetMemcap (uint64_t size)
 
uint64_t HTPByteRangeMemcapGlobalCounter (void)
 
uint64_t HTPByteRangeMemuseGlobalCounter (void)
 
int HttpRangeContainerBufferCompare (HttpRangeContainerBuffer *a, HttpRangeContainerBuffer *b)
 
 RB_GENERATE (HTTP_RANGES, HttpRangeContainerBuffer, rb, HttpRangeContainerBufferCompare)
 
void HttpRangeContainersInit (void)
 
void HttpRangeContainersDestroy (void)
 
uint32_t HttpRangeContainersTimeoutHash (const SCTime_t ts)
 
HttpRangeContainerBlockHttpRangeContainerOpenFile (const uint8_t *key, uint32_t keylen, const Flow *f, const HTTPContentRange *crparsed, const StreamingBufferConfig *sbcfg, const uint8_t *name, uint16_t name_len, uint16_t flags, const uint8_t *data, uint32_t data_len)
 
int HttpRangeAppendData (const StreamingBufferConfig *sbcfg, HttpRangeContainerBlock *c, const uint8_t *data, uint32_t len)
 
FileHttpRangeClose (const StreamingBufferConfig *sbcfg, HttpRangeContainerBlock *c, uint16_t flags)
 
void HttpRangeFreeBlock (HttpRangeContainerBlock *b)
 

Variables

ContainerTHashTable ContainerUrlRangeList
 

Detailed Description

Macro Definition Documentation

◆ CONTAINER_URLRANGE_HASH_SIZE

#define CONTAINER_URLRANGE_HASH_SIZE   256

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

◆ HTTP_RANGE_DEFAULT_MEMCAP

#define HTTP_RANGE_DEFAULT_MEMCAP   100 * 1024 * 1024

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

◆ HTTP_RANGE_DEFAULT_TIMEOUT

#define HTTP_RANGE_DEFAULT_TIMEOUT   60

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

Typedef Documentation

◆ ContainerTHashTable

Function Documentation

◆ HTPByteRangeMemcapGlobalCounter()

uint64_t HTPByteRangeMemcapGlobalCounter ( void  )

Definition at line 55 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 61 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  size)

◆ HttpRangeAppendData()

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

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

Referenced by HTPFileStoreChunk().

Here is the caller graph for this function:

◆ 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 450 of file app-layer-htp-range.c.

◆ HttpRangeContainerBufferCompare()

◆ HttpRangeContainerOpenFile()

HttpRangeContainerBlock* HttpRangeContainerOpenFile ( const uint8_t *  key,
uint32_t  keylen,
const Flow f,
const HTTPContentRange *  crparsed,
const StreamingBufferConfig sbcfg,
const uint8_t *  name,
uint16_t  name_len,
uint16_t  flags,
const uint8_t *  data,
uint32_t  data_len 
)

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

◆ HttpRangeContainersDestroy()

void HttpRangeContainersDestroy ( void  )

Definition at line 204 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 171 of file app-layer-htp-range.c.

References ConfGet(), ContainerUrlRangeList, ContainerTHashTable::ht, HTTP_RANGE_DEFAULT_MEMCAP, HTTP_RANGE_DEFAULT_TIMEOUT, ParseSizeStringU64(), 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 209 of file app-layer-htp-range.c.

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

Here is the call graph for this function:

◆ HttpRangeFreeBlock()

void HttpRangeFreeBlock ( HttpRangeContainerBlock b)

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

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

Referenced by HTPFileClose().

Here is the caller graph for this function:

◆ RB_GENERATE()

RB_GENERATE ( HTTP_RANGES  ,
HttpRangeContainerBuffer  ,
rb  ,
HttpRangeContainerBufferCompare   
)

Variable Documentation

◆ ContainerUrlRangeList