smf_settings.h
Go to the documentation of this file.
1 /* spmfilter - mail filtering framework
2  * Copyright (C) 2009-2012 Axel Steiner and SpaceNet AG
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 3 of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
26 #ifndef _SMF_SETTINGS_H
27 #define _SMF_SETTINGS_H
28 
29 #include "spmfilter_config.h"
30 #include "smf_dict.h"
31 #include "smf_list.h"
32 
37 typedef enum {
42 
47 typedef enum {
51 
56 typedef struct {
57  int debug;
58  char *config_file;
59  char *queue_dir;
60  char *engine;
63  char *nexthop;
66  char *backend;
67  char *backend_connection;
77  int add_header;
78  unsigned long max_size;
80  char *lib_dir;
81  char *pid_file;
82  char *bind_ip;
83  int bind_port;
85  int foreground;
86  char *user;
87  char *group;
88  int max_childs;
95  char *sql_driver;
96  char *sql_name;
98  int sql_port;
99  char *sql_user;
100  char *sql_pass;
102  char *sql_encoding;
105  char *ldap_uri;
107  int ldap_port;
108  char *ldap_binddn;
109  char *ldap_bindpw;
110  char *ldap_base;
112  char *ldap_scope;
120 } SMFSettings_T;
121 
122 
130 int smf_settings_set_debug(SMFSettings_T *settings, int debug);
131 
138 int smf_settings_get_debug(SMFSettings_T *settings);
139 
147 int smf_settings_set_config_file(SMFSettings_T *settings, char *cf);
148 
155 char *smf_settings_get_config_file(SMFSettings_T *settings);
156 
164 int smf_settings_set_queue_dir(SMFSettings_T *settings, char *qd);
165 
172 char *smf_settings_get_queue_dir(SMFSettings_T *settings);
173 
180 void smf_settings_set_engine(SMFSettings_T *settings, char *engine);
181 
188 char *smf_settings_get_engine(SMFSettings_T *settings);
189 
197 int smf_settings_add_module(SMFSettings_T *settings, char *module);
198 
205 SMFList_T *smf_settings_get_modules(SMFSettings_T *settings);
206 
216 void smf_settings_set_module_fail(SMFSettings_T *settings, int i);
217 
224 int smf_settings_get_module_fail(SMFSettings_T *settings);
225 
234 void smf_settings_set_nexthop(SMFSettings_T *settings, char *nexthop);
235 
242 char *smf_settings_get_nexthop(SMFSettings_T *settings);
243 
253 void smf_settings_set_nexthop_fail_code(SMFSettings_T *settings, int i);
254 
261 int smf_settings_get_nexthop_fail_code(SMFSettings_T *settings);
262 
272 void smf_settings_set_nexthop_fail_msg(SMFSettings_T *settings, char *msg);
273 
280 char *smf_settings_get_nexthop_fail_msg(SMFSettings_T *settings);
281 
288 void smf_settings_set_backend(SMFSettings_T *settings, char *backend);
289 
296 char *smf_settings_get_backend(SMFSettings_T *settings);
297 
314 void smf_settings_set_backend_connection(SMFSettings_T *settings, char *conn);
315 
322 char *smf_settings_get_backend_connection(SMFSettings_T *settings);
323 
330 void smf_settings_set_add_header(SMFSettings_T *settings, int i);
331 
338 int smf_settings_get_add_header(SMFSettings_T *settings);
339 
346 void smf_settings_set_max_size(SMFSettings_T *settings, unsigned long size);
347 
354 unsigned long smf_settings_get_max_size(SMFSettings_T *settings);
355 
362 void smf_settings_set_tls(SMFSettings_T *settings, SMFTlsOption_T t);
363 
370 SMFTlsOption_T smf_settings_get_tls(SMFSettings_T *settings);
371 
378 void smf_settings_set_lib_dir(SMFSettings_T *settings, char *lib_dir);
379 
386 char *smf_settings_get_lib_dir(SMFSettings_T *settings);
387 
394 void smf_settings_set_pid_file(SMFSettings_T *settings, char *pid_file);
395 
402 char *smf_settings_get_pid_file(SMFSettings_T *settings);
403 
410 void smf_settings_set_bind_ip(SMFSettings_T *settings, char *ip);
411 
418 char *smf_settings_get_bind_ip(SMFSettings_T *settings);
419 
426 void smf_settings_set_bind_port(SMFSettings_T *settings, int port);
427 
434 int smf_settings_get_bind_port(SMFSettings_T *settings);
435 
442 void smf_settings_set_listen_backlog(SMFSettings_T *settings, int backlog);
443 
450 int smf_settings_get_listen_backlog(SMFSettings_T *settings);
451 
458 void smf_settings_set_foreground(SMFSettings_T *settings, int foreground);
459 
466 int smf_settings_get_foreground(SMFSettings_T *settings);
467 
474 void smf_settings_set_user(SMFSettings_T *settings, char *user);
475 
482 char *smf_settings_get_user(SMFSettings_T *settings);
483 
490 void smf_settings_set_group(SMFSettings_T *settings, char *group);
491 
498 char *smf_settings_get_group(SMFSettings_T *settings);
499 
506 void smf_settings_set_max_childs(SMFSettings_T *settings, int max_childs);
507 
514 int smf_settings_get_max_childs(SMFSettings_T *settings);
515 
522 void smf_settings_set_spare_childs(SMFSettings_T *settings, int spare_childs);
523 
530 int smf_settings_get_spare_childs(SMFSettings_T *settings);
531 
538 void smf_settings_set_syslog_facility(SMFSettings_T *settings, char *facility);
539 
546 int smf_settings_get_syslog_facility(SMFSettings_T *settings);
547 
556 int smf_settings_set_smtp_code(SMFSettings_T *settings, int code, char *msg);
557 
565 char *smf_settings_get_smtp_code(SMFSettings_T *settings, int code);
566 
573 void smf_settings_set_smtpd_timeout(SMFSettings_T *settings, int timeout);
574 
581 int smf_settings_get_smtpd_timeout(SMFSettings_T *settings);
582 
593 void smf_settings_set_sql_driver(SMFSettings_T *settings, char *driver);
594 
601 char *smf_settings_get_sql_driver(SMFSettings_T *settings);
602 
609 void smf_settings_set_sql_name(SMFSettings_T *settings, char *name);
610 
617 char *smf_settings_get_sql_name(SMFSettings_T *settings);
618 
626 int smf_settings_add_sql_host(SMFSettings_T *settings, char *host);
627 
634 SMFList_T *smf_settings_get_sql_hosts(SMFSettings_T *settings);
635 
642 void smf_settings_set_sql_port(SMFSettings_T *settings, int port);
643 
650 int smf_settings_get_sql_port(SMFSettings_T *settings);
651 
658 void smf_settings_set_sql_user(SMFSettings_T *settings, char *user);
659 
666 char *smf_settings_get_sql_user(SMFSettings_T *settings);
667 
674 void smf_settings_set_sql_pass(SMFSettings_T *settings, char *pass);
675 
682 char *smf_settings_get_sql_pass(SMFSettings_T *settings);
683 
690 void smf_settings_set_sql_user_query(SMFSettings_T *settings, char *query);
691 
698 char *smf_settings_get_sql_user_query(SMFSettings_T *settings);
699 
706 void smf_settings_set_sql_encoding(SMFSettings_T *settings, char *encoding);
707 
714 char *smf_settings_get_sql_encoding(SMFSettings_T *settings);
715 
722 void smf_settings_set_sql_max_connections(SMFSettings_T *settings, int i);
723 
730 int smf_settings_get_sql_max_connections(SMFSettings_T *settings);
731 
738 void smf_settings_set_ldap_uri(SMFSettings_T *settings, char *uri);
739 
746 char *smf_settings_get_ldap_uri(SMFSettings_T *settings);
747 
755 int smf_settings_add_ldap_host(SMFSettings_T *settings, char *host);
756 
763 SMFList_T *smf_settings_get_ldap_hosts(SMFSettings_T *settings);
764 
771 void smf_settings_set_ldap_port(SMFSettings_T *settings, int port);
772 
779 int smf_settings_get_ldap_port(SMFSettings_T *settings);
780 
787 void smf_settings_set_ldap_binddn(SMFSettings_T *settings, char *binddn);
788 
795 char *smf_settings_get_ldap_binddn(SMFSettings_T *settings);
796 
803 void smf_settings_set_ldap_bindpw(SMFSettings_T *settings, char *bindpw);
804 
811 char *smf_settings_get_ldap_bindpw(SMFSettings_T *settings);
812 
819 void smf_settings_set_ldap_base(SMFSettings_T *settings, char *base);
820 
827 char *smf_settings_get_ldap_base(SMFSettings_T *settings);
828 
835 void smf_settings_set_ldap_referrals(SMFSettings_T *settings, int i);
836 
843 int smf_settings_get_ldap_referrals(SMFSettings_T *settings);
844 
855 void smf_settings_set_ldap_scope(SMFSettings_T *settings, char *scope);
856 
863 char *smf_settings_get_ldap_scope(SMFSettings_T *settings);
864 
871 void smf_settings_set_ldap_user_query(SMFSettings_T *settings, char *query);
872 
879 char *smf_settings_get_ldap_user_query(SMFSettings_T *settings);
880 
887 void smf_settings_set_lookup_persistent(SMFSettings_T *settings, int persistent);
888 
895 int smf_settings_get_lookup_persistent(SMFSettings_T *settings);
896 
905 char *smf_settings_group_get(SMFSettings_T *settings, char *group_name, char *key);
906 
915 int smf_settings_group_get_integer(SMFSettings_T *settings, char *group_name, char *key);
916 
925 int smf_settings_group_get_boolean(SMFSettings_T *settings, char *group_name, char *key);
926 
935 SMFList_T *smf_settings_group_get_list(SMFSettings_T *settings, char *group_name, char *key);
936 
937 #endif /* _SMF_SETTINGS_H */