Postfix3.3.1
mail_conf.h
[詳解]
1 #ifndef _MAIL_CONF_H_INCLUDED_
2 #define _MAIL_CONF_H_INCLUDED_
3 
4 /*++
5 /* NAME
6 /* mail_conf 3h
7 /* SUMMARY
8 /* global configuration parameter management
9 /* SYNOPSIS
10 /* #include <mail_conf.h>
11 /* DESCRIPTION
12 /* .nf
13 
14  /*
15  * Well known names. These are not configurable. One has to start somewhere.
16  */
17 #define CONFIG_DICT "mail_dict" /* global Postfix dictionary */
18 
19  /*
20  * Environment variables.
21  */
22 #define CONF_ENV_PATH "MAIL_CONFIG" /* config database */
23 #define CONF_ENV_VERB "MAIL_VERBOSE" /* verbose mode on */
24 #define CONF_ENV_DEBUG "MAIL_DEBUG" /* live debugging */
25 #define CONF_ENV_LOGTAG "MAIL_LOGTAG" /* instance name */
26 
27  /*
28  * External representation for booleans.
29  */
30 #define CONFIG_BOOL_YES "yes"
31 #define CONFIG_BOOL_NO "no"
32 
33  /*
34  * Basic configuration management.
35  */
36 extern void mail_conf_read(void);
37 extern void mail_conf_suck(void);
38 extern void mail_conf_flush(void);
39 extern void mail_conf_checkdir(const char *);
40 
41 extern void mail_conf_update(const char *, const char *);
42 extern const char *mail_conf_lookup(const char *);
43 extern const char *mail_conf_eval(const char *);
44 extern const char *mail_conf_eval_once(const char *);
45 extern const char *mail_conf_lookup_eval(const char *);
46 
47  /*
48  * Specific parameter lookup routines.
49  */
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);
57 extern int get_mail_conf_nbool(const char *, const char *);
58 
59 extern char *get_mail_conf_str2(const char *, const char *, const char *, int, int);
60 extern int get_mail_conf_int2(const char *, const char *, int, int, int);
61 extern long get_mail_conf_long2(const char *, const char *, long, long, long);
62 extern int get_mail_conf_time2(const char *, const char *, int, int, int, int);
63 extern int get_mail_conf_nint2(const char *, const char *, int, int, int);
64 extern void check_mail_conf_str(const char *, const char *, int, int);
65 extern void check_mail_conf_time(const char *, int, int, int);
66 extern void check_mail_conf_int(const char *, int, int, int);
67 
68  /*
69  * Lookup with function-call defaults.
70  */
71 extern char *get_mail_conf_str_fn(const char *, const char *(*) (void), int, int);
72 extern int get_mail_conf_int_fn(const char *, int (*) (void), int, int);
73 extern long get_mail_conf_long_fn(const char *, long (*) (void), long, long);
74 extern int get_mail_conf_bool_fn(const char *, int (*) (void));
75 extern int get_mail_conf_time_fn(const char *, const char *(*) (void), int, int, int);
76 extern int get_mail_conf_nint_fn(const char *, const char *(*) (void), int, int);
77 extern char *get_mail_conf_raw_fn(const char *, const char *(*) (void), int, int);
78 extern int get_mail_conf_nbool_fn(const char *, const char *(*) (void));
79 
80  /*
81  * Update dictionary.
82  */
83 extern void set_mail_conf_str(const char *, const char *);
84 extern void set_mail_conf_int(const char *, int);
85 extern void set_mail_conf_long(const char *, long);
86 extern void set_mail_conf_bool(const char *, int);
87 extern void set_mail_conf_time(const char *, const char *);
88 extern void set_mail_conf_time_int(const char *, int);
89 extern void set_mail_conf_nint(const char *, const char *);
90 extern void set_mail_conf_nint_int(const char *, int);
91 extern void set_mail_conf_nbool(const char *, const char *);
92 
93 #define set_mail_conf_nbool_int(name, value) \
94  set_mail_conf_nbool((name), (value) ? CONFIG_BOOL_YES : CONFIG_BOOL_NO)
95 
96  /*
97  * Tables that allow us to selectively copy values from the global
98  * configuration file to global variables.
99  */
100 typedef struct {
101  const char *name; /* config variable name */
102  const char *defval; /* default value or null */
103  char **target; /* pointer to global variable */
104  int min; /* min length or zero */
105  int max; /* max length or zero */
107 
108 typedef struct {
109  const char *name; /* config variable name */
110  const char *defval; /* default value or null */
111  char **target; /* pointer to global variable */
112  int min; /* min length or zero */
113  int max; /* max length or zero */
115 
116 typedef struct {
117  const char *name; /* config variable name */
118  int defval; /* default value */
119  int *target; /* pointer to global variable */
120  int min; /* lower bound or zero */
121  int max; /* upper bound or zero */
123 
124 typedef struct {
125  const char *name; /* config variable name */
126  long defval; /* default value */
127  long *target; /* pointer to global variable */
128  long min; /* lower bound or zero */
129  long max; /* upper bound or zero */
131 
132 typedef struct {
133  const char *name; /* config variable name */
134  int defval; /* default value */
135  int *target; /* pointer to global variable */
137 
138 typedef struct {
139  const char *name; /* config variable name */
140  const char *defval; /* default value + default unit */
141  int *target; /* pointer to global variable */
142  int min; /* lower bound or zero */
143  int max; /* upper bound or zero */
145 
146 typedef struct {
147  const char *name; /* config variable name */
148  const char *defval; /* default value + default unit */
149  int *target; /* pointer to global variable */
150  int min; /* lower bound or zero */
151  int max; /* upper bound or zero */
153 
154 typedef struct {
155  const char *name; /* config variable name */
156  const char *defval; /* default value */
157  int *target; /* pointer to global variable */
159 
160 extern void get_mail_conf_str_table(const CONFIG_STR_TABLE *);
161 extern void get_mail_conf_int_table(const CONFIG_INT_TABLE *);
162 extern void get_mail_conf_long_table(const CONFIG_LONG_TABLE *);
163 extern void get_mail_conf_bool_table(const CONFIG_BOOL_TABLE *);
164 extern void get_mail_conf_time_table(const CONFIG_TIME_TABLE *);
165 extern void get_mail_conf_nint_table(const CONFIG_NINT_TABLE *);
166 extern void get_mail_conf_raw_table(const CONFIG_RAW_TABLE *);
167 extern void get_mail_conf_nbool_table(const CONFIG_NBOOL_TABLE *);
168 
169  /*
170  * Tables to initialize parameters from the global configuration file or
171  * from function calls.
172  */
173 typedef struct {
174  const char *name; /* config variable name */
175  const char *(*defval) (void); /* default value provider */
176  char **target; /* pointer to global variable */
177  int min; /* lower bound or zero */
178  int max; /* upper bound or zero */
180 
181 typedef struct {
182  const char *name; /* config variable name */
183  const char *(*defval) (void); /* default value provider */
184  char **target; /* pointer to global variable */
185  int min; /* lower bound or zero */
186  int max; /* upper bound or zero */
188 
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  int min; /* lower bound or zero */
194  int max; /* upper bound or zero */
196 
197 typedef struct {
198  const char *name; /* config variable name */
199  long (*defval) (void); /* default value provider */
200  long *target; /* pointer to global variable */
201  long min; /* lower bound or zero */
202  long max; /* upper bound or zero */
204 
205 typedef struct {
206  const char *name; /* config variable name */
207  int (*defval) (void); /* default value provider */
208  int *target; /* pointer to global variable */
210 
211 typedef struct {
212  const char *name; /* config variable name */
213  const char *(*defval) (void); /* default value provider */
214  int *target; /* pointer to global variable */
215  int min; /* lower bound or zero */
216  int max; /* upper bound or zero */
218 
219 typedef struct {
220  const char *name; /* config variable name */
221  const char *(*defval) (void); /* default value provider */
222  int *target; /* pointer to global variable */
224 
232 
233 /* LICENSE
234 /* .ad
235 /* .fi
236 /* The Secure Mailer license must be distributed with this software.
237 /* AUTHOR(S)
238 /* Wietse Venema
239 /* IBM T.J. Watson Research
240 /* P.O. Box 704
241 /* Yorktown Heights, NY 10598, USA
242 /*
243 /* Wietse Venema
244 /* Google, Inc.
245 /* 111 8th Avenue
246 /* New York, NY 10011, USA
247 /*--*/
248 
249 #endif
void set_mail_conf_nbool(const char *, const char *)
char * get_mail_conf_str2(const char *, const char *, const char *, int, int)
const char * name
Definition: mail_conf.h:220
const char * mail_conf_eval(const char *)
Definition: mail_conf.c:237
int get_mail_conf_nint2(const char *, const char *, int, int, int)
void set_mail_conf_str(const char *, const char *)
int get_mail_conf_nbool_fn(const char *, const char *(*)(void))
int get_mail_conf_int_fn(const char *, int(*)(void), int, int)
void set_mail_conf_time(const char *, const char *)
const char * name
Definition: mail_conf.h:212
int get_mail_conf_bool(const char *, int)
void get_mail_conf_nint_table(const CONFIG_NINT_TABLE *)
const char * defval
Definition: mail_conf.h:102
void get_mail_conf_nbool_table(const CONFIG_NBOOL_TABLE *)
void get_mail_conf_nbool_fn_table(const CONFIG_NBOOL_FN_TABLE *)
void mail_conf_update(const char *, const char *)
Definition: mail_conf.c:275
char * get_mail_conf_raw(const char *, const char *, int, int)
Definition: mail_conf_raw.c:91
void set_mail_conf_long(const char *, long)
int get_mail_conf_int(const char *, int, int, int)
const char * name
Definition: mail_conf.h:190
const char * name
Definition: mail_conf.h:155
const char * name
Definition: mail_conf.h:139
const char * defval
Definition: mail_conf.h:140
void set_mail_conf_nint(const char *, const char *)
const char * name
Definition: mail_conf.h:133
const char * name
Definition: mail_conf.h:206
void get_mail_conf_str_fn_table(const CONFIG_STR_FN_TABLE *)
long get_mail_conf_long2(const char *, const char *, long, long, long)
void get_mail_conf_time_table(const CONFIG_TIME_TABLE *)
void set_mail_conf_bool(const char *, int)
const char * defval
Definition: mail_conf.h:148
void get_mail_conf_nint_fn_table(const CONFIG_NINT_FN_TABLE *)
void get_mail_conf_raw_table(const CONFIG_RAW_TABLE *)
const char * name
Definition: mail_conf.h:117
const char * mail_conf_lookup_eval(const char *)
Definition: mail_conf.c:262
long get_mail_conf_long(const char *, long, long, long)
const char * name
Definition: mail_conf.h:198
void check_mail_conf_str(const char *, const char *, int, int)
int get_mail_conf_nbool(const char *, const char *)
int get_mail_conf_bool_fn(const char *, int(*)(void))
int get_mail_conf_time2(const char *, const char *, int, int, int, int)
const char * name
Definition: mail_conf.h:109
char ** target
Definition: mail_conf.h:111
void const char long
Definition: opened.h:22
void mail_conf_suck(void)
Definition: mail_conf.c:186
void get_mail_conf_long_fn_table(const CONFIG_LONG_FN_TABLE *)
int get_mail_conf_time_fn(const char *, const char *(*)(void), int, int, int)
const char * name
Definition: mail_conf.h:147
void get_mail_conf_raw_fn_table(const CONFIG_RAW_FN_TABLE *)
void get_mail_conf_str_table(const CONFIG_STR_TABLE *)
long get_mail_conf_long_fn(const char *, long(*)(void), long, long)
void mail_conf_flush(void)
Definition: mail_conf.c:229
void get_mail_conf_bool_table(const CONFIG_BOOL_TABLE *)
void mail_conf_checkdir(const char *)
Definition: mail_conf.c:134
int get_mail_conf_int2(const char *, const char *, int, int, int)
int get_mail_conf_nint(const char *, const char *, int, int)
const char * defval
Definition: mail_conf.h:156
void get_mail_conf_int_fn_table(const CONFIG_INT_FN_TABLE *)
int int
Definition: smtpd_proxy.h:21
void check_mail_conf_int(const char *, int, int, int)
char * get_mail_conf_raw_fn(const char *, const char *(*)(void), int, int)
void get_mail_conf_bool_fn_table(const CONFIG_BOOL_FN_TABLE *)
void mail_conf_read(void)
Definition: mail_conf.c:178
const char * name
Definition: mail_conf.h:125
void get_mail_conf_int_table(const CONFIG_INT_TABLE *)
void set_mail_conf_nint_int(const char *, int)
char * get_mail_conf_str_fn(const char *, const char *(*)(void), int, int)
void check_mail_conf_time(const char *, int, int, int)
const char * name
Definition: mail_conf.h:101
char * get_mail_conf_str(const char *, const char *, int, int)
void set_mail_conf_int(const char *, int)
void set_mail_conf_time_int(const char *, int)
int get_mail_conf_time(const char *, const char *, int, int)
void get_mail_conf_long_table(const CONFIG_LONG_TABLE *)
char ** target
Definition: mail_conf.h:103
const char * name
Definition: mail_conf.h:182
const char * mail_conf_lookup(const char *)
Definition: mail_conf.c:255
const char * defval
Definition: mail_conf.h:110
int get_mail_conf_nint_fn(const char *, const char *(*)(void), int, int)
const char * name
Definition: mail_conf.h:174
const char * mail_conf_eval_once(const char *)
Definition: mail_conf.c:246