OpenVAS Libraries
4.0+rc3.SVN
|
00001 /* OpenVAS: openvas-libraries/base 00002 * $Id$ 00003 * Description: API (structs and protos) for Access Rules 00004 * 00005 * Authors: 00006 * Jan-Oliver Wagner <jan-oliver.wagner@greenbone.net> 00007 * 00008 * Copyright: 00009 * Copyright (C) 2009 Greenbone Networks GmbH 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License version 2, 00013 * or, at your option, any later version as published by the Free 00014 * Software Foundation 00015 * 00016 * This program 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 00019 * GNU 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 00033 #ifndef _OPENVAS_ACCESSRULES_H 00034 #define _OPENVAS_ACCESSRULES_H 00035 00036 #include <glib.h> 00037 00041 typedef enum 00042 { 00043 ALLOW = 1, 00044 REJECT = 2 00045 } rule_t; 00046 00053 typedef struct accessrule 00054 { 00055 rule_t rule; 00056 gchar *ip; 00057 00058 gchar *comment; 00059 } accessrule_t; 00060 00061 accessrule_t *accessrule_new (void); 00062 void accessrule_free (accessrule_t *); 00063 00064 rule_t accessrule_rule (const accessrule_t *); 00065 gchar *accessrule_ip (const accessrule_t *); 00066 gchar *accessrule_comment (const accessrule_t *); 00067 00068 int accessrule_set_rule (accessrule_t *, const rule_t); 00069 int accessrule_set_ip (accessrule_t *, const gchar *); 00070 int accessrule_set_comment (accessrule_t *, const gchar *); 00071 00072 gchar *accessrule_as_xml (const accessrule_t *); 00073 00074 /* Collections of Access Rules. */ 00075 00079 typedef GHashTable accessrules_t; 00080 00081 accessrules_t *accessrules_new (); 00082 void accessrules_free (accessrules_t *); 00083 guint accessrules_size (accessrules_t *); 00084 void accessrules_add (accessrules_t *, accessrule_t *); 00085 00086 guint accessrules_to_file (accessrules_t *, gchar *); 00087 accessrules_t *accessrules_from_file (gchar *); 00088 00089 #endif /* not _OPENVAS_ACCESSRULE_H */