|
Greenbone Vulnerability Management Libraries 22.32.0
|
Protos and data structures for Hosts collections and single hosts objects. More...
#include <glib.h>#include <netinet/in.h>

Go to the source code of this file.
Data Structures | |
| struct | gvm_host |
| The structure for a single host object. More... | |
| struct | gvm_vhost |
| The structure for a single vhost object. More... | |
| struct | gvm_hosts |
| The structure for Hosts collection. More... | |
Macros | |
| #define | FEATURE_HOSTS_ALLOWED_ONLY 1 |
| Flag that indecates that this version includes the function gvm_hosts_allowed_only(). | |
| #define | FEATURE_REVERSE_LOOKUP_EXCLUDED 1 |
| Flag that indecates that this version includes the functions gvm_reverse_lookup_only_excluded() and gvm_reverse_lookup_unify_excluded(). | |
Typedefs | |
| typedef struct gvm_host | gvm_host_t |
| typedef struct gvm_vhost | gvm_vhost_t |
| typedef struct gvm_hosts | gvm_hosts_t |
Enumerations | |
| enum | host_type { HOST_TYPE_NAME = 0 , HOST_TYPE_IPV4 , HOST_TYPE_CIDR_BLOCK , HOST_TYPE_RANGE_SHORT , HOST_TYPE_RANGE_LONG , HOST_TYPE_IPV6 , HOST_TYPE_CIDR6_BLOCK , HOST_TYPE_RANGE6_LONG , HOST_TYPE_RANGE6_SHORT , HOST_TYPE_MAX } |
Functions | |
| gvm_hosts_t * | gvm_hosts_new (const gchar *) |
| Creates a new gvm_hosts_t structure and the associated hosts objects from the provided hosts_str. | |
| gvm_hosts_t * | gvm_hosts_new_with_max (const gchar *, unsigned int) |
| Creates a new gvm_hosts_t structure and the associated hosts objects from the provided hosts_str. | |
| gvm_host_t * | gvm_hosts_next (gvm_hosts_t *) |
| Gets the next gvm_host_t from a gvm_hosts_t structure. The state of iteration is kept internally within the gvm_hosts structure. | |
| void | gvm_hosts_move_current_host_to_end (gvm_hosts_t *) |
| Move the current gvm_host_t from a gvm_hosts_t structure to the end of the hosts list. | |
| void | gvm_hosts_free (gvm_hosts_t *) |
| Frees memory occupied by an gvm_hosts_t structure. | |
| void | gvm_hosts_shuffle (gvm_hosts_t *) |
| Randomizes the order of the hosts objects in the collection. Not to be used while iterating over the single hosts as it resets the iterator. | |
| void | gvm_hosts_reverse (gvm_hosts_t *) |
| Reverses the order of the hosts objects in the collection. Not to be used while iterating over the single hosts as it resets the iterator. | |
| void | gvm_hosts_add (gvm_hosts_t *, gvm_host_t *) |
| Inserts a host object at the end of a hosts collection. | |
| GSList * | gvm_hosts_resolve (gvm_hosts_t *) |
| Resolves host objects of type name in a hosts collection, replacing hostnames with IPv4 values. Not to be used while iterating over the single hosts as it resets the iterator. | |
| int | gvm_hosts_exclude (gvm_hosts_t *, const char *) |
| Excludes a set of hosts provided as a string from a hosts collection. Not to be used while iterating over the single hosts as it resets the iterator. | |
| int | gvm_vhosts_exclude (gvm_host_t *, const char *) |
| Exclude a list of vhosts from a host's vhosts list. | |
| int | gvm_hosts_exclude_with_max (gvm_hosts_t *, const char *, unsigned int) |
| Excludes a set of hosts provided as a string from a hosts collection. Not to be used while iterating over the single hosts as it resets the iterator. | |
| GSList * | gvm_hosts_allowed_only (gvm_hosts_t *, const char *, const char *) |
| Returns a list of hosts after a host authorization check. | |
| char * | gvm_host_reverse_lookup (gvm_host_t *) |
| Checks for a host object reverse dns lookup existence. | |
| int | gvm_hosts_reverse_lookup_only (gvm_hosts_t *) |
| Removes hosts that don't reverse-lookup from the hosts collection. Not to be used while iterating over the single hosts as it resets the iterator. | |
| int | gvm_hosts_reverse_lookup_unify (gvm_hosts_t *) |
| Removes hosts duplicates that reverse-lookup to the same value. Not to be used while iterating over the single hosts as it resets the iterator. | |
| gvm_hosts_t * | gvm_hosts_reverse_lookup_only_excluded (gvm_hosts_t *) |
| Removes hosts that don't reverse-lookup from the hosts collection. Not to be used while iterating over the single hosts as it resets the iterator. | |
| gvm_hosts_t * | gvm_hosts_reverse_lookup_unify_excluded (gvm_hosts_t *) |
| Removes hosts duplicates that reverse-lookup to the same value. Not to be used while iterating over the single hosts as it resets the iterator. | |
| unsigned int | gvm_hosts_count (const gvm_hosts_t *) |
| Gets the count of single hosts objects in a hosts collection. | |
| unsigned int | gvm_hosts_removed (const gvm_hosts_t *) |
| Gets the count of single values in hosts string that were removed (duplicates / excluded.). | |
| unsigned int | gvm_hosts_duplicated (const gvm_hosts_t *) |
| Gets the count of single values in hosts string that were duplicated and therefore removed from the list. | |
| gvm_host_t * | gvm_host_from_str (const gchar *hosts_str) |
| Creates a new gvm_host_t from a host string. | |
| int | gvm_host_in_hosts (const gvm_host_t *, const struct in6_addr *, const gvm_hosts_t *) |
| Returns whether a host has an equal host in a hosts collection. eg. 192.168.10.1 has an equal in list created from "192.168.10.1-5, 192.168.10.10-20" string while 192.168.10.7 doesn't. | |
| gvm_host_t * | gvm_host_find_in_hosts (const gvm_host_t *, const struct in6_addr *, const gvm_hosts_t *) |
| Find the gvm_host_t from a gvm_hosts_t structure. | |
| gchar * | gvm_host_type_str (const gvm_host_t *) |
| Gets a host's type in printable format. | |
| enum host_type | gvm_host_type (const gvm_host_t *) |
| Gets a host object's type. | |
| gchar * | gvm_host_value_str (const gvm_host_t *) |
| Gets a host's value in printable format. | |
| int | gvm_host_resolve (const gvm_host_t *, void *, int) |
| Resolves a host object's name to an IPv4 or IPv6 address. Host object should be of type HOST_TYPE_NAME. | |
| int | gvm_host_get_addr6 (const gvm_host_t *, struct in6_addr *) |
| Gives a host object's value as an IPv6 address. If the host type is hostname, it resolves the IPv4 address then gives an IPv4-mapped IPv6 address (eg. ::ffff:192.168.1.1 .) If the host type is IPv4, it gives an IPv4-mapped IPv6 address. If the host's type is IPv6, it gives the value directly. | |
| void | gvm_host_add_reverse_lookup (gvm_host_t *) |
| Add a host's reverse-lookup name to the vhosts list. | |
| void | gvm_host_free (gpointer) |
| Frees the memory occupied by an gvm_host_t object. | |
| gpointer | gvm_duplicate_vhost (gconstpointer, gpointer) |
| Creates a deep copy of a gvm_vhost_t object. | |
| gvm_host_t * | gvm_duplicate_host (gvm_host_t *) |
| Creates a deep copy of a host. gvm_host_free has to be called on it. | |
| gvm_vhost_t * | gvm_vhost_new (char *, char *) |
| Creates a new gvm_vhost_t object. | |
| int | gvm_get_host_type (const gchar *) |
| Determines the host type in a buffer. | |
Protos and data structures for Hosts collections and single hosts objects.
This file contains the protos for hosts.c
Definition in file hosts.h.
| #define FEATURE_HOSTS_ALLOWED_ONLY 1 |
Flag that indecates that this version includes the function gvm_hosts_allowed_only().
| #define FEATURE_REVERSE_LOOKUP_EXCLUDED 1 |
| typedef struct gvm_host gvm_host_t |
| typedef struct gvm_hosts gvm_hosts_t |
| typedef struct gvm_vhost gvm_vhost_t |
| enum host_type |
| gvm_host_t * gvm_duplicate_host | ( | gvm_host_t * | host | ) |
Creates a deep copy of a host. gvm_host_free has to be called on it.
| host | source host |
Definition at line 2199 of file hosts.c.
References gvm_host::addr, gvm_host::addr6, gvm_duplicate_vhost(), gvm_host_new(), HOST_TYPE_IPV4, HOST_TYPE_IPV6, HOST_TYPE_NAME, gvm_host::name, gvm_host::type, and gvm_host::vhosts.
Referenced by gvm_hosts_reverse_lookup_only_excluded(), and gvm_hosts_reverse_lookup_unify_excluded().


| gpointer gvm_duplicate_vhost | ( | gconstpointer | vhost, |
| gpointer | data ) |
Creates a deep copy of a gvm_vhost_t object.
| vhost | source vhost |
| data | dummy for g_slist_copy_deep |
Definition at line 909 of file hosts.c.
References gvm_vhost_new().
Referenced by gvm_duplicate_host().


| int gvm_get_host_type | ( | const gchar * | str_stripped | ) |
Determines the host type in a buffer.
| [in] | str_stripped | Buffer that contains host definition, could a be hostname, single IPv4 or IPv6, CIDR-expressed block etc,. |
Definition at line 813 of file hosts.c.
References HOST_TYPE_CIDR6_BLOCK, HOST_TYPE_CIDR_BLOCK, HOST_TYPE_IPV4, HOST_TYPE_IPV6, HOST_TYPE_NAME, HOST_TYPE_RANGE6_LONG, HOST_TYPE_RANGE6_SHORT, HOST_TYPE_RANGE_LONG, HOST_TYPE_RANGE_SHORT, is_cidr6_block(), is_cidr_block(), is_hostname(), is_ipv4_address(), is_ipv6_address(), is_long_range6_network(), is_long_range_network(), is_short_range6_network(), and is_short_range_network().
Referenced by Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), gvm_host_from_str(), gvm_hosts_new_with_max(), gvm_server_open_verify(), and osp_send_command().


| void gvm_host_add_reverse_lookup | ( | gvm_host_t * | host | ) |
Add a host's reverse-lookup name to the vhosts list.
| [in] | host | The host to which we add the vhost. |
Definition at line 1921 of file hosts.c.
References gvm_host_reverse_lookup(), gvm_vhost_new(), host_name_verify(), HOST_TYPE_NAME, gvm_host::type, and gvm_host::vhosts.

| gvm_host_t * gvm_host_find_in_hosts | ( | const gvm_host_t * | host, |
| const struct in6_addr * | addr, | ||
| const gvm_hosts_t * | hosts ) |
Find the gvm_host_t from a gvm_hosts_t structure.
| [in] | host | The host object. |
| [in] | addr | Optional pointer to ip address. Could be used so that host isn't resolved multiple times when type is HOST_TYPE_NAME. |
| [in] | hosts | Hosts collection. |
Definition at line 2150 of file hosts.c.
References gvm_hosts::count, gvm_host_get_addr6(), gvm_host_type(), gvm_host_value_str(), HOST_TYPE_NAME, and gvm_hosts::hosts.
Referenced by gvm_host_in_hosts().


| void gvm_host_free | ( | gpointer | host | ) |
Frees the memory occupied by an gvm_host_t object.
| [in] | host | Host to free. |
Definition at line 944 of file hosts.c.
References gvm_vhost_free(), HOST_TYPE_NAME, gvm_host::name, gvm_host::type, and gvm_host::vhosts.
Referenced by gvm_hosts_allowed_only(), gvm_hosts_deduplicate(), gvm_hosts_exclude_with_max(), gvm_hosts_free(), gvm_hosts_resolve(), gvm_hosts_reverse_lookup_only_excluded(), and gvm_hosts_reverse_lookup_unify_excluded().


| gvm_host_t * gvm_host_from_str | ( | const gchar * | host_str | ) |
Creates a new gvm_host_t from a host string.
| [in] | host_str | The host string can consist of a hostname, IPv4 address or IPv6 address. |
Definition at line 1787 of file hosts.c.
References gvm_host::addr, gvm_host::addr6, gvm_get_host_type(), gvm_host_new(), HOST_TYPE_IPV4, HOST_TYPE_IPV6, HOST_TYPE_NAME, gvm_host::name, and gvm_host::type.

| int gvm_host_get_addr6 | ( | const gvm_host_t * | host, |
| struct in6_addr * | ip6 ) |
Gives a host object's value as an IPv6 address. If the host type is hostname, it resolves the IPv4 address then gives an IPv4-mapped IPv6 address (eg. ::ffff:192.168.1.1 .) If the host type is IPv4, it gives an IPv4-mapped IPv6 address. If the host's type is IPv6, it gives the value directly.
| [in] | host | The host object whose value to get as IPv6. |
| [out] | ip6 | Buffer to store the IPv6 address. |
Definition at line 2368 of file hosts.c.
References gvm_host::addr, gvm_host::addr6, gvm_host_resolve(), gvm_host_type(), HOST_TYPE_IPV4, HOST_TYPE_IPV6, HOST_TYPE_NAME, and ipv4_as_ipv6().
Referenced by gvm_host_find_in_hosts().


| int gvm_host_in_hosts | ( | const gvm_host_t * | host, |
| const struct in6_addr * | addr, | ||
| const gvm_hosts_t * | hosts ) |
Returns whether a host has an equal host in a hosts collection. eg. 192.168.10.1 has an equal in list created from "192.168.10.1-5, 192.168.10.10-20" string while 192.168.10.7 doesn't.
| [in] | host | The host object. |
| [in] | addr | Optional pointer to ip address. Could be used so that host isn't resolved multiple times when type is HOST_TYPE_NAME. |
| [in] | hosts | Hosts collection. |
Definition at line 2242 of file hosts.c.
References gvm_host_find_in_hosts().

| int gvm_host_resolve | ( | const gvm_host_t * | host, |
| void * | dst, | ||
| int | family ) |
Resolves a host object's name to an IPv4 or IPv6 address. Host object should be of type HOST_TYPE_NAME.
| [in] | host | The host object whose name to resolve. |
| [out] | dst | Buffer to store resolved address. Size must be at least 4 bytes for AF_INET and 16 bytes for AF_INET6. |
| [in] | family | Either AF_INET or AF_INET6. |
Definition at line 2347 of file hosts.c.
References gvm_resolve(), HOST_TYPE_NAME, gvm_host::name, and gvm_host::type.
Referenced by gvm_host_get_addr6().


| char * gvm_host_reverse_lookup | ( | gvm_host_t * | host | ) |
Checks for a host object reverse dns lookup existence.
| [in] | host | The host to reverse-lookup. |
Definition at line 1836 of file hosts.c.
References gvm_host::addr, gvm_host::addr6, HOST_TYPE_IPV4, HOST_TYPE_IPV6, and gvm_host::type.
Referenced by gvm_host_add_reverse_lookup(), gvm_hosts_reverse_lookup_only_excluded(), and gvm_hosts_reverse_lookup_unify_excluded().

| enum host_type gvm_host_type | ( | const gvm_host_t * | host | ) |
Gets a host object's type.
| [in] | host | The host object. |
Definition at line 2259 of file hosts.c.
References gvm_host::type.
Referenced by gvm_host_find_in_hosts(), and gvm_host_get_addr6().

| gchar * gvm_host_type_str | ( | const gvm_host_t * | host | ) |
Gets a host's type in printable format.
| [in] | host | The host object. |
Definition at line 2274 of file hosts.c.
References host_type_str, and gvm_host::type.
| gchar * gvm_host_value_str | ( | const gvm_host_t * | host | ) |
Gets a host's value in printable format.
| [in] | host | The host object. |
Definition at line 2290 of file hosts.c.
References gvm_host::addr, gvm_host::addr6, HOST_TYPE_IPV4, HOST_TYPE_IPV6, HOST_TYPE_NAME, gvm_host::name, and gvm_host::type.
Referenced by Ensure(), gvm_host_find_in_hosts(), gvm_hosts_allowed_only(), gvm_hosts_deduplicate(), gvm_hosts_exclude_with_max(), host_name_verify(), and host_value_eq().

| void gvm_hosts_add | ( | gvm_hosts_t * | hosts, |
| gvm_host_t * | host ) |
Inserts a host object at the end of a hosts collection.
| [in] | hosts | Hosts in which to insert the host. |
| [in] | host | Host to insert. |
Definition at line 965 of file hosts.c.
References gvm_hosts::count, gvm_hosts::hosts, and gvm_hosts::max_size.
Referenced by gvm_hosts_new_with_max(), gvm_hosts_resolve(), gvm_hosts_reverse_lookup_only_excluded(), and gvm_hosts_reverse_lookup_unify_excluded().

| GSList * gvm_hosts_allowed_only | ( | gvm_hosts_t * | hosts, |
| const char * | deny_hosts_str, | ||
| const char * | allow_hosts_str ) |
Returns a list of hosts after a host authorization check.
| [in,out] | hosts | The hosts collection from which to exclude. |
| [in] | deny_hosts_str | String of denied hosts. This hosts will be removed from the hosts list |
| [in] | allow_hosts_str | String of allow hosts. This hosts will be kept in the hosts list |
Uses a hash table in order to exclude hosts in O(N+M) time.
Definition at line 1658 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, gvm_host_free(), gvm_host_value_str(), gvm_hosts_count(), gvm_hosts_fill_gaps(), gvm_hosts_free(), gvm_hosts_new_with_max(), gvm_hosts::hosts, and gvm_hosts::removed.
Referenced by Ensure(), and main().


| unsigned int gvm_hosts_count | ( | const gvm_hosts_t * | hosts | ) |
Gets the count of single hosts objects in a hosts collection.
| [in] | hosts | The hosts collection to count hosts of. |
Definition at line 2106 of file hosts.c.
References gvm_hosts::count.
Referenced by Ensure(), Ensure(), gvm_hosts_allowed_only(), and gvm_hosts_exclude_with_max().

| unsigned int gvm_hosts_duplicated | ( | const gvm_hosts_t * | hosts | ) |
Gets the count of single values in hosts string that were duplicated and therefore removed from the list.
| [in] | hosts | The hosts collection. |
Definition at line 2134 of file hosts.c.
References gvm_hosts::duplicated.
| int gvm_hosts_exclude | ( | gvm_hosts_t * | hosts, |
| const char * | excluded_str ) |
Excludes a set of hosts provided as a string from a hosts collection. Not to be used while iterating over the single hosts as it resets the iterator.
| [in] | hosts | The hosts collection from which to exclude. |
| [in] | excluded_str | String of hosts to exclude. |
Definition at line 1771 of file hosts.c.
References gvm_hosts_exclude_with_max().

| int gvm_hosts_exclude_with_max | ( | gvm_hosts_t * | hosts, |
| const char * | excluded_str, | ||
| unsigned int | max_hosts ) |
Excludes a set of hosts provided as a string from a hosts collection. Not to be used while iterating over the single hosts as it resets the iterator.
| [in,out] | hosts | The hosts collection from which to exclude. |
| [in] | excluded_str | String of hosts to exclude. |
| [in] | max_hosts | Max number of hosts in hosts_str. 0 means unlimited. |
Uses a hash table in order to exclude hosts in O(N+M) time.
Definition at line 1580 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, gvm_host_free(), gvm_host_value_str(), gvm_hosts_count(), gvm_hosts_fill_gaps(), gvm_hosts_free(), gvm_hosts_new_with_max(), gvm_hosts::hosts, and gvm_hosts::removed.
Referenced by gvm_hosts_exclude().


| void gvm_hosts_free | ( | gvm_hosts_t * | hosts | ) |
Frees memory occupied by an gvm_hosts_t structure.
| [in] | hosts | The hosts collection to free. |
Definition at line 1375 of file hosts.c.
References gvm_hosts::count, gvm_host_free(), gvm_hosts::hosts, and gvm_hosts::orig_str.
Referenced by Ensure(), Ensure(), Ensure(), Ensure(), gvm_hosts_allowed_only(), gvm_hosts_exclude_with_max(), gvm_hosts_new_with_max(), gvm_hosts_reverse_lookup_only(), and gvm_hosts_reverse_lookup_unify().


| void gvm_hosts_move_current_host_to_end | ( | gvm_hosts_t * | hosts | ) |
Move the current gvm_host_t from a gvm_hosts_t structure to the end of the hosts list.
| [in,out] | hosts | gvm_hosts_t structure which hosts must be rearange. The hosts->current index points to the last used host and gvm_hosts_next() must be called to get the next host in the list. |
Definition at line 1332 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, and gvm_hosts::hosts.
Referenced by Ensure().

| gvm_hosts_t * gvm_hosts_new | ( | const gchar * | hosts_str | ) |
Creates a new gvm_hosts_t structure and the associated hosts objects from the provided hosts_str.
| [in] | hosts_str | The hosts string. A copy will be created of this within the returned struct. |
Definition at line 1300 of file hosts.c.
References gvm_hosts_new_with_max().
Referenced by Ensure(), Ensure(), Ensure(), gvm_hosts_reverse_lookup_only_excluded(), and gvm_hosts_reverse_lookup_unify_excluded().


| gvm_hosts_t * gvm_hosts_new_with_max | ( | const gchar * | hosts_str, |
| unsigned int | max_hosts ) |
Creates a new gvm_hosts_t structure and the associated hosts objects from the provided hosts_str.
| [in] | hosts_str | The hosts string. A copy will be created of this within the returned struct. |
| [in] | max_hosts | Max number of hosts in hosts_str. 0 means unlimited. |
Definition at line 1103 of file hosts.c.
References gvm_host::addr, gvm_host::addr6, cidr6_block_ips(), cidr_block_ips(), gvm_hosts::count, gvm_get_host_type(), gvm_host_new(), gvm_hosts_add(), gvm_hosts_deduplicate(), gvm_hosts_free(), gvm_hosts_init(), HOST_TYPE_CIDR6_BLOCK, HOST_TYPE_CIDR_BLOCK, HOST_TYPE_IPV4, HOST_TYPE_IPV6, HOST_TYPE_NAME, HOST_TYPE_RANGE6_LONG, HOST_TYPE_RANGE6_SHORT, HOST_TYPE_RANGE_LONG, HOST_TYPE_RANGE_SHORT, long_range6_network_ips(), long_range_network_ips(), gvm_host::name, gvm_hosts::orig_str, short_range6_network_ips(), short_range_network_ips(), and gvm_host::type.
Referenced by Ensure(), Ensure(), gvm_hosts_allowed_only(), gvm_hosts_exclude_with_max(), and gvm_hosts_new().


| gvm_host_t * gvm_hosts_next | ( | gvm_hosts_t * | hosts | ) |
Gets the next gvm_host_t from a gvm_hosts_t structure. The state of iteration is kept internally within the gvm_hosts structure.
| [in] | hosts | gvm_hosts_t structure to get next host from. |
Definition at line 1314 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, and gvm_hosts::hosts.
Referenced by Ensure(), and Ensure().

| unsigned int gvm_hosts_removed | ( | const gvm_hosts_t * | hosts | ) |
Gets the count of single values in hosts string that were removed (duplicates / excluded.).
| [in] | hosts | The hosts collection. |
Definition at line 2120 of file hosts.c.
References gvm_hosts::removed.
| GSList * gvm_hosts_resolve | ( | gvm_hosts_t * | hosts | ) |
Resolves host objects of type name in a hosts collection, replacing hostnames with IPv4 values. Not to be used while iterating over the single hosts as it resets the iterator.
| [in] | hosts | The hosts collection from which to exclude. |
Definition at line 1457 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, gvm_host_free(), gvm_host_new(), gvm_hosts_add(), gvm_hosts_deduplicate(), gvm_hosts_fill_gaps(), gvm_resolve_list(), gvm_vhost_new(), HOST_TYPE_IPV4, HOST_TYPE_IPV6, HOST_TYPE_NAME, gvm_hosts::hosts, gvm_host::name, gvm_hosts::removed, and gvm_host::type.

| void gvm_hosts_reverse | ( | gvm_hosts_t * | hosts | ) |
Reverses the order of the hosts objects in the collection. Not to be used while iterating over the single hosts as it resets the iterator.
| [in] | hosts | The hosts collection to reverse. |
Definition at line 1431 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, and gvm_hosts::hosts.
| int gvm_hosts_reverse_lookup_only | ( | gvm_hosts_t * | hosts | ) |
Removes hosts that don't reverse-lookup from the hosts collection. Not to be used while iterating over the single hosts as it resets the iterator.
| [in] | hosts | The hosts collection to filter. |
Definition at line 2004 of file hosts.c.
References gvm_hosts::count, gvm_hosts_free(), and gvm_hosts_reverse_lookup_only_excluded().

| gvm_hosts_t * gvm_hosts_reverse_lookup_only_excluded | ( | gvm_hosts_t * | hosts | ) |
Removes hosts that don't reverse-lookup from the hosts collection. Not to be used while iterating over the single hosts as it resets the iterator.
| [in] | hosts | The hosts collection to filter. |
Definition at line 1963 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, gvm_duplicate_host(), gvm_host_free(), gvm_host_reverse_lookup(), gvm_hosts_add(), gvm_hosts_fill_gaps(), gvm_hosts_new(), gvm_hosts::hosts, and gvm_hosts::removed.
Referenced by gvm_hosts_reverse_lookup_only().


| int gvm_hosts_reverse_lookup_unify | ( | gvm_hosts_t * | hosts | ) |
Removes hosts duplicates that reverse-lookup to the same value. Not to be used while iterating over the single hosts as it resets the iterator.
| [in] | hosts | The hosts collection to filter. |
Definition at line 2085 of file hosts.c.
References gvm_hosts::count, gvm_hosts_free(), and gvm_hosts_reverse_lookup_unify_excluded().

| gvm_hosts_t * gvm_hosts_reverse_lookup_unify_excluded | ( | gvm_hosts_t * | hosts | ) |
Removes hosts duplicates that reverse-lookup to the same value. Not to be used while iterating over the single hosts as it resets the iterator.
| [in] | hosts | The hosts collection to filter. |
Uses a hash table in order to unify the hosts list in O(N) time.
Definition at line 2029 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, gvm_duplicate_host(), gvm_host_free(), gvm_host_reverse_lookup(), gvm_hosts_add(), gvm_hosts_fill_gaps(), gvm_hosts_new(), gvm_hosts::hosts, and gvm_hosts::removed.
Referenced by gvm_hosts_reverse_lookup_unify().


| void gvm_hosts_shuffle | ( | gvm_hosts_t * | hosts | ) |
Randomizes the order of the hosts objects in the collection. Not to be used while iterating over the single hosts as it resets the iterator.
| [in] | hosts | The hosts collection to shuffle. |
Definition at line 1399 of file hosts.c.
References gvm_hosts::count, gvm_hosts::current, and gvm_hosts::hosts.
| gvm_vhost_t * gvm_vhost_new | ( | char * | value, |
| char * | source ) |
Creates a new gvm_vhost_t object.
| [in] | value | Vhost value. |
| [in] | source | Source of hostname. |
Definition at line 874 of file hosts.c.
References gvm_vhost::source, and gvm_vhost::value.
Referenced by gvm_duplicate_vhost(), gvm_host_add_reverse_lookup(), and gvm_hosts_resolve().

| int gvm_vhosts_exclude | ( | gvm_host_t * | host, |
| const char * | excluded_str ) |
Exclude a list of vhosts from a host's vhosts list.
| [in] | host | The host whose vhosts are to be excluded from. |
| [in] | excluded_str | String of hosts to exclude. |
Definition at line 1525 of file hosts.c.
References gvm_vhost_free(), and gvm_host::vhosts.
