globals.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 char* cfg_file;
  41. extern int config_check;
  42. extern char* stat_file;
  43. extern unsigned short port_no;
  44. extern time_t up_since;
  45. extern pid_t creator_pid; /* pid of first process before daemonization */
  46. extern int uid;
  47. extern int gid;
  48. extern char* pid_file;
  49. extern char* pgid_file;
  50. extern int own_pgid; /* whether or not we have our own pgid (and it's ok to use kill(0, sig) */
  51. extern int server_id; /* A unique ID of the SIP server */
  52. extern struct socket_info* bind_address; /* pointer to the crt. proc.
  53. listening address */
  54. extern struct socket_info* sendipv4; /* ipv4 socket to use when msg.
  55. comes from ipv6*/
  56. extern struct socket_info* sendipv6; /* same as above for ipv6 */
  57. #ifdef USE_RAW_SOCKS
  58. extern int raw_udp4_send_sock;
  59. #endif /* USE_RAW_SOCKS */
  60. #ifdef USE_TCP
  61. extern struct socket_info* sendipv4_tcp; /* ipv4 socket to use when msg.
  62. comes from ipv6*/
  63. extern struct socket_info* sendipv6_tcp; /* same as above for ipv6 */
  64. extern int unix_tcp_sock; /* socket used for communication with tcp main*/
  65. #endif
  66. #ifdef USE_TLS
  67. extern struct socket_info* sendipv4_tls; /* ipv4 socket to use when msg.
  68. comes from ipv6*/
  69. extern struct socket_info* sendipv6_tls; /* same as above for ipv6 */
  70. #endif
  71. #ifdef USE_SCTP
  72. extern struct socket_info* sendipv4_sctp; /* ipv4 socket to use when msg.
  73. comes from ipv6*/
  74. extern struct socket_info* sendipv6_sctp; /* same as above for ipv6 */
  75. #endif
  76. extern unsigned int maxbuffer;
  77. extern unsigned int sql_buffer_size;
  78. extern int children_no;
  79. extern int socket_workers;
  80. #ifdef USE_TCP
  81. extern int tcp_main_pid;
  82. extern int tcp_cfg_children_no;
  83. extern int tcp_children_no;
  84. extern int tcp_disable;
  85. extern enum poll_types tcp_poll_method;
  86. extern int tcp_max_connections; /* maximum tcp connections, hard limit */
  87. extern int tls_max_connections; /* maximum tls connections, hard limit */
  88. #endif
  89. #ifdef USE_TLS
  90. extern int tls_disable;
  91. extern unsigned short tls_port_no;
  92. #endif
  93. #ifdef USE_SCTP
  94. extern int sctp_disable;
  95. extern int sctp_children_no;
  96. #endif
  97. extern int dont_fork;
  98. extern int dont_daemonize;
  99. extern int check_via;
  100. extern int phone2tel;
  101. extern int received_dns;
  102. /* extern int process_no; */
  103. extern int child_rank;
  104. extern int sip_warning;
  105. extern int server_signature;
  106. extern str server_hdr;
  107. extern str user_agent_hdr;
  108. extern char* user;
  109. extern char* group;
  110. extern char* sock_user;
  111. extern char* sock_group;
  112. extern int sock_uid;
  113. extern int sock_gid;
  114. extern int sock_mode;
  115. extern char* chroot_dir;
  116. extern char* working_dir;
  117. extern int sr_auto_aliases;
  118. extern int sr_msg_time;
  119. extern str version_table;
  120. #ifdef USE_MCAST
  121. extern int mcast_loopback;
  122. extern int mcast_ttl;
  123. #endif /* USE_MCAST */
  124. extern int auto_bind_ipv6;
  125. extern int tos;
  126. extern int pmtu_discovery;
  127. /*
  128. * debug & log_stderr moved to dprint.h*/
  129. /* extern process_bm_t process_bit; */
  130. /* extern int *pids; -moved to pt.h */
  131. extern int cfg_errors;
  132. extern int cfg_warnings;
  133. extern unsigned int msg_no;
  134. extern unsigned long shm_mem_size;
  135. extern unsigned long pkg_mem_size;
  136. /* AVP configuration */
  137. extern char *avp_db_url; /* db url used by user preferences (AVPs) */
  138. /* moved to pt.h
  139. extern int *pids;
  140. extern int process_no;
  141. */
  142. extern int reply_to_via;
  143. extern int is_main;
  144. extern int fixup_complete;
  145. /* debugging level for dumping memory status */
  146. extern int memlog;
  147. /* debugging level for malloc debugging messages */
  148. extern int memdbg;
  149. /* debugging level for timer debugging (see -DTIMER_DEBUG) */
  150. extern int timerlog;
  151. /* looking up outbound interface ? */
  152. extern int mhomed;
  153. /* command-line arguments */
  154. extern int my_argc;
  155. extern char **my_argv;
  156. /* pre-set addresses */
  157. extern str default_global_address;
  158. /* pre-ser ports */
  159. extern str default_global_port;
  160. /* how much time to allow for shutdown, before killing everything */
  161. extern int ser_kill_timeout;
  162. /* core dump and file limits */
  163. extern int disable_core_dump;
  164. extern int open_files_limit;
  165. /* memory lock/pre-fault */
  166. extern int shm_force_alloc;
  167. extern int mlock_pages;
  168. /* real time stuff */
  169. extern int real_time;
  170. extern int rt_prio;
  171. extern int rt_policy; /* SCHED_OTHER */
  172. extern int rt_timer1_prio; /* "fast" timer */
  173. extern int rt_timer2_prio; /* "slow" timer */
  174. extern int rt_timer1_policy; /* "fast" timer, SCHED_OTHER */
  175. extern int rt_timer2_policy; /* "slow" timer, SCHED_OTHER */
  176. extern int http_reply_parse;
  177. #ifdef USE_DNS_CACHE
  178. extern int dns_cache_init; /* if 0, the DNS cache is not initialized at startup */
  179. extern unsigned int dns_timer_interval; /* gc timer interval in s */
  180. extern int dns_flags; /* default flags used for the dns_*resolvehost
  181. (compatibility wrappers) */
  182. #ifdef USE_DNS_CACHE_STATS
  183. struct t_dns_cache_stats{
  184. unsigned long dns_req_cnt;
  185. unsigned long dc_hits_cnt;
  186. unsigned long dc_neg_hits_cnt;
  187. unsigned long dc_lru_cnt;
  188. };
  189. extern struct t_dns_cache_stats* dns_cache_stats;
  190. #endif /* USE_DNS_CACHE_STATS */
  191. #endif
  192. #ifdef USE_DST_BLACKLIST
  193. extern int dst_blacklist_init; /* if 0, the dst blacklist is not initialized at startup */
  194. extern unsigned int blst_timer_interval; /*blacklist gc timer interval (in s)*/
  195. #ifdef USE_DST_BLACKLIST_STATS
  196. struct t_dst_blacklist_stats{
  197. unsigned long bkl_hit_cnt;
  198. unsigned long bkl_lru_cnt;
  199. };
  200. extern struct t_dst_blacklist_stats* dst_blacklist_stats;
  201. #endif /* USE_DST_BLACKLIST_STATS */
  202. #endif
  203. #endif