"Fossies" - the Fresh Open Source Software Archive

Member "gvm-libs-11.0.1/osp/osp.h" (12 May 2020, 5850 Bytes) of package /linux/misc/openvas/gvm-libs-11.0.1.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 "osp.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 11.0.0_vs_11.0.1.

    1 /* Copyright (C) 2014-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 API for Open Scanner Protocol communication.
   23  */
   24 
   25 #ifndef _GVM_OSP_H
   26 #define _GVM_OSP_H
   27 
   28 #include <glib.h> /* for GHashTable, GSList */
   29 #include "../util/xmlutils.h"
   30 
   31 /* Type definitions */
   32 
   33 typedef struct osp_connection osp_connection_t;
   34 
   35 typedef struct osp_credential osp_credential_t;
   36 
   37 typedef struct osp_target osp_target_t;
   38 
   39 typedef struct osp_vt_group osp_vt_group_t;
   40 
   41 typedef struct osp_vt_single osp_vt_single_t;
   42 
   43 /**
   44  * @brief OSP parameter types.
   45  */
   46 typedef enum
   47 {
   48   OSP_PARAM_TYPE_INT = 0,      /**< Integer type. */
   49   OSP_PARAM_TYPE_STR,          /**< String type. */
   50   OSP_PARAM_TYPE_PASSWORD,     /**< Password type. */
   51   OSP_PARAM_TYPE_FILE,         /**< File type. */
   52   OSP_PARAM_TYPE_BOOLEAN,      /**< Boolean type. */
   53   OSP_PARAM_TYPE_OVALDEF_FILE, /**< Oval definition type. */
   54   OSP_PARAM_TYPE_SELECTION,    /**< Selection type. */
   55   OSP_PARAM_TYPE_CRD_UP,       /**< Credential user/pass type. */
   56 } osp_param_type_t;
   57 
   58 /**
   59  * @brief OSP scan status.
   60  */
   61 typedef enum
   62 {
   63   OSP_SCAN_STATUS_ERROR = -1, /**< Error status. */
   64   OSP_SCAN_STATUS_INIT,       /**< Init status. */
   65   OSP_SCAN_STATUS_RUNNING,    /**< Running status. */
   66   OSP_SCAN_STATUS_STOPPED,    /**< Stopped status. */
   67   OSP_SCAN_STATUS_FINISHED,   /**< Finished status. */
   68 } osp_scan_status_t;
   69 
   70 
   71 typedef struct {
   72   const char *scan_id; ///< UUID of the scan which get the status from.
   73 } osp_get_scan_status_opts_t;
   74 
   75 typedef struct {
   76   int start;    /**< Start interval. */
   77   int end;      /**< End interval. */
   78   char *titles; /**< Graph title. */
   79 } osp_get_performance_opts_t;
   80 
   81 typedef struct osp_param osp_param_t;
   82 
   83 /* OSP Connection handling */
   84 
   85 osp_connection_t *
   86 osp_connection_new (const char *, int, const char *, const char *,
   87                     const char *);
   88 
   89 void
   90 osp_connection_close (osp_connection_t *);
   91 
   92 /* OSP commands */
   93 int
   94 osp_get_version (osp_connection_t *, char **, char **, char **, char **,
   95                  char **, char **);
   96 
   97 int
   98 osp_get_vts_version (osp_connection_t *, char **);
   99 
  100 int
  101 osp_get_vts (osp_connection_t *, entity_t *);
  102 
  103 typedef struct {
  104   char *filter; ///< the filter to apply for a vt sub-selection.
  105 } osp_get_vts_opts_t;
  106 
  107 int
  108 osp_get_vts_ext (osp_connection_t *, osp_get_vts_opts_t, entity_t *);
  109 
  110 int
  111 osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
  112                 const char *, char **);
  113 
  114 typedef struct {
  115   GSList *targets;              ///< Target hosts to scan.
  116   GSList *vt_groups;            ///< VT groups to use for the scan.
  117   GSList *vts;                  ///< Single VTs to use for the scan.
  118   GHashTable *scanner_params;   ///< Table of scanner parameters.
  119   int parallel;                 ///< Number of parallel scans.
  120   const char *scan_id;          ///< UUID to set for scan, null otherwise.
  121 } osp_start_scan_opts_t;
  122 
  123 int
  124 osp_start_scan_ext (osp_connection_t *, osp_start_scan_opts_t, char **);
  125 
  126 int
  127 osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
  128 
  129 int
  130 osp_get_scan_pop (osp_connection_t *,
  131                   const char *,
  132                   char **,
  133                   int,
  134                   int,
  135                   char **);
  136 
  137 osp_scan_status_t
  138 osp_get_scan_status_ext (osp_connection_t *,
  139                          osp_get_scan_status_opts_t,
  140                          char **);
  141 
  142 int
  143 osp_delete_scan (osp_connection_t *, const char *);
  144 
  145 int
  146 osp_stop_scan (osp_connection_t *, const char *, char **);
  147 
  148 int
  149 osp_get_scanner_details (osp_connection_t *, char **, GSList **);
  150 
  151 
  152 int
  153 osp_get_performance_ext (osp_connection_t *,
  154                          osp_get_performance_opts_t,
  155                          char **,
  156                          char **);
  157 
  158 /* OSP scanner parameters handling */
  159 
  160 osp_param_t *
  161 osp_param_new (void);
  162 
  163 const char *
  164 osp_param_id (const osp_param_t *);
  165 
  166 const char *
  167 osp_param_name (const osp_param_t *);
  168 
  169 const char *
  170 osp_param_desc (const osp_param_t *);
  171 
  172 const char *
  173 osp_param_default (const osp_param_t *);
  174 
  175 const char *
  176 osp_param_type_str (const osp_param_t *);
  177 
  178 int
  179 osp_param_mandatory (const osp_param_t *);
  180 
  181 void
  182 osp_param_free (osp_param_t *);
  183 
  184 /* OSP credential handling */
  185 
  186 osp_credential_t *
  187 osp_credential_new (const char *, const char *, const char *);
  188 
  189 void
  190 osp_credential_free (osp_credential_t *);
  191 
  192 const gchar*
  193 osp_credential_get_auth_data (osp_credential_t *, const char*);
  194 
  195 void
  196 osp_credential_set_auth_data (osp_credential_t *, const char*, const char*);
  197 
  198 
  199 /* OSP targets handling */
  200 
  201 osp_target_t *
  202 osp_target_new (const char *, const char *, const char *);
  203 
  204 void
  205 osp_target_set_finished_hosts (osp_target_t *, const char *);
  206 
  207 void
  208 osp_target_free (osp_target_t *);
  209 
  210 void
  211 osp_target_add_credential (osp_target_t *, osp_credential_t *);
  212 
  213 /* OSP VT group handling */
  214 
  215 osp_vt_group_t *
  216 osp_vt_group_new (const char *);
  217 
  218 void
  219 osp_vt_group_free (osp_vt_group_t *);
  220 
  221 /* OSP single VT handling */
  222 
  223 osp_vt_single_t *
  224 osp_vt_single_new (const char *);
  225 
  226 void
  227 osp_vt_single_free (osp_vt_single_t *);
  228 
  229 void
  230 osp_vt_single_add_value (osp_vt_single_t *, const char*, const char*);
  231 
  232 #endif