OpenVAS Scanner  7.0.0~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)
 
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.

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.

34 {
38 };

Function Documentation

◆ plugins_scheduler_count_active()

int plugins_scheduler_count_active ( plugins_scheduler_t  )

Definition at line 343 of file pluginscheduler.c.

344 {
345  int ret = 0, i;
346  assert (sched);
347 
348  for (i = ACT_INIT; i <= ACT_END; i++)
349  ret += g_slist_length (sched->list[i]);
350  return ret;
351 }

References ACT_END, ACT_INIT, and plugins_scheduler::list.

Referenced by attack_host().

Here is the caller graph for this function:

◆ plugins_scheduler_free()

void plugins_scheduler_free ( plugins_scheduler_t  )

Definition at line 536 of file pluginscheduler.c.

537 {
538  int i;
539 
540  for (i = ACT_INIT; i <= ACT_END; i++)
541  g_slist_free_full (sched->list[i], scheduler_plugin_free);
542  g_free (sched);
543 }

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

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

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   
)

Definition at line 310 of file pluginscheduler.c.

312 {
314  int i, err = 0;
315 
316  /* Fill our lists */
317  ret = g_malloc0 (sizeof (*ret));
318  err = plugins_scheduler_enable (ret, plugins_list, autoload);
319  if (err)
320  {
322  return NULL;
323  }
324 
325  if (only_network)
326  {
327  for (i = ACT_GATHER_INFO; i <= ACT_END; i++)
328  {
329  ret->list[i] = NULL;
330  }
331  }
332 
333  if (check_dependency_cycles (ret))
334  {
336  return NULL;
337  }
338  malloc_trim (0);
339  return ret;
340 }

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

Referenced by attack_network().

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 444 of file pluginscheduler.c.

445 {
446  struct scheduler_plugin *ret;
447  static int scheduler_phase = 0;
448 
449  if (h == NULL)
450  return NULL;
451 
452  if (scheduler_phase == 0)
453  {
454  ret = get_next_in_range (h, ACT_INIT, ACT_INIT);
455  if (ret)
456  return ret;
457  scheduler_phase = 1;
459  }
460  if (scheduler_phase <= 1)
461  {
463  if (ret)
464  return ret;
465  scheduler_phase = 2;
467  }
468  if (scheduler_phase <= 2)
469  {
471  if (ret)
472  return ret;
473  scheduler_phase = 3;
475  }
476  if (scheduler_phase <= 3)
477  {
479  if (ret)
480  return ret;
481  scheduler_phase = 4;
483  }
484  if (scheduler_phase <= 4)
485  {
486  ret = get_next_in_range (h, ACT_END, ACT_END);
487  if (ret)
488  return ret;
489  scheduler_phase = 5;
491  }
492  return NULL;
493 }

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().

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 501 of file pluginscheduler.c.

502 {
503  int category;
504 
505  if (sched->stopped)
506  return;
507  for (category = ACT_INIT; category < ACT_END; category++)
508  {
509  GSList *element = sched->list[category];
510 
511  while (element)
512  {
513  struct scheduler_plugin *plugin = element->data;
514 
516  element = element->next;
517  }
518  }
519  sched->stopped = 1;
520 }

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

Referenced by attack_host().

Here is the caller graph for this function:
ACT_FLOOD
@ ACT_FLOOD
Definition: nvt_categories.h:47
plugins_scheduler_enable
static int plugins_scheduler_enable(plugins_scheduler_t sched, const char *oid_list, int autoload)
Definition: pluginscheduler.c:203
scheduler_phase_cleanup
static void scheduler_phase_cleanup(plugins_scheduler_t sched, int start, int end)
Definition: pluginscheduler.c:421
plugins_scheduler
Definition: pluginscheduler.c:49
scheduler_plugin
Definition: pluginscheduler.h:40
PLUGIN_STATUS_RUNNING
@ PLUGIN_STATUS_RUNNING
Definition: pluginscheduler.h:36
ACT_ATTACK
@ ACT_ATTACK
Definition: nvt_categories.h:42
plugins_scheduler_free
void plugins_scheduler_free(plugins_scheduler_t sched)
Definition: pluginscheduler.c:536
get_next_in_range
static struct scheduler_plugin * get_next_in_range(plugins_scheduler_t h, int start, int end)
Definition: pluginscheduler.c:396
PLUGIN_STATUS_DONE
@ PLUGIN_STATUS_DONE
Definition: pluginscheduler.h:37
ACT_END
@ ACT_END
Definition: nvt_categories.h:48
check_dependency_cycles
int check_dependency_cycles(plugins_scheduler_t sched)
Definition: pluginscheduler.c:271
ACT_SETTINGS
@ ACT_SETTINGS
Definition: nvt_categories.h:40
scheduler_plugin::running_state
enum plugin_status running_state
Definition: pluginscheduler.h:44
scheduler_plugin_free
void scheduler_plugin_free(void *data)
Definition: pluginscheduler.c:523
plugins_scheduler::list
GSList * list[ACT_END+1]
Definition: pluginscheduler.c:51
PLUGIN_STATUS_UNRUN
@ PLUGIN_STATUS_UNRUN
Definition: pluginscheduler.h:35
ACT_SCANNER
@ ACT_SCANNER
Definition: nvt_categories.h:39
ACT_GATHER_INFO
@ ACT_GATHER_INFO
Definition: nvt_categories.h:41
ACT_INIT
@ ACT_INIT
Definition: nvt_categories.h:38