Mention PAM file.
[doldaconnect.git] / daemon / conf.h
CommitLineData
d3372da9 1/*
2 * Dolda Connect - Modular multiuser Direct Connect-style client
3 * Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19#ifndef _CONF_H
20#define _CONF_H
21
22#include <stddef.h>
23#include <stdio.h>
24#include <netinet/in.h>
25#include <utils.h>
26
27#define CONFIG_PATH "/usr/local/etc/doldacond.conf:/usr/etc/doldacond.conf:/etc/doldacond.conf"
28
29#define CONF_VAR_END -1
30#define CONF_VAR_BOOL 0
31#define CONF_VAR_INT 1
32#define CONF_VAR_STRING 2
33#define CONF_VAR_IPV4 3
34
35struct configvar
36{
37 int type;
38 char *name;
39 union
40 {
41 int num;
42 wchar_t *str;
43 struct in_addr ipv4;
44 } defaults;
45 union
46 {
47 int num;
48 wchar_t *str;
49 struct in_addr ipv4;
50 } val;
51 CBCHAIN(conf_update, struct configvar *);
52};
53
54struct configcmd
55{
56 char *name;
57 int (*handler)(int argc, wchar_t **argv);
58};
59
60struct configmod
61{
62 struct configmod *next;
63 char *name;
64 struct configvar *vars;
65 struct configcmd *cmds;
66};
67
68struct configvar *confgetvar(char *modname, char *varname);
69#define confgetint(m, v) (confgetvar((m), (v))->val.num)
70#define confgetstr(m, v) (confgetvar((m), (v))->val.str)
71void confregmod(struct configmod *mod);
72void readconfig(FILE *stream);
73char *findconfigfile(void);
74
75#endif