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, write to the Free Software Foundation, Inc., 51
18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef __ONAK_CONF_H_
22 #define __ONAK_CONF_H_
27 * @brief Backend database configuration.
30 struct onak_db_config {
31 /** Name, as used to refer to individual backend instances */
33 /** Backend type [e.g. db4, pg, fs, file] */
35 /** Location information; directory for file backed, DB name for DBs */
37 /** Database backend hostname, if appropriate */
39 /** Database backend username, if appropriate */
41 /** Database backend password, if appropriate */
46 * @brief Runtime configuration for onak.
48 * This structure holds various runtime configuration options for onak. It
49 * will eventually be populated from the config file.
55 /** The maximum number of keys a query should return. */
57 /** Our email address that servers sync with. */
59 /** The email address of the server admin. */
61 /** The mta to invoke to send sync mails. */
63 /** List of email address for sites we sync with via email */
65 /** A linked list of sites we sync with. */
68 /** Set if we're using keyd as the backend. */
70 /** The path to the directory the keyd socket lives in. */
73 /** List of backend configurations */
76 /* The default backend to use */
77 struct onak_db_config *backend;
80 * Options for the dynamic backend.
82 /** Name of the DB backend we're using */
84 /** Directory where backend .so files can be found */
87 /** Pointer to the initialisation function for our loaded DB backend */
88 struct onak_dbctx *(*dbinit)(struct onak_db_config *, bool);
90 /** Should we verify signature hashes match? */
94 * Options used by the email handling script.
95 * None of the C code uses this information, but we should be able
98 /** Location of the onak binary, so the mail script can find it. */
100 /** Where incoming mail gets queue, one file per mail. */
105 * @brief The variable containing our runtime config.
107 extern struct onak_config config;
110 * @brief read the onak config.
111 * @param configfile the config file to read.
113 * Read in our config file. If config file is NULL read in the compile
116 void readconfig(const char *configfile);
119 * @brief write the onak config.
120 * @param configfile the config file to write to.
122 * Write out the config file. If config file is NULL write it to STDOUT.
124 void writeconfig(const char *configfile);
127 * @brief clean up the config when we're shutting down.
129 void cleanupconfig(void);
133 * @brief Find a specified backend configuration by name.
135 struct onak_db_config *find_db_backend_config(struct ll *backends, char *name);
137 #endif /* __ONAK_CONF_H_ */