Holger Hans Peter Freyther | b63a9f8 | 2010-06-15 18:48:36 +0800 | [diff] [blame] | 1 | /* test data */ |
| 2 | |
| 3 | /* BSC -> MSC, CR */ |
| 4 | static const u_int8_t bsc_cr[] = { |
| 5 | 0x00, 0x2e, 0xfd, |
| 6 | 0x01, 0x00, 0x00, 0x15, 0x02, 0x02, 0x04, 0x02, |
| 7 | 0x42, 0xfe, 0x0f, 0x21, 0x00, 0x1f, 0x57, 0x05, |
| 8 | 0x08, 0x00, 0x72, 0xf4, 0x80, 0x20, 0x1c, 0xc3, |
| 9 | 0x51, 0x17, 0x12, 0x05, 0x08, 0x20, 0x72, 0xf4, |
| 10 | 0x90, 0x20, 0x1d, 0x50, 0x08, 0x29, 0x47, 0x80, |
| 11 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }; |
| 12 | |
| 13 | static const u_int8_t bsc_cr_patched[] = { |
| 14 | 0x00, 0x2e, 0xfd, |
| 15 | 0x01, 0x00, 0x00, 0x05, 0x02, 0x02, 0x04, 0x02, |
| 16 | 0x42, 0xfe, 0x0f, 0x21, 0x00, 0x1f, 0x57, 0x05, |
| 17 | 0x08, 0x00, 0x72, 0xf4, 0x80, 0x20, 0x1c, 0xc3, |
| 18 | 0x51, 0x17, 0x12, 0x05, 0x08, 0x20, 0x72, 0xf4, |
| 19 | 0x90, 0x20, 0x1d, 0x50, 0x08, 0x29, 0x47, 0x80, |
| 20 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }; |
| 21 | |
| 22 | /* CC, MSC -> BSC */ |
| 23 | static const u_int8_t msc_cc[] = { |
| 24 | 0x00, 0x0a, 0xfd, |
| 25 | 0x02, 0x00, 0x00, 0x05, 0x01, 0x1f, 0xe4, 0x02, |
| 26 | 0x01, 0x00 }; |
| 27 | static const u_int8_t msc_cc_patched[] = { |
| 28 | 0x00, 0x0a, 0xfd, |
| 29 | 0x02, 0x00, 0x00, 0x15, 0x01, 0x1f, 0xe4, 0x02, |
| 30 | 0x01, 0x00 }; |
| 31 | |
| 32 | /* Classmark, BSC -> MSC */ |
| 33 | static const u_int8_t bsc_dtap[] = { |
| 34 | 0x00, 0x17, 0xfd, |
| 35 | 0x06, 0x01, 0x1f, 0xe4, 0x00, 0x01, 0x10, 0x00, |
| 36 | 0x0e, 0x54, 0x12, 0x03, 0x50, 0x18, 0x93, 0x13, |
| 37 | 0x06, 0x60, 0x14, 0x45, 0x00, 0x81, 0x00 }; |
| 38 | |
| 39 | static const u_int8_t bsc_dtap_patched[] = { |
| 40 | 0x00, 0x17, 0xfd, |
| 41 | 0x06, 0x01, 0x1f, 0xe4, 0x00, 0x01, 0x10, 0x00, |
| 42 | 0x0e, 0x54, 0x12, 0x03, 0x50, 0x18, 0x93, 0x13, |
| 43 | 0x06, 0x60, 0x14, 0x45, 0x00, 0x81, 0x00 }; |
| 44 | |
| 45 | /* Clear command, MSC -> BSC */ |
| 46 | static const u_int8_t msc_dtap[] = { |
| 47 | 0x00, 0x0d, 0xfd, |
| 48 | 0x06, 0x00, 0x00, 0x05, 0x00, 0x01, 0x06, 0x00, |
| 49 | 0x04, 0x20, 0x04, 0x01, 0x09 }; |
| 50 | static const u_int8_t msc_dtap_patched[] = { |
| 51 | 0x00, 0x0d, 0xfd, |
| 52 | 0x06, 0x00, 0x00, 0x15, 0x00, 0x01, 0x06, 0x00, |
| 53 | 0x04, 0x20, 0x04, 0x01, 0x09 }; |
| 54 | |
| 55 | /*RLSD, MSC -> BSC */ |
| 56 | static const u_int8_t msc_rlsd[] = { |
| 57 | 0x00, 0x0a, 0xfd, |
| 58 | 0x04, 0x00, 0x00, 0x05, 0x01, 0x1f, 0xe4, 0x00, |
| 59 | 0x01, 0x00 }; |
| 60 | static const u_int8_t msc_rlsd_patched[] = { |
| 61 | 0x00, 0x0a, 0xfd, |
| 62 | 0x04, 0x00, 0x00, 0x15, 0x01, 0x1f, 0xe4, 0x00, |
| 63 | 0x01, 0x00 }; |
| 64 | |
| 65 | /* RLC, BSC -> MSC */ |
| 66 | static const u_int8_t bsc_rlc[] = { |
| 67 | 0x00, 0x07, 0xfd, |
| 68 | 0x05, 0x01, 0x1f, 0xe4, 0x00, 0x00, 0x15 }; |
| 69 | |
| 70 | static const u_int8_t bsc_rlc_patched[] = { |
| 71 | 0x00, 0x07, 0xfd, |
| 72 | 0x05, 0x01, 0x1f, 0xe4, 0x00, 0x00, 0x05 }; |
Holger Hans Peter Freyther | d5deb33 | 2010-03-30 06:51:53 +0200 | [diff] [blame] | 73 | |
| 74 | |
| 75 | /* a paging command */ |
| 76 | static const u_int8_t paging_by_lac_cmd[] = { |
| 77 | 0x00, 0x22, 0xfd, 0x09, |
| 78 | 0x00, 0x03, 0x07, 0x0b, 0x04, 0x43, 0x02, 0x00, |
| 79 | 0xfe, 0x04, 0x43, 0x5c, 0x00, 0xfe, 0x12, 0x00, |
| 80 | 0x10, 0x52, 0x08, 0x08, 0x29, 0x47, 0x10, 0x02, |
| 81 | 0x01, 0x50, 0x02, 0x30, 0x1a, 0x03, 0x05, 0x20, |
| 82 | 0x15 }; |
Holger Hans Peter Freyther | dccb915 | 2010-06-15 18:49:53 +0800 | [diff] [blame] | 83 | |
| 84 | /* an assignment command */ |
| 85 | static const u_int8_t ass_cmd[] = { |
| 86 | 0x00, 0x12, 0xfd, 0x06, |
| 87 | 0x00, 0x00, 0x49, 0x00, 0x01, 0x0b, 0x00, 0x09, |
| 88 | 0x01, 0x0b, 0x03, 0x01, 0x0a, 0x11, 0x01, 0x00, |
| 89 | 0x15 }; |
Holger Hans Peter Freyther | acd6420 | 2010-04-01 06:48:52 +0200 | [diff] [blame] | 90 | |
| 91 | /* |
| 92 | * MGCP messages |
| 93 | */ |
| 94 | |
| 95 | /* nothing to patch */ |
| 96 | static 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"; |
| 97 | static 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 */ |
| 101 | static 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"; |
| 102 | static 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 */ |
| 105 | static 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"; |
| 106 | static 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 | |
| 109 | static 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"; |
| 110 | static 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 | |
Holger Hans Peter Freyther | 3237065 | 2010-04-04 19:34:44 +0200 | [diff] [blame] | 112 | /* different line ending */ |
| 113 | static 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"; |
| 114 | static 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"; |
| 115 | |
Holger Hans Peter Freyther | acd6420 | 2010-04-01 06:48:52 +0200 | [diff] [blame] | 116 | struct mgcp_patch_test { |
| 117 | const char *orig; |
| 118 | const char *patch; |
| 119 | const char *ip; |
| 120 | const int port; |
| 121 | }; |
| 122 | |
| 123 | static const struct mgcp_patch_test mgcp_messages[] = { |
| 124 | { |
| 125 | .orig = crcx, |
| 126 | .patch = crcx_patched, |
| 127 | .ip = "0.0.0.0", |
| 128 | .port = 2323, |
| 129 | }, |
| 130 | { |
| 131 | .orig = crcx_resp, |
| 132 | .patch = crcx_resp_patched, |
| 133 | .ip = "10.0.0.1", |
| 134 | .port = 999, |
| 135 | }, |
| 136 | { |
| 137 | .orig = mdcx, |
| 138 | .patch = mdcx_patched, |
| 139 | .ip = "10.0.0.23", |
| 140 | .port = 6666, |
| 141 | }, |
| 142 | { |
| 143 | .orig = mdcx_resp, |
| 144 | .patch = mdcx_resp_patched, |
| 145 | .ip = "10.0.0.23", |
| 146 | .port = 5555, |
| 147 | }, |
Holger Hans Peter Freyther | 3237065 | 2010-04-04 19:34:44 +0200 | [diff] [blame] | 148 | { |
| 149 | .orig = mdcx_resp2, |
| 150 | .patch = mdcx_resp_patched2, |
| 151 | .ip = "10.0.0.23", |
| 152 | .port = 5555, |
| 153 | }, |
Holger Hans Peter Freyther | acd6420 | 2010-04-01 06:48:52 +0200 | [diff] [blame] | 154 | }; |