OpenVAS Scanner  5.1.3
hosts.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int hosts_init (int, int)
 
int hosts_new (struct arglist *, char *, int)
 
int hosts_set_pid (char *, pid_t)
 
int hosts_read (struct arglist *)
 Returns -1 if client asked to stop all tests or connection was lost or error. 0 otherwise. More...
 
void hosts_stop_all (void)
 

Function Documentation

◆ hosts_init()

int hosts_init ( int  ,
int   
)

Definition at line 168 of file hosts.c.

169 {
170  g_soc = soc;
171  g_max_hosts = max_hosts;
172  return 0;
173 }
int soc
Definition: hosts.c:47

◆ hosts_new()

int hosts_new ( struct arglist *  ,
char *  ,
int   
)

Definition at line 178 of file hosts.c.

179 {
180  struct host *h;
181 
182  while (hosts_num () >= g_max_hosts)
183  {
184  if (hosts_read (globals) < 0)
185  return -1;
186  }
187  if (global_scan_stop)
188  return 0;
189 
190  h = g_malloc0 (sizeof (struct host));
191  h->name = g_strdup (name);
192  h->pid = 0;
193  h->soc = soc;
194  if (hosts != NULL)
195  hosts->prev = h;
196  h->next = hosts;
197  h->prev = NULL;
198  hosts = h;
199  return 0;
200 }
int soc
Definition: hosts.c:47
Host information, implemented as doubly linked list.
Definition: hosts.c:44
struct host * prev
Definition: hosts.c:50
int global_scan_stop
Definition: attack.c:181
char * name
Definition: hosts.c:46
int hosts_read(struct arglist *globals)
Returns -1 if client asked to stop all tests or connection was lost or error. 0 otherwise.
Definition: hosts.c:357
pid_t pid
Definition: hosts.c:48
struct host * next
Definition: hosts.c:49

◆ hosts_read()

int hosts_read ( struct arglist *  )

Returns -1 if client asked to stop all tests or connection was lost or error. 0 otherwise.

Definition at line 357 of file hosts.c.

358 {
359  if (hosts_read_client (globals) < 0)
360  {
361  hosts_stop_all ();
362  log_write ("Client abruptly closed the communication");
363  return -1;
364  }
365 
366  if (hosts == NULL)
367  return -1;
368 
369  hosts_read_data ();
370 
371  return 0;
372 }
void hosts_stop_all(void)
Definition: hosts.c:230
void log_write(const char *str,...)
Write into the logfile / syslog.
Definition: log.c:140

◆ hosts_set_pid()

int hosts_set_pid ( char *  ,
pid_t   
)

Definition at line 204 of file hosts.c.

205 {
206  struct host *h = hosts_get (name);
207  if (h == NULL)
208  {
209  log_write ("host_set_pid() failed!\n");
210  return -1;
211  }
212 
213  h->pid = pid;
214  return 0;
215 }
void log_write(const char *str,...)
Write into the logfile / syslog.
Definition: log.c:140
Host information, implemented as doubly linked list.
Definition: hosts.c:44
char * name
Definition: hosts.c:46
pid_t pid
Definition: hosts.c:48

◆ hosts_stop_all()

void hosts_stop_all ( void  )

Definition at line 230 of file hosts.c.

231 {
232  struct host *host = hosts;
233 
234  global_scan_stop = 1;
235  while (host)
236  {
237  hosts_stop_host (host);
238  host = host->next;
239  }
240 }
Host information, implemented as doubly linked list.
Definition: hosts.c:44
int global_scan_stop
Definition: attack.c:181
struct host * next
Definition: hosts.c:49