OpenVAS Scanner  7.0.1~git
pluginscheduler.h File Reference

header for pluginscheduler.c More...

#include <glib.h>
Include dependency graph for pluginscheduler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  scheduler_plugin
 

Macros

#define PLUG_RUNNING   ((struct scheduler_plugin *) 0x02)
 

Typedefs

typedef struct plugins_schedulerplugins_scheduler_t
 

Enumerations

enum  plugin_status { PLUGIN_STATUS_UNRUN = 0, PLUGIN_STATUS_RUNNING, PLUGIN_STATUS_DONE }
 

Functions

plugins_scheduler_t plugins_scheduler_init (const char *, int, int, int *)
 
struct scheduler_pluginplugins_scheduler_next (plugins_scheduler_t)
 
int plugins_scheduler_count_active (plugins_scheduler_t)
 
void plugins_scheduler_stop (plugins_scheduler_t)
 
void plugins_scheduler_free (plugins_scheduler_t)
 

Detailed Description

header for pluginscheduler.c

Definition in file pluginscheduler.h.

Macro Definition Documentation

◆ PLUG_RUNNING

#define PLUG_RUNNING   ((struct scheduler_plugin *) 0x02)

Definition at line 49 of file pluginscheduler.h.

Referenced by attack_host(), get_next_in_range(), and plugins_next_unrun().

Typedef Documentation

◆ plugins_scheduler_t

Definition at line 47 of file pluginscheduler.h.

Enumeration Type Documentation

◆ plugin_status

Enumerator
PLUGIN_STATUS_UNRUN 
PLUGIN_STATUS_RUNNING 
PLUGIN_STATUS_DONE 

Definition at line 33 of file pluginscheduler.h.

Function Documentation

◆ plugins_scheduler_count_active()

int plugins_scheduler_count_active ( plugins_scheduler_t  )

Definition at line 341 of file pluginscheduler.c.

References ACT_END, ACT_INIT, and plugins_scheduler::list.

Referenced by attack_host().

342 {
343  int ret = 0, i;
344  assert (sched);
345 
346  for (i = ACT_INIT; i <= ACT_END; i++)
347  ret += g_slist_length (sched->list[i]);
348  return ret;
349 }
Here is the caller graph for this function:

◆ plugins_scheduler_free()

void plugins_scheduler_free ( plugins_scheduler_t  )

Definition at line 534 of file pluginscheduler.c.

References ACT_END, ACT_INIT, plugins_scheduler::list, and scheduler_plugin_free().

Referenced by attack_host(), attack_network(), and plugins_scheduler_init().

535 {
536  int i;
537 
538  for (i = ACT_INIT; i <= ACT_END; i++)
539  g_slist_free_full (sched->list[i], scheduler_plugin_free);
540  g_free (sched);
541 }
void scheduler_plugin_free(void *data)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ plugins_scheduler_init()

plugins_scheduler_t plugins_scheduler_init ( const char *  ,
int  ,
int  ,
int *   
)

Definition at line 313 of file pluginscheduler.c.

References ACT_END, ACT_GATHER_INFO, check_dependency_cycles(), plugins_scheduler::list, plugins_scheduler_enable(), and plugins_scheduler_free().

Referenced by attack_network().

315 {
317  int i;
318 
319  /* Fill our lists */
320  ret = g_malloc0 (sizeof (*ret));
321  *error = plugins_scheduler_enable (ret, plugins_list, autoload);
322 
323  if (only_network)
324  {
325  for (i = ACT_GATHER_INFO; i <= ACT_END; i++)
326  {
327  ret->list[i] = NULL;
328  }
329  }
330 
331  if (check_dependency_cycles (ret))
332  {
334  return NULL;
335  }
336  malloc_trim (0);
337  return ret;
338 }
void plugins_scheduler_free(plugins_scheduler_t sched)
static int plugins_scheduler_enable(plugins_scheduler_t sched, const char *oid_list, int autoload)
GSList * list[ACT_END+1]
int check_dependency_cycles(plugins_scheduler_t sched)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ plugins_scheduler_next()

struct scheduler_plugin* plugins_scheduler_next ( plugins_scheduler_t  )

Definition at line 442 of file pluginscheduler.c.

References ACT_ATTACK, ACT_END, ACT_FLOOD, ACT_GATHER_INFO, ACT_INIT, ACT_SCANNER, ACT_SETTINGS, get_next_in_range(), and scheduler_phase_cleanup().

Referenced by attack_host().

443 {
444  struct scheduler_plugin *ret;
445  static int scheduler_phase = 0;
446 
447  if (h == NULL)
448  return NULL;
449 
450  if (scheduler_phase == 0)
451  {
452  ret = get_next_in_range (h, ACT_INIT, ACT_INIT);
453  if (ret)
454  return ret;
455  scheduler_phase = 1;
457  }
458  if (scheduler_phase <= 1)
459  {
461  if (ret)
462  return ret;
463  scheduler_phase = 2;
465  }
466  if (scheduler_phase <= 2)
467  {
469  if (ret)
470  return ret;
471  scheduler_phase = 3;
473  }
474  if (scheduler_phase <= 3)
475  {
477  if (ret)
478  return ret;
479  scheduler_phase = 4;
481  }
482  if (scheduler_phase <= 4)
483  {
484  ret = get_next_in_range (h, ACT_END, ACT_END);
485  if (ret)
486  return ret;
487  scheduler_phase = 5;
489  }
490  return NULL;
491 }
static void scheduler_phase_cleanup(plugins_scheduler_t sched, int start, int end)
static struct scheduler_plugin * get_next_in_range(plugins_scheduler_t h, int start, int end)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ plugins_scheduler_stop()

void plugins_scheduler_stop ( plugins_scheduler_t  )

Definition at line 499 of file pluginscheduler.c.

References ACT_END, ACT_INIT, plugins_scheduler::list, PLUGIN_STATUS_DONE, scheduler_plugin::running_state, and plugins_scheduler::stopped.

Referenced by attack_host().

500 {
501  int category;
502 
503  if (sched->stopped)
504  return;
505  for (category = ACT_INIT; category < ACT_END; category++)
506  {
507  GSList *element = sched->list[category];
508 
509  while (element)
510  {
511  struct scheduler_plugin *plugin = element->data;
512 
514  element = element->next;
515  }
516  }
517  sched->stopped = 1;
518 }
enum plugin_status running_state
Here is the caller graph for this function: