1 /* config.h - configuration abstraction structure */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2005 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 typedef struct ConfigTable {
23 unsigned int arg_type;
26 AttributeDescription *ad;
30 #define ARGS_USERLAND 0x00000fff
31 #define ARGS_TYPES 0x000ff000
32 #define ARGS_POINTER 0x0003f000
33 #define ARGS_NUMERIC 0x0000f000
34 #define ARG_INT 0x00001000
35 #define ARG_LONG 0x00002000
36 #define ARG_BER_LEN_T 0x00004000
37 #define ARG_ON_OFF 0x00008000
38 #define ARG_STRING 0x00010000
39 #define ARG_BERVAL 0x00020000
40 #define ARG_DN 0x00040000
41 #define ARG_IGNORED 0x00080000
43 #define ARGS_SYNTAX 0xfff00000
44 #define ARG_PRE_BI 0x00100000
45 #define ARG_PRE_DB 0x00200000
46 #define ARG_DB 0x00400000 /* Only applies to DB */
47 #define ARG_MAY_DB 0x00800000 /* May apply to DB */
48 #define ARG_PAREN 0x01000000
49 #define ARG_NONZERO 0x02000000
50 #define ARG_UNIQUE 0x10000000
51 #define ARG_MUTEX 0x20000000 /* modify in single-thread mode */
52 #define ARG_OFFSET 0x40000000
53 #define ARG_MAGIC 0x80000000
55 #define ARG_BAD_CONF 0xdead0000 /* overload return values */
56 #define ARG_UNKNOWN 0xc0de0000
58 extern ConfigTable config_back_cf_table[];
60 typedef struct ConfigOCs {
65 typedef struct config_args_s {
72 char log[PATH_MAX + STRLENOF(": line 18446744073709551615") + 1];
74 /* parsed first val for simple cases */
83 struct berval vdn_ndn;
86 /* return values for emit mode */
87 BerVarray rvalue_vals;
88 BerVarray rvalue_nvals;
89 #define SLAP_CONFIG_EMIT 0x2000 /* emit instead of set */
91 int type; /* ConfigTable.arg_type & ARGS_USERLAND */
96 #define value_int values.v_int
97 #define value_long values.v_long
98 #define value_ber_t values.v_ber_t
99 #define value_string values.v_string
100 #define value_bv values.v_bv
101 #define value_dn values.v_dn.vdn_dn
102 #define value_ndn values.v_dn.vdn_ndn
104 typedef int (ConfigDriver)(ConfigArgs *c);
106 int config_get_vals(ConfigTable *ct, ConfigArgs *c);
107 int config_add_vals(ConfigTable *ct, ConfigArgs *c);
108 ConfigTable * config_find_keyword(ConfigTable *ct, ConfigArgs *c);