OpenVAS Libraries  7.0.9
kb.h
Go to the documentation of this file.
1 /* OpenVAS
2  * $Id$
3  * Description: Header file for module kb.
4  *
5  * Authors:
6  * Renaud Deraison <deraison@nessus.org> (Original pre-fork development)
7  *
8  * Copyright:
9  * Based on work Copyright (C) 1998 - 2007 Tenable Network Security, Inc.
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25 
26 #ifndef OPENVAS_KB_H
27 #define OPENVAS_KB_H
28 
33 #define KB_TYPE_INT ARG_INT
34 
38 #define KB_TYPE_STR ARG_STRING
39 
44 struct kb_item
45 {
46  char *name;
47  char type;
50  union
51  {
52  char *v_str;
53  int v_int;
54  } v;
55  struct kb_item *next;
56 };
57 
58 typedef struct kb_item ** kb_t;
59 
60 struct kb_item **kb_new ();
61 struct kb_item *kb_item_get_single (struct kb_item **, char *, int);
62 char *kb_item_get_str (struct kb_item **, char *);
63 int kb_item_get_int (struct kb_item **, char *);
64 struct kb_item *kb_item_get_all (struct kb_item **, char *);
65 struct kb_item *kb_item_get_pattern (struct kb_item **, char *);
66 void kb_item_get_all_free (struct kb_item *);
67 
68 int kb_item_add_str (struct kb_item **, char *, char *);
69 int kb_item_set_str (struct kb_item **, char *, char *);
70 int kb_item_add_int (struct kb_item **, char *, int);
71 int kb_item_set_int (struct kb_item **, char *, int);
72 void kb_item_rm_all (struct kb_item **, char *);
73 
74 #endif
int kb_item_set_int(struct kb_item **, char *, int)
Definition: kb.c:376
struct kb_item * kb_item_get_pattern(struct kb_item **, char *)
Returns a list of copies of kb_items that match a pattern.
Definition: kb.c:197
struct kb_item ** kb_new()
Allocates memory for an array of kb_items with max length of HASH_MAX.
Definition: kb.c:80
void kb_item_rm_all(struct kb_item **, char *)
Definition: kb.c:389
Definition: kb.h:44
struct kb_item * next
Definition: kb.h:55
char * kb_item_get_str(struct kb_item **, char *)
Get the value of a kb_item with type KB_TYPE_STR and name name.
Definition: kb.c:120
int kb_item_get_int(struct kb_item **, char *)
Get the value of a kb_item with type KB_TYPE_INT and name name.
Definition: kb.c:137
int kb_item_add_int(struct kb_item **, char *, int)
Definition: kb.c:382
struct kb_item * kb_item_get_all(struct kb_item **, char *)
Returns a list of copies of kb_items with name name in a knowledge base.
Definition: kb.c:159
int kb_item_set_str(struct kb_item **, char *, char *)
Definition: kb.c:320
char type
Definition: kb.h:47
int v_int
Definition: kb.h:53
struct kb_item * kb_item_get_single(struct kb_item **, char *, int)
READ the knowledge base.
Definition: kb.c:93
char * name
Definition: kb.h:46
int kb_item_add_str(struct kb_item **, char *, char *)
Adds a string to the knowledge base. In contrast to kb_item_set_str the item will not be replaced (us...
Definition: kb.c:314
void kb_item_get_all_free(struct kb_item *)
Frees a list of kb_items.
Definition: kb.c:235
union kb_item::@3 v
char * v_str
Definition: kb.h:52
struct kb_item ** kb_t
Definition: kb.h:58