Add dynamic loading of backends.
[onak.git] / onak-conf.h
1 /*
2  * onak-conf.h - Routines related to runtime config.
3  *
4  * Jonathan McDowell <noodles@earth.li>
5  *
6  * Copyright 2002 Project Purple
7  */
8
9 #ifndef __ONAK_CONF_H_
10 #define __ONAK_CONF_H_
11
12 /*
13  *      struct onak_config - Runtime configuration for onak.
14  *      @maxkeys: The maximum number of keys a query should return.
15  *      @thissite: Our email address that servers sync with.
16  *      @adminemail: The email address of the server admin.
17  *      @mta: The mta to invoke to send sync mails.
18  *      @syncsites: A linked list of sites we sync with.
19  *
20  *      @db_dir: The path to the directory containing the database files.
21  * 
22  *      @pg_dbhost: The host that Postgres is running on.
23  *      @pg_dbname: The database name.
24  *      @pg_dbuser: The user we should connect as.
25  *      @pg_dbpass: The password for the user.
26  *
27  *      This structure holds various runtime configuration options for onak. It
28  *      will eventually be populated from the config file.
29  */
30 struct onak_config {
31         /*
32          * Generic options.
33          */
34         int maxkeys;
35         char *thissite;
36         char *adminemail;
37         char *mta;
38         struct ll *syncsites;
39         char *logfile;
40
41         /*
42          * Options for any database backend that needs a directory, be it the
43          * file, db2 or db3 options.
44          */
45         char *db_dir;
46         
47         /*
48          * Options for the Postgres backend.
49          */
50         char *pg_dbhost;
51         char *pg_dbname;
52         char *pg_dbuser;
53         char *pg_dbpass;
54
55         /*
56          * Options for the dynamic backend.
57          */
58         char *db_backend;
59         char *backends_dir;
60 };
61
62 /*
63  *      config - The variable containing our runtime config.
64  */
65 extern struct onak_config config;
66
67 /*
68  *      readconfig - read the onak config.
69  *      @configfile - the config file to read.
70  *
71  *      Read in our config file. If config file is NULL read in the compile
72  *      time default.
73  */
74 void readconfig(const char *configfile);
75
76 /*
77  *      cleanupconfig - clean up the config when we're shutting down.
78  */
79 void cleanupconfig(void);
80
81 #endif /* __ONAK_CONF_H_ */