Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / global / mail_conf.h
blob5e54003e9c3d29c4428944b09fbe374a6347dbe3
1 /* $NetBSD$ */
3 #ifndef _MAIL_CONF_H_INCLUDED_
4 #define _MAIL_CONF_H_INCLUDED_
6 /*++
7 /* NAME
8 /* mail_conf 3h
9 /* SUMMARY
10 /* global configuration parameter management
11 /* SYNOPSIS
12 /* #include <mail_conf.h>
13 /* DESCRIPTION
14 /* .nf
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);
76 * Update dictionary.
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.
91 typedef struct {
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 */
97 } CONFIG_STR_TABLE;
99 typedef struct {
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 */
105 } CONFIG_RAW_TABLE;
107 typedef struct {
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 */
113 } CONFIG_INT_TABLE;
115 typedef struct {
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 */
121 } CONFIG_LONG_TABLE;
123 typedef struct {
124 const char *name; /* config variable name */
125 int defval; /* default value */
126 int *target; /* pointer to global variable */
127 } CONFIG_BOOL_TABLE;
129 typedef struct {
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 */
135 } CONFIG_TIME_TABLE;
137 typedef struct {
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 */
143 } CONFIG_NINT_TABLE;
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.
157 typedef struct {
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;
165 typedef struct {
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;
173 typedef struct {
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;
181 typedef struct {
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;
189 typedef struct {
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;
195 typedef struct {
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 *);
210 /* LICENSE
211 /* .ad
212 /* .fi
213 /* The Secure Mailer license must be distributed with this software.
214 /* AUTHOR(S)
215 /* Wietse Venema
216 /* IBM T.J. Watson Research
217 /* P.O. Box 704
218 /* Yorktown Heights, NY 10598, USA
219 /*--*/
221 #endif