SIP: Fix incoming re-invite
[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_ALERTING_REQ                 0x00030100
30 #define L3_ALERTING_IND                 0x00030102
31 #define L3_PROCEEDING_REQ               0x00030200
32 #define L3_PROCEEDING_IND               0x00030202
33 #define L3_CONNECT_REQ                  0x00030700
34 #define L3_CONNECT_IND                  0x00030702
35 #define L3_CONNECT_RES                  0x00030703
36 #define L3_CONNECT_ACKNOWLEDGE_REQ      0x00030f00
37 #define L3_CONNECT_ACKNOWLEDGE_IND      0x00030f02
38 #define L3_PROGRESS_REQ                 0x00030300
39 #define L3_PROGRESS_IND                 0x00030302
40 #define L3_SETUP_REQ                    0x00030500
41 #define L3_SETUP_IND                    0x00030502
42 #define L3_SETUP_ACKNOWLEDGE_REQ        0x00030d00
43 #define L3_SETUP_ACKNOWLEDGE_IND        0x00030d02
44 #define L3_RESUME_REQ                   0x00032600
45 #define L3_RESUME_IND                   0x00032602
46 #define L3_RESUME_ACKNOWLEDGE_REQ       0x00032e00
47 #define L3_RESUME_ACKNOWLEDGE_IND       0x00032e02
48 #define L3_RESUME_REJECT_REQ            0x00032200
49 #define L3_RESUME_REJECT_IND            0x00032202
50 #define L3_SUSPEND_REQ                  0x00032500
51 #define L3_SUSPEND_IND                  0x00032502
52 #define L3_SUSPEND_ACKNOWLEDGE_REQ      0x00032d00
53 #define L3_SUSPEND_ACKNOWLEDGE_IND      0x00032d02
54 #define L3_SUSPEND_REJECT_REQ           0x00032100
55 #define L3_SUSPEND_REJECT_IND           0x00032102
56 #define L3_USER_INFORMATION_REQ         0x00032000
57 #define L3_USER_INFORMATION_IND         0x00032002
58 #define L3_DISCONNECT_REQ               0x00034500
59 #define L3_DISCONNECT_IND               0x00034502
60 #define L3_RELEASE_REQ                  0x00034d00
61 #define L3_RELEASE_IND                  0x00034d02
62 #define L3_RELEASE_COMPLETE_REQ         0x00035a00
63 #define L3_RELEASE_COMPLETE_IND         0x00035a02
64 #define L3_RESTART_REQ                  0x00034600
65 #define L3_RESTART_IND                  0x00034602
66 #define L3_RESTART_ACKNOWLEDGE_REQ      0x00034e00
67 #define L3_RESTART_ACKNOWLEDGE_IND      0x00034e02
68 #define L3_SEGMENT_REQ                  0x00036000
69 #define L3_SEGMENT_IND                  0x00036002
70 #define L3_CONGESTION_CONTROL_REQ       0x00037900
71 #define L3_CONGESTION_CONTROL_IND       0x00037902
72 #define L3_INFORMATION_REQ              0x00037b00
73 #define L3_INFORMATION_IND              0x00037b02
74 #define L3_FACILITY_REQ                 0x00036200
75 #define L3_FACILITY_IND                 0x00036202
76 #define L3_NOTIFY_REQ                   0x00036e00
77 #define L3_NOTIFY_IND                   0x00036e02
78 #define L3_STATUS_REQ                   0x00037d00
79 #define L3_STATUS_IND                   0x00037d02
80 #define L3_STATUS_ENQUIRY_REQ           0x00037500
81 #define L3_STATUS_ENQUIRY_IND           0x00037502
82 #define L3_HOLD_REQ                     0x00032400
83 #define L3_HOLD_IND                     0x00032402
84 #define L3_HOLD_ACKNOWLEDGE_REQ         0x00032800
85 #define L3_HOLD_ACKNOWLEDGE_IND         0x00032802
86 #define L3_HOLD_REJECT_REQ              0x00033000
87 #define L3_HOLD_REJECT_IND              0x00033002
88 #define L3_RETRIEVE_REQ                 0x00033100
89 #define L3_RETRIEVE_IND                 0x00033102
90 #define L3_RETRIEVE_ACKNOWLEDGE_REQ     0x00033300
91 #define L3_RETRIEVE_ACKNOWLEDGE_IND     0x00033302
92 #define L3_RETRIEVE_REJECT_REQ          0x00033700
93 #define L3_RETRIEVE_REJECT_IND          0x00033702
94 #define L3_NEW_L3ID_REQ                 0x0003f000
95 #define L3_NEW_L3ID_IND                 0x0003f002
96 #define L3_RELEASE_L3ID_REQ             0x0003f100
97 #define L3_RELEASE_L3ID_IND             0x0003f102
98 #define L3_TIMEOUT_REQ                  0x0003f200
99 #define L3_TIMEOUT_IND                  0x0003f202
100 #define L3_UNKNOWN_REQ                  0x0003ff00
101 #define L3_UNKNOWN_IND                  0x0003ff02
102
103
104 struct trace_element {
105         char name[11];
106         char sub[11];
107         char value[64];
108 };
109
110 #define MAX_TRACE_ELEMENTS      32
111 struct trace {
112         /* header */
113         int port;
114         char interface[32];
115         char caller[64];
116         char dialing[64];
117         int direction;
118         unsigned int sec, usec;
119         
120         /* type */
121         int category;
122         unsigned int serial;
123         char name[64];
124
125         /* elements */
126         int elements;
127         struct trace_element element[MAX_TRACE_ELEMENTS];
128 };
129
130
131
132 #define CATEGORY_CH     0x01
133 #define CATEGORY_EP     0x02
134 //#define CATEGORY_BC   0x04 check lcradmin help
135
136
137 #define start_trace(port, interface, caller, dialing, direction, category, serial, name) _start_trace(__FILE__, __LINE__, port, interface, caller, dialing, direction, category, serial, name)
138 #define add_trace(name, sub, fmt, arg...) _add_trace(__FILE__, __LINE__, name, sub, fmt, ## arg)
139 #define end_trace() _end_trace(__FILE__, __LINE__)
140 void _start_trace(const char *__file, int line, int port, struct interface *interface, const char *caller, const char *dialing, int direction, int category, int serial, const char *name);
141 void _add_trace(const char *__file, int line, const char *name, const char *sub, const char *fmt, ...);
142 void _end_trace(const char *__file, int line);
143 //char *print_trace(int port, char *interface, char *caller, char *dialing, int direction, char *category, char *name);
144
145