blob: 28d5064665c5aa0018e97ed8b028ce0844abed87 [file] [log] [blame]
Holger Hans Peter Freyther38f7c752010-06-15 18:48:36 +08001/* test data */
2
3/* BSC -> MSC, CR */
4static const u_int8_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 u_int8_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 u_int8_t msc_cc[] = {
240x00, 0x0a, 0xfd,
250x02, 0x00, 0x00, 0x05, 0x01, 0x1f, 0xe4, 0x02,
260x01, 0x00 };
27static const u_int8_t msc_cc_patched[] = {
280x00, 0x0a, 0xfd,
290x02, 0x00, 0x00, 0x15, 0x01, 0x1f, 0xe4, 0x02,
300x01, 0x00 };
31
32/* Classmark, BSC -> MSC */
33static const u_int8_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 u_int8_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 u_int8_t msc_dtap[] = {
470x00, 0x0d, 0xfd,
480x06, 0x00, 0x00, 0x05, 0x00, 0x01, 0x06, 0x00,
490x04, 0x20, 0x04, 0x01, 0x09 };
50static const u_int8_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 u_int8_t msc_rlsd[] = {
570x00, 0x0a, 0xfd,
580x04, 0x00, 0x00, 0x05, 0x01, 0x1f, 0xe4, 0x00,
590x01, 0x00 };
60static const u_int8_t msc_rlsd_patched[] = {
610x00, 0x0a, 0xfd,
620x04, 0x00, 0x00, 0x15, 0x01, 0x1f, 0xe4, 0x00,
630x01, 0x00 };
64
65/* RLC, BSC -> MSC */
66static const u_int8_t bsc_rlc[] = {
670x00, 0x07, 0xfd,
680x05, 0x01, 0x1f, 0xe4, 0x00, 0x00, 0x15 };
69
70static const u_int8_t bsc_rlc_patched[] = {
710x00, 0x07, 0xfd,
720x05, 0x01, 0x1f, 0xe4, 0x00, 0x00, 0x05 };
Holger Hans Peter Freyther04fd9922010-03-30 06:51:53 +020073
74
75/* a paging command */
76static const u_int8_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 };
Holger Hans Peter Freyther465313e2010-06-15 18:49:53 +080083
84/* an assignment command */
85static const u_int8_t ass_cmd[] = {
860x00, 0x12, 0xfd, 0x06,
870x00, 0x00, 0x49, 0x00, 0x01, 0x0b, 0x00, 0x09,
880x01, 0x0b, 0x03, 0x01, 0x0a, 0x11, 0x01, 0x00,
890x15 };
Holger Hans Peter Freyther76c83542010-04-01 06:48:52 +020090
91/*
92 * MGCP messages
93 */
94
95/* nothing to patch */
96static 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";
97static const char crcx_patched[] = "CRCX 23265295 8@mgw MGCP 1.0\r\nC: 394b0439fb\r\nL: p:20, a:AMR, nt:IN\r\nM: recvonly\r\n";
98
99
100/* patch the ip and port */
101static 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";
102static 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";
103
104/* patch the ip and port */
105static 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";
106static const char mdcx_patched[] = " 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 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";
107
108
109static 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";
110static 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";
111
112struct mgcp_patch_test {
113 const char *orig;
114 const char *patch;
115 const char *ip;
116 const int port;
117};
118
119static const struct mgcp_patch_test mgcp_messages[] = {
120 {
121 .orig = crcx,
122 .patch = crcx_patched,
123 .ip = "0.0.0.0",
124 .port = 2323,
125 },
126 {
127 .orig = crcx_resp,
128 .patch = crcx_resp_patched,
129 .ip = "10.0.0.1",
130 .port = 999,
131 },
132 {
133 .orig = mdcx,
134 .patch = mdcx_patched,
135 .ip = "10.0.0.23",
136 .port = 6666,
137 },
138 {
139 .orig = mdcx_resp,
140 .patch = mdcx_resp_patched,
141 .ip = "10.0.0.23",
142 .port = 5555,
143 },
144};