blob: 8a06348fd186dcb551d9a42ea543e879a5980e8d [file] [log] [blame]
Jonathan Santos03fd8d02011-05-25 13:54:02 -04001/* test data */
2
3/* BSC -> MSC, CR */
4static const uint8_t bsc_cr[] = {
50x00, 0x2e, 0xfd,
60x01, 0x00, 0x00, 0x15, 0x02, 0x02, 0x04, 0x02,
70x42, 0xfe, 0x0f, 0x21, 0x00, 0x1f, 0x57, 0x05,
80x08, 0x00, 0x72, 0xf4, 0x80, 0x20, 0x1c, 0xc3,
90x51, 0x17, 0x12, 0x05, 0x08, 0x20, 0x72, 0xf4,
100x90, 0x20, 0x1d, 0x50, 0x08, 0x29, 0x47, 0x80,
110x00, 0x00, 0x00, 0x00, 0x80, 0x00 };
12
13static const uint8_t bsc_cr_patched[] = {
140x00, 0x2e, 0xfd,
150x01, 0x00, 0x00, 0x05, 0x02, 0x02, 0x04, 0x02,
160x42, 0xfe, 0x0f, 0x21, 0x00, 0x1f, 0x57, 0x05,
170x08, 0x00, 0x72, 0xf4, 0x80, 0x20, 0x1c, 0xc3,
180x51, 0x17, 0x12, 0x05, 0x08, 0x20, 0x72, 0xf4,
190x90, 0x20, 0x1d, 0x50, 0x08, 0x29, 0x47, 0x80,
200x00, 0x00, 0x00, 0x00, 0x80, 0x00 };
21
22/* CC, MSC -> BSC */
23static const uint8_t msc_cc[] = {
240x00, 0x0a, 0xfd,
250x02, 0x00, 0x00, 0x05, 0x01, 0x1f, 0xe4, 0x02,
260x01, 0x00 };
27static const uint8_t msc_cc_patched[] = {
280x00, 0x0a, 0xfd,
290x02, 0x00, 0x00, 0x15, 0x01, 0x1f, 0xe4, 0x02,
300x01, 0x00 };
31
32/* Classmark, BSC -> MSC */
33static const uint8_t bsc_dtap[] = {
340x00, 0x17, 0xfd,
350x06, 0x01, 0x1f, 0xe4, 0x00, 0x01, 0x10, 0x00,
360x0e, 0x54, 0x12, 0x03, 0x50, 0x18, 0x93, 0x13,
370x06, 0x60, 0x14, 0x45, 0x00, 0x81, 0x00 };
38
39static const uint8_t bsc_dtap_patched[] = {
400x00, 0x17, 0xfd,
410x06, 0x01, 0x1f, 0xe4, 0x00, 0x01, 0x10, 0x00,
420x0e, 0x54, 0x12, 0x03, 0x50, 0x18, 0x93, 0x13,
430x06, 0x60, 0x14, 0x45, 0x00, 0x81, 0x00 };
44
45/* Clear command, MSC -> BSC */
46static const uint8_t msc_dtap[] = {
470x00, 0x0d, 0xfd,
480x06, 0x00, 0x00, 0x05, 0x00, 0x01, 0x06, 0x00,
490x04, 0x20, 0x04, 0x01, 0x09 };
50static const uint8_t msc_dtap_patched[] = {
510x00, 0x0d, 0xfd,
520x06, 0x00, 0x00, 0x15, 0x00, 0x01, 0x06, 0x00,
530x04, 0x20, 0x04, 0x01, 0x09 };
54
55/*RLSD, MSC -> BSC */
56static const uint8_t msc_rlsd[] = {
570x00, 0x0a, 0xfd,
580x04, 0x00, 0x00, 0x05, 0x01, 0x1f, 0xe4, 0x00,
590x01, 0x00 };
60static const uint8_t msc_rlsd_patched[] = {
610x00, 0x0a, 0xfd,
620x04, 0x00, 0x00, 0x15, 0x01, 0x1f, 0xe4, 0x00,
630x01, 0x00 };
64
65/* RLC, BSC -> MSC */
66static const uint8_t bsc_rlc[] = {
670x00, 0x07, 0xfd,
680x05, 0x01, 0x1f, 0xe4, 0x00, 0x00, 0x15 };
69
70static const uint8_t bsc_rlc_patched[] = {
710x00, 0x07, 0xfd,
720x05, 0x01, 0x1f, 0xe4, 0x00, 0x00, 0x05 };
73
74
75/* a paging command */
76static const uint8_t paging_by_lac_cmd[] = {
770x00, 0x22, 0xfd, 0x09,
780x00, 0x03, 0x07, 0x0b, 0x04, 0x43, 0x02, 0x00,
790xfe, 0x04, 0x43, 0x5c, 0x00, 0xfe, 0x12, 0x00,
800x10, 0x52, 0x08, 0x08, 0x29, 0x47, 0x10, 0x02,
810x01, 0x50, 0x02, 0x30, 0x1a, 0x03, 0x05, 0x20,
820x15 };
83
84/* an assignment command */
85static const uint8_t ass_cmd[] = {
860x00, 0x12, 0xfd, 0x06,
870x00, 0x00, 0x49, 0x00, 0x01, 0x0b, 0x00, 0x09,
880x01, 0x0b, 0x03, 0x01, 0x0a, 0x11, 0x01, 0x00,
890x01 };
90
91/* identity response */
92static const uint8_t id_resp[] = {
930x00, 0x15, 0xfd, 0x06, 0x01, 0x1c, 0xdc,
940x00, 0x01, 0x0e, 0x01, 0x00, 0x0b, 0x05, 0x59,
950x08, 0x29, 0x40, 0x21, 0x03, 0x07, 0x48, 0x66,
960x31
97};
98
Jonathan Santos5a45b152011-08-17 15:33:57 -040099/* sms code msg */
100static const uint8_t smsc_rewrite[] = {
1010x00, 0x30, 0xfd, 0x06, 0x01, 0x13, 0x1e, 0x00,
1020x01, 0x29, 0x01, 0x03, 0x26, 0x09, 0x01, 0x23,
1030x00, 0x0c, 0x00, 0x07, 0x91, 0x36, 0x19, 0x08,
1040x00, 0x10, 0x50, 0x17, 0x01, 0x0c, 0x0f, 0x81,
1050x00, 0x94, 0x51, 0x87, 0x86, 0x78, 0x46, 0xf5,
1060x00, 0x00, 0x09, 0xcc, 0xb7, 0xbd, 0x0c, 0xca,
1070xbf, 0xeb, 0x20
108};
109
110static const uint8_t smsc_rewrite_patched[] = {
1110x00, 0x31, 0xfd, 0x06, 0x01, 0x13, 0x1e, 0x00,
1120x01, 0x2a, 0x01, 0x00, 0x27, 0x09, 0x01, 0x24,
1130x00, 0x0c, 0x00, 0x08, 0x91, 0x66, 0x66, 0x66,
1140x66, 0x66, 0x66, 0xf7, 0x17, 0x01, 0x0c, 0x0f,
1150x81, 0x00, 0x94, 0x51, 0x87, 0x86, 0x78, 0x46,
1160xf5, 0x00, 0x00, 0x09, 0xcc, 0xb7, 0xbd, 0x0c,
1170xca, 0xbf, 0xeb, 0x20
118};
119
120
Jonathan Santos03fd8d02011-05-25 13:54:02 -0400121/*
122 * MGCP messages
123 */
124
125/* nothing to patch */
126static const char crcx[] = "CRCX 23265295 8@mgw MGCP 1.0\r\nC: 394b0439fb\r\nL: p:20, a:AMR, nt:IN\r\nM: recvonly\r\n";
127static const char crcx_patched[] = "CRCX 23265295 1e@mgw MGCP 1.0\r\nC: 394b0439fb\r\nL: p:20, a:AMR, nt:IN\r\nM: recvonly\r\n";
128
129
130/* patch the ip and port */
131static const char crcx_resp[] = "200 23265295\r\nI: 1\r\n\r\nv=0\r\nc=IN IP4 172.16.18.2\r\nm=audio 4002 RTP/AVP 98\r\na=rtpmap:98 AMR/8000\r\n";
132static const char crcx_resp_patched[] = "200 23265295\r\nI: 1\r\n\r\nv=0\r\nc=IN IP4 10.0.0.1\r\nm=audio 999 RTP/AVP 98\r\na=rtpmap:98 AMR/8000\r\n";
133
134/* patch the ip and port */
135static const char mdcx[] = "MDCX 23330829 8@mgw MGCP 1.0\r\nC: 394b0439fb\r\nI: 1\r\nL: p:20, a:AMR, nt:IN\r\nM: recvonly\r\n\r\nv=0\r\no=- 1049380491 0 IN IP4 172.16.18.2\r\ns=-\r\nc=IN IP4 172.16.18.2\r\nt=0 0\r\nm=audio 4410 RTP/AVP 126\r\na=rtpmap:126 AMR/8000/1\r\na=fmtp:126 mode-set=2;start-mode=0\r\na=ptime:20\r\na=recvonly\r\nm=image 4412 udptl t38\r\na=T38FaxVersion:0\r\na=T38MaxBitRate:14400\r\n";
136static const char mdcx_patched[] = "MDCX 23330829 1e@mgw MGCP 1.0\r\nC: 394b0439fb\r\nI: 1\r\nL: p:20, a:AMR, nt:IN\r\nM: recvonly\r\n\r\nv=0\r\no=- 1049380491 0 IN IP4 172.16.18.2\r\ns=-\r\nc=IN IP4 10.0.0.23\r\nt=0 0\r\nm=audio 6666 RTP/AVP 126\r\na=rtpmap:126 AMR/8000/1\r\na=fmtp:126 mode-set=2;start-mode=0\r\na=ptime:20\r\na=recvonly\r\nm=image 4412 udptl t38\r\na=T38FaxVersion:0\r\na=T38MaxBitRate:14400\r\n";
137
138
139static const char mdcx_resp[] = "200 23330829\r\n\r\nv=0\r\nc=IN IP4 172.16.18.2\r\nm=audio 4002 RTP/AVP 98\r\na=rtpmap:98 AMR/8000\r\n";
140static const char mdcx_resp_patched[] = "200 23330829\r\n\r\nv=0\r\nc=IN IP4 10.0.0.23\r\nm=audio 5555 RTP/AVP 98\r\na=rtpmap:98 AMR/8000\r\n";
141
142/* different line ending */
143static const char mdcx_resp2[] = "200 33330829\n\nv=0\nc=IN IP4 172.16.18.2\nm=audio 4002 RTP/AVP 98\na=rtpmap:98 AMR/8000\n";
144static const char mdcx_resp_patched2[] = "200 33330829\n\nv=0\nc=IN IP4 10.0.0.23\nm=audio 5555 RTP/AVP 98\na=rtpmap:98 AMR/8000\n";
145
146struct mgcp_patch_test {
147 const char *orig;
148 const char *patch;
149 const char *ip;
150 const int port;
151};
152
153static const struct mgcp_patch_test mgcp_messages[] = {
154 {
155 .orig = crcx,
156 .patch = crcx_patched,
157 .ip = "0.0.0.0",
158 .port = 2323,
159 },
160 {
161 .orig = crcx_resp,
162 .patch = crcx_resp_patched,
163 .ip = "10.0.0.1",
164 .port = 999,
165 },
166 {
167 .orig = mdcx,
168 .patch = mdcx_patched,
169 .ip = "10.0.0.23",
170 .port = 6666,
171 },
172 {
173 .orig = mdcx_resp,
174 .patch = mdcx_resp_patched,
175 .ip = "10.0.0.23",
176 .port = 5555,
177 },
178 {
179 .orig = mdcx_resp2,
180 .patch = mdcx_resp_patched2,
181 .ip = "10.0.0.23",
182 .port = 5555,
183 },
184};
185
186/* CC Setup messages */
187static const uint8_t cc_setup_national[] = {
188 0x00, 0x20, 0xfd, 0x06, 0x01, 0x12,
189 0x6d, 0x00, 0x01, 0x19, 0x01, 0x00, 0x16, 0x03,
190 0x05, 0x04, 0x06, 0x60, 0x04, 0x02, 0x00, 0x05,
191 0x81, 0x5e, 0x06, 0x81, 0x10, 0x27, 0x33, 0x63,
192 0x66, 0x15, 0x02, 0x11, 0x01
193};
194
195static const uint8_t cc_setup_national_patched[] = {
196 0x00, 0x21, 0xfd, 0x06, 0x01, 0x12,
197 0x6d, 0x00, 0x01, 0x1a, 0x01, 0x00, 0x17, 0x03,
198 0x05, 0x04, 0x06, 0x60, 0x04, 0x02, 0x00, 0x05,
199 0x81, 0x5e, 0x07, 0x91, 0x94, 0x71, 0x32, 0x33,
200 0x66, 0xf6, 0x15, 0x02, 0x11, 0x01
201};
202
203static const uint8_t cc_setup_international[] = {
204 0x00, 0x22, 0xfd, 0x06, 0x01, 0x13,
205 0xe7, 0x00, 0x01, 0x1b, 0x01, 0x00, 0x18, 0x03,
206 0x45, 0x04, 0x06, 0x60, 0x04, 0x02, 0x00, 0x05,
207 0x81, 0x5e, 0x08, 0x81, 0x00, 0x94, 0x71, 0x33,
208 0x63, 0x66, 0x03, 0x15, 0x02, 0x11, 0x01
209};