summaryrefslogtreecommitdiff
path: root/include/mailutils/libcfg.h
blob: d8600edc18a1d62bf7c0c29697ed07a46bd85397 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* GNU Mailutils -- a suite of utilities for electronic mail
   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General
   Public License along with this library; if not, write to the
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301 USA */

#ifndef _MAILUTILS_LIBCFG_H
#define _MAILUTILS_LIBCFG_H

#include <mailutils/cfg.h>
#include <mailutils/gocs.h>
#include <mailutils/nls.h>
#include <mailutils/error.h>
#include <mailutils/errno.h>

#ifndef MU_CONFIG_FILE
# define MU_CONFIG_FILE SYSCONFDIR "/mailutils.rc"
#endif

#ifndef MU_USER_CONFIG_FILE
# define MU_USER_CONFIG_FILE "~/.mailutils"
#endif

#ifdef __cplusplus
extern "C" {
#endif

struct mu_cfg_capa
{
  char *name;
  struct mu_cfg_param *cfgparam;
  mu_cfg_section_fp parser;
};

extern int mu_register_cfg_capa (const char *name,
				 struct mu_cfg_param *cfgparam,
				 mu_cfg_section_fp *parser);

extern void mu_libcfg_init (char **cnames);
extern int mu_parse_config_files (struct mu_cfg_param *param,
				  void *target_ptr) MU_CFG_DEPRECATED;
int mu_libcfg_parse_config (mu_cfg_tree_t **ptree);
  
extern void mu_acl_cfg_init (void);

#define __mu_common_cat2__(a,b) a ## b
#define __mu_common_cat3__(a,b,c) a ## b ## c
#define DCL_PARSER(capa)						      \
int									      \
__mu_common_cat3__(mu_,capa,_section_parser)				      \
     (enum mu_cfg_section_stage stage, const mu_cfg_node_t *node,	      \
      const char *section_label, void **section_data,                         \
      void *call_data, mu_cfg_tree_t *tree)	                              \
{									      \
  switch (stage)							      \
    {									      \
    case mu_cfg_section_start:						      \
      break;								      \
      									      \
    case mu_cfg_section_end:						      \
      mu_gocs_store (#capa, &__mu_common_cat2__(capa, _settings));	      \
    }									      \
  return 0;								      \
}

#define DCL_DEFAULT_CFG_CAPA(capa)                                            \
 struct mu_cfg_capa __mu_common_cat3__(mu_,capa,_cfg_capa) = {                \
      #capa,                                                                  \
      __mu_common_cat3__(mu_,capa,_param),                                    \
      __mu_common_cat3__(mu_,capa,_section_parser)                            \
 }

#define DCL_CFG_CAPA(capa)                                                    \
  DCL_PARSER (capa)                                                           \
  DCL_DEFAULT_CFG_CAPA (capa) 

extern struct mu_cfg_capa mu_mailbox_cfg_capa;
extern struct mu_cfg_capa mu_locking_cfg_capa;
extern struct mu_cfg_capa mu_address_cfg_capa;
extern struct mu_cfg_capa mu_mailer_cfg_capa;
extern struct mu_cfg_capa mu_logging_cfg_capa;
extern struct mu_cfg_capa mu_debug_cfg_capa;
extern struct mu_cfg_capa mu_gsasl_cfg_capa;
extern struct mu_cfg_capa mu_pam_cfg_capa;
extern struct mu_cfg_capa mu_radius_cfg_capa;
extern struct mu_cfg_capa mu_sql_cfg_capa;
extern struct mu_cfg_capa mu_tls_cfg_capa;
extern struct mu_cfg_capa mu_virtdomain_cfg_capa;
extern struct mu_cfg_capa mu_sieve_cfg_capa;
extern struct mu_cfg_capa mu_auth_cfg_capa;
extern struct mu_cfg_capa mu_ldap_cfg_capa;

#ifdef __cplusplus
}
#endif

#endif

Return to:

Send suggestions and report system problems to the System administrator.