3 #ifndef _MAIL_CONF_H_INCLUDED_
4 #define _MAIL_CONF_H_INCLUDED_
10 /* global configuration parameter management
12 /* #include <mail_conf.h>
17 * Well known names. These are not configurable. One has to start somewhere.
19 #define CONFIG_DICT "mail_dict" /* global Postfix dictionary */
22 * Environment variables.
24 #define CONF_ENV_PATH "MAIL_CONFIG" /* config database */
25 #define CONF_ENV_VERB "MAIL_VERBOSE" /* verbose mode on */
26 #define CONF_ENV_DEBUG "MAIL_DEBUG" /* live debugging */
27 #define CONF_ENV_LOGTAG "MAIL_LOGTAG" /* instance name */
30 * External representation for booleans.
32 #define CONFIG_BOOL_YES "yes"
33 #define CONFIG_BOOL_NO "no"
36 * Basic configuration management.
38 extern void mail_conf_read(void);
39 extern void mail_conf_suck(void);
40 extern void mail_conf_flush(void);
42 extern void mail_conf_update(const char *, const char *);
43 extern const char *mail_conf_lookup(const char *);
44 extern const char *mail_conf_eval(const char *);
45 extern const char *mail_conf_lookup_eval(const char *);
48 * Specific parameter lookup routines.
50 extern char *get_mail_conf_str(const char *, const char *, int, int);
51 extern int get_mail_conf_int(const char *, int, int, int);
52 extern long get_mail_conf_long(const char *, long, long, long);
53 extern int get_mail_conf_bool(const char *, int);
54 extern int get_mail_conf_time(const char *, const char *, int, int);
55 extern int get_mail_conf_nint(const char *, const char *, int, int);
56 extern char *get_mail_conf_raw(const char *, const char *, int, int);
58 extern char *get_mail_conf_str2(const char *, const char *, const char *, int, int);
59 extern int get_mail_conf_int2(const char *, const char *, int, int, int);
60 extern long get_mail_conf_long2(const char *, const char *, long, long, long);
61 extern int get_mail_conf_time2(const char *, const char *, int, int, int, int);
62 extern int get_mail_conf_nint2(const char *, const char *, int, int, int);
65 * Lookup with function-call defaults.
67 extern char *get_mail_conf_str_fn(const char *, const char *(*) (void), int, int);
68 extern int get_mail_conf_int_fn(const char *, int (*) (void), int, int);
69 extern long get_mail_conf_long_fn(const char *, long (*) (void), long, long);
70 extern int get_mail_conf_bool_fn(const char *, int (*) (void));
71 extern int get_mail_conf_time_fn(const char *, const char *(*) (void), int, int, int);
72 extern int get_mail_conf_nint_fn(const char *, const char *(*) (void), int, int);
73 extern char *get_mail_conf_raw_fn(const char *, const char *(*) (void), int, int);
78 extern void set_mail_conf_str(const char *, const char *);
79 extern void set_mail_conf_int(const char *, int);
80 extern void set_mail_conf_long(const char *, long);
81 extern void set_mail_conf_bool(const char *, int);
82 extern void set_mail_conf_time(const char *, const char *);
83 extern void set_mail_conf_time_int(const char *, int);
84 extern void set_mail_conf_nint(const char *, const char *);
85 extern void set_mail_conf_nint_int(const char *, int);
88 * Tables that allow us to selectively copy values from the global
89 * configuration file to global variables.
92 const char *name
; /* config variable name */
93 const char *defval
; /* default value or null */
94 char **target
; /* pointer to global variable */
95 int min
; /* min length or zero */
96 int max
; /* max length or zero */
100 const char *name
; /* config variable name */
101 const char *defval
; /* default value or null */
102 char **target
; /* pointer to global variable */
103 int min
; /* min length or zero */
104 int max
; /* max length or zero */
108 const char *name
; /* config variable name */
109 int defval
; /* default value */
110 int *target
; /* pointer to global variable */
111 int min
; /* lower bound or zero */
112 int max
; /* upper bound or zero */
116 const char *name
; /* config variable name */
117 long defval
; /* default value */
118 long *target
; /* pointer to global variable */
119 long min
; /* lower bound or zero */
120 long max
; /* upper bound or zero */
124 const char *name
; /* config variable name */
125 int defval
; /* default value */
126 int *target
; /* pointer to global variable */
130 const char *name
; /* config variable name */
131 const char *defval
; /* default value + default unit */
132 int *target
; /* pointer to global variable */
133 int min
; /* lower bound or zero */
134 int max
; /* upper bound or zero */
138 const char *name
; /* config variable name */
139 const char *defval
; /* default value + default unit */
140 int *target
; /* pointer to global variable */
141 int min
; /* lower bound or zero */
142 int max
; /* upper bound or zero */
145 extern void get_mail_conf_str_table(const CONFIG_STR_TABLE
*);
146 extern void get_mail_conf_int_table(const CONFIG_INT_TABLE
*);
147 extern void get_mail_conf_long_table(const CONFIG_LONG_TABLE
*);
148 extern void get_mail_conf_bool_table(const CONFIG_BOOL_TABLE
*);
149 extern void get_mail_conf_time_table(const CONFIG_TIME_TABLE
*);
150 extern void get_mail_conf_nint_table(const CONFIG_NINT_TABLE
*);
151 extern void get_mail_conf_raw_table(const CONFIG_RAW_TABLE
*);
154 * Tables to initialize parameters from the global configuration file or
155 * from function calls.
158 const char *name
; /* config variable name */
159 const char *(*defval
) (void); /* default value provider */
160 char **target
; /* pointer to global variable */
161 int min
; /* lower bound or zero */
162 int max
; /* upper bound or zero */
163 } CONFIG_STR_FN_TABLE
;
166 const char *name
; /* config variable name */
167 const char *(*defval
) (void); /* default value provider */
168 char **target
; /* pointer to global variable */
169 int min
; /* lower bound or zero */
170 int max
; /* upper bound or zero */
171 } CONFIG_RAW_FN_TABLE
;
174 const char *name
; /* config variable name */
175 int (*defval
) (void); /* default value provider */
176 int *target
; /* pointer to global variable */
177 int min
; /* lower bound or zero */
178 int max
; /* upper bound or zero */
179 } CONFIG_INT_FN_TABLE
;
182 const char *name
; /* config variable name */
183 long (*defval
) (void); /* default value provider */
184 long *target
; /* pointer to global variable */
185 long min
; /* lower bound or zero */
186 long max
; /* upper bound or zero */
187 } CONFIG_LONG_FN_TABLE
;
190 const char *name
; /* config variable name */
191 int (*defval
) (void); /* default value provider */
192 int *target
; /* pointer to global variable */
193 } CONFIG_BOOL_FN_TABLE
;
196 const char *name
; /* config variable name */
197 const char *(*defval
) (void); /* default value provider */
198 int *target
; /* pointer to global variable */
199 int min
; /* lower bound or zero */
200 int max
; /* upper bound or zero */
201 } CONFIG_NINT_FN_TABLE
;
203 extern void get_mail_conf_str_fn_table(const CONFIG_STR_FN_TABLE
*);
204 extern void get_mail_conf_int_fn_table(const CONFIG_INT_FN_TABLE
*);
205 extern void get_mail_conf_long_fn_table(const CONFIG_LONG_FN_TABLE
*);
206 extern void get_mail_conf_bool_fn_table(const CONFIG_BOOL_FN_TABLE
*);
207 extern void get_mail_conf_raw_fn_table(const CONFIG_RAW_FN_TABLE
*);
208 extern void get_mail_conf_nint_fn_table(const CONFIG_NINT_FN_TABLE
*);
213 /* The Secure Mailer license must be distributed with this software.
216 /* IBM T.J. Watson Research
218 /* Yorktown Heights, NY 10598, USA