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