Module for Greenbone Vulnerability Manager: Scanner Connection API.
More...
#include <gnutls/gnutls.h>
Go to the source code of this file.
Module for Greenbone Vulnerability Manager: Scanner Connection API.
◆ openvas_scanner_close()
int openvas_scanner_close |
( |
| ) |
|
Finish the connection to the Scanner and free internal buffers.
- Returns
- -1 if error, 0 if success.
◆ openvas_scanner_connect()
int openvas_scanner_connect |
( |
| ) |
|
Create a new connection to the scanner and set it as current scanner.
- Returns
- 0 on success, -1 on error.
◆ openvas_scanner_connected()
int openvas_scanner_connected |
( |
| ) |
|
◆ openvas_scanner_fd_isset()
int openvas_scanner_fd_isset |
( |
fd_set * |
fd | ) |
|
Check if connected to Scanner is set in an fd_set.
- Parameters
-
[in] | fd | File descriptor set. |
- Returns
- 1 if scanner socket in fd_set, 0 if not connected or or not set.
◆ openvas_scanner_fd_set()
void openvas_scanner_fd_set |
( |
fd_set * |
fd | ) |
|
Add connected to Scanner's socket to an fd_set.
- Parameters
-
[in] | fd | File Descriptor set. |
◆ openvas_scanner_fork()
void openvas_scanner_fork |
( |
| ) |
|
Reset Scanner variables after a fork.
This other side of the fork will do the actual cleanup.
◆ openvas_scanner_full()
int openvas_scanner_full |
( |
| ) |
|
Check whether the buffer for data from Scanner is full.
- Returns
- 1 if full, 0 otherwise.
◆ openvas_scanner_get_nfds()
int openvas_scanner_get_nfds |
( |
int |
socket | ) |
|
Get the nfds value to use for a select() call.
- Parameters
-
[in] | socket | Socket to compare to. |
- Returns
- socket + 1 if socket value is higher then scanner's or not connected to a scanner, scanner socket + 1 otherwise.
◆ openvas_scanner_init()
int openvas_scanner_init |
( |
int |
cache_mode | ) |
|
Initializes the already setup connection with the Scanner.
- Parameters
-
[in] | cache_mode | NVT Cache mode if true, which means sending NVT_INFO command to scanner in initial negotiation. |
- Returns
- 0 success, -1 error.
◆ openvas_scanner_is_loading()
int openvas_scanner_is_loading |
( |
| ) |
|
Checks whether the connected to OpenVAS Scanner is still loading plugins. To be called right after openvas_scanner_init().
- Returns
- 1 if loading, 0 if not loading or error.
◆ openvas_scanner_peek()
int openvas_scanner_peek |
( |
| ) |
|
Check if there is any data to receive from connected Scanner socket.
- Returns
- 1 if there is data in socket buffer, 0 if no data or not connected to a scanner.
◆ openvas_scanner_read()
int openvas_scanner_read |
( |
| ) |
|
Read as much from the server as the from_scanner buffer will.
hold.
- Returns
- 0 on reading everything available, -1 on error, -2 if from_scanner buffer is full or -3 on reaching end of file.
- Todo:
- Rehandshake.
◆ openvas_scanner_realloc()
int openvas_scanner_realloc |
( |
| ) |
|
Reallocates the from_scanner buffer to a higher size.
- Returns
- 1 if max size reached, 0 otherwise.
◆ openvas_scanner_session_peek()
int openvas_scanner_session_peek |
( |
| ) |
|
Check if there is any data to receive from connected Scanner session.
- Returns
- 1 if there is data in session buffer, 0 if no data or not connected to a scanner.
◆ openvas_scanner_set_address()
int openvas_scanner_set_address |
( |
const char * |
addr, |
|
|
int |
port |
|
) |
| |
Set the scanner's address and port. Will try to resolve addr if it is a hostname.
- Parameters
-
[in] | addr | Scanner address string. |
[in] | port | Scanner port. |
- Returns
- 0 success, -1 error.
◆ openvas_scanner_set_certs()
void openvas_scanner_set_certs |
( |
const char * |
ca_pub, |
|
|
const char * |
key_pub, |
|
|
const char * |
key_priv |
|
) |
| |
Set the scanner's CA Certificate, and public/private key pair.
- Parameters
-
[in] | ca_pub | CA Certificate. |
[in] | key_pub | Scanner Certificate. |
[in] | key_priv | Scanner private key. |
◆ openvas_scanner_set_unix()
int openvas_scanner_set_unix |
( |
const char * |
path | ) |
|
Set the scanner's unix socket path.
- Parameters
-
[in] | path | Path to scanner unix socket. |
- Returns
- 0 success, -1 error.
◆ openvas_scanner_write()
int openvas_scanner_write |
( |
int |
nvt_cache_mode | ) |
|
Write as much as possible from the to_scanner buffer to the scanner.
- Parameters
-
[in] | nvt_cache_mode | NVT cache mode. |
- Returns
- 0 wrote everything, -1 error, -2 wrote as much as scanner accepted, -3 did an initialisation step.