Fix a few 'gcc -fanalyzer' warnings.
[pwmd.git] / src / rcfile.h
blob458a1323d9782b88c7254900f1b768c851b04af9
1 /*
2 Copyright (C) 2006-2023 Ben Kibbey <bjk@luxsci.net>
4 This file is part of pwmd.
6 Pwmd is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 Pwmd is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef RCFILE_H
19 #define RCFILE_H
21 #include <pthread.h>
22 #include <sys/types.h>
23 #include "util-slist.h"
25 #define INVALID_PRIORITY "-99"
27 struct config_section_s
29 char *name;
30 struct slist_s *params;
33 #define INVOKING_UID 0
34 #define INVOKING_GID 1
35 #define INVOKING_TLS 2
37 struct invoking_user_s
39 int type;
40 int not;
41 union {
42 uid_t uid;
43 char *id;
45 struct invoking_user_s *next;
48 #ifdef HAVE_MLOCKALL
49 extern int disable_mlock;
50 #endif
51 extern char *logfile;
52 extern char *rcfile;
53 extern char *homedir;
54 extern int max_recursion_depth;
55 extern int disable_list_and_dump;
56 extern struct slist_s *global_config;
57 extern int log_syslog;
58 extern pthread_mutex_t rcfile_mutex;
59 extern pthread_cond_t rcfile_cond;
60 extern pthread_t rcfile_tid;
61 extern struct invoking_user_s *invoking_users;
62 extern int log_keepopen;
63 extern int log_level;
65 void free_invoking_users (struct invoking_user_s *);
66 struct slist_s *config_parse (const char *filename, int reload);
67 void config_free (struct slist_s *config);
69 char *config_get_value (const char *section, const char *what);
70 long config_get_long (const char *section, const char *what);
71 int config_get_boolean (const char *section, const char *what);
72 int config_get_integer (const char *section, const char *what);
73 char *config_get_string (const char *section, const char *what);
74 char **config_get_list (const char *section, const char *what);
75 long long config_get_longlong (const char *section, const char *what);
77 int config_set_list_param (struct slist_s **config, const char *section,
78 const char *name, const char *value);
79 char **config_get_list_param (struct slist_s *config, const char *section,
80 const char *what, int *exists);
81 int config_set_int_param (struct slist_s **config, const char *section,
82 const char *name, const char *value);
83 int config_get_int_param (struct slist_s *config, const char *section,
84 const char *name, int *exists);
85 int config_get_bool_param (struct slist_s *config, const char *section,
86 const char *name, int *exists);
87 int config_set_bool_param (struct slist_s **config, const char *section,
88 const char *name, const char *value);
89 int config_set_long_param (struct slist_s **config, const char *section,
90 const char *name, const char *value);
91 struct slist_s *config_keep_save ();
92 void config_keep_restore (struct slist_s *);
94 #endif