d6bc25d9c0ffa189a287cf153f6e9bc1dd2bac91
[lcr.git] / trace.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** Linux Call Router                                                         **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** trace header file                                                         **
9 **                                                                           **
10 \*****************************************************************************/ 
11
12 /* definitions of commands */
13 #define L1_ACTIVATE_REQ                 0x0001f000
14 #define L1_ACTIVATE_CON                 0x0001f001
15 #define L1_ACTIVATE_IND                 0x0001f002
16 #define L1_ACTIVATE_RES                 0x0001f003
17 #define L1_DEACTIVATE_REQ               0x0001f100
18 #define L1_DEACTIVATE_CON               0x0001f101
19 #define L1_DEACTIVATE_IND               0x0001f102
20 #define L1_DEACTIVATE_RES               0x0001f103
21 #define L2_ESTABLISH_REQ                0x0002f000
22 #define L2_ESTABLISH_CON                0x0002f001
23 #define L2_ESTABLISH_IND                0x0002f002
24 #define L2_ESTABLISH_RES                0x0002f003
25 #define L2_RELEASE_REQ                  0x0002f100
26 #define L2_RELEASE_CON                  0x0002f101
27 #define L2_RELEASE_IND                  0x0002f102
28 #define L2_RELEASE_RES                  0x0002f103
29 #define L3_UNKNOWN                      0x0003f200
30 #define L3_ALERTING_REQ                 0x00030100
31 #define L3_ALERTING_IND                 0x00030102
32 #define L3_PROCEEDING_REQ               0x00030200
33 #define L3_PROCEEDING_IND               0x00030202
34 #define L3_CONNECT_REQ                  0x00030700
35 #define L3_CONNECT_IND                  0x00030702
36 #define L3_CONNECT_RES                  0x00030703
37 #define L3_CONNECT_ACKNOWLEDGE_REQ      0x00030f00
38 #define L3_CONNECT_ACKNOWLEDGE_IND      0x00030f02
39 #define L3_PROGRESS_REQ                 0x00030300
40 #define L3_PROGRESS_IND                 0x00030302
41 #define L3_SETUP_REQ                    0x00030500
42 #define L3_SETUP_IND                    0x00030502
43 #define L3_SETUP_ACKNOWLEDGE_REQ        0x00030d00
44 #define L3_SETUP_ACKNOWLEDGE_IND        0x00030d02
45 #define L3_RESUME_REQ                   0x00032600
46 #define L3_RESUME_IND                   0x00032602
47 #define L3_RESUME_ACKNOWLEDGE_REQ       0x00032e00
48 #define L3_RESUME_ACKNOWLEDGE_IND       0x00032e02
49 #define L3_RESUME_REJECT_REQ            0x00032200
50 #define L3_RESUME_REJECT_IND            0x00032202
51 #define L3_SUSPEND_REQ                  0x00032500
52 #define L3_SUSPEND_IND                  0x00032502
53 #define L3_SUSPEND_ACKNOWLEDGE_REQ      0x00032d00
54 #define L3_SUSPEND_ACKNOWLEDGE_IND      0x00032d02
55 #define L3_SUSPEND_REJECT_REQ           0x00032100
56 #define L3_SUSPEND_REJECT_IND           0x00032102
57 #define L3_USER_INFORMATION_REQ         0x00032000
58 #define L3_USER_INFORMATION_IND         0x00032002
59 #define L3_DISCONNECT_REQ               0x00034500
60 #define L3_DISCONNECT_IND               0x00034502
61 #define L3_RELEASE_REQ                  0x00034d00
62 #define L3_RELEASE_IND                  0x00034d02
63 #define L3_RELEASE_COMPLETE_REQ         0x00035a00
64 #define L3_RELEASE_COMPLETE_IND         0x00035a02
65 #define L3_RESTART_REQ                  0x00034600
66 #define L3_RESTART_IND                  0x00034602
67 #define L3_RESTART_ACKNOWLEDGE_REQ      0x00034e00
68 #define L3_RESTART_ACKNOWLEDGE_IND      0x00034e02
69 #define L3_SEGMENT_REQ                  0x00036000
70 #define L3_SEGMENT_IND                  0x00036002
71 #define L3_CONGESTION_CONTROL_REQ       0x00037900
72 #define L3_CONGESTION_CONTROL_IND       0x00037902
73 #define L3_INFORMATION_REQ              0x00037b00
74 #define L3_INFORMATION_IND              0x00037b02
75 #define L3_FACILITY_REQ                 0x00036200
76 #define L3_FACILITY_IND                 0x00036202
77 #define L3_NOTIFY_REQ                   0x00036e00
78 #define L3_NOTIFY_IND                   0x00036e02
79 #define L3_STATUS_REQ                   0x00037d00
80 #define L3_STATUS_IND                   0x00037d02
81 #define L3_STATUS_ENQUIRY_REQ           0x00037500
82 #define L3_STATUS_ENQUIRY_IND           0x00037502
83 #define L3_HOLD_REQ                     0x00032400
84 #define L3_HOLD_IND                     0x00032402
85 #define L3_HOLD_ACKNOWLEDGE_REQ         0x00032800
86 #define L3_HOLD_ACKNOWLEDGE_IND         0x00032802
87 #define L3_HOLD_REJECT_REQ              0x00033000
88 #define L3_HOLD_REJECT_IND              0x00033002
89 #define L3_RETRIEVE_REQ                 0x00033100
90 #define L3_RETRIEVE_IND                 0x00033102
91 #define L3_RETRIEVE_ACKNOWLEDGE_REQ     0x00033300
92 #define L3_RETRIEVE_ACKNOWLEDGE_IND     0x00033302
93 #define L3_RETRIEVE_REJECT_REQ          0x00033700
94 #define L3_RETRIEVE_REJECT_IND          0x00033702
95 #ifdef SOCKET_MISDN
96 #define L3_NEW_L3ID_REQ                 0x0003f000
97 #define L3_NEW_L3ID_IND                 0x0003f002
98 #define L3_RELEASE_L3ID_REQ             0x0003f100
99 #define L3_RELEASE_L3ID_IND             0x0003f102
100 #else
101 #define L3_NEW_CR_REQ                   0x0003f000
102 #define L3_NEW_CR_IND                   0x0003f002
103 #define L3_RELEASE_CR_REQ               0x0003f100
104 #define L3_RELEASE_CR_IND               0x0003f102
105 #endif
106 #define L3_TIMEOUT_REQ                  0x0003f200
107 #define L3_TIMEOUT_IND                  0x0003f202
108
109
110 struct trace_element {
111         char name[11];
112         char sub[11];
113         char value[64];
114 };
115
116 #define MAX_TRACE_ELEMENTS      32
117 struct trace {
118         /* header */
119         int port;
120         char interface[32];
121         char caller[64];
122         char dialing[64];
123         int direction;
124         unsigned long sec, usec;
125         
126         /* type */
127         int category;
128         unsigned long serial;
129         char name[64];
130
131         /* elements */
132         int elements;
133         struct trace_element element[MAX_TRACE_ELEMENTS];
134 };
135
136
137
138 #define CATEGORY_CH     0x01
139 #define CATEGORY_EP     0x02
140 //#define CATEGORY_BC   0x04 check lcradmin help
141
142
143 #define start_trace(port, interface, caller, dialing, direction, category, serial, name) _start_trace(__FUNCTION__, __LINE__, port, interface, caller, dialing, direction, category, serial, name)
144 #define add_trace(name, sub, fmt, arg...) _add_trace(__FUNCTION__, __LINE__, name, sub, fmt, ## arg)
145 #define end_trace() _end_trace(__FUNCTION__, __LINE__)
146 void _start_trace(const char *__file, int line, int port, struct interface *interface, char *caller, char *dialing, int direction, int category, int serial, char *name);
147 void _add_trace(const char *__file, int line, char *name, char *sub, const char *fmt, ...);
148 void _end_trace(const char *__file, int line);
149 //char *print_trace(int port, char *interface, char *caller, char *dialing, int direction, char *category, char *name);
150
151