suricata
|
#include "suricata-common.h"
Go to the source code of this file.
Data Structures | |
struct | SCRadix4Node_ |
Structure for the node in the radix tree. More... | |
struct | SCRadix4Tree_ |
Structure for the radix tree. More... | |
struct | SCRadix4Config_ |
Macros | |
#define | SC_RADIX4_TREE_INITIALIZER |
Typedefs | |
typedef struct SCRadix4Node_ | SCRadix4Node |
Structure for the node in the radix tree. More... | |
typedef struct SCRadix4Tree_ | SCRadix4Tree |
Structure for the radix tree. More... | |
typedef struct SCRadix4Config_ | SCRadix4Config |
typedef int(* | SCRadix4ForEachNodeFunc) (const SCRadix4Node *node, void *user_data, const uint8_t netmask, void *data) |
typedef bool(* | SCRadix4TreeCompareFunc) (const void *ud1, const void *ud2) |
compare content of 2 user data entries More... | |
Functions | |
SCRadix4Tree | SCRadix4TreeInitialize (void) |
void | SCRadix4TreeRelease (SCRadix4Tree *, const SCRadix4Config *) |
SCRadix4Node * | SCRadix4AddKeyIPV4 (SCRadix4Tree *, const SCRadix4Config *, const uint8_t *, void *) |
Adds a new IPV4 address to the Radix4 tree. More... | |
SCRadix4Node * | SCRadix4AddKeyIPV4Netblock (SCRadix4Tree *, const SCRadix4Config *, const uint8_t *, uint8_t, void *) |
Adds a new IPV4 netblock to the Radix4 tree. More... | |
bool | SCRadix4AddKeyIPV4String (SCRadix4Tree *, const SCRadix4Config *, const char *, void *) |
Adds a new IPV4/netblock to the Radix4 tree from a string. More... | |
void | SCRadix4RemoveKeyIPV4Netblock (SCRadix4Tree *, const SCRadix4Config *, const uint8_t *, uint8_t) |
Removes an IPV4 address netblock key from the Radix4 tree. More... | |
void | SCRadix4RemoveKeyIPV4 (SCRadix4Tree *, const SCRadix4Config *, const uint8_t *) |
Removes an IPV4 address key(not a netblock) from the Radix4 tree. Instead of using this function, we can also used SCRadix4RemoveKeyIPV4Netblock(), by supplying a netmask value of 32. More... | |
SCRadix4Node * | SCRadix4TreeFindExactMatch (const SCRadix4Tree *, const uint8_t *, void **) |
SCRadix4Node * | SCRadix4TreeFindNetblock (const SCRadix4Tree *, const uint8_t *, const uint8_t, void **) |
SCRadix4Node * | SCRadix4TreeFindBestMatch (const SCRadix4Tree *, const uint8_t *, void **) |
SCRadix4Node * | SCRadix4TreeFindBestMatch2 (const SCRadix4Tree *, const uint8_t *, void **, uint8_t *) |
void | SCRadix4PrintTree (SCRadix4Tree *, const SCRadix4Config *config) |
void | SCRadix4PrintNodeInfo (SCRadix4Node *, int, void(*PrintData)(void *)) |
void | SCRadix4RegisterTests (void) |
int | SCRadix4ForEachNode (const SCRadix4Tree *tree, SCRadix4ForEachNodeFunc Callback, void *data) |
bool | SCRadix4CompareTrees (const SCRadix4Tree *t1, const SCRadix4Tree *t2, SCRadix4TreeCompareFunc Callback) |
Definition in file util-radix4-tree.h.
#define SC_RADIX4_TREE_INITIALIZER |
Definition at line 79 of file util-radix4-tree.h.
typedef struct SCRadix4Config_ SCRadix4Config |
typedef int(* SCRadix4ForEachNodeFunc) (const SCRadix4Node *node, void *user_data, const uint8_t netmask, void *data) |
Definition at line 106 of file util-radix4-tree.h.
typedef struct SCRadix4Node_ SCRadix4Node |
Structure for the node in the radix tree.
typedef struct SCRadix4Tree_ SCRadix4Tree |
Structure for the radix tree.
typedef bool(* SCRadix4TreeCompareFunc) (const void *ud1, const void *ud2) |
compare content of 2 user data entries
true | equal |
false | not equal |
Definition at line 115 of file util-radix4-tree.h.
SCRadix4Node* SCRadix4AddKeyIPV4 | ( | SCRadix4Tree * | tree, |
const SCRadix4Config * | config, | ||
const uint8_t * | key_stream, | ||
void * | user | ||
) |
Adds a new IPV4 address to the Radix4 tree.
key_stream | Data that has to be added to the Radix4 tree. In this case a pointer to an IPV4 address |
tree | Pointer to the Radix4 tree |
user | Pointer to the user data that has to be associated with the key |
node | Pointer to the newly created node |
Definition at line 188 of file util-radix4-tree.c.
SCRadix4Node* SCRadix4AddKeyIPV4Netblock | ( | SCRadix4Tree * | tree, |
const SCRadix4Config * | config, | ||
const uint8_t * | key_stream, | ||
uint8_t | netmask, | ||
void * | user | ||
) |
Adds a new IPV4 netblock to the Radix4 tree.
key_stream | Data that has to be added to the Radix4 tree. In this case a pointer to an IPV4 netblock |
tree | Pointer to the Radix4 tree |
user | Pointer to the user data that has to be associated with the key |
netmask | The netmask (cidr) if we are adding a netblock |
node | Pointer to the newly created node |
Definition at line 206 of file util-radix4-tree.c.
bool SCRadix4AddKeyIPV4String | ( | SCRadix4Tree * | tree, |
const SCRadix4Config * | config, | ||
const char * | str, | ||
void * | user | ||
) |
Adds a new IPV4/netblock to the Radix4 tree from a string.
str | IPV4 string with optional /cidr netmask |
tree | Pointer to the Radix4 tree |
user | Pointer to the user data that has to be associated with the key |
bool | true if node was added, false otherwise |
If the function returns false, sc_errno
is set:
Definition at line 227 of file util-radix4-tree.c.
References RadixUserData::netmask, SC_EINVAL, sc_errno, str, StringParseU8RangeCheck(), and strlcpy().
bool SCRadix4CompareTrees | ( | const SCRadix4Tree * | t1, |
const SCRadix4Tree * | t2, | ||
SCRadix4TreeCompareFunc | Callback | ||
) |
Definition at line 359 of file util-radix4-tree.c.
int SCRadix4ForEachNode | ( | const SCRadix4Tree * | tree, |
SCRadix4ForEachNodeFunc | Callback, | ||
void * | data | ||
) |
Definition at line 352 of file util-radix4-tree.c.
References SCRadix4Tree_::head.
void SCRadix4PrintNodeInfo | ( | SCRadix4Node * | , |
int | , | ||
void(*)(void *) | PrintData | ||
) |
void SCRadix4PrintTree | ( | SCRadix4Tree * | , |
const SCRadix4Config * | config | ||
) |
Definition at line 303 of file util-radix4-tree.c.
void SCRadix4RegisterTests | ( | void | ) |
Definition at line 922 of file util-radix4-tree.c.
References UtRegisterTest().
void SCRadix4RemoveKeyIPV4 | ( | SCRadix4Tree * | tree, |
const SCRadix4Config * | config, | ||
const uint8_t * | key_stream | ||
) |
Removes an IPV4 address key(not a netblock) from the Radix4 tree. Instead of using this function, we can also used SCRadix4RemoveKeyIPV4Netblock(), by supplying a netmask value of 32.
key_stream | Data that has to be removed from the Radix4 tree. In this case an IPV4 address |
tree | Pointer to the Radix4 tree from which the key has to be removed |
Definition at line 282 of file util-radix4-tree.c.
void SCRadix4RemoveKeyIPV4Netblock | ( | SCRadix4Tree * | tree, |
const SCRadix4Config * | config, | ||
const uint8_t * | key_stream, | ||
uint8_t | netmask | ||
) |
Removes an IPV4 address netblock key from the Radix4 tree.
key_stream | Data that has to be removed from the Radix4 tree. In this case an IPV4 address |
tree | Pointer to the Radix4 tree from which the key has to be removed |
Definition at line 296 of file util-radix4-tree.c.
References SCLogNotice.
SCRadix4Node* SCRadix4TreeFindBestMatch | ( | const SCRadix4Tree * | , |
const uint8_t * | , | ||
void ** | |||
) |
Definition at line 154 of file util-radix4-tree.c.
Referenced by IPOnlyMatchPacket(), and SCHInfoGetIPv4HostOSFlavour().
SCRadix4Node* SCRadix4TreeFindBestMatch2 | ( | const SCRadix4Tree * | , |
const uint8_t * | , | ||
void ** | , | ||
uint8_t * | |||
) |
Definition at line 160 of file util-radix4-tree.c.
SCRadix4Node* SCRadix4TreeFindExactMatch | ( | const SCRadix4Tree * | , |
const uint8_t * | , | ||
void ** | |||
) |
Definition at line 142 of file util-radix4-tree.c.
SCRadix4Node* SCRadix4TreeFindNetblock | ( | const SCRadix4Tree * | , |
const uint8_t * | , | ||
const uint8_t | , | ||
void ** | |||
) |
Definition at line 148 of file util-radix4-tree.c.
SCRadix4Tree SCRadix4TreeInitialize | ( | void | ) |
Definition at line 166 of file util-radix4-tree.c.
References SC_RADIX4_TREE_INITIALIZER.
Referenced by IPOnlyInit(), and SRepInit().
void SCRadix4TreeRelease | ( | SCRadix4Tree * | , |
const SCRadix4Config * | |||
) |
Definition at line 172 of file util-radix4-tree.c.
Referenced by DefragTreeDestroy(), IPOnlyDeinit(), SCHInfoCleanResources(), and SRepDestroy().