suricata
util-host-os-info.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SC_HINFO_IS_IPV6   0
 
#define SC_HINFO_IS_IPV4   1
 

Functions

int SCHInfoAddHostOSInfo (const char *, const char *, int)
 Used to add the host-os-info data obtained from the conf. More...
 
int SCHInfoGetHostOSFlavour (const char *)
 Retrieves the host os flavour, given an ipv4/ipv6 address as a string. More...
 
int SCHInfoGetIPv4HostOSFlavour (uint8_t *)
 Retrieves the host os flavour, given an ipv4 address in the raw address format. More...
 
int SCHInfoGetIPv6HostOSFlavour (uint8_t *)
 Retrieves the host os flavour, given an ipv6 address in the raw address format. More...
 
void SCHInfoCleanResources (void)
 
void SCHInfoLoadFromConfig (void)
 Load the host os policy information from the configuration. More...
 
void SCHInfoRegisterTests (void)
 

Detailed Description

Macro Definition Documentation

#define SC_HINFO_IS_IPV4   1

Definition at line 28 of file util-host-os-info.h.

Referenced by SCHInfoLoadFromConfig().

#define SC_HINFO_IS_IPV6   0

Definition at line 27 of file util-host-os-info.h.

Referenced by SCHInfoLoadFromConfig().

Function Documentation

int SCHInfoAddHostOSInfo ( const char *  host_os,
const char *  host_os_ip_range,
int  is_ipv4 
)

Used to add the host-os-info data obtained from the conf.

Parameters
host_osThe host_os name/flavour from the conf file
host_os_ip_rangePointer to a char string holding the ip/ip_netblock for the host_os specified in the first argument
is_ipv4Indicates if the ip address to be considered for the default configuration is IPV4; if not it is IPV6. Specified using SC_HINFO_IS_IPV6 or SC_HINFO_IS_IPV4
Return values
0On successfully adding the host os info to the Radix tree
-1On failure (only specified from config, at the startup)

Definition at line 122 of file util-host-os-info.c.

References FALSE, MaskIPNetblock(), SC_ERR_INVALID_ARGUMENT, SC_ERR_INVALID_ENUM_MAP, SC_ERR_INVALID_IP_NETBLOCK, SC_ERR_INVALID_IPV4_ADDR, SC_ERR_INVALID_IPV6_ADDR, SC_ERR_MEM_ALLOC, SCFree, SCHInfoAddHostOSInfo(), SCLogError, SCRadixAddKeyIPV4(), SCRadixAddKeyIPV4Netblock(), SCRadixAddKeyIPV6(), SCRadixAddKeyIPV6Netblock(), SCRadixCreateRadixTree(), SCStrdup, TRUE, ValidateIPV4Address(), and ValidateIPV6Address().

Referenced by SCHInfoAddHostOSInfo(), and SCHInfoLoadFromConfig().

Here is the call graph for this function:

Here is the caller graph for this function:

void SCHInfoCleanResources ( void  )

Definition at line 321 of file util-host-os-info.c.

References SCRadixReleaseRadixTree().

Referenced by SCHInfoLoadFromConfig().

Here is the call graph for this function:

Here is the caller graph for this function:

int SCHInfoGetHostOSFlavour ( const char *  ip_addr_str)

Retrieves the host os flavour, given an ipv4/ipv6 address as a string.

Parameters
Pointerto a string containing an IP address
Return values
TheOS flavour on success; -1 on failure, or on not finding the key

Definition at line 249 of file util-host-os-info.c.

References SC_ERR_INVALID_IPV4_ADDR, SCFree, SCLogError, SCRadixFindKeyIPV4BestMatch(), SCRadixFindKeyIPV6BestMatch(), ValidateIPV4Address(), and ValidateIPV6Address().

Referenced by SCHInfoLoadFromConfig().

Here is the call graph for this function:

Here is the caller graph for this function:

int SCHInfoGetIPv4HostOSFlavour ( uint8_t *  ipv4_addr)

Retrieves the host os flavour, given an ipv4 address in the raw address format.

Parameters
Pointerto a raw ipv4 address.
Return values
TheOS flavour on success; -1 on failure, or on not finding the key

Definition at line 293 of file util-host-os-info.c.

References SCRadixFindKeyIPV4BestMatch().

Referenced by DefragGetOsPolicy(), SCHInfoLoadFromConfig(), and StreamTcpSetOSPolicy().

Here is the call graph for this function:

Here is the caller graph for this function:

int SCHInfoGetIPv6HostOSFlavour ( uint8_t *  ipv6_addr)

Retrieves the host os flavour, given an ipv6 address in the raw address format.

Parameters
Pointerto a raw ipv6 address.
Return values
TheOS flavour on success; -1 on failure, or on not finding the key

Definition at line 311 of file util-host-os-info.c.

References SCRadixFindKeyIPV6BestMatch().

Referenced by DefragGetOsPolicy(), SCHInfoLoadFromConfig(), and StreamTcpSetOSPolicy().

Here is the call graph for this function:

Here is the caller graph for this function:

void SCHInfoRegisterTests ( void  )

Definition at line 1605 of file util-host-os-info.c.

References UtRegisterTest().

Here is the call graph for this function: