Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

cfg_core.c

Go to the documentation of this file.
00001 /*
00002  * $Id: cfg_core.c,v 1.10 2009/01/06 17:14:12 ondra Exp $
00003  *
00004  * Copyright (C) 2007 iptelorg GmbH
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  * History
00028  * -------
00029  *  2007-12-03  Initial version (Miklos)
00030  *  2008-01-31  added DNS resolver parameters (Miklos)
00031  */
00032 
00033 #include "dprint.h"
00034 #ifdef USE_DST_BLACKLIST
00035 #include "dst_blacklist.h"
00036 #endif
00037 #include "resolve.h"
00038 #ifdef USE_DNS_CACHE
00039 #include "dns_cache.h"
00040 #endif
00041 #if defined PKG_MALLOC || defined SHM_MEM
00042 #include "pt.h"
00043 #endif
00044 #include "msg_translator.h" /* fix_global_req_flags() */
00045 #include "cfg/cfg.h"
00046 #include "cfg_core.h"
00047 
00048 struct cfg_group_core default_core_cfg = {
00049         L_WARN,         /*  print only msg. < L_WARN */
00050         LOG_DAEMON,     /* log_facility -- see syslog(3) */
00051 #ifdef USE_DST_BLACKLIST
00052         /* blacklist */
00053         0, /* dst blacklist is disabled by default */
00054         DEFAULT_BLST_TIMEOUT,
00055         DEFAULT_BLST_MAX_MEM,
00056 #endif
00057         /* resolver */
00058 #ifdef USE_IPV6
00059         1,  /* dns_try_ipv6 -- on by default */
00060 #else
00061         0,  /* dns_try_ipv6 -- off, if no ipv6 support */
00062 #endif
00063         0,  /* dns_try_naptr -- off by default */
00064         30,  /* udp transport preference (for naptr) */
00065         20,  /* tcp transport preference (for naptr) */
00066         10,  /* tls transport preference (for naptr) */
00067         20,  /* sctp transport preference (for naptr) */
00068         -1, /* dns_retr_time */
00069         -1, /* dns_retr_no */
00070         -1, /* dns_servers_no */
00071         1,  /* dns_search_list */
00072         1,  /* dns_search_fmatch */
00073         0,  /* dns_reinit */
00074         /* DNS cache */
00075 #ifdef USE_DNS_CACHE
00076         1,  /* use_dns_cache -- on by default */
00077         0,  /* dns_cache_flags */
00078         0,  /* use_dns_failover -- off by default */
00079         0,  /* dns_srv_lb -- off by default */
00080         DEFAULT_DNS_NEG_CACHE_TTL, /* neg. cache ttl */
00081         DEFAULT_DNS_CACHE_MIN_TTL, /* minimum ttl */
00082         DEFAULT_DNS_CACHE_MAX_TTL, /* maximum ttl */
00083         DEFAULT_DNS_MAX_MEM, /* dns_cache_max_mem */
00084         0, /* dns_cache_del_nonexp -- delete only expired entries by default */
00085 #endif
00086 #ifdef PKG_MALLOC
00087         0, /* mem_dump_pkg */
00088 #endif
00089 #ifdef SHM_MEM
00090         0, /* mem_dump_shm */
00091 #endif
00092         0, /* udp_mtu (disabled by default) */
00093         0, /* udp_mtu_try_proto -> default disabled */
00094         0  /* force_rport */ 
00095 };
00096 
00097 void    *core_cfg = &default_core_cfg;
00098 
00099 cfg_def_t core_cfg_def[] = {
00100         {"debug",               CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
00101                 "debug level"},
00102         {"log_facility",        CFG_VAR_INT|CFG_INPUT_STRING,   0, 0, log_facility_fixup, 0,
00103                 "syslog facility, see \"man 3 syslog\""},
00104 #ifdef USE_DST_BLACKLIST
00105         /* blacklist */
00106         {"use_dst_blacklist",   CFG_VAR_INT,    0, 1, use_dst_blacklist_fixup, 0,
00107                 "enable/disable destination blacklisting"},
00108         {"dst_blacklist_expire",        CFG_VAR_INT,    0, 0, 0, 0,
00109                 "how much time (in s) a blacklisted destination is kept in the list"},
00110         {"dst_blacklist_mem",   CFG_VAR_INT,    0, 0, blst_max_mem_fixup, 0,
00111                 "maximum shared memory amount (in KB) used for keeping the blacklisted destinations"},
00112 #endif
00113         /* resolver */
00114 #ifdef USE_DNS_CACHE
00115         {"dns_try_ipv6",        CFG_VAR_INT,    0, 1, dns_try_ipv6_fixup, fix_dns_flags,
00116 #else
00117         {"dns_try_ipv6",        CFG_VAR_INT,    0, 1, dns_try_ipv6_fixup, 0,
00118 #endif
00119                 "enable/disable IPv6 DNS lookups"},
00120 #ifdef USE_DNS_CACHE
00121         {"dns_try_naptr",       CFG_VAR_INT,    0, 1, 0, fix_dns_flags,
00122 #else
00123         {"dns_try_naptr",       CFG_VAR_INT,    0, 1, 0, 0,
00124 #endif
00125                 "enable/disable NAPTR DNS lookups"},
00126         {"dns_udp_pref",        CFG_VAR_INT,    0, 0, 0, reinit_naptr_proto_prefs,
00127                 "udp protocol preference when doing NAPTR lookups"},
00128         {"dns_tcp_pref",        CFG_VAR_INT,    0, 0, 0, reinit_naptr_proto_prefs,
00129                 "tcp protocol preference when doing NAPTR lookups"},
00130         {"dns_tls_pref",        CFG_VAR_INT,    0, 0, 0, reinit_naptr_proto_prefs,
00131                 "tls protocol preference when doing NAPTR lookups"},
00132         {"dns_sctp_pref",       CFG_VAR_INT,    0, 0, 0, reinit_naptr_proto_prefs,
00133                 "sctp protocol preference when doing NAPTR lookups"},
00134         {"dns_retr_time",       CFG_VAR_INT,    0, 0, 0, resolv_reinit,
00135                 "time in s before retrying a dns request"},
00136         {"dns_retr_no",         CFG_VAR_INT,    0, 0, 0, resolv_reinit,
00137                 "number of dns retransmissions before giving up"},
00138         {"dns_servers_no",      CFG_VAR_INT,    0, 0, 0, resolv_reinit,
00139                 "how many dns servers from the ones defined in "
00140                 "/etc/resolv.conf will be used"},
00141         {"dns_use_search_list", CFG_VAR_INT,    0, 1, 0, resolv_reinit,
00142                 "if set to 0, the search list in /etc/resolv.conf is ignored"},
00143         {"dns_search_full_match",       CFG_VAR_INT,    0, 1, 0, 0,
00144                 "enable/disable domain name checks against the search list "
00145                 "in DNS answers"},
00146         {"dns_reinit",          CFG_VAR_INT|CFG_INPUT_INT,      1, 1, dns_reinit_fixup, resolv_reinit,
00147                 "set to 1 in order to reinitialize the DNS resolver"},
00148         /* DNS cache */
00149 #ifdef USE_DNS_CACHE
00150         {"use_dns_cache",       CFG_VAR_INT,    0, 1, use_dns_cache_fixup, 0,
00151                 "enable/disable the dns cache"},
00152         {"dns_cache_flags",     CFG_VAR_INT,    0, 4, 0, fix_dns_flags,
00153                 "dns cache specific resolver flags "
00154                 "(1=ipv4 only, 2=ipv6 only, 4=prefer ipv6"},
00155         {"use_dns_failover",    CFG_VAR_INT,    0, 1, use_dns_failover_fixup, 0,
00156                 "enable/disable dns failover in case the destination "
00157                 "resolves to multiple ip addresses and/or multiple SRV records "
00158                 "(depends on use_dns_cache)"},
00159         {"dns_srv_lb",          CFG_VAR_INT,    0, 1, 0, fix_dns_flags,
00160                 "enable/disable load balancing to different srv records "
00161                 "of the same priority based on the srv records weights "
00162                 "(depends on dns_failover)"},
00163         {"dns_cache_negative_ttl",      CFG_VAR_INT,    0, 0, 0, 0,
00164                 "time to live for negative results (\"not found\") "
00165                 "in seconds. Use 0 to disable"},
00166         {"dns_cache_min_ttl",   CFG_VAR_INT,    0, 0, 0, 0,
00167                 "minimum accepted time to live for a record, in seconds"},
00168         {"dns_cache_max_ttl",   CFG_VAR_INT,    0, 0, 0, 0,
00169                 "maximum accepted time to live for a record, in seconds"},
00170         {"dns_cache_mem",       CFG_VAR_INT,    0, 0, dns_cache_max_mem_fixup, 0,
00171                 "maximum memory used for the dns cache in Kb"},
00172         {"dns_cache_del_nonexp",        CFG_VAR_INT,    0, 1, 0, 0,
00173                 "allow deletion of non-expired records from the cache when "
00174                 "there is no more space left for new ones"},
00175 #endif
00176 #ifdef PKG_MALLOC
00177         {"mem_dump_pkg",        CFG_VAR_INT,    0, 0, 0, mem_dump_pkg_cb,
00178                 "dump process memory status, parameter: pid_number"},
00179 #endif
00180 #ifdef SHM_MEM
00181         {"mem_dump_shm",        CFG_VAR_INT,    0, 0, mem_dump_shm_fixup, 0,
00182                 "dump shared memory status"},
00183 #endif
00184         {"udp_mtu",     CFG_VAR_INT|CFG_ATOMIC, 0, 65535, 0, 0,
00185                 "fallback to a congestion controlled protocol if send size"
00186                         " exceeds udp_mtu"},
00187         {"udp_mtu_try_proto", CFG_VAR_INT, 1, 4, 0, fix_global_req_flags,
00188                 "if send size > udp_mtu use proto (1 udp, 2 tcp, 3 tls, 4 sctp)"},
00189         {"force_rport",     CFG_VAR_INT, 0, 1,  0, fix_global_req_flags,
00190                 "force rport for all the received messages" },
00191         {0, 0, 0, 0, 0, 0}
00192 };

Generated on Tue Sep 7 04:15:51 2010 for SIPExpressRouter by  doxygen 1.3.9.1