OpenVAS Libraries  4.0+rc3.SVN
misc/kb.h
00001 /* OpenVAS
00002  * $Id$
00003  * Description: Header file for module kb.
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_KB_H
00027 #define OPENVAS_KB_H
00028 
00029 /* this define can be removed, once openvas-plugins 1.0.5 is mandatory
00030    minimum version */
00031 #define NEW_KB_MGMT
00032 
00037 #define KB_TYPE_INT ARG_INT
00038 
00042 #define KB_TYPE_STR ARG_STRING
00043 
00048 struct kb_item
00049 {
00050   char *name;  
00051   char type;   
00054   union
00055   {
00056     char *v_str;
00057     int v_int;
00058   } v;        
00059   struct kb_item *next;  
00060 };
00061 
00062 struct kb_item **kb_new ();
00063 struct kb_item *kb_item_get_single (struct kb_item **, char *, int);
00064 char *kb_item_get_str (struct kb_item **, char *);
00065 int kb_item_get_int (struct kb_item **, char *);
00066 struct kb_item *kb_item_get_all (struct kb_item **, char *);
00067 struct kb_item *kb_item_get_pattern (struct kb_item **, char *);
00068 void kb_item_get_all_free (struct kb_item *);
00069 
00070 int kb_item_add_str (struct kb_item **, char *, char *);
00071 int kb_item_set_str (struct kb_item **, char *, char *);
00072 int kb_item_add_int (struct kb_item **, char *, int);
00073 int kb_item_set_int (struct kb_item **, char *, int);
00074 void kb_item_rm_all (struct kb_item **, char *);
00075 
00076 struct arglist *plug_get_oldstyle_kb (struct arglist *);
00077 
00078 #endif