suricata
pkt-var.c File Reference
#include "suricata-common.h"
#include "decode.h"
#include "pkt-var.h"
#include "util-debug.h"
Include dependency graph for pkt-var.c:

Go to the source code of this file.

Functions

PktVarPktVarGet (Packet *p, uint32_t id)
 
int PktVarAddKeyValue (Packet *p, uint8_t *key, uint16_t ksize, uint8_t *value, uint16_t size)
 add a key-value pktvar to the pkt More...
 
int PktVarAdd (Packet *p, uint32_t id, uint8_t *value, uint16_t size)
 add a key-value pktvar to the pkt More...
 
void PktVarFree (PktVar *pv)
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Implements per packet vars

Todo:

move away from a linked list implementation

use different datatypes, such as string, int, etc.

have more than one instance of the same var, and be able to match on a specific one, or one all at a time. So if a certain capture matches multiple times, we can operate on all of them.

Definition in file pkt-var.c.

Function Documentation

int PktVarAdd ( Packet p,
uint32_t  id,
uint8_t *  value,
uint16_t  size 
)

add a key-value pktvar to the pkt

Return values
r0 ok, -1 error

Definition at line 86 of file pkt-var.c.

References PktVar_::id, PktVar_::next, Packet_::pktvar, SCCalloc, unlikely, PktVar_::value, and PktVar_::value_len.

Referenced by DetectFlowvarPostMatchSetup().

Here is the caller graph for this function:

int PktVarAddKeyValue ( Packet p,
uint8_t *  key,
uint16_t  ksize,
uint8_t *  value,
uint16_t  size 
)

add a key-value pktvar to the pkt

Return values
r0 ok, -1 error

Definition at line 56 of file pkt-var.c.

References PktVar_::key, PktVar_::key_len, PktVar_::next, Packet_::pktvar, SCCalloc, unlikely, PktVar_::value, and PktVar_::value_len.

Referenced by DetectFlowvarPostMatchSetup().

Here is the caller graph for this function:

void PktVarFree ( PktVar pv)

Definition at line 111 of file pkt-var.c.

References PktVar_::key, PktVar_::next, PktVarFree(), SCFree, and PktVar_::value.

Referenced by GenericVarFree(), and PktVarFree().

Here is the call graph for this function:

Here is the caller graph for this function:

PktVar* PktVarGet ( Packet p,
uint32_t  id 
)

Definition at line 40 of file pkt-var.c.

References PktVar_::id, PktVar_::next, and Packet_::pktvar.

Referenced by DetectPktvarRegister().

Here is the caller graph for this function: