"Fossies" - the Fresh Open Source Software Archive

Member "gvm-libs-11.0.0/base/networking.h" (11 Oct 2019, 2547 Bytes) of package /linux/misc/openvas/gvm-libs-11.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "networking.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.0-beta2_vs_1.0.0.

    1 /* Copyright (C) 2013-2019 Greenbone Networks GmbH
    2  *
    3  * SPDX-License-Identifier: GPL-2.0-or-later
    4  *
    5  * This program is free software; you can redistribute it and/or
    6  * modify it under the terms of the GNU General Public License
    7  * as published by the Free Software Foundation; either version 2
    8  * of the License, or (at your option) any later version.
    9  *
   10  * This program is distributed in the hope that it will be useful,
   11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13  * GNU General Public License for more details.
   14  *
   15  * You should have received a copy of the GNU General Public License
   16  * along with this program; if not, write to the Free Software
   17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18  */
   19 
   20 /**
   21  * @file
   22  * @brief GVM Networking related API.
   23  */
   24 
   25 #ifndef _GVM_NETWORKING_H
   26 #define _GVM_NETWORKING_H
   27 
   28 #include "array.h" /* for array_t */
   29 
   30 #include <netdb.h> /* for struct in6_addr */
   31 
   32 /**
   33  * @brief Possible port types.
   34  *
   35  * Used in Manager database. If any symbol changes then a migrator must be
   36  * added to update existing data.
   37  */
   38 typedef enum
   39 {
   40   PORT_PROTOCOL_TCP = 0,
   41   PORT_PROTOCOL_UDP = 1,
   42   PORT_PROTOCOL_OTHER = 2
   43 } port_protocol_t;
   44 
   45 /**
   46  * @brief A port range.
   47  */
   48 struct range
   49 {
   50   gchar *comment;       /**< Comment. */
   51   gchar *id;            /**< UUID. */
   52   int end;              /**< End port.  0 for single port. */
   53   int exclude;          /**< Whether to exclude range. */
   54   int start;            /**< Start port. */
   55   port_protocol_t type; /**< Port protocol. */
   56 };
   57 typedef struct range range_t;
   58 
   59 int
   60 gvm_source_iface_init (const char *);
   61 
   62 int
   63 gvm_source_iface_is_set (void);
   64 
   65 int
   66 gvm_source_set_socket (int, int, int);
   67 
   68 void
   69 gvm_source_addr (void *);
   70 
   71 void
   72 gvm_source_addr6 (void *);
   73 
   74 void
   75 gvm_source_addr_as_addr6 (struct in6_addr *);
   76 
   77 char *
   78 gvm_source_addr_str (void);
   79 
   80 char *
   81 gvm_source_addr6_str (void);
   82 
   83 void
   84 ipv4_as_ipv6 (const struct in_addr *, struct in6_addr *);
   85 
   86 void
   87 addr6_to_str (const struct in6_addr *, char *);
   88 
   89 char *
   90 addr6_as_str (const struct in6_addr *);
   91 
   92 void
   93 sockaddr_as_str (const struct sockaddr_storage *, char *);
   94 
   95 int
   96 gvm_resolve (const char *, void *, int);
   97 
   98 GSList *
   99 gvm_resolve_list (const char *);
  100 
  101 int
  102 gvm_resolve_as_addr6 (const char *, struct in6_addr *);
  103 
  104 int
  105 validate_port_range (const char *);
  106 
  107 array_t *
  108 port_range_ranges (const char *);
  109 
  110 int
  111 port_in_port_ranges (int, port_protocol_t, array_t *);
  112 
  113 int
  114 ipv6_is_enabled ();
  115 
  116 #endif /* not _GVM_NETWORKING_H */