62241fb83925b7c428e726ce3200df8cdbd743f4
[lcr.git] / main.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** PBX4Linux                                                                 **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** Header file for defining fixed values for the current version             **
9 **                                                                           **
10 \*****************************************************************************/ 
11
12 #define NAME            "PBX4Linux"
13
14 #define DEFAULT_ENDPOINT_APP EndpointAppPBX
15
16 #define VERSION_STRING  "3.6 (Januar 2006)"
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 #define PDEBUG(mask, fmt, arg...) _printdebug(__FUNCTION__, __LINE__, mask, fmt, ## arg)
30 #define PERROR(fmt, arg...) _printerror(__FUNCTION__, __LINE__, fmt, ## arg)
31 #define PDEBUG_RUNTIME(mask, fmt, arg...) _printdebug(NULL, 0, mask, fmt, ## arg)
32 #define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, 0, fmt, ## arg)
33 void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...);
34 void _printerror(const char *function, int line, const char *fmt, ...);
35
36 #define DEBUG_CONFIG    0x0001
37 #define DEBUG_MSG       0x0002
38 #define DEBUG_STACK     0x0004
39 #define DEBUG_BCHANNEL  0x0008
40 #define DEBUG_PORT      0x0100
41 #define DEBUG_ISDN      0x0110
42 //#define DEBUG_KNOCK   0x0140
43 #define DEBUG_VBOX      0x0180
44 #define DEBUG_EPOINT    0x0200
45 #define DEBUG_CALL      0x0400
46 #define DEBUG_VERSATEL  0x0800
47 #define DEBUG_CRYPT     0x1000
48 #define DEBUG_ROUTE     0x2000
49 #define DEBUG_IDLETIME  0x4000
50 #define DEBUG_LOG       0x7fff
51
52 // check any faulty malloc
53 #define MALLOC_CHECK_   1
54
55 /*
56  * one of the bits must be enabled in order to write log files
57  */
58 #define DEBUG_LOG       0x7fff
59
60 /*
61  * preload transmit buffer to avoid gaps at the beginning due to jitter
62  * this is also the maximum load that will be kept in tx-buffer
63  */
64 #define ISDN_PRELOAD    1024 // samples
65
66 /* 
67  * interval for refreshing transmit buffer
68  */
69 #define ISDN_TRANSMIT   256 // samples
70
71 /* give sendmail program. if not inside $PATH, give absolute path here (e.g. "/usr/sbin/sendmail")
72  */
73 #define SENDMAIL        "sendmail"
74
75 /* maximum number of redial/powerdial and reply numbers to remember
76  */
77 #define MAX_REMEMBER    50
78
79 /* leave it above 1024, because lower values can be unsafe, higher valuse cause
80  * data larger than 512 bytes of hex strings.
81  */
82 #define RSA_BITS        1536
83
84 /* 'goto' or 'menu' actions may cause infinite loops. they will be prevented by this limit.
85  * Also other recursions, like redialing the 'redial' action must be prevented.
86  * increase it ONLY IF you have a deeper tree of rule sets, than the value given here.
87  */
88 #define RULE_NESTING    10
89
90 /* special debugging for buffer overflow bugs
91  * note: whenever a buffer gets strange values, the budetect function must
92  * be modified to detect the change of these values. whenever it is detected,
93  * an error message is given at budetect function.
94  */
95 //#define BUDETECT_DEF
96
97 #ifdef BUDETECT_DEF
98  #define BUDETECT       budetect(__FILE__, __LINE__, __FUNCTION__);
99  void budetect(const char *file, int line, char *function);
100 #else
101  #define BUDETECT       ;
102 #endif
103
104 #include <stdio.h>
105 #include <stdlib.h>
106 #include <unistd.h>
107 #include <string.h>
108 #include <time.h>
109 #include <sys/time.h>
110 //#include <asm/bitops.h>
111 #ifdef __cplusplus
112 extern "C" {
113 #endif
114 #include <isdn_net.h>
115 #include <../i4lnet/net_l3.h>
116 #ifdef __cplusplus
117 }
118 #endif
119 #include "save.h"
120 #include "options.h"
121 #include "interface.h"
122 #include "extension.h"
123 #include "message.h"
124 #include "endpoint.h"
125 #include "endpointapp.h"
126 #include "apppbx.h"
127 #include "route.h"
128 #include "port.h"
129 #include "mISDN.h"
130 #include "dss1.h"
131 #include "vbox.h"
132 #include "call.h"
133 #include "callpbx.h"
134 #include "callchan.h"
135 #include "cause.h"
136 #include "alawulaw.h"
137 #include "tones.h"
138 #include "crypt.h"
139 #include "admin_server.h"
140 #include "trace.h"
141
142 extern double now_d;
143 extern time_t now;
144 extern struct tm *now_tm;
145 extern struct timeval now_tv;
146 extern struct timezone now_tz;
147
148 #define DIRECTION_NONE  0
149 #define DIRECTION_OUT   1
150 #define DIRECTION_IN    2
151
152