OpenVAS Libraries  4.0+rc3.SVN
misc/arglists.h
00001 /* OpenVAS
00002  * $Id$
00003  * Description: Header file for module arglists.
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_ARGLISTS_H
00027 #define OPENVAS_ARGLISTS_H
00028 
00029 struct arglist
00030 {
00031   char *name;
00032   int type;
00033   void *value;
00034   long length;
00035   struct arglist *next;
00036   int hash;
00037 };
00038 
00047 struct name_cache
00048 {
00049   char *name;
00050   int occurences;
00051   struct name_cache *next;
00052   struct name_cache *prev;
00053 };
00054 
00055 #define ARG_STRING  1
00056 #define ARG_PTR     2
00057 #define ARG_INT     3
00058 #define ARG_ARGLIST 4
00059 #define ARG_STRUCT  5
00060 
00061 char *cache_inc (const char *name);
00062 void cache_dec (const char *name);
00063 
00064 void arg_add_value_at_head (struct arglist *arglst, const char *name, int type,
00065                             long length, void *value);
00066 void arg_add_value (struct arglist *, const char *, int, long, void *);
00067 int arg_set_name (struct arglist *, const char *, const char *);
00068 int arg_set_value (struct arglist *, const char *, long, void *);
00069 int arg_set_type (struct arglist *, const char *, int);
00070 void *arg_get_value (struct arglist *, const char *);
00071 int arg_get_length (struct arglist *, const char *);
00072 int arg_get_type (struct arglist *, const char *);
00073 void arg_dump (struct arglist *, int);
00074 void arg_dup (struct arglist *, struct arglist *);
00075 void arg_free (struct arglist *);
00076 void arg_free_all (struct arglist *);
00077 void arg_free_name (char *);
00078 
00079 char * arglist2str (struct arglist *);
00080 struct arglist * str2arglist (char *str);
00081 
00082 #endif /* OPENVAS_ARGLISTS_H */