21#include <gvm/base/networking.h>
31#define G_LOG_DOMAIN "sd main"
75 timestr = g_strdup (ts_ptr);
76 len = strlen (timestr);
77 if (timestr[
len - 1] ==
'\n')
78 timestr[
len - 1] =
'\0';
80 snprintf (log_msg,
sizeof (log_msg),
"%s|||%s||||||||| |||%s", type,
ip,
91 waitpid (h->
pid, NULL, WNOHANG);
121 for (num = 0; h != NULL; num++, h = h->
next)
163 h = g_malloc0 (
sizeof (
struct host));
182 g_debug (
"host_set_pid() failed!\n");
197 g_message (
"Stopping host %s scan (pid: %d)", h->
name, h->
pid);
198 kill (h->
pid, SIGUSR1);
225 ret = waitpid (-1, NULL, WNOHANG);
227 g_debug (
"waitpid() failed. %s)", strerror (errno));
235 if (h->
pid != 0 && kill (h->
pid, 0) < 0)
283 vhost = gvm_host_reverse_lookup (host_to_check);
287 list = tmp = gvm_resolve_list (vhost);
292 char buffer[INET6_ADDRSTRLEN];
293 addr6_to_str (tmp->data, buffer);
297 if (!strcasecmp (h->
name, buffer))
299 g_slist_free_full (
list, g_free);
307 g_slist_free_full (
list, g_free);
static void hosts_read_data(void)
static struct host * hosts
static void host_rm(struct host *h)
static int hosts_stop_host(struct host *h)
static struct host * hosts_get(char *name)
Retrieves a host specified by its name from the global host list.
void host_set_time(kb_t kb, char *ip, char *type)
Add star_scan and end_scan results to the main kb.
static int hosts_num(void)
Returns the number of entries in the global hosts list.
int host_is_currently_scanned(gvm_host_t *host_to_check)
Returns 1 if the host is being scanned. 0 otherwise.
void hosts_stop_all(void)
int hosts_set_pid(char *name, pid_t pid)
int hosts_read(void)
Returns -1 if client asked to stop all tests or connection was lost or error. 0 otherwise.
int hosts_init(int max_hosts)
int hosts_new(char *name, kb_t kb, kb_t main_kb)
Header file for module network.
int kb_item_push_str_with_main_kb_check(kb_t kb, const char *name, const char *value)
Check if the current kb corresponds to the original scanid, if it matches it kb_item_push_str....
Header file for module plugutils.
Host information, implemented as doubly linked list.