]> git.sur5r.net Git - openldap/blob - servers/slapd/config.h
Fix compiler error and warnings.
[openldap] / servers / slapd / config.h
1 /* config.h - configuration abstraction structure */
2
3 /* $OpenLDAP$ */
4 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5  *
6  * Copyright 1998-2005 The OpenLDAP Foundation.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted only as authorized by the OpenLDAP
11  * Public License.
12  *
13  * A copy of this license is available in the file LICENSE in the
14  * top-level directory of the distribution or, alternatively, at
15  * <http://www.OpenLDAP.org/license.html>.
16  */
17
18 typedef struct ConfigTable {
19         char *name;
20         char *what;
21         int min_args;
22         int max_args;
23         int length;
24         unsigned int arg_type;
25         void *arg_item;
26         char *attribute;
27         AttributeDescription *ad;
28         void *notify;
29 } ConfigTable;
30
31 #define ARGS_USERLAND   0x00000fff
32 #define ARGS_TYPES      0x000ff000
33 #define ARGS_POINTER    0x0001f000
34 #define ARGS_NUMERIC    0x0000f000
35 #define ARG_INT         0x00001000
36 #define ARG_LONG        0x00002000
37 #define ARG_BER_LEN_T   0x00004000
38 #define ARG_ON_OFF      0x00008000
39 #define ARG_STRING      0x00010000
40 #define ARG_DN          0x00020000
41 #define ARG_EXISTS      0x00040000      /* XXX not yet */
42 #define ARG_IGNORED     0x00080000
43
44 #define ARGS_SYNTAX     0xfff00000
45 #define ARG_PRE_BI      0x00100000
46 #define ARG_PRE_DB      0x00200000
47 #define ARG_DB          0x00400000      /* Only applies to DB */
48 #define ARG_MAY_DB      0x00800000      /* May apply to DB */
49 #define ARG_PAREN       0x01000000
50 #define ARG_NONZERO     0x02000000
51 #define ARG_UNIQUE      0x10000000
52 #define ARG_MUTEX       0x20000000      /* modify in single-thread mode */
53 #define ARG_OFFSET      0x40000000
54 #define ARG_MAGIC       0x80000000
55
56 #define ARG_BAD_CONF    0xdead0000      /* overload return values */
57 #define ARG_UNKNOWN     0xc0de0000
58
59 typedef struct config_args_s {
60         int argc;
61         char **argv;
62         int argv_size;
63         char *line;
64         const char *fname;
65         unsigned long lineno;
66         char log[PATH_MAX + STRLENOF(": line 18446744073709551615") + 1];
67         int depth;
68         /* parsed first val for simple cases */
69         union {
70                 int v_int;
71                 long v_long;
72                 ber_len_t v_ber_t;
73                 char *v_string;
74                 struct {
75                         struct berval vdn_dn;
76                         struct berval vdn_ndn;
77                 } v_dn;
78         } values;
79         /* return values for emit mode */
80         BerVarray rvalue_vals;
81         BerVarray rvalue_nvals;
82         int emit;       /* emit instead of setting */
83         int type;       /* ConfigTable.arg_type & ARGS_USERLAND */
84         BackendDB *be;
85         BackendInfo *bi;
86 } ConfigArgs;
87
88 #define value_int values.v_int
89 #define value_long values.v_long
90 #define value_ber_t values.v_ber_t
91 #define value_string values.v_string
92 #define value_dn values.v_dn.vdn_dn
93 #define value_ndn values.v_dn.vdn_ndn
94
95 typedef int (ConfigDriver)(ConfigArgs *c);
96
97 #ifdef SLAPD_MODULES
98 typedef struct modpath_s {
99         struct modpath_s *mp_next;
100         struct berval mp_path;
101         BerVarray mp_loads;
102 } ModPaths;
103 #endif
104
105 typedef struct ConfigFile {
106         struct ConfigFile *c_sibs;
107         struct ConfigFile *c_kids;
108         struct berval c_file;
109 #ifdef SLAPD_MODULES
110         ModPaths c_modpaths;
111         ModPaths *c_modlast;
112 #endif
113         BerVarray c_dseFiles;
114 } ConfigFile;
115
116 int config_back_init( ConfigFile *cfp, ConfigTable *ct );
117 int config_get_vals(ConfigTable *ct, ConfigArgs *c);