OpenVAS Scanner  5.1.3
pluginscheduler.h File Reference
#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)
 
#define PLUGIN_STATUS_UNRUN   1
 
#define PLUGIN_STATUS_RUNNING   2
 
#define PLUGIN_STATUS_DONE   3
 
#define PLUGIN_STATUS_DONE_AND_CLEANED   4
 

Typedefs

typedef struct plugins_schedulerplugins_scheduler_t
 

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_free (plugins_scheduler_t)
 

Macro Definition Documentation

◆ PLUG_RUNNING

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

Definition at line 52 of file pluginscheduler.h.

Referenced by plugin_next_unrun_dependency().

◆ PLUGIN_STATUS_DONE

#define PLUGIN_STATUS_DONE   3

Definition at line 55 of file pluginscheduler.h.

Referenced by plugin_next_unrun_dependency().

◆ PLUGIN_STATUS_DONE_AND_CLEANED

#define PLUGIN_STATUS_DONE_AND_CLEANED   4

Definition at line 56 of file pluginscheduler.h.

Referenced by plugin_next_unrun_dependency().

◆ PLUGIN_STATUS_RUNNING

#define PLUGIN_STATUS_RUNNING   2

Definition at line 54 of file pluginscheduler.h.

Referenced by plugin_next_unrun_dependency().

◆ PLUGIN_STATUS_UNRUN

#define PLUGIN_STATUS_UNRUN   1

Definition at line 53 of file pluginscheduler.h.

Referenced by plugin_next_unrun_dependency().

Typedef Documentation

◆ plugins_scheduler_t

Definition at line 49 of file pluginscheduler.h.

Function Documentation

◆ plugins_scheduler_count_active()

int plugins_scheduler_count_active ( plugins_scheduler_t  )

Definition at line 585 of file pluginscheduler.c.

References scheduler_plugin::enabled, plugins_scheduler::list, list::next, and list::plugin.

586 {
587  int ret = 0, i;
588  assert (sched);
589 
590  for (i = ACT_FIRST; i <= ACT_LAST; i++)
591  {
592  struct list *element = sched->list[i];
593 
594  while (element)
595  {
596  if (element->plugin->enabled)
597  ret++;
598  element = element->next;
599  }
600  }
601  return ret;
602 }
struct scheduler_plugin * plugin
struct list * next

◆ plugins_scheduler_free()

void plugins_scheduler_free ( plugins_scheduler_t  )

Definition at line 730 of file pluginscheduler.c.

731 {
732  int i;
733  hash_destroy (sched->hash);
734  for (i = ACT_FIRST; i <= ACT_LAST; i++)
735  list_destroy (sched->list[i]);
736  g_free (sched);
737 }
void list_destroy(struct list *list)

◆ plugins_scheduler_init()

plugins_scheduler_t plugins_scheduler_init ( const char *  ,
int  ,
int   
)

Definition at line 535 of file pluginscheduler.c.

References plugins_scheduler::hash.

536 {
538  int i;
539 
540  /* Fill our lists */
541  ret = g_malloc0 (sizeof (*ret));
542  ret->hash = hash_init ();
543  plugins_scheduler_fill (ret);
544 
545  plugins_scheduler_enable (ret, plugins_list, autoload);
546 
547  /* Now, remove the plugins that won't be launched */
548  for (i = ACT_FIRST; i <= ACT_LAST; i++)
549  {
550  struct list *plist = ret->list[i];
551 
552  while (plist != NULL)
553  {
554  if (!plist->plugin->enabled)
555  {
556  struct list *old = plist->next;
557 
558  if (plist->prev != NULL)
559  plist->prev->next = plist->next;
560  else
561  ret->list[i] = plist->next;
562 
563  if (plist->next != NULL)
564  plist->next->prev = plist->prev;
565 
566  g_free (plist);
567  plist = old;
568  continue;
569  }
570  plist = plist->next;
571  }
572  }
573 
574  if (only_network)
575  {
576  for (i = ACT_GATHER_INFO; i <= ACT_LAST; i++)
577  {
578  ret->list[i] = NULL;
579  }
580  }
581  return ret;
582 }
struct list * list[ACT_LAST+1]
struct hash * hash
struct plist * next
struct plist * prev

◆ plugins_scheduler_next()

struct scheduler_plugin* plugins_scheduler_next ( plugins_scheduler_t  )

Definition at line 694 of file pluginscheduler.c.

695 {
696  struct scheduler_plugin *ret;
697 
698  if (h == NULL)
699  return NULL;
700  ret = get_next_in_range (h, ACT_INIT, ACT_INIT);
701  if (ret)
702  return ret;
703  ret = get_next_in_range (h, ACT_SCANNER, ACT_SCANNER);
704  if (ret)
705  return ret;
706  ret = get_next_in_range (h, ACT_SETTINGS, ACT_GATHER_INFO);
707  if (ret)
708  return ret;
709  ret = get_next_in_range (h, ACT_ATTACK, ACT_FLOOD);
710  if (ret)
711  return ret;
712  ret = get_next_in_range (h, ACT_END, ACT_END);
713  if (ret)
714  return ret;
715  return NULL;
716 }