OpenVAS Libraries  6.0+beta5
plugutils.h
Go to the documentation of this file.
1 /* OpenVAS
2  * $Id$
3  * Description: Header file for module plugutils.
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_PLUGUTILS_H
27 #define OPENVAS_PLUGUTILS_H
28 
29 #include "../misc/arglists.h"
30 
31 #include "../base/nvti.h"
32 
33 #define LEGACY_OID "1.3.6.1.4.1.25623.1.0."
34 
35 void scanner_add_port (struct arglist *, int, char *);
36 
37 
38 /*
39  * Arglist management at plugin-level
40  */
41 void plug_set_launch (struct arglist *, int);
42 int plug_get_launch (struct arglist *);
43 
44 void plug_set_dep (struct arglist *, const char *);
45 
46 void plug_set_xref (struct arglist *, char *, char *);
47 
48 void plug_set_tag (struct arglist *, char *, char *);
49 
50 void plug_set_ssl_cert (struct arglist *, char *);
51 void plug_set_ssl_key (struct arglist *, char *);
52 void plug_set_ssl_pem_password (struct arglist *, char *);
53 void plug_set_ssl_CA_file (struct arglist *, char *);
54 
55 
56 const char *plug_get_hostname (struct arglist *);
57 const char *plug_get_host_fqdn (struct arglist *);
58 void plug_add_host (struct arglist *, struct arglist *);
59 unsigned int plug_get_host_open_port (struct arglist *desc);
60 
61 void plug_set_port_transport (struct arglist *, int, int);
62 
63 int plug_get_port_transport (struct arglist *, int);
64 
66 
67 /*
68  * Reporting functions
69  */
70 void proto_post_hole (struct arglist *, int, const char *, const char *);
71 void post_hole (struct arglist *, int, const char *);
72 void post_hole_udp (struct arglist *, int, const char *);
73 #define post_hole_tcp post_hole
74 
75 void proto_post_info (struct arglist *, int, const char *, const char *);
76 void post_info (struct arglist *, int, const char *);
77 void post_info_udp (struct arglist *, int, const char *);
78 #define post_info_tcp post_info
79 
80 void proto_post_note (struct arglist *, int, const char *, const char *);
81 void post_note (struct arglist *, int, const char *);
82 void post_note_udp (struct arglist *, int, const char *);
83 #define post_note_tcp post_note
84 
85 void proto_post_error (struct arglist *, int, const char *, const char *);
86 void post_error (struct arglist *, int, const char *);
87 void post_error_udp (struct arglist *, int, const char *);
88 #define post_error_tcp post_error
89 
90 void proto_post_log (struct arglist *, int, const char *, const char *);
91 void post_log (struct arglist *, int, const char *);
92 void post_log_udp (struct arglist *, int, const char *);
93 #define post_log_tcp post_log
94 
95 
96 /*
97  * Management of the portlists
98  */
99 void host_add_port (struct arglist *, int, int);
100 void host_add_port_udp (struct arglist *, int, int);
101 int host_get_port_state (struct arglist *, int);
102 int host_get_port_state_udp (struct arglist *, int);
103 
104 /* Not implemented
105 char * host_get_port_banner(struct arglist *, int);
106 */
107 
108 
109 /*
110  * Inter Plugins Communication functions
111  */
112 void plug_set_key (struct arglist *, char *, int, void *);
113 void plug_replace_key (struct arglist *, char *, int, void *);
114 void *plug_get_fresh_key (struct arglist *, char *, int *);
115 struct kb_item **plug_get_kb (struct arglist *);
116 void *plug_get_key (struct arglist *, char *, int *);
117 
118 char *openvaslib_version ();
119 void openvas_lib_version (int *, int *, int *);
120 char *addslashes (char *);
121 char *rmslashes (char *);
122 
123 struct in6_addr *plug_get_host_ip (struct arglist *);
124 char *get_preference (struct arglist *, const char *);
125 void add_plugin_preference (struct arglist *, const char *, const char *,
126  const char *);
127 char *get_plugin_preference (struct arglist *, const char *);
128 const char *get_plugin_preference_fname (struct arglist *, const char *);
129 char *get_plugin_preference_file_content (struct arglist *, const char *);
130 const long get_plugin_preference_file_size (struct arglist *, const char *);
131 
132 char *find_in_path (char *, int);
133 
138 /*
139  * Type of "transport layer", for encapsulated connections
140  * Only SSL is supported at this time.
141  * (Bad) examples of other layers could be SOCKS, httptunnel, icmptunnel,
142  * RMI over HTTP, DCOM over HTTP, TCP over TCP, etc.
143  */
144 #define OPENVAS_ENCAPS_AUTO 0 /* Request auto detection. */
145 #define OPENVAS_ENCAPS_IP 1
146 #define OPENVAS_ENCAPS_SSLv23 2 /* Ask for compatibility options */
147 #define OPENVAS_ENCAPS_SSLv2 3
148 #define OPENVAS_ENCAPS_SSLv3 4
149 #define OPENVAS_ENCAPS_TLSv1 5
150 #define OPENVAS_ENCAPS_TLScustom 6 /* SSL/TLS using custom priorities. */
151 
152 #define IS_ENCAPS_SSL(x) ((x) >= OPENVAS_ENCAPS_SSLv23 && (x) <= OPENVAS_ENCAPS_TLScustom)
153 
154 #endif