61ffc806d942fa00f40d6a29fb95ab85c40b4345
[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 #define NAME            "LCR"
13
14 #define DEFAULT_ENDPOINT_APP EndpointAppPBX
15
16 #define VERSION_STRING  "0.5 (Spring 2007)"
17
18 extern int memuse;
19 extern int mmemuse;
20 extern int cmemuse;
21 extern int ememuse;
22 extern int pmemuse;
23 extern int amemuse;
24 extern int rmemuse;
25 extern int classuse;
26 extern int fduse;
27 extern int fhuse;
28
29 extern int global_debug;
30
31 #define PDEBUG(mask, fmt, arg...) _printdebug(__FUNCTION__, __LINE__, mask, fmt, ## arg)
32 #define PERROR(fmt, arg...) _printerror(__FUNCTION__, __LINE__, fmt, ## arg)
33 #define PDEBUG_RUNTIME(mask, fmt, arg...) _printdebug(NULL, 0, mask, fmt, ## arg)
34 #define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, 0, fmt, ## arg)
35 void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...);
36 void _printerror(const char *function, int line, const char *fmt, ...);
37 #define DEBUG_FUNC
38 void debug(const char *function, int line, char *prefix, char *buffer);
39
40 #define DEBUG_CONFIG    0x0001
41 #define DEBUG_MSG       0x0002
42 #define DEBUG_STACK     0x0004
43 #define DEBUG_BCHANNEL  0x0008
44 #define DEBUG_PORT      0x0100
45 #define DEBUG_ISDN      0x0110
46 //#define DEBUG_KNOCK   0x0140
47 #define DEBUG_VBOX      0x0180
48 #define DEBUG_EPOINT    0x0200
49 #define DEBUG_JOIN      0x0400
50 #define DEBUG_VERSATEL  0x0800
51 #define DEBUG_CRYPT     0x1000
52 #define DEBUG_ROUTE     0x2000
53 #define DEBUG_IDLETIME  0x4000
54 #define DEBUG_LOG       0x7fff
55
56 // check any faulty malloc
57 #define MALLOC_CHECK_   1
58
59 /*
60  * one of the bits must be enabled in order to write log files
61  */
62 #define DEBUG_LOG       0x7fff
63
64 /*
65  * load transmit buffer to avoid gaps at the beginning due to jitter
66  * also the maximum load that will be kept in tx-buffer
67  * also the (minimum) number of data to transmit in a frame
68  */
69 #define ISDN_LOAD       1024 // samples
70 #define ISDN_MAXLOAD    2048 // samples
71
72 /* give sendmail program. if not inside $PATH, give absolute path here (e.g. "/usr/sbin/sendmail")
73  */
74 #define SENDMAIL        "sendmail"
75
76 /* leave it above 1024, because lower values can be unsafe, higher valuse cause
77  * data larger than 512 bytes of hex strings.
78  */
79 #define RSA_BITS        1536
80
81 /* 'goto' or 'menu' actions may cause infinite loops. they will be prevented by this limit.
82  * Also other recursions, like redialing the 'redial' action must be prevented.
83  * increase it ONLY IF you have a deeper tree of rule sets, than the value given here.
84  */
85 #define RULE_NESTING    10
86
87 /* to debug core bridging, rather than mISDN dsp bridging, enable.
88  * this is for debugging only, bridging conferences will not work
89  */
90 //#define DEBUG_COREBRIDGE
91
92 /* special debugging for buffer overflow bugs
93  * note: whenever a buffer gets strange values, the budetect function must
94  * be modified to detect the change of these values. whenever it is detected,
95  * an error message is given at budetect function.
96  */
97 //#define BUDETECT_DEF
98
99 #ifdef BUDETECT_DEF
100  #define BUDETECT       budetect(__FILE__, __LINE__, __FUNCTION__);
101  void budetect(const char *file, int line, char *function);
102 #else
103  #define BUDETECT       ;
104 #endif
105
106 #include <stdio.h>
107 #include <stdlib.h>
108 #include <unistd.h>
109 #include <string.h>
110 #include <time.h>
111 #include <sys/time.h>
112 //#include <asm/bitops.h>
113 #ifdef __cplusplus
114 extern "C" {
115 #endif
116 #ifndef SOCKET_MISDN
117 #include <mISDNuser/isdn_net.h>
118 #include <mISDNuser/net_l3.h>
119 #endif
120 #ifdef __cplusplus
121 }
122 #endif
123 #include "macro.h"
124 #include "options.h"
125 #include "interface.h"
126 #include "extension.h"
127 #include "message.h"
128 #include "endpoint.h"
129 #include "endpointapp.h"
130 #include "apppbx.h"
131 #include "route.h"
132 #include "port.h"
133 #include "mISDN.h"
134 #include "dss1.h"
135 #include "vbox.h"
136 #include "join.h"
137 #include "joinpbx.h"
138 #include "joinremote.h"
139 #include "cause.h"
140 #include "alawulaw.h"
141 #include "tones.h"
142 #include "crypt.h"
143 #include "socket_server.h"
144 #include "trace.h"
145
146 extern double now_d;
147 extern time_t now;
148 extern struct tm *now_tm;
149 extern struct timeval now_tv;
150 extern struct timezone now_tz;
151
152 #define DIRECTION_NONE  0
153 #define DIRECTION_OUT   1
154 #define DIRECTION_IN    2
155
156 #if 0
157 struct lcr_fdset {
158         struct mISDNport *mISDNport;
159         int b_index;
160 };
161 #endif
162