3 * @brief Routines related to runtime config.
5 * Copyright 2002 Jonathan McDowell <noodles@earth.li>
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <https://www.gnu.org/licenses/>.
20 #ifndef __ONAK_CONF_H_
21 #define __ONAK_CONF_H_
30 * @brief Backend database configuration.
33 struct onak_db_config {
34 /** Name, as used to refer to individual backend instances */
36 /** Backend type [e.g. db4, pg, fs, file] */
38 /** Location information; directory for file backed, DB name for DBs */
40 /** Database backend hostname, if appropriate */
42 /** Database backend username, if appropriate */
44 /** Database backend password, if appropriate */
49 * @brief Runtime configuration for onak.
51 * This structure holds various runtime configuration options for onak. It
52 * will eventually be populated from the config file.
58 /** The maximum number of keys a query should return. */
60 /** Our email address that servers sync with. */
62 /** The email address of the server admin. */
64 /** The mta to invoke to send sync mails. */
66 /** List of email address for sites we sync with via email */
68 /** A linked list of sites we sync with. */
71 /** Set if we're using keyd as the backend. */
73 /** The path to the directory the keyd socket lives in. */
76 /** List of backend configurations */
79 /* The default backend to use */
80 struct onak_db_config *backend;
83 * Options for the dynamic backend.
85 /** Name of the DB backend we're using */
87 /** Directory where backend .so files can be found */
90 /** Pointer to the initialisation function for our loaded DB backend */
91 struct onak_dbctx *(*dbinit)(struct onak_db_config *, bool);
93 /** Blacklist of fingerprints to reject */
94 struct keyarray blacklist;
96 /** What policies should we use for cleaning keys? */
97 uint64_t clean_policies;
100 * Options used by the email handling script.
101 * None of the C code uses this information, but we should be able
104 /** Location of the onak binary, so the mail script can find it. */
106 /** Where incoming mail gets queue, one file per mail. */
111 * @brief The variable containing our runtime config.
113 extern struct onak_config config;
116 * @brief read the onak config.
117 * @param configfile the config file to read.
119 * Read in our config file. If config file is NULL read in the compile
122 void readconfig(const char *configfile);
125 * @brief write the onak config.
126 * @param configfile the config file to write to.
128 * Write out the config file. If config file is NULL write it to STDOUT.
130 void writeconfig(const char *configfile);
133 * @brief clean up the config when we're shutting down.
135 void cleanupconfig(void);
139 * @brief Find a specified backend configuration by name.
141 struct onak_db_config *find_db_backend_config(struct ll *backends, char *name);
143 #endif /* __ONAK_CONF_H_ */