OpenVAS Libraries
4.0+rc3.SVN
|
00001 /* openvas-libraries/base 00002 * $Id$ 00003 * Description: API (structs and protos) for NVT Info datasets 00004 * 00005 * Authors: 00006 * Jan-Oliver Wagner <jan-oliver.wagner@greenbone.net> 00007 * Matthew Mundell <matt@mundell.ukfsn.org> 00008 * 00009 * Copyright: 00010 * Copyright (C) 2009 Greenbone Networks GmbH 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License version 2, 00014 * or, at your option, any later version as published by the Free 00015 * Software Foundation 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 00025 */ 00026 00034 #ifndef _NVTI_H 00035 #define _NVTI_H 00036 00037 #include <glib.h> 00038 00045 typedef struct nvtpref 00046 { 00047 gchar *type; 00048 gchar *name; 00049 gchar *dflt; 00050 } nvtpref_t; 00051 00052 nvtpref_t *nvtpref_new (gchar *, gchar *, gchar *); 00053 void nvtpref_free (nvtpref_t *); 00054 gchar *nvtpref_name (const nvtpref_t *); 00055 gchar *nvtpref_type (const nvtpref_t *); 00056 gchar *nvtpref_default (const nvtpref_t *); 00057 00064 typedef struct nvti 00065 { 00066 gchar *oid; 00067 gchar *version; 00068 gchar *name; 00069 gchar *summary; 00070 gchar *description; 00071 gchar *copyright; 00073 gchar *cve; 00074 gchar *bid; 00076 gchar *xref; 00078 gchar *tag; 00079 gchar *cvss_base; 00080 gchar *risk_factor; 00082 gchar *dependencies; 00083 gchar *required_keys; 00084 gchar *mandatory_keys; 00085 gchar *excluded_keys; 00086 gchar *required_ports; 00087 gchar *required_udp_ports; 00089 gchar *sign_key_ids; 00092 gchar *src; 00095 GSList *prefs; 00097 // The following are not settled yet. 00098 gint timeout; 00099 gint category; 00100 gchar *family; 00101 } nvti_t; 00102 00103 nvti_t *nvti_new (void); 00104 void nvti_free (nvti_t *); 00105 00106 gchar *nvti_oid (const nvti_t *); 00107 gchar *nvti_version (const nvti_t *); 00108 gchar *nvti_name (const nvti_t *); 00109 gchar *nvti_summary (const nvti_t *); 00110 gchar *nvti_description (const nvti_t *); 00111 gchar *nvti_copyright (const nvti_t *); 00112 gchar *nvti_cve (const nvti_t *); 00113 gchar *nvti_bid (const nvti_t *); 00114 gchar *nvti_xref (const nvti_t *); 00115 gchar *nvti_tag (const nvti_t *); 00116 gchar *nvti_cvss_base (const nvti_t *); 00117 gchar *nvti_risk_factor (const nvti_t *); 00118 gchar *nvti_dependencies (const nvti_t *); 00119 gchar *nvti_required_keys (const nvti_t *); 00120 gchar *nvti_mandatory_keys (const nvti_t *); 00121 gchar *nvti_excluded_keys (const nvti_t *); 00122 gchar *nvti_required_ports (const nvti_t *); 00123 gchar *nvti_required_udp_ports (const nvti_t *); 00124 gchar *nvti_sign_key_ids (const nvti_t *); 00125 gchar *nvti_src (const nvti_t *); 00126 gint nvti_timeout (const nvti_t *); 00127 gint nvti_category (const nvti_t *); 00128 gchar *nvti_family (const nvti_t *); 00129 guint nvti_pref_len (const nvti_t *); 00130 nvtpref_t *nvti_pref (const nvti_t *, guint); 00131 00132 int nvti_set_oid (nvti_t *, const gchar *); 00133 int nvti_set_version (nvti_t *, const gchar *); 00134 int nvti_set_name (nvti_t *, const gchar *); 00135 int nvti_set_summary (nvti_t *, const gchar *); 00136 int nvti_set_description (nvti_t *, const gchar *); 00137 int nvti_set_copyright (nvti_t *, const gchar *); 00138 int nvti_set_cve (nvti_t *, const gchar *); 00139 int nvti_set_bid (nvti_t *, const gchar *); 00140 int nvti_set_xref (nvti_t *, const gchar *); 00141 int nvti_set_tag (nvti_t *, const gchar *); 00142 int nvti_set_cvss_base (nvti_t *, const gchar *); 00143 int nvti_set_risk_factor (nvti_t *, const gchar *); 00144 int nvti_set_dependencies (nvti_t *, const gchar *); 00145 int nvti_set_required_keys (nvti_t *, const gchar *); 00146 int nvti_set_mandatory_keys (nvti_t *, const gchar *); 00147 int nvti_set_excluded_keys (nvti_t *, const gchar *); 00148 int nvti_set_required_ports (nvti_t *, const gchar *); 00149 int nvti_set_required_udp_ports (nvti_t *, const gchar *); 00150 int nvti_set_sign_key_ids (nvti_t *, const gchar *); 00151 int nvti_set_src (nvti_t *, const gchar *); 00152 int nvti_set_timeout (nvti_t *, const gint); 00153 int nvti_set_category (nvti_t *, const gint); 00154 int nvti_set_family (nvti_t *, const gchar *); 00155 int nvti_add_pref (nvti_t *, nvtpref_t *); 00156 00157 gchar *nvti_as_text (const nvti_t *); 00158 gchar *nvti_as_openvas_nvt_cache_entry (const nvti_t *); 00159 00160 nvti_t *nvti_from_keyfile (const gchar *); 00161 int nvti_to_keyfile (const nvti_t *, const gchar *); 00162 00163 00164 /* Collections of NVT Infos. */ 00165 00169 typedef GHashTable nvtis_t; 00170 00171 nvtis_t *nvtis_new (); 00172 00173 void nvtis_free (nvtis_t *); 00174 00175 guint nvtis_size (nvtis_t *); 00176 00177 void nvtis_add (nvtis_t *, nvti_t *); 00178 00179 nvti_t *nvtis_lookup (nvtis_t *, const char *); 00180 00181 #define nvtis_find g_hash_table_find 00182 00183 #endif /* not _NVTI_H */