globals.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /*
  2. * $Id$
  3. *
  4. * global variables
  5. *
  6. *
  7. * Copyright (C) 2001-2003 FhG Fokus
  8. *
  9. * This file is part of ser, a free SIP server.
  10. *
  11. * ser is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version
  15. *
  16. * For a license to use the ser software under conditions
  17. * other than those described here, or to purchase support for this
  18. * software, please contact iptel.org by e-mail at the following addresses:
  19. * [email protected]
  20. *
  21. * ser is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #ifndef globals_h
  31. #define globals_h
  32. #include "types.h"
  33. #include "ip_addr.h"
  34. #include "str.h"
  35. #include "poll_types.h"
  36. #define NO_DNS 0
  37. #define DO_DNS 1
  38. #define DO_REV_DNS 2
  39. extern char* mods_dir; /* directory with dyn. loadable modules */
  40. extern int mods_dir_cmd; /* marker if mods dir was set in command line */
  41. extern char* cfg_file;
  42. extern int config_check;
  43. extern char* stat_file;
  44. extern unsigned short port_no;
  45. extern time_t up_since;
  46. extern pid_t creator_pid; /* pid of first process before daemonization */
  47. extern int uid;
  48. extern int gid;
  49. extern char* pid_file;
  50. extern char* pgid_file;
  51. extern int own_pgid; /* whether or not we have our own pgid (and it's ok to use kill(0, sig) */
  52. extern int server_id; /* A unique ID of the SIP server */
  53. extern struct socket_info* bind_address; /* pointer to the crt. proc.
  54. listening address */
  55. extern struct socket_info* sendipv4; /* ipv4 socket to use when msg.
  56. comes from ipv6*/
  57. extern struct socket_info* sendipv6; /* same as above for ipv6 */
  58. #ifdef USE_RAW_SOCKS
  59. extern int raw_udp4_send_sock;
  60. #endif /* USE_RAW_SOCKS */
  61. #ifdef USE_TCP
  62. extern struct socket_info* sendipv4_tcp; /* ipv4 socket to use when msg.
  63. comes from ipv6*/
  64. extern struct socket_info* sendipv6_tcp; /* same as above for ipv6 */
  65. extern int unix_tcp_sock; /* socket used for communication with tcp main*/
  66. #endif
  67. #ifdef USE_TLS
  68. extern struct socket_info* sendipv4_tls; /* ipv4 socket to use when msg.
  69. comes from ipv6*/
  70. extern struct socket_info* sendipv6_tls; /* same as above for ipv6 */
  71. #endif
  72. #ifdef USE_SCTP
  73. extern struct socket_info* sendipv4_sctp; /* ipv4 socket to use when msg.
  74. comes from ipv6*/
  75. extern struct socket_info* sendipv6_sctp; /* same as above for ipv6 */
  76. #endif
  77. extern unsigned int maxbuffer;
  78. extern unsigned int sql_buffer_size;
  79. extern int children_no;
  80. extern int socket_workers;
  81. #ifdef USE_TCP
  82. extern int tcp_main_pid;
  83. extern int tcp_cfg_children_no;
  84. extern int tcp_children_no;
  85. extern int tcp_disable;
  86. extern enum poll_types tcp_poll_method;
  87. extern int tcp_max_connections; /* maximum tcp connections, hard limit */
  88. extern int tls_max_connections; /* maximum tls connections, hard limit */
  89. #endif
  90. #ifdef USE_TLS
  91. extern int tls_disable;
  92. extern unsigned short tls_port_no;
  93. #endif
  94. #ifdef USE_SCTP
  95. extern int sctp_disable;
  96. extern int sctp_children_no;
  97. #endif
  98. extern int dont_fork;
  99. extern int dont_daemonize;
  100. extern int check_via;
  101. extern int phone2tel;
  102. extern int received_dns;
  103. /* extern int process_no; */
  104. extern int child_rank;
  105. extern int sip_warning;
  106. extern int server_signature;
  107. extern str server_hdr;
  108. extern str user_agent_hdr;
  109. extern char* user;
  110. extern char* group;
  111. extern char* sock_user;
  112. extern char* sock_group;
  113. extern int sock_uid;
  114. extern int sock_gid;
  115. extern int sock_mode;
  116. extern char* chroot_dir;
  117. extern char* working_dir;
  118. extern int sr_auto_aliases;
  119. extern int sr_msg_time;
  120. extern str version_table;
  121. #ifdef USE_MCAST
  122. extern int mcast_loopback;
  123. extern int mcast_ttl;
  124. #endif /* USE_MCAST */
  125. extern int auto_bind_ipv6;
  126. extern int tos;
  127. extern int pmtu_discovery;
  128. /*
  129. * debug & log_stderr moved to dprint.h*/
  130. /* extern process_bm_t process_bit; */
  131. /* extern int *pids; -moved to pt.h */
  132. extern int cfg_errors;
  133. extern int cfg_warnings;
  134. extern unsigned int msg_no;
  135. extern unsigned long shm_mem_size;
  136. extern unsigned long pkg_mem_size;
  137. /* AVP configuration */
  138. extern char *avp_db_url; /* db url used by user preferences (AVPs) */
  139. /* moved to pt.h
  140. extern int *pids;
  141. extern int process_no;
  142. */
  143. extern int reply_to_via;
  144. extern int is_main;
  145. extern int fixup_complete;
  146. /* debugging level for dumping memory status */
  147. extern int memlog;
  148. /* debugging level for malloc debugging messages */
  149. extern int memdbg;
  150. /* debugging level for timer debugging (see -DTIMER_DEBUG) */
  151. extern int timerlog;
  152. /* looking up outbound interface ? */
  153. extern int mhomed;
  154. /* command-line arguments */
  155. extern int my_argc;
  156. extern char **my_argv;
  157. /* pre-set addresses */
  158. extern str default_global_address;
  159. /* pre-ser ports */
  160. extern str default_global_port;
  161. /* how much time to allow for shutdown, before killing everything */
  162. extern int ser_kill_timeout;
  163. /* core dump and file limits */
  164. extern int disable_core_dump;
  165. extern int open_files_limit;
  166. /* memory lock/pre-fault */
  167. extern int shm_force_alloc;
  168. extern int mlock_pages;
  169. /* execute onsend_route for replies */
  170. extern int onsend_route_reply;
  171. /* real time stuff */
  172. extern int real_time;
  173. extern int rt_prio;
  174. extern int rt_policy; /* SCHED_OTHER */
  175. extern int rt_timer1_prio; /* "fast" timer */
  176. extern int rt_timer2_prio; /* "slow" timer */
  177. extern int rt_timer1_policy; /* "fast" timer, SCHED_OTHER */
  178. extern int rt_timer2_policy; /* "slow" timer, SCHED_OTHER */
  179. extern int http_reply_parse;
  180. #ifdef USE_DNS_CACHE
  181. extern int dns_cache_init; /* if 0, the DNS cache is not initialized at startup */
  182. extern unsigned int dns_timer_interval; /* gc timer interval in s */
  183. extern int dns_flags; /* default flags used for the dns_*resolvehost
  184. (compatibility wrappers) */
  185. #ifdef USE_DNS_CACHE_STATS
  186. struct t_dns_cache_stats{
  187. unsigned long dns_req_cnt;
  188. unsigned long dc_hits_cnt;
  189. unsigned long dc_neg_hits_cnt;
  190. unsigned long dc_lru_cnt;
  191. };
  192. extern struct t_dns_cache_stats* dns_cache_stats;
  193. #endif /* USE_DNS_CACHE_STATS */
  194. #endif
  195. #ifdef USE_DST_BLACKLIST
  196. extern int dst_blacklist_init; /* if 0, the dst blacklist is not initialized at startup */
  197. extern unsigned int blst_timer_interval; /*blacklist gc timer interval (in s)*/
  198. #ifdef USE_DST_BLACKLIST_STATS
  199. struct t_dst_blacklist_stats{
  200. unsigned long bkl_hit_cnt;
  201. unsigned long bkl_lru_cnt;
  202. };
  203. extern struct t_dst_blacklist_stats* dst_blacklist_stats;
  204. #endif /* USE_DST_BLACKLIST_STATS */
  205. #endif
  206. #endif