OpenVAS Libraries
7.0.6
Main Page
Related Pages
Data Structures
Files
File List
Globals
misc
network.h
Go to the documentation of this file.
1
/* OpenVAS
2
* $Id$
3
* Description: Header file for module network.
4
*
5
* Authors:
6
* Renaud Deraison <deraison@nessus.org> (Original pre-fork development)
7
*
8
* Copyright:
9
* Based on work Copyright (C) 1998 - 2007 Tenable Network Security, Inc.
10
*
11
* This library is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU Library General Public
13
* License as published by the Free Software Foundation; either
14
* version 2 of the License, or (at your option) any later version.
15
*
16
* This library is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
* Library General Public License for more details.
20
*
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24
*/
25
26
#ifndef OPENVAS_NETWORK_H
27
#define OPENVAS_NETWORK_H
28
29
#include <sys/select.h>
/* at least for fd_set */
30
#include <netinet/in.h>
/* struct in_addr, struct in6_addr */
31
32
#include <gnutls/gnutls.h>
33
#include <gnutls/x509.h>
34
35
#include "
arglists.h
"
36
#include "../base/openvas_networking.h"
37
38
/*
39
* Type of "transport layer", for encapsulated connections
40
* Only SSL is supported at this time.
41
* (Bad) examples of other layers could be SOCKS, httptunnel, icmptunnel,
42
* RMI over HTTP, DCOM over HTTP, TCP over TCP, etc.
43
*/
44
typedef
enum
openvas_encaps
{
45
OPENVAS_ENCAPS_AUTO
= 0,
/* Request auto detection. */
46
OPENVAS_ENCAPS_IP
,
47
OPENVAS_ENCAPS_SSLv23
,
/* Ask for compatibility options */
48
OPENVAS_ENCAPS_SSLv2
,
49
OPENVAS_ENCAPS_SSLv3
,
50
OPENVAS_ENCAPS_TLSv1
,
51
OPENVAS_ENCAPS_TLSv11
,
52
OPENVAS_ENCAPS_TLSv12
,
53
OPENVAS_ENCAPS_TLScustom
,
/* SSL/TLS using custom priorities. */
54
OPENVAS_ENCAPS_MAX
,
55
}
openvas_encaps_t
;
56
57
#define IS_ENCAPS_SSL(x) ((x) >= OPENVAS_ENCAPS_SSLv23 && (x) <= OPENVAS_ENCAPS_TLScustom)
58
59
/* Plugin specific network functions */
60
int
open_sock_tcp
(
struct
arglist
*,
unsigned
int
,
int
);
61
int
open_sock_option
(
struct
arglist
*,
unsigned
int
,
int
,
int
,
int
);
62
int
recv_line
(
int
,
char
*,
size_t
);
63
int
nrecv
(
int
,
void
*,
int
,
int
);
64
int
socket_close
(
int
);
65
int
get_sock_infos
(
int
sock,
int
*r_transport,
void
**r_tls_session);
66
67
int
open_stream_connection
(
struct
arglist
*,
unsigned
int
,
int
,
int
);
68
int
open_stream_connection_ext
(
struct
arglist
*,
unsigned
int
,
int
,
int
,
69
const
char
*);
70
int
open_stream_auto_encaps_ext
(
struct
arglist
*args,
unsigned
int
port,
71
int
timeout,
int
force);
72
73
int
write_stream_connection
(
int
,
void
*buf,
int
n);
74
int
read_stream_connection
(
int
,
void
*,
int
);
75
int
read_stream_connection_min
(
int
,
void
*,
int
,
int
);
76
int
nsend
(
int
,
void
*,
int
,
int
);
77
void
add_close_stream_connection_hook
(
int
(*)(
int
));
78
int
close_stream_connection
(
int
);
79
80
const
char
*
get_encaps_name
(
openvas_encaps_t
);
81
const
char
*
get_encaps_through
(
openvas_encaps_t
);
82
83
/* Additional functions -- should not be used by the plugins */
84
int
open_sock_opt_hn
(
const
char
*,
unsigned
int
,
int
,
int
,
int
);
85
86
#ifdef __GNUC__
87
void
auth_printf
(
struct
arglist
*,
char
*, ...) __attribute__ ((format (printf, 2, 3)));
/* RATS: ignore */
88
#else
89
void
auth_printf
(
struct
arglist
*,
char
*, ...);
90
#endif
91
92
void
auth_send
(
struct
arglist
*,
char
*);
93
char
*
auth_gets
(
struct
arglist
*,
char
*,
size_t
);
94
95
int
openvas_SSL_init
();
96
97
int
stream_set_buffer
(
int
,
int
);
98
int
stream_get_buffer_sz
(
int
);
99
int
stream_get_err
(
int
);
100
101
struct
ovas_scanner_context_s
;
102
typedef
struct
ovas_scanner_context_s
*
ovas_scanner_context_t
;
103
104
ovas_scanner_context_t
105
ovas_scanner_context_new
(
openvas_encaps_t
,
const
char
*,
const
char
*,
106
const
char
*,
const
char
*,
const
char
*,
107
const
char
*);
108
109
void
ovas_scanner_context_free
(ovas_scanner_context_t);
110
int
ovas_scanner_context_attach
(ovas_scanner_context_t ctx,
int
soc);
111
112
int
openvas_register_connection
(
int
s,
void
*ssl,
113
gnutls_certificate_credentials_t certcred,
114
openvas_encaps_t
encaps
);
115
int
openvas_deregister_connection
(
int
);
116
int
openvas_get_socket_from_connection
(
int
);
117
gnutls_session_t
ovas_get_tlssession_from_connection
(
int
);
118
119
int
stream_zero
(fd_set *);
120
int
stream_set
(
int
, fd_set *);
121
122
int
os_send
(
int
,
void
*,
int
,
int
);
123
int
os_recv
(
int
,
void
*,
int
,
int
);
124
125
int
internal_send
(
int
,
char
*,
int
);
126
int
internal_recv
(
int
,
char
**,
int
*,
int
*);
127
128
int
fd_is_stream
(
int
);
129
130
int
stream_set_timeout
(
int
,
int
);
131
132
int
socket_negotiate_ssl
(
int
,
openvas_encaps_t
,
struct
arglist
*);
133
void
socket_get_cert
(
int
,
void
**,
int
*);
134
openvas_encaps_t
socket_get_ssl_version
(
int
);
135
void
socket_get_ssl_session_id
(
int
,
void
**,
size_t
*);
136
int
socket_get_ssl_compression
(
int
);
137
int
socket_get_ssl_ciphersuite
(
int
);
138
139
#endif
Generated by
1.8.3.1