OpenVAS Libraries
4.0+rc3.SVN
|
00001 /* OpenVAS 00002 * $Id$ 00003 * Description: Header file for module network. 00004 * 00005 * Authors: 00006 * Renaud Deraison <deraison@nessus.org> (Original pre-fork development) 00007 * 00008 * Copyright: 00009 * Based on work Copyright (C) 1998 - 2007 Tenable Network Security, Inc. 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Library General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 00024 */ 00025 00026 #ifndef OPENVAS_NETWORK_H 00027 #define OPENVAS_NETWORK_H 00028 00029 #include <sys/select.h> /* at least for fd_set */ 00030 #include <netinet/in.h> /* struct in_addr, struct in6_addr */ 00031 00032 #include <gnutls/gnutls.h> 00033 #include <gnutls/x509.h> 00034 00035 #include "arglists.h" 00036 00037 /* Plugin specific network functions */ 00038 int open_sock_tcp (struct arglist *, unsigned int, int); 00039 int open_sock_udp (struct arglist *, unsigned int); 00040 int open_sock_option (struct arglist *, unsigned int, int, int, int); 00041 int recv_line (int, char *, size_t); 00042 int nrecv (int, void *, int, int); 00043 int socket_close (int); 00044 00045 int open_stream_connection (struct arglist *, unsigned int, int, int); 00046 int open_stream_connection_unknown_encaps (struct arglist *, unsigned int, int, 00047 int *); 00048 int open_stream_connection_unknown_encaps5 (struct arglist *, unsigned int, int, 00049 int *, int *); 00050 int open_stream_auto_encaps (struct arglist *, unsigned int, int); 00051 00052 int write_stream_connection (int, void *buf, int n); 00053 int read_stream_connection (int, void *, int); 00054 int read_stream_connection_min (int, void *, int, int); 00055 int nsend (int, void *, int, int); 00056 int close_stream_connection (int); 00057 const char *get_encaps_name (int); 00058 const char *get_encaps_through (int); 00059 00060 /* Additional functions -- should not be used by the plugins */ 00061 int open_sock_tcp_hn (const char *, unsigned int); 00062 int open_sock_opt_hn (const char *, unsigned int, int, int, int); 00063 00064 #ifdef __GNUC__ 00065 void auth_printf (struct arglist *, char *, ...) __attribute__ ((format (printf, 2, 3))); /* RATS: ignore */ 00066 #else 00067 void auth_printf (struct arglist *, char *, ...); 00068 #endif 00069 00070 void auth_send (struct arglist *, char *); 00071 char *auth_gets (struct arglist *, char *, size_t); 00072 00073 int openvas_SSL_init (); 00074 00075 int stream_set_buffer (int, int); 00076 int stream_get_buffer_sz (int); 00077 int stream_get_err (int); 00078 00079 void *stream_get_ssl (int); 00080 00081 struct ovas_scanner_context_s; 00082 typedef struct ovas_scanner_context_s *ovas_scanner_context_t; 00083 00084 ovas_scanner_context_t ovas_scanner_context_new (int encaps, 00085 const char *certfile, 00086 const char *keyfile, 00087 const char *passwd, 00088 const char *cacertfile, 00089 int force_pubkey_auth); 00090 00091 void ovas_scanner_context_free (ovas_scanner_context_t); 00092 int ovas_scanner_context_attach (ovas_scanner_context_t ctx, int soc); 00093 00094 int openvas_register_connection (int s, void *ssl, 00095 gnutls_certificate_credentials_t certcred); 00096 int openvas_deregister_connection (int); 00097 int openvas_get_socket_from_connection (int); 00098 gnutls_session_t *ovas_get_tlssession_from_connection (int); 00099 00100 int stream_zero (fd_set *); 00101 int stream_set (int, fd_set *); 00102 int stream_isset (int, fd_set *); 00103 00104 struct in_addr socket_get_next_source_addr (); 00105 struct in6_addr socket_get_next_source_v4_addr (); 00106 struct in6_addr socket_get_next_source_v6_addr (); 00107 int set_socket_source_addr (int, int, int); 00108 void socket_source_init (struct in6_addr *, int family); 00109 00110 int os_send (int, void *, int, int); 00111 int os_recv (int, void *, int, int); 00112 00113 int internal_send (int, char *, int); 00114 int internal_recv (int, char **, int *, int *); 00115 00116 int fd_is_stream (int); 00117 int stream_pending (int); 00118 00119 int stream_set_timeout (int, int); 00120 int stream_set_options (int, int, int); 00121 00122 void convipv4toipv4mappedaddr (struct in_addr, struct in6_addr *); 00123 00124 #endif