Fix Coverity issue #100334.
[libpwmd.git] / src / rcfile.h
blobcea1f3e9c9103c708d69619828d7ef1e919d620c
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
3 Ben Kibbey <bjk@luxsci.net>
5 This file is part of pwmd.
7 Pwmd is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 Pwmd is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef RCFILE_H
21 #define RCFILE_H
23 #include <pthread.h>
24 #include <sys/types.h>
25 #include "util-slist.h"
27 /* This is a string so ealier versions of glib can be used. */
28 #define DEFAULT_ITERATION_PROGRESS "2000"
30 #define INVALID_PRIORITY "-99"
32 struct config_section_s
34 char *name;
35 struct slist_s *params;
38 #ifdef HAVE_MLOCKALL
39 int disable_mlock;
40 #endif
41 char *logfile;
42 char *rcfile;
43 char *homedir;
44 int max_recursion_depth;
45 int disable_list_and_dump;
46 struct slist_s *global_config;
47 int log_syslog;
48 pthread_mutex_t rcfile_mutex;
49 pthread_cond_t rcfile_cond;
50 pthread_t rcfile_tid;
51 uid_t invoking_uid;
52 gid_t invoking_gid;
53 char *invoking_tls;
55 struct slist_s *config_parse (const char *filename);
56 void config_clear_keys ();
57 void config_free (struct slist_s *config);
59 char *config_get_value (const char *section, const char *what);
60 long config_get_long (const char *section, const char *what);
61 unsigned long config_get_ulong (const char *section, const char *what);
62 int config_get_boolean (const char *section, const char *what);
63 int config_get_integer (const char *section, const char *what);
64 char *config_get_string (const char *section, const char *what);
65 char **config_get_list (const char *section, const char *what);
66 long long config_get_longlong (const char *section, const char *what);
67 unsigned long long config_get_ulonglong (const char *section,
68 const char *what);
70 int config_set_list_param (struct slist_s **config, const char *section,
71 const char *name, const char *value);
72 char **config_get_list_param (struct slist_s *config, const char *section,
73 const char *what, int *exists);
74 int config_set_int_param (struct slist_s **config, const char *section,
75 const char *name, const char *value);
76 int config_get_int_param (struct slist_s *config, const char *section,
77 const char *name, int *exists);
78 int config_get_bool_param (struct slist_s *config, const char *section,
79 const char *name, int *exists);
80 int config_set_bool_param (struct slist_s **config, const char *section,
81 const char *name, const char *value);
83 #endif