OpenVAS Scanner 23.32.3
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.

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

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};
@ PLUGIN_STATUS_RUNNING
@ PLUGIN_STATUS_DONE
@ PLUGIN_STATUS_UNRUN

Function Documentation

◆ plugins_scheduler_count_active()

int plugins_scheduler_count_active ( plugins_scheduler_t sched)

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}
@ ACT_END
@ ACT_INIT
GSList * list[ACT_END+1]

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 sched)

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}
static void scheduler_plugin_free(void *data)

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 * plugins_list,
int autoload,
int * error )

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}
static int plugins_scheduler_enable(plugins_scheduler_t sched, const char *oid_list, int autoload)
static int check_dependency_cycles(plugins_scheduler_t sched)
void plugins_scheduler_free(plugins_scheduler_t sched)
struct plugins_scheduler * plugins_scheduler_t

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 h)

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 {
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 {
469 if (ret)
470 return ret;
471 scheduler_phase = 5;
473 }
474 return NULL;
475}
@ ACT_SCANNER
@ ACT_FLOOD
@ ACT_GATHER_INFO
@ ACT_ATTACK
@ ACT_SETTINGS
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)

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 sched)

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}
enum plugin_status running_state

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: