suricata
|
Go to the source code of this file.
Functions | |
bool | IPv4AddressStringIsValid (const char *str) |
determine if a string is a valid ipv4 address More... | |
bool | IPv6AddressStringIsValid (const char *str) |
determine if a string is a valid ipv6 address More... | |
struct in_addr * | ValidateIPV4Address (const char *addr_str) |
Validates an IPV4 address and returns the network endian arranged version of the IPV4 address. More... | |
struct in6_addr * | ValidateIPV6Address (const char *addr_str) |
Validates an IPV6 address and returns the network endian arranged version of the IPV6 address. More... | |
void | MaskIPNetblock (uint8_t *stream, int netmask, int key_bitlen) |
Culls the non-netmask portion of the IP address. For example an IP address 192.168.240.1 would be chopped to 192.168.224.0 against a netmask value of 19. More... | |
IP addresses related utility functions
Definition in file util-ip.c.
bool IPv4AddressStringIsValid | ( | const char * | str | ) |
determine if a string is a valid ipv4 address
bool | is addr valid? |
Definition at line 35 of file util-ip.c.
References len, SCLogDebug, str, and StringParseUint8().
Referenced by ValidateIPV4Address().
bool IPv6AddressStringIsValid | ( | const char * | str | ) |
determine if a string is a valid ipv6 address
bool | is addr valid? |
Definition at line 82 of file util-ip.c.
References len, SCLogDebug, and str.
Referenced by ValidateIPV6Address().
void MaskIPNetblock | ( | uint8_t * | stream, |
int | netmask, | ||
int | key_bitlen | ||
) |
Culls the non-netmask portion of the IP address. For example an IP address 192.168.240.1 would be chopped to 192.168.224.0 against a netmask value of 19.
stream | Pointer the IP address that has to be masked |
netmask | The netmask value (cidr) to which the IP address has to be culled |
key_bitlen | The bitlen of the stream |
struct in_addr* ValidateIPV4Address | ( | const char * | addr_str | ) |
Validates an IPV4 address and returns the network endian arranged version of the IPV4 address.
addr | Pointer to a character string containing an IPV4 address. A valid IPV4 address is a character string containing a dotted format of "ddd.ddd.ddd.ddd" |
Pointer | to an in_addr instance containing the network endian format of the IPV4 address |
NULL | if the IPV4 address is invalid |
Definition at line 130 of file util-ip.c.
References FatalError, IPv4AddressStringIsValid(), SCFree, and SCMalloc.
struct in6_addr* ValidateIPV6Address | ( | const char * | addr_str | ) |
Validates an IPV6 address and returns the network endian arranged version of the IPV6 address.
addr | Pointer to a character string containing an IPV6 address |
Pointer | to a in6_addr instance containing the network endian format of the IPV6 address |
NULL | if the IPV6 address is invalid |
Definition at line 159 of file util-ip.c.
References FatalError, IPv6AddressStringIsValid(), SCFree, and SCMalloc.