OpenVAS Scanner  22.7.9
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 36 of file pluginscheduler.h.

Typedef Documentation

◆ plugins_scheduler_t

Definition at line 34 of file pluginscheduler.h.

Enumeration Type Documentation

◆ plugin_status

Enumerator
PLUGIN_STATUS_UNRUN 
PLUGIN_STATUS_RUNNING 
PLUGIN_STATUS_DONE 

Definition at line 20 of file pluginscheduler.h.

21 {
25 };

Function Documentation

◆ plugins_scheduler_count_active()

int plugins_scheduler_count_active ( plugins_scheduler_t  )

Definition at line 323 of file pluginscheduler.c.

324 {
325  int ret = 0, i;
326  assert (sched);
327 
328  for (i = ACT_INIT; i <= ACT_END; i++)
329  ret += g_slist_length (sched->list[i]);
330  return ret;
331 }

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

519 {
520  int i;
521 
522  for (i = ACT_INIT; i <= ACT_END; i++)
523  g_slist_free_full (sched->list[i], scheduler_plugin_free);
524  g_free (sched);
525 }

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

303 {
305 
306  /* Fill our lists */
307  ret = g_malloc0 (sizeof (*ret));
308  *error = plugins_scheduler_enable (ret, plugins_list, autoload);
309 
310  if (check_dependency_cycles (ret))
311  {
313  return NULL;
314  }
315 
316 #ifdef __GLIBC__
317  malloc_trim (0);
318 #endif
319  return ret;
320 }

References check_dependency_cycles(), 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 426 of file pluginscheduler.c.

427 {
428  struct scheduler_plugin *ret;
429  static int scheduler_phase = 0;
430 
431  if (h == NULL)
432  return NULL;
433 
434  if (scheduler_phase == 0)
435  {
436  ret = get_next_in_range (h, ACT_INIT, ACT_INIT);
437  if (ret)
438  return ret;
439  scheduler_phase = 1;
441  }
442  if (scheduler_phase <= 1)
443  {
445  if (ret)
446  return ret;
447  scheduler_phase = 2;
449  }
450  if (scheduler_phase <= 2)
451  {
453  if (ret)
454  return ret;
455  scheduler_phase = 3;
457  }
458  if (scheduler_phase <= 3)
459  {
461  if (ret)
462  return ret;
463  scheduler_phase = 4;
465  }
466  if (scheduler_phase <= 4)
467  {
468  ret = get_next_in_range (h, ACT_END, ACT_END);
469  if (ret)
470  return ret;
471  scheduler_phase = 5;
473  }
474  return NULL;
475 }

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

484 {
485  int category;
486 
487  if (sched->stopped)
488  return;
489  for (category = ACT_INIT; category < ACT_END; category++)
490  {
491  GSList *element = sched->list[category];
492 
493  while (element)
494  {
495  struct scheduler_plugin *plugin = element->data;
496 
498  element = element->next;
499  }
500  }
501  sched->stopped = 1;
502 }

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:33
plugins_scheduler_enable
static int plugins_scheduler_enable(plugins_scheduler_t sched, const char *oid_list, int autoload)
Definition: pluginscheduler.c:200
scheduler_phase_cleanup
static void scheduler_phase_cleanup(plugins_scheduler_t sched, int start, int end)
Definition: pluginscheduler.c:401
plugins_scheduler
Definition: pluginscheduler.c:37
scheduler_plugin
Definition: pluginscheduler.h:28
PLUGIN_STATUS_RUNNING
@ PLUGIN_STATUS_RUNNING
Definition: pluginscheduler.h:23
scheduler_plugin_free
static void scheduler_plugin_free(void *data)
Definition: pluginscheduler.c:505
ACT_ATTACK
@ ACT_ATTACK
Definition: nvt_categories.h:28
plugins_scheduler_free
void plugins_scheduler_free(plugins_scheduler_t sched)
Definition: pluginscheduler.c:518
get_next_in_range
static struct scheduler_plugin * get_next_in_range(plugins_scheduler_t h, int start, int end)
Definition: pluginscheduler.c:376
PLUGIN_STATUS_DONE
@ PLUGIN_STATUS_DONE
Definition: pluginscheduler.h:24
ACT_END
@ ACT_END
Definition: nvt_categories.h:34
ACT_SETTINGS
@ ACT_SETTINGS
Definition: nvt_categories.h:26
scheduler_plugin::running_state
enum plugin_status running_state
Definition: pluginscheduler.h:31
check_dependency_cycles
static int check_dependency_cycles(plugins_scheduler_t sched)
Definition: pluginscheduler.c:263
PLUGIN_STATUS_UNRUN
@ PLUGIN_STATUS_UNRUN
Definition: pluginscheduler.h:22
ACT_SCANNER
@ ACT_SCANNER
Definition: nvt_categories.h:25
ACT_GATHER_INFO
@ ACT_GATHER_INFO
Definition: nvt_categories.h:27
ACT_INIT
@ ACT_INIT
Definition: nvt_categories.h:24