OpenVAS Libraries  4.0+rc3.SVN
base/settings.h
Go to the documentation of this file.
00001 /* openvas-libraries/base
00002  * $Id$
00003  * Description: API (structs and protos) for configuration file management
00004  *
00005  * Authors:
00006  * Matthew Mundell <matthew.mundell@intevation.de>
00007  * Michael Wiegand <michael.wiegand@intevation.de>
00008  *
00009  * Copyright:
00010  * Copyright (C) 2010 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 _OPENVAS_LIBRARIES_BASE_SETTINGS_H
00035 #define _OPENVAS_LIBRARIES_BASE_SETTINGS_H
00036 
00037 #include <glib.h>
00038 
00039 typedef struct
00040 {
00041   gchar *file_name;
00042   gchar *group_name;
00043   GKeyFile *key_file;
00044 } settings_t;
00045 
00046 int settings_init (settings_t *, const gchar *, const gchar *);
00047 void settings_cleanup (settings_t *);
00048 void settings_set (settings_t *, const gchar *, const gchar *);
00049 int settings_save (settings_t *);
00050 
00051 typedef struct
00052 {
00053   gchar **keys;
00054   settings_t settings;
00055   gchar **current_key;
00056   gchar **last_key;
00057 } settings_iterator_t;
00058 
00059 int init_settings_iterator (settings_iterator_t *, const gchar *,
00060                             const gchar *);
00061 int init_settings_iterator_from_file (settings_iterator_t *, const gchar *,
00062                                       const gchar *);
00063 void cleanup_settings_iterator (settings_iterator_t *);
00064 int settings_iterator_next (settings_iterator_t *);
00065 const gchar *settings_iterator_name (settings_iterator_t *);
00066 const gchar *settings_iterator_value (settings_iterator_t *);
00067 
00068 #endif /* not _OPENVAS_LIBRARIES_BASE_SETTINGS_H */