Update copyright year.
[pwmd.git] / src / rcfile.h
blob159f05b76f1fd68cb22e0fdee47780d723501081
1 /*
2 Copyright (C) 2006-2019 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 as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
11 Pwmd is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef RCFILE_H
20 #define RCFILE_H
22 #include <pthread.h>
23 #include <sys/types.h>
24 #include "util-slist.h"
26 #define INVALID_PRIORITY "-99"
28 struct config_section_s
30 char *name;
31 struct slist_s *params;
34 #define INVOKING_UID 0
35 #define INVOKING_GID 1
36 #define INVOKING_TLS 2
38 struct invoking_user_s
40 int type;
41 int not;
42 union {
43 uid_t uid;
44 char *id;
46 struct invoking_user_s *next;
49 #ifdef HAVE_MLOCKALL
50 int disable_mlock;
51 #endif
52 char *logfile;
53 char *rcfile;
54 char *homedir;
55 int max_recursion_depth;
56 int disable_list_and_dump;
57 struct slist_s *global_config;
58 int log_syslog;
59 pthread_mutex_t rcfile_mutex;
60 pthread_cond_t rcfile_cond;
61 pthread_t rcfile_tid;
62 struct invoking_user_s *invoking_users;
63 int log_keepopen;
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