OpenVAS Manager
7.0.3~git
|
The OpenVAS Manager OMP daemon. More...
#include "ompd.h"
#include "scanner.h"
#include "logf.h"
#include "omp.h"
#include "otp.h"
#include "ovas-mngr-comm.h"
#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <openvas/misc/openvas_server.h>
Go to the source code of this file.
Macros | |
#define | G_LOG_DOMAIN "md main" |
GLib log domain. More... | |
Functions | |
int | init_ompd (GSList *log_config, int nvt_cache_mode, const gchar *database, int max_ips_per_target, int max_email_attachment_size, int max_email_include_size, int max_email_message_size, void(*progress)(), int(*fork_connection)(openvas_connection_t *, gchar *), int skip_db_check) |
Initialise the OMP library for the OMP daemon. More... | |
void | init_ompd_process (const gchar *database, gchar **disable) |
Initialise a process forked within the OMP daemon. More... | |
gboolean | ompd_send_to_client (const char *msg, void *write_to_client_data) |
Send a response message to the client. More... | |
int | serve_omp (openvas_connection_t *client_connection, const gchar *database, gchar **disable, void(*progress)()) |
Serve the OpenVAS Management Protocol (OMP). More... | |
Variables | |
char | from_client [FROM_BUFFER_SIZE] |
Buffer of input from the client. More... | |
buffer_size_t | from_buffer_size = FROM_BUFFER_SIZE |
Size of from_client data buffer, in bytes. More... | |
buffer_size_t | from_client_start = 0 |
The start of the data in the from_client buffer. More... | |
buffer_size_t | from_client_end = 0 |
The end of the data in the from_client buffer. More... | |
The OpenVAS Manager OMP daemon.
This file defines the OpenVAS Manager daemon. The Manager serves the OpenVAS Management Protocol (OMP) to clients such as OpenVAS-Client. The Manager and OMP give clients full access to an OpenVAS Scanner.
The library provides two functions: init_ompd and serve_omp. init_ompd initialises the daemon. serve_omp serves OMP to a single client socket until end of file is reached on the socket.
Definition in file ompd.c.
#define G_LOG_DOMAIN "md main" |
int init_ompd | ( | GSList * | log_config, |
int | nvt_cache_mode, | ||
const gchar * | database, | ||
int | max_ips_per_target, | ||
int | max_email_attachment_size, | ||
int | max_email_include_size, | ||
int | max_email_message_size, | ||
void(*)() | progress, | ||
int(*)(openvas_connection_t *, gchar *) | fork_connection, | ||
int | skip_db_check | ||
) |
Initialise the OMP library for the OMP daemon.
[in] | log_config | Log configuration |
[in] | nvt_cache_mode | 0 operate normally, -1 just update NVT cache, -2 just rebuild NVT cache. |
[in] | database | Location of manage database. |
[in] | max_ips_per_target | Max number of IPs per target. |
[in] | max_email_attachment_size | Max size of email attachments. |
[in] | max_email_include_size | Max size of email inclusions. |
[in] | max_email_message_size | Max size of email user message text. |
[in] | progress | Function to update progress, or NULL. |
[in] | fork_connection | Function to fork a connection to the OMP daemon layer, or NULL. |
[in] | skip_db_check | Skip DB check. |
Definition at line 117 of file ompd.c.
void init_ompd_process | ( | const gchar * | database, |
gchar ** | disable | ||
) |
Initialise a process forked within the OMP daemon.
[in] | database | Location of manage database. |
[in] | disable | Commands to disable. |
Definition at line 137 of file ompd.c.
References from_client_end, from_client_start, init_omp_process(), and openvas_scanner_fork().
gboolean ompd_send_to_client | ( | const char * | msg, |
void * | write_to_client_data | ||
) |
Send a response message to the client.
Queue a message in to_client.
[in] | msg | The message, a string. |
[in] | write_to_client_data | Argument to write_to_client . |
Definition at line 390 of file ompd.c.
References TO_CLIENT_BUFFER_SIZE, and to_client_end.
int serve_omp | ( | openvas_connection_t * | client_connection, |
const gchar * | database, | ||
gchar ** | disable, | ||
void(*)() | progress | ||
) |
Serve the OpenVAS Management Protocol (OMP).
Loop reading input from the sockets, processing the input, and writing any results to the appropriate socket. Exit the loop on reaching end of file on the client socket.
Read input from the client and scanner. Process the input with process_omp_client_input and process_otp_scanner_input. Write the results to the client.
If compiled with logging (LOG) then log all input and output with logf.
If client_socket is 0 or less, then update the NVT cache and exit.
[in] | client_connection | Connection. |
[in] | database | Location of manage database. |
[in] | disable | Commands to disable. |
[in] | progress | Function to mark progress, or NULL. |
Definition at line 493 of file ompd.c.
buffer_size_t from_buffer_size = FROM_BUFFER_SIZE |
Size of from_client data buffer, in bytes.
char from_client[FROM_BUFFER_SIZE] |
Buffer of input from the client.
buffer_size_t from_client_end = 0 |
The end of the data in the from_client buffer.
Definition at line 89 of file ompd.c.
Referenced by init_ompd_process().
buffer_size_t from_client_start = 0 |
The start of the data in the from_client buffer.
Definition at line 84 of file ompd.c.
Referenced by init_ompd_process().