suricata
|
Go to the source code of this file.
Functions | |
DetectAddress * | DetectAddressInit (void) |
Creates and returns a new instance of a DetectAddress. More... | |
void | DetectAddressFree (DetectAddress *) |
Frees a DetectAddress instance. More... | |
DetectAddress * | DetectAddressCopy (DetectAddress *) |
copy a DetectAddress More... | |
int | DetectAddressParse (const DetectEngineCtx *, DetectAddressHead *, const char *) |
Parses an address group sent as a character string and updates the DetectAddressHead sent as the argument with the relevant address ranges from the parsed string. More... | |
void | DetectAddressHeadCleanup (DetectAddressHead *) |
Cleans a DetectAddressHead. The functions frees the address group heads(ipv4 and ipv6) inside the DetectAddressHead instance. More... | |
bool | DetectAddressListsAreEqual (DetectAddress *list1, DetectAddress *list2) |
Checks if two address group lists are equal. More... | |
DetectAddress * | DetectAddressLookupInHead (const DetectAddressHead *, Address *) |
Find the group matching address in a group head. More... | |
int | DetectAddressCmp (DetectAddress *, DetectAddress *) |
Used to compare 2 address ranges. More... | |
int | DetectAddressMatchIPv4 (const DetectMatchAddressIPv4 *, uint16_t, const Address *) |
Match a packets address against a signatures addrs array. More... | |
int | DetectAddressMatchIPv6 (const DetectMatchAddressIPv6 *, uint16_t, const Address *) |
Match a packets address against a signatures addrs array. More... | |
int | DetectAddressTestConfVars (void) |
void | DetectAddressTests (void) |
int | DetectAddressMapInit (DetectEngineCtx *de_ctx) |
void | DetectAddressMapFree (DetectEngineCtx *de_ctx) |
const DetectAddressHead * | DetectParseAddress (DetectEngineCtx *de_ctx, const char *string, bool *contains_negation) |
Definition in file detect-engine-address.h.
int DetectAddressCmp | ( | DetectAddress * | a, |
DetectAddress * | b | ||
) |
Used to compare 2 address ranges.
a | Pointer to the first DetectAddressData to be compared. |
b | Pointer to the second DetectAddressData to be compared. |
Definition at line 1562 of file detect-engine-address.c.
References ADDRESS_ER, DetectAddressCmpIPv4(), DetectAddressCmpIPv6(), Address_::family, and DetectAddress_::ip.
Referenced by DetectAddressListsAreEqual().
DetectAddress* DetectAddressCopy | ( | DetectAddress * | orig | ) |
copy a DetectAddress
orig | Pointer to the instance of DetectAddress that contains the address data to be copied to the new instance. |
ag | Pointer to the new instance of DetectAddress that contains the copied address. |
Definition at line 127 of file detect-engine-address.c.
References COPY_ADDRESS, DetectAddressInit(), DetectAddress_::flags, DetectAddress_::ip, and DetectAddress_::ip2.
Referenced by DetectThresholdDataCopy().
void DetectAddressFree | ( | DetectAddress * | ag | ) |
Frees a DetectAddress instance.
ag | Pointer to the DetectAddress instance to be freed. |
Definition at line 82 of file detect-engine-address.c.
References SCFree.
Referenced by DetectAddressCutIPv4().
void DetectAddressHeadCleanup | ( | DetectAddressHead * | gh | ) |
Cleans a DetectAddressHead. The functions frees the address group heads(ipv4 and ipv6) inside the DetectAddressHead instance.
gh | Pointer to the DetectAddressHead instance that has to be cleaned. |
Definition at line 1476 of file detect-engine-address.c.
References DetectAddressHead_::ipv4_head.
DetectAddress* DetectAddressInit | ( | void | ) |
Creates and returns a new instance of a DetectAddress.
ag | Pointer to the newly created DetectAddress on success; NULL on failure. |
Definition at line 69 of file detect-engine-address.c.
References SCCalloc, and unlikely.
Referenced by DetectAddressCopy(), DetectAddressCutIPv4(), and DetectAddressCutNotIPv4().
bool DetectAddressListsAreEqual | ( | DetectAddress * | list1, |
DetectAddress * | list2 | ||
) |
Checks if two address group lists are equal.
list1 | Pointer to the first address group list. |
list2 | Pointer to the second address group list. |
true | On success. |
false | On failure. |
Definition at line 349 of file detect-engine-address.c.
References ADDRESS_EQ, DetectAddressCmp(), and DetectAddress_::next.
DetectAddress* DetectAddressLookupInHead | ( | const DetectAddressHead * | gh, |
Address * | a | ||
) |
Find the group matching address in a group head.
gh | Pointer to the address group head(DetectAddressHead instance). |
a | Pointer to an Address instance. |
g | On success pointer to an DetectAddress if we find a match for the Address "a", in the DetectAddressHead "gh". |
Definition at line 1798 of file detect-engine-address.c.
References Address_::family, DetectAddressHead_::ipv4_head, DetectAddressHead_::ipv6_head, DetectAddress_::next, SCEnter, SCLogDebug, and SCReturnPtr.
void DetectAddressMapFree | ( | DetectEngineCtx * | de_ctx | ) |
Definition at line 1337 of file detect-engine-address.c.
References DetectEngineCtx_::address_table, de_ctx, and HashListTableFree().
int DetectAddressMapInit | ( | DetectEngineCtx * | de_ctx | ) |
Definition at line 1326 of file detect-engine-address.c.
References DetectEngineCtx_::address_table, de_ctx, and HashListTableInit().
int DetectAddressMatchIPv4 | ( | const DetectMatchAddressIPv4 * | addrs, |
uint16_t | addrs_cnt, | ||
const Address * | a | ||
) |
Match a packets address against a signatures addrs array.
addrs | array of DetectMatchAddressIPv4's |
addrs_cnt | array size in members |
a | packets address |
0 | no match |
1 | match |
Definition at line 1589 of file detect-engine-address.c.
References SCEnter, SCNtohl, and SCReturnInt.
int DetectAddressMatchIPv6 | ( | const DetectMatchAddressIPv6 * | addrs, |
uint16_t | addrs_cnt, | ||
const Address * | a | ||
) |
Match a packets address against a signatures addrs array.
addrs | array of DetectMatchAddressIPv6's |
addrs_cnt | array size in members |
a | packets address |
0 | no match |
1 | match |
Definition at line 1622 of file detect-engine-address.c.
References SCEnter, SCNtohl, and SCReturnInt.
int DetectAddressParse | ( | const DetectEngineCtx * | de_ctx, |
DetectAddressHead * | gh, | ||
const char * | str | ||
) |
Parses an address group sent as a character string and updates the DetectAddressHead sent as the argument with the relevant address ranges from the parsed string.
de_ctx | Pointer to the detection engine context |
gh | Pointer to the DetectAddressHead. |
str | Pointer to the character string containing the address group that has to be parsed. |
1 | On success. Contained negation. |
0 | On success. Did not contain negation. |
-1 | On failure. |
Definition at line 1394 of file detect-engine-address.c.
References SCLogDebug, and str.
int DetectAddressTestConfVars | ( | void | ) |
Definition at line 1217 of file detect-engine-address.c.
References ConfGetNode(), ConfNode_::name, next, SCLogDebug, TAILQ_FOREACH, TAILQ_HEAD_INITIALIZER, and ConfNode_::val.
void DetectAddressTests | ( | void | ) |
const DetectAddressHead* DetectParseAddress | ( | DetectEngineCtx * | de_ctx, |
const char * | string, | ||
bool * | contains_negation | ||
) |
Definition at line 1434 of file detect-engine-address.c.