Since this banch only is for debugging the chan_lcr deadlock problem, i will commit...
[lcr.git] / main.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** Linux Call Router                                                         **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** Header file for defining fixed values for the current version             **
9 **                                                                           **
10 \*****************************************************************************/ 
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <stdarg.h>
15 #include <unistd.h>
16 #include <string.h>
17 #include <signal.h>
18 #include <time.h>
19 #include <fcntl.h>
20 #include <errno.h>
21 #include <pthread.h>
22 #include <dirent.h>
23 #include <math.h>
24 #include <sys/time.h>
25 #include <sys/types.h>
26 #include <sys/wait.h>
27 #include <sys/stat.h>
28 #include <sys/ioctl.h>
29 #include <sys/file.h>
30 #include <sys/mman.h>
31 #include <sys/resource.h>
32 #include <config.h>
33
34 #define NAME            "LCR"
35
36 #define DEFAULT_ENDPOINT_APP EndpointAppPBX
37
38 #define VERSION_STRING  VERSION
39
40 extern int memuse;
41 extern int mmemuse;
42 extern int cmemuse;
43 extern int ememuse;
44 extern int pmemuse;
45 extern int amemuse;
46 extern int rmemuse;
47 extern int classuse;
48 extern int fduse;
49 extern int fhuse;
50
51 //extern pthread_mutex_t mutex_lcr; // lcr process mutex
52
53 extern FILE *debug_fp;
54
55 #define PDEBUG(mask, fmt, arg...) _printdebug(__FUNCTION__, __LINE__, mask, fmt, ## arg)
56 #define PERROR(fmt, arg...) _printerror(__FUNCTION__, __LINE__, fmt, ## arg)
57 #define PDEBUG_RUNTIME(mask, fmt, arg...) _printdebug(NULL, 0, mask, fmt, ## arg)
58 #define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, 0, fmt, ## arg)
59 void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...);
60 void _printerror(const char *function, int line, const char *fmt, ...);
61 #define DEBUG_FUNC
62 void debug(const char *function, int line, const char *prefix, char *buffer);
63
64 #define DEBUG_CONFIG    0x0001
65 #define DEBUG_MSG       0x0002
66 #define DEBUG_STACK     0x0004
67 #define DEBUG_BCHANNEL  0x0008
68 #define DEBUG_PORT      0x0100
69 #define DEBUG_ISDN      0x0110
70 #define DEBUG_GSM       0x0120
71 #define DEBUG_SS5       0x0140
72 #define DEBUG_VBOX      0x0180
73 #define DEBUG_EPOINT    0x0200
74 #define DEBUG_JOIN      0x0400
75 #define DEBUG_VERSATEL  0x0800
76 #define DEBUG_CRYPT     0x1000
77 #define DEBUG_ROUTE     0x2000
78 #define DEBUG_IDLETIME  0x4000
79 #define DEBUG_LOG       0x7fff
80
81 // check any faulty malloc
82 #define MALLOC_CHECK_   1
83
84 /*
85  * one of the bits must be enabled in order to write log files
86  */
87 #define DEBUG_LOG       0x7fff
88
89 /*
90  * load transmit buffer to avoid gaps at the beginning due to jitter
91  * also the maximum load that will be kept in tx-buffer
92  * also the (minimum) number of data to transmit in a frame
93  */
94 #define ISDN_LOAD       1024 // samples
95 #define ISDN_MAXLOAD    2048 // samples
96
97 /* give sendmail program. if not inside $PATH, give absolute path here (e.g. "/usr/sbin/sendmail")
98  */
99 #define SENDMAIL        "sendmail"
100
101 /* leave it above 1024, because lower values can be unsafe, higher valuse cause
102  * data larger than 512 bytes of hex strings.
103  */
104 #define RSA_BITS        1536
105
106 /* 'goto' or 'menu' actions may cause infinite loops. they will be prevented by this limit.
107  * Also other recursions, like redialing the 'redial' action must be prevented.
108  * increase it ONLY IF you have a deeper tree of rule sets, than the value given here.
109  */
110 #define RULE_NESTING    10
111
112 /* to debug core bridging, rather than mISDN dsp bridging, enable.
113  * this is for debugging only, bridging conferences will not work
114  */
115 //#define DEBUG_COREBRIDGE
116
117 /* special debugging for buffer overflow bugs
118  * note: whenever a buffer gets strange values, the budetect function must
119  * be modified to detect the change of these values. whenever it is detected,
120  * an error message is given at budetect function.
121  */
122 //#define BUDETECT_DEF
123
124 #ifdef BUDETECT_DEF
125  #define BUDETECT       budetect(__FILE__, __LINE__, __FUNCTION__);
126  void budetect(const char *file, int line, const char *function);
127 #else
128  #define BUDETECT       ;
129 #endif
130
131 #ifdef __cplusplus
132 extern "C" {
133 #endif
134 #include <mISDN/mbuffer.h>
135 #ifdef __cplusplus
136 }
137 #endif
138 #include "macro.h"
139 #include "select.h"
140 #include "options.h"
141 #include "interface.h"
142 #include "extension.h"
143 #include "message.h"
144 #include "endpoint.h"
145 #include "endpointapp.h"
146 #include "apppbx.h"
147 #include "callerid.h"
148 #include "route.h"
149 #include "port.h"
150 #include "mISDN.h"
151 #include "dss1.h"
152 #if defined WITH_GSM_BS || defined WITH_GSM_MS
153 #include "gsm.h"
154 #endif
155 #ifdef WITH_GSM_BS
156 #include "gsm_bs.h"
157 #endif
158 #ifdef WITH_GSM_MS
159 #include "gsm_ms.h"
160 #endif
161 #ifdef WITH_SS5
162 #include "ss5_encode.h"
163 #include "ss5_decode.h"
164 #include "ss5.h"
165 #endif
166 #include "vbox.h"
167 #include "join.h"
168 #include "joinpbx.h"
169 #include "joinremote.h"
170 #include "cause.h"
171 #include "alawulaw.h"
172 #include "tones.h"
173 #include "crypt.h"
174 #include "socket_server.h"
175 #include "trace.h"
176
177 extern int quit;
178
179 #define DIRECTION_NONE  0
180 #define DIRECTION_OUT   1
181 #define DIRECTION_IN    2
182
183 #if 0
184 struct lcr_fdset {
185         struct mISDNport *mISDNport;
186         int b_index;
187 };
188 #endif
189