Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 1 | Index: wireshark/epan/dissectors/packet-rsl.c |
| 2 | =================================================================== |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 3 | --- wireshark.orig/epan/dissectors/packet-rsl.c 2009-07-03 22:20:16.000000000 +0200 |
| 4 | +++ wireshark/epan/dissectors/packet-rsl.c 2009-07-04 04:06:04.000000000 +0200 |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 5 | @@ -2,6 +2,7 @@ |
| 6 | * Routines for Radio Signalling Link (RSL) dissection. |
| 7 | * |
| 8 | * Copyright 2007, Anders Broman <anders.broman@ericsson.com> |
| 9 | + * Copyright 2009, Harald Welte <laforge@gnumonks.org> |
| 10 | * |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 11 | * $Id: packet-rsl.c 28770 2009-06-18 21:30:42Z stig $ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 12 | * |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 13 | @@ -44,6 +45,8 @@ |
| 14 | #include <epan/lapd_sapi.h> |
| 15 | |
| 16 | #include "packet-gsm_a_common.h" |
| 17 | +#include "packet-rtp.h" |
| 18 | +#include "packet-rtcp.h" |
| 19 | |
| 20 | /* Initialize the protocol and registered fields */ |
| 21 | static int proto_rsl = -1; |
| 22 | @@ -116,6 +119,14 @@ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 23 | static int hf_rsl_rtd = -1; |
| 24 | static int hf_rsl_delay_ind = -1; |
| 25 | static int hf_rsl_tfo = -1; |
| 26 | +static int hf_rsl_f4 = -1; |
| 27 | +static int hf_rsl_f6 = -1; |
| 28 | +static int hf_rsl_f8 = -1; |
| 29 | +static int hf_rsl_fc = -1; |
| 30 | +static int hf_rsl_local_port = -1; |
| 31 | +static int hf_rsl_remote_port = -1; |
| 32 | +static int hf_rsl_local_ip = -1; |
| 33 | +static int hf_rsl_remote_ip = -1; |
| 34 | |
| 35 | /* Initialize the subtree pointers */ |
| 36 | static int ett_rsl = -1; |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 37 | @@ -173,6 +184,15 @@ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 38 | static int ett_ie_meas_res_no = -1; |
| 39 | static int ett_ie_message_id = -1; |
| 40 | static int ett_ie_sys_info_type = -1; |
| 41 | +static int ett_ie_f4 = -1; |
| 42 | +static int ett_ie_f6 = -1; |
| 43 | +static int ett_ie_f8 = -1; |
| 44 | +static int ett_ie_remote_ip = -1; |
| 45 | +static int ett_ie_remote_port = -1; |
| 46 | +static int ett_ie_local_port = -1; |
| 47 | +static int ett_ie_local_ip = -1; |
| 48 | +static int ett_ie_fc = -1; |
| 49 | + |
| 50 | |
| 51 | proto_tree *top_tree; |
| 52 | dissector_handle_t gsm_a_ccch_handle; |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 53 | @@ -208,8 +228,11 @@ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 54 | { 0x06, "Common Channel Management messages" }, |
| 55 | { 0x08, "TRX Management messages" }, |
| 56 | { 0x16, "Location Services messages" }, |
| 57 | + { 0x3f, "ip.access Vendor Specific messages" }, |
| 58 | { 0, NULL } |
| 59 | }; |
| 60 | +#define RSL_MSGDISC_IPACCESS 0x3f |
| 61 | + |
| 62 | /* |
| 63 | * 9.2 MESSAGE TYPE |
| 64 | */ |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 65 | @@ -276,6 +299,21 @@ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 66 | /* 0 1 - - - - - - Location Services messages: */ |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 67 | #define RSL_MSG_LOC_INF 65 /* 8.7.1 */ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 68 | |
| 69 | +/* Vendor-Specific messages of ip.access nanoBTS. There is no public documentation |
| 70 | + * about those extensions, all information in this dissector is based on lawful |
| 71 | + * protocol reverse enginering by Harald Welte <laforge@gnumonks.org> */ |
| 72 | +#define RSL_MSG_TYPE_IPAC_BIND 0x70 |
| 73 | +#define RSL_MSG_TYPE_IPAC_BIND_ACK 0x71 |
| 74 | +#define RSL_MSG_TYPE_IPAC_BIND_NACK 0x72 |
| 75 | +#define RSL_MSG_TYPE_IPAC_CONNECT 0x73 |
| 76 | +#define RSL_MSG_TYPE_IPAC_CONNECT_ACK 0x74 |
| 77 | +#define RSL_MSG_TYPE_IPAC_CONNECT_NACK 0x75 |
| 78 | +#define RSL_MSG_TYPE_IPAC_DISC_IND 0x76 |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 79 | + |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 80 | +#define RSL_IE_IPAC_REMOTE_IP 0xf0 |
| 81 | +#define RSL_IE_IPAC_REMOTE_PORT 0xf1 |
| 82 | +#define RSL_IE_IPAC_LOCAL_PORT 0xf3 |
| 83 | +#define RSL_IE_IPAC_LOCAL_IP 0xf5 |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 84 | |
| 85 | static const value_string rsl_msg_type_vals[] = { |
| 86 | /* 0 0 0 0 - - - - Radio Link Layer Management messages: */ |
| 87 | @@ -338,6 +376,14 @@ |
| 88 | { 0x3f, "TFO MODification REQuest" }, /* 8.4.31 */ |
| 89 | /* 0 1 - - - - - - Location Services messages: */ |
| 90 | { 0x41, "Location Information" }, /* 8.7.1 */ |
| 91 | + /* ip.access */ |
| 92 | + { 0x70, "ip.access BIND" }, |
| 93 | + { 0x71, "ip.access BIND ACK" }, |
| 94 | + { 0x72, "ip.access BIND NACK" }, |
| 95 | + { 0x73, "ip.access CONNECT" }, |
| 96 | + { 0x74, "ip.access CONNECT ACK" }, |
| 97 | + { 0x75, "ip.access CONNECT NACK" }, |
| 98 | + { 0x76, "ip.access DISCONNECT INDication" }, |
| 99 | { 0, NULL } |
| 100 | }; |
| 101 | |
| 102 | @@ -477,6 +523,10 @@ |
| 103 | Not used |
| 104 | |
| 105 | */ |
| 106 | + { 0xf0, "Remote IP Address" }, |
| 107 | + { 0xf1, "Remote RTP Port" }, |
| 108 | + { 0xf3, "Local RTP Port" }, |
| 109 | + { 0xf5, "Local IP Address" }, |
| 110 | { 0, NULL } |
| 111 | }; |
| 112 | |
| 113 | @@ -513,6 +563,95 @@ |
| 114 | { 0, NULL } |
| 115 | }; |
| 116 | |
| 117 | +/* From openbsc/include/openbsc/tlv.h */ |
| 118 | +enum tlv_type { |
| 119 | + TLV_TYPE_FIXED, |
| 120 | + TLV_TYPE_T, |
| 121 | + TLV_TYPE_TV, |
| 122 | + TLV_TYPE_TLV, |
| 123 | + TLV_TYPE_TL16V, |
| 124 | +}; |
| 125 | + |
| 126 | +struct tlv_def { |
| 127 | + enum tlv_type type; |
| 128 | + u_int8_t fixed_len; |
| 129 | +}; |
| 130 | + |
| 131 | +struct tlv_definition { |
| 132 | + struct tlv_def def[0xff]; |
| 133 | +}; |
| 134 | + |
| 135 | +static const struct tlv_definition rsl_att_tlvdef = { |
| 136 | + .def = { |
| 137 | + [RSL_IE_CH_NO] = { TLV_TYPE_TV, 0 }, |
| 138 | + [RSL_IE_LINK_ID] = { TLV_TYPE_TV, 0 }, |
| 139 | + [RSL_IE_ACT_TYPE] = { TLV_TYPE_TV, 0 }, |
| 140 | + [RSL_IE_BS_POW] = { TLV_TYPE_TV, 0 }, |
| 141 | + [RSL_IE_CH_ID] = { TLV_TYPE_TLV, 0 }, |
| 142 | + [RSL_IE_CH_MODE] = { TLV_TYPE_TLV, 0 }, |
| 143 | + [RSL_IE_ENC_INF] = { TLV_TYPE_TLV, 0 }, |
| 144 | + [RSL_IE_FRAME_NO] = { TLV_TYPE_FIXED, 2 }, |
| 145 | + [RSL_IE_HO_REF] = { TLV_TYPE_TV, 0 }, |
| 146 | + [RSL_IE_L1_INF] = { TLV_TYPE_FIXED, 2 }, |
| 147 | + [RSL_IE_L3_INF] = { TLV_TYPE_TL16V, 0 }, |
| 148 | + [RSL_IE_MS_ID] = { TLV_TYPE_TLV, 0 }, |
| 149 | + [RSL_IE_MS_POW] = { TLV_TYPE_TV, 0 }, |
| 150 | + [RSL_IE_PAGING_GRP] = { TLV_TYPE_TV, 0 }, |
| 151 | + [RSL_IE_PAGING_LOAD] = { TLV_TYPE_FIXED, 2 }, |
| 152 | + [RSL_IE_PHY_CTX] = { TLV_TYPE_TLV, 0 }, |
| 153 | + [RSL_IE_ACCESS_DELAY] = { TLV_TYPE_TV, 0 }, |
| 154 | + [RSL_IE_RACH_LOAD] = { TLV_TYPE_TLV, 0 }, |
| 155 | + [RSL_IE_REQ_REF] = { TLV_TYPE_FIXED, 3 }, |
| 156 | + [RSL_IE_REL_MODE] = { TLV_TYPE_TV, 0 }, |
| 157 | + [RSL_IE_RESOURCE_INF] = { TLV_TYPE_TLV, 0 }, |
| 158 | + [RSL_IE_RLM_CAUSE] = { TLV_TYPE_TLV, 0 }, |
| 159 | + [RSL_IE_STARTING_TIME] = { TLV_TYPE_FIXED, 2 }, |
| 160 | + [RSL_IE_TIMING_ADV] = { TLV_TYPE_TV, 0 }, |
| 161 | + [RSL_IE_UPLINK_MEAS] = { TLV_TYPE_TLV, 0 }, |
| 162 | + [RSL_IE_CAUSE] = { TLV_TYPE_TLV, 0 }, |
| 163 | + [RSL_IE_MEAS_RES_NO] = { TLV_TYPE_TV, 0 }, |
| 164 | + [RSL_IE_MESSAGE_ID] = { TLV_TYPE_TV, 0 }, |
| 165 | + [RSL_IE_SYS_INFO_TYPE] = { TLV_TYPE_TV, 0 }, |
| 166 | + //[RSL_IE_MS_POWER_PARAM] = { TLV_TYPE_TLV, 0 }, |
| 167 | + //[RSL_IE_BS_POWER_PARAM] = { TLV_TYPE_TLV, 0 }, |
| 168 | + //[RSL_IE_PREPROC_CONFIG] = { TLV_TYPE_TLV, 0 }, |
| 169 | + //[RSL_IE_PREPROC_MEAS_RES] = { TLV_TYPE_TLV, 0 }, |
| 170 | + //[RSL_IE_IMM_ASS_INFO] = { TLV_TYPE_TLV, 0 }, |
| 171 | + //[RSL_IE_SMSCB_INFO] = { TLV_TYPE_FIXED, 23 }, |
| 172 | + //[RSL_IE_MS_TIMING_OFFSET] = { TLV_TYPE_TV, 0 }, |
| 173 | + [RSL_IE_ERR_MSG] = { TLV_TYPE_TLV, 0 }, |
| 174 | + [RSL_IE_FULL_BCCH_INF] = { TLV_TYPE_TLV, 0 }, |
| 175 | + [RSL_IE_CH_NEEDED] = { TLV_TYPE_TV, 0 }, |
| 176 | + [RSL_IE_CB_CMD_TYPE] = { TLV_TYPE_TV, 0 }, |
| 177 | + [RSL_IE_SMSCB_MESS] = { TLV_TYPE_TLV, 0 }, |
| 178 | + [RSL_IE_FULL_IMM_ASS_INF] = { TLV_TYPE_TLV, 0 }, |
| 179 | + //[RSL_IE_SACCH_INFO] = { TLV_TYPE_TLV, 0 }, |
| 180 | + [RSL_IE_CBCH_LOAD_INF] = { TLV_TYPE_TV, 0 }, |
| 181 | + [RSL_IE_SMSCB_CH_IND] = { TLV_TYPE_TV, 0 }, |
| 182 | + [RSL_IE_GRP_CALL_REF] = { TLV_TYPE_TLV, 0 }, |
| 183 | + [RSL_IE_CH_DESC] = { TLV_TYPE_TLV, 0 }, |
| 184 | + [RSL_IE_NCH_DRX_INF] = { TLV_TYPE_TLV, 0 }, |
| 185 | + [RSL_IE_CMD_IND] = { TLV_TYPE_TLV, 0 }, |
| 186 | + [RSL_IE_EMLPP_PRIO] = { TLV_TYPE_TV, 0 }, |
| 187 | + [RSL_IE_UIC] = { TLV_TYPE_TLV, 0 }, |
| 188 | + [RSL_IE_MAIN_CH_REF] = { TLV_TYPE_TV, 0 }, |
| 189 | + [RSL_IE_MULTIRATE_CONF] = { TLV_TYPE_TLV, 0 }, |
| 190 | + [RSL_IE_MULTIRATE_CNTRL] = { TLV_TYPE_TV, 0 }, |
| 191 | + [RSL_IE_SUP_CODEC_TYPES] = { TLV_TYPE_TLV, 0 }, |
| 192 | + [RSL_IE_CODEC_CONF] = { TLV_TYPE_TLV, 0 }, |
| 193 | + [RSL_IE_RTD] = { TLV_TYPE_TV, 0 }, |
| 194 | + [RSL_IE_TFO_STATUS] = { TLV_TYPE_TV, 0 }, |
| 195 | + [RSL_IE_LLP_APDU] = { TLV_TYPE_TLV, 0 }, |
| 196 | + [RSL_IE_IPAC_REMOTE_IP] = { TLV_TYPE_FIXED, 4 }, |
| 197 | + [RSL_IE_IPAC_REMOTE_PORT] = { TLV_TYPE_FIXED, 2 }, |
| 198 | + [RSL_IE_IPAC_LOCAL_IP] = { TLV_TYPE_FIXED, 4 }, |
| 199 | + [RSL_IE_IPAC_LOCAL_PORT] = { TLV_TYPE_FIXED, 2 }, |
| 200 | + [0xf4] = { TLV_TYPE_TV, 0 }, |
| 201 | + [0xf8] = { TLV_TYPE_FIXED, 2 }, |
| 202 | + [0xfc] = { TLV_TYPE_TV, 0 }, |
| 203 | + }, |
| 204 | +}; |
| 205 | + |
| 206 | /* 9.3.1 Channel number 9.3.1 M TV 2 */ |
| 207 | static int |
| 208 | dissect_rsl_ie_ch_no(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 209 | @@ -2043,7 +2182,6 @@ |
| 210 | proto_item_set_len(ti, length+2); |
| 211 | |
| 212 | proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE); |
| 213 | - offset++; |
| 214 | |
| 215 | /* Received Message */ |
| 216 | offset = dissct_rsl_msg(tvb, pinfo, ie_tree, offset); |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 217 | @@ -2907,13 +3045,392 @@ |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 218 | return ie_offset + length; |
| 219 | } |
| 220 | |
| 221 | +#if 0 |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 222 | +static int |
| 223 | +dissect_rsl_ipac_ie_f8(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 224 | +{ |
| 225 | + proto_item *ti; |
| 226 | + proto_tree *ie_tree; |
| 227 | + guint8 ie_id; |
| 228 | + |
| 229 | + if (is_mandatory == FALSE) { |
| 230 | + ie_id = tvb_get_guint8(tvb, offset); |
| 231 | + if (ie_id != 0xf8) |
| 232 | + return offset; |
| 233 | + } |
| 234 | + |
| 235 | + ti = proto_tree_add_text(tree, tvb, offset, 0, "Unknown 0xf8 IE"); |
| 236 | + ie_tree = proto_item_add_subtree(ti, ett_ie_f8); |
| 237 | + |
| 238 | + /* Element identifier */ |
| 239 | + proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 240 | + offset++; |
| 241 | + /* Fixed Length */ |
| 242 | + proto_item_set_len(ti, 3); |
| 243 | + |
| 244 | + proto_tree_add_item(ie_tree, hf_rsl_f8, tvb, offset, 2, FALSE); |
| 245 | + offset += 2; |
| 246 | + |
| 247 | + return offset; |
| 248 | +} |
| 249 | + |
| 250 | +static int |
| 251 | +dissect_rsl_ipac_ie_local_port(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 252 | +{ |
| 253 | + proto_item *ti; |
| 254 | + proto_tree *ie_tree; |
| 255 | + guint8 ie_id; |
| 256 | + |
| 257 | + if (is_mandatory == FALSE) { |
| 258 | + ie_id = tvb_get_guint8(tvb, offset); |
| 259 | + if (ie_id != RSL_IE_IPAC_LOCAL_PORT) |
| 260 | + return offset; |
| 261 | + } |
| 262 | + |
| 263 | + ti = proto_tree_add_text(tree, tvb, offset, 0, "Local RTP Port IE"); |
| 264 | + ie_tree = proto_item_add_subtree(ti, ett_ie_local_port); |
| 265 | + |
| 266 | + /* Element identifier */ |
| 267 | + proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 268 | + offset++; |
| 269 | + /* Fixed Length */ |
| 270 | + proto_item_set_len(ti, 3); |
| 271 | + |
| 272 | + proto_tree_add_item(ie_tree, hf_rsl_local_port, tvb, offset, 2, FALSE); |
| 273 | + offset += 2; |
| 274 | + |
| 275 | + return offset; |
| 276 | +} |
| 277 | + |
| 278 | +static int |
| 279 | +dissect_rsl_ipac_ie_remote_port(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 280 | +{ |
| 281 | + proto_item *ti; |
| 282 | + proto_tree *ie_tree; |
| 283 | + guint8 ie_id; |
| 284 | + |
| 285 | + if (is_mandatory == FALSE) { |
| 286 | + ie_id = tvb_get_guint8(tvb, offset); |
| 287 | + if (ie_id != RSL_IE_IPAC_REMOTE_PORT) |
| 288 | + return offset; |
| 289 | + } |
| 290 | + |
| 291 | + ti = proto_tree_add_text(tree, tvb, offset, 0, "Remote RTP Port IE"); |
| 292 | + ie_tree = proto_item_add_subtree(ti, ett_ie_remote_port); |
| 293 | + |
| 294 | + /* Element identifier */ |
| 295 | + proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 296 | + offset++; |
| 297 | + /* Fixed Length */ |
| 298 | + proto_item_set_len(ti, 3); |
| 299 | + |
| 300 | + proto_tree_add_uint(ie_tree, hf_rsl_remote_port, tvb, offset, 2, FALSE); |
| 301 | + offset += 2; |
| 302 | + |
| 303 | + return offset; |
| 304 | +} |
| 305 | + |
| 306 | +static int |
| 307 | +dissect_rsl_ipac_ie_local_ip(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 308 | +{ |
| 309 | + proto_item *ti; |
| 310 | + proto_tree *ie_tree; |
| 311 | + guint8 ie_id; |
| 312 | + guint32 ip; |
| 313 | + |
| 314 | + if (is_mandatory == FALSE) { |
| 315 | + ie_id = tvb_get_guint8(tvb, offset); |
| 316 | + if (ie_id != RSL_IE_IPAC_LOCAL_IP) |
| 317 | + return offset; |
| 318 | + } |
| 319 | + |
| 320 | + ti = proto_tree_add_text(tree, tvb, offset, 0, "Local IP Address IE"); |
| 321 | + ie_tree = proto_item_add_subtree(ti, ett_ie_local_ip); |
| 322 | + |
| 323 | + /* Element identifier */ |
| 324 | + proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 325 | + offset++; |
| 326 | + /* Fixed Length */ |
| 327 | + proto_item_set_len(ti, 5); |
| 328 | + |
| 329 | + ip = tvb_get_ipv4(tvb, offset); |
| 330 | + proto_tree_add_ipv4(ie_tree, hf_rsl_local_ip, tvb, offset, 4, ip); |
| 331 | + offset += 4; |
| 332 | + |
| 333 | + return offset; |
| 334 | +} |
| 335 | + |
| 336 | +static int |
| 337 | +dissect_rsl_ipac_ie_remote_ip(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 338 | +{ |
| 339 | + proto_item *ti; |
| 340 | + proto_tree *ie_tree; |
| 341 | + guint8 ie_id; |
| 342 | + guint32 ip; |
| 343 | + |
| 344 | + if (is_mandatory == FALSE) { |
| 345 | + ie_id = tvb_get_guint8(tvb, offset); |
| 346 | + if (ie_id != RSL_IE_IPAC_REMOTE_IP) |
| 347 | + return offset; |
| 348 | + } |
| 349 | + |
| 350 | + ti = proto_tree_add_text(tree, tvb, offset, 0, "Remote IP Address IE"); |
| 351 | + ie_tree = proto_item_add_subtree(ti, ett_ie_remote_ip); |
| 352 | + |
| 353 | + /* Element identifier */ |
| 354 | + proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 355 | + offset++; |
| 356 | + /* Fixed Length */ |
| 357 | + proto_item_set_len(ti, 5); |
| 358 | + |
| 359 | + ip = tvb_get_ipv4(tvb, offset); |
| 360 | + proto_tree_add_ipv4(ie_tree, hf_rsl_remote_ip, tvb, offset, 4, ip); |
| 361 | + offset += 4; |
| 362 | + |
| 363 | + return offset; |
| 364 | +} |
| 365 | + |
| 366 | +static int |
| 367 | +dissect_rsl_ipac_ie_f6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 368 | +{ |
| 369 | + proto_item *ti; |
| 370 | + proto_tree *ie_tree; |
| 371 | + guint8 length; |
| 372 | + guint8 ie_id; |
| 373 | + |
| 374 | + if (is_mandatory == FALSE) { |
| 375 | + ie_id = tvb_get_guint8(tvb, offset); |
| 376 | + if (ie_id != 0xf6) |
| 377 | + return offset; |
| 378 | + } |
| 379 | + |
| 380 | + ti = proto_tree_add_text(tree, tvb, offset, 0, "Unknown 0xf6 IE"); |
| 381 | + ie_tree = proto_item_add_subtree(ti, ett_ie_f6); |
| 382 | + |
| 383 | + /* Element identifier */ |
| 384 | + proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 385 | + offset++; |
| 386 | + |
| 387 | + /* Length */ |
| 388 | + length = tvb_get_guint8(tvb, offset); |
| 389 | + offset++; |
| 390 | + proto_item_set_len(ti, length+2); |
| 391 | + |
| 392 | + proto_tree_add_bytes(ie_tree, hf_rsl_f6, tvb, offset, length, |
| 393 | + tvb_get_ptr(tvb, offset, length)); |
| 394 | + offset += length; |
| 395 | + |
| 396 | + return offset; |
| 397 | +} |
| 398 | + |
| 399 | +static int |
| 400 | +dissect_rsl_ipac_ie_f4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 401 | +{ |
| 402 | + proto_item *ti; |
| 403 | + proto_tree *ie_tree; |
| 404 | + guint8 ie_id; |
| 405 | + |
| 406 | + if (is_mandatory == FALSE) { |
| 407 | + ie_id = tvb_get_guint8(tvb, offset); |
| 408 | + if (ie_id != 0xf4) |
| 409 | + return offset; |
| 410 | + } |
| 411 | + |
| 412 | + ti = proto_tree_add_text(tree, tvb, offset, 0, "Unknown 0xf4 IE"); |
| 413 | + ie_tree = proto_item_add_subtree(ti, ett_ie_f4); |
| 414 | + |
| 415 | + /* Element identifier */ |
| 416 | + proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 417 | + offset++; |
| 418 | + /* Fixed Length */ |
| 419 | + proto_item_set_len(ti, 2); |
| 420 | + proto_tree_add_item(ie_tree, hf_rsl_f4, tvb, offset, 1, FALSE); |
| 421 | + offset++; |
| 422 | + |
| 423 | + return offset; |
| 424 | +} |
| 425 | + |
| 426 | +static int |
| 427 | +dissect_rsl_ipac_ie_fc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory) |
| 428 | +{ |
| 429 | + proto_item *ti; |
| 430 | + proto_tree *ie_tree; |
| 431 | + guint8 ie_id; |
| 432 | + |
| 433 | + if (is_mandatory == FALSE) { |
| 434 | + ie_id = tvb_get_guint8(tvb, offset); |
| 435 | + if (ie_id != 0xfc) |
| 436 | + return offset; |
| 437 | + } |
| 438 | + |
| 439 | + ti = proto_tree_add_text(tree, tvb, offset, 0, "Unknown 0xfc IE"); |
| 440 | + ie_tree = proto_item_add_subtree(ti, ett_ie_fc); |
| 441 | + |
| 442 | + /* Element identifier */ |
| 443 | + proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 444 | + offset++; |
| 445 | + /* Fixed Length */ |
| 446 | + proto_item_set_len(ti, 2); |
| 447 | + proto_tree_add_item(ie_tree, hf_rsl_fc, tvb, offset, 1, FALSE); |
| 448 | + offset++; |
| 449 | + |
| 450 | + return offset; |
| 451 | +} |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 452 | +#endif |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 453 | + |
| 454 | +static int |
| 455 | +dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
| 456 | +{ |
| 457 | + guint8 msg_type; |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 458 | + guint32 local_addr = 0; |
| 459 | + guint16 local_port = 0; |
| 460 | + address src_addr; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 461 | + |
| 462 | + msg_type = tvb_get_guint8(tvb, offset)&0x7f; |
| 463 | + offset++; |
| 464 | + |
| 465 | + switch (msg_type) { |
| 466 | + case RSL_MSG_TYPE_IPAC_BIND: |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 467 | + case RSL_MSG_TYPE_IPAC_BIND_ACK: |
| 468 | + case RSL_MSG_TYPE_IPAC_BIND_NACK: |
| 469 | + case RSL_MSG_TYPE_IPAC_CONNECT: |
| 470 | + case RSL_MSG_TYPE_IPAC_CONNECT_ACK: |
| 471 | + case RSL_MSG_TYPE_IPAC_CONNECT_NACK: |
| 472 | + case RSL_MSG_TYPE_IPAC_DISC_IND: |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 473 | + /* Channel number 9.3.1 M TV 2 */ |
| 474 | + offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); |
| 475 | + break; |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 476 | +#if 0 |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 477 | + /* Channel number 9.3.1 M TV 2 */ |
| 478 | + offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); |
| 479 | + offset = dissect_rsl_ipac_ie_f8(tvb, pinfo, tree, offset, TRUE); |
| 480 | + offset = dissect_rsl_ipac_ie_local_port(tvb, pinfo, tree, offset, TRUE); |
| 481 | + offset = dissect_rsl_ipac_ie_local_ip(tvb, pinfo, tree, offset, TRUE); |
| 482 | + offset = dissect_rsl_ipac_ie_fc(tvb, pinfo, tree, offset, TRUE); |
| 483 | + break; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 484 | + /* Channel number 9.3.1 M TV 2 */ |
| 485 | + offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); |
| 486 | + break; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 487 | + /* Channel number 9.3.1 M TV 2 */ |
| 488 | + offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); |
| 489 | + offset = dissect_rsl_ipac_ie_remote_ip(tvb, pinfo, tree, offset, TRUE); |
| 490 | + offset = dissect_rsl_ipac_ie_remote_port(tvb, pinfo, tree, offset, TRUE); |
| 491 | + offset = dissect_rsl_ipac_ie_f4(tvb, pinfo, tree, offset, TRUE); |
| 492 | + offset = dissect_rsl_ipac_ie_fc(tvb, pinfo, tree, offset, TRUE); |
| 493 | + break; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 494 | + /* Channel number 9.3.1 M TV 2 */ |
| 495 | + offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); |
| 496 | + offset = dissect_rsl_ipac_ie_f8(tvb, pinfo, tree, offset, TRUE); |
| 497 | + break; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 498 | + /* Channel number 9.3.1 M TV 2 */ |
| 499 | + offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); |
| 500 | + break; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 501 | + /* Channel number 9.3.1 M TV 2 */ |
| 502 | + offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); |
| 503 | + offset = dissect_rsl_ipac_ie_f8(tvb, pinfo, tree, offset, TRUE); |
| 504 | + offset = dissect_rsl_ipac_ie_f6(tvb, pinfo, tree, offset, TRUE); |
| 505 | + /* Cause 9.3.26 M TLV >=3 */ |
| 506 | + offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE); |
| 507 | + break; |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 508 | +#endif |
| 509 | + } |
| 510 | + /* parse remaining TLV attributes */ |
| 511 | + while (tvb_reported_length_remaining(tvb, offset) != 0) { |
| 512 | + guint8 tag; |
| 513 | + unsigned int len, hlen, len_len; |
| 514 | + const struct tlv_def *tdef; |
| 515 | + proto_item *ti; |
| 516 | + proto_tree *ie_tree; |
| 517 | + |
| 518 | + tag = tvb_get_guint8(tvb, offset); |
| 519 | + tdef = &rsl_att_tlvdef.def[tag]; |
| 520 | + |
| 521 | + switch (tdef->type) { |
| 522 | + case TLV_TYPE_FIXED: |
| 523 | + hlen = 1; |
| 524 | + len_len = 0; |
| 525 | + len = tdef->fixed_len; |
| 526 | + break; |
| 527 | + case TLV_TYPE_T: |
| 528 | + hlen = 1; |
| 529 | + len_len = 0; |
| 530 | + len = 0; |
| 531 | + break; |
| 532 | + case TLV_TYPE_TV: |
| 533 | + hlen = 1; |
| 534 | + len_len = 0; |
| 535 | + len = 1; |
| 536 | + break; |
| 537 | + case TLV_TYPE_TLV: |
| 538 | + hlen = 2; |
| 539 | + len_len = 1; |
| 540 | + len = tvb_get_guint8(tvb, offset+1); |
| 541 | + break; |
| 542 | + case TLV_TYPE_TL16V: |
| 543 | + hlen = 3; |
| 544 | + len_len = 2; |
| 545 | + len = tvb_get_guint8(tvb, offset+1) << 8 | |
| 546 | + tvb_get_guint8(tvb, offset+2); |
| 547 | + break; |
| 548 | + } |
| 549 | + |
| 550 | + ti = proto_tree_add_item(tree, hf_rsl_ie_id, tvb, offset, 1, FALSE); |
| 551 | + ie_tree = proto_item_add_subtree(ti, ett_ie_local_port); |
| 552 | + offset += hlen; |
| 553 | + |
| 554 | + switch (tag) { |
| 555 | + case RSL_IE_CH_NO: |
| 556 | + break; |
| 557 | + case RSL_IE_IPAC_REMOTE_IP: |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 558 | + proto_tree_add_item(ie_tree, hf_rsl_remote_ip, tvb, |
| 559 | + offset, len, FALSE); |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 560 | + break; |
| 561 | + case RSL_IE_IPAC_REMOTE_PORT: |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 562 | + proto_tree_add_item(ie_tree, hf_rsl_remote_port, tvb, |
| 563 | + offset, len, FALSE); |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 564 | + break; |
| 565 | + case RSL_IE_IPAC_LOCAL_IP: |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 566 | + proto_tree_add_item(ie_tree, hf_rsl_local_ip, tvb, |
| 567 | + offset, len, FALSE); |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 568 | + local_addr = tvb_get_ipv4(tvb, offset); |
| 569 | + break; |
| 570 | + case RSL_IE_IPAC_LOCAL_PORT: |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 571 | + proto_tree_add_item(ie_tree, hf_rsl_local_port, tvb, |
| 572 | + offset, len, FALSE); |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 573 | + local_port = tvb_get_ntohs(tvb, offset); |
| 574 | + break; |
| 575 | + } |
| 576 | + offset += len; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 577 | + } |
| 578 | + |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 579 | + switch (msg_type) { |
| 580 | + case RSL_MSG_TYPE_IPAC_BIND_ACK: |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 581 | + /* Notify the RTP and RTCP dissectors about a new RTP stream */ |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 582 | + src_addr.type = AT_IPv4; |
| 583 | + src_addr.len = 4; |
| 584 | + src_addr.data = (guint8 *)&local_addr; |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 585 | + rtp_add_address(pinfo, &src_addr, local_port, 0, |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 586 | + "GSM A-bis/IP", pinfo->fd->num, 0, NULL); |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 587 | + rtcp_add_address(pinfo, &src_addr, local_port+1, 0, |
| 588 | + "GSM A-bis/IP", pinfo->fd->num); |
Harald Welte | 9b8eea0 | 2009-06-26 15:04:00 +0200 | [diff] [blame] | 589 | + break; |
| 590 | + } |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 591 | + return offset; |
| 592 | +} |
| 593 | + |
| 594 | static int |
| 595 | dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) |
| 596 | { |
| 597 | - guint8 msg_type; |
| 598 | + guint8 msg_disc, msg_type; |
| 599 | |
| 600 | + msg_disc = tvb_get_guint8(tvb, offset++) >> 1; |
| 601 | msg_type = tvb_get_guint8(tvb,offset)&0x7f; |
| 602 | proto_tree_add_item(tree, hf_rsl_msg_type, tvb, offset, 1, FALSE); |
| 603 | + |
| 604 | + if (msg_disc == RSL_MSGDISC_IPACCESS) { |
| 605 | + offset = dissct_rsl_ipaccess_msg(tvb, pinfo, tree, offset); |
| 606 | + return offset; |
| 607 | + } |
| 608 | offset++; |
| 609 | |
| 610 | switch (msg_type){ |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 611 | @@ -3517,7 +4034,6 @@ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 612 | /* 9.1 Message discriminator */ |
| 613 | proto_tree_add_item(rsl_tree, hf_rsl_msg_dsc, tvb, offset, 1, FALSE); |
| 614 | proto_tree_add_item(rsl_tree, hf_rsl_T_bit, tvb, offset, 1, FALSE); |
| 615 | - offset++; |
| 616 | |
| 617 | offset = dissct_rsl_msg(tvb, pinfo, rsl_tree, offset); |
| 618 | |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 619 | @@ -3883,6 +4399,46 @@ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 620 | FT_UINT8, BASE_DEC, VALS(rsl_emlpp_prio_vals), 0x03, |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 621 | NULL, HFILL } |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 622 | }, |
| 623 | + { &hf_rsl_f4, |
| 624 | + { "unknown F4 IE", "rsl.ipacc.f4", |
| 625 | + FT_UINT8, BASE_DEC, NULL, 0x0, |
| 626 | + "unknown F4 IE", HFILL } |
| 627 | + }, |
| 628 | + { &hf_rsl_f6, |
| 629 | + { "unknown F6 IE", "rsl.ipacc.f6", |
| 630 | + FT_BYTES, BASE_HEX, NULL, 0x0, |
| 631 | + "unknown F6 IE", HFILL } |
| 632 | + }, |
| 633 | + { &hf_rsl_f8, |
| 634 | + { "unknown F8 IE", "rsl.ipacc.f8", |
| 635 | + FT_UINT16, BASE_DEC, NULL, 0x0, |
| 636 | + "unknown F8 IE", HFILL } |
| 637 | + }, |
| 638 | + { &hf_rsl_fc, |
| 639 | + { "unknown FC IE", "rsl.ipacc.fc", |
| 640 | + FT_UINT8, BASE_DEC, NULL, 0x0, |
| 641 | + "unknown FC IE", HFILL } |
| 642 | + }, |
| 643 | + { &hf_rsl_local_port, |
| 644 | + { "ip.access Local RTP Port", "rsl.ipacc.local_port", |
| 645 | + FT_UINT16, BASE_DEC, NULL, 0x0, |
| 646 | + "ip.access Local RTP Port", HFILL }, |
| 647 | + }, |
| 648 | + { &hf_rsl_remote_port, |
| 649 | + { "ip.access Remote RTP Port", "rsl.ipacc.remote_port", |
| 650 | + FT_UINT16, BASE_DEC, NULL, 0x0, |
| 651 | + "ip.access Remote RTP Port", HFILL }, |
| 652 | + }, |
| 653 | + { &hf_rsl_local_ip, |
| 654 | + { "ip.access Local IP Address", "rsl.ipacc.local_ip", |
| 655 | + FT_IPv4, BASE_NONE, NULL, 0x0, |
| 656 | + "ip.access Local IP Address", HFILL }, |
| 657 | + }, |
| 658 | + { &hf_rsl_remote_ip, |
| 659 | + { "ip.access Remote IP Address", "rsl.ipacc.remote_ip", |
| 660 | + FT_IPv4, BASE_NONE, NULL, 0x0, |
| 661 | + "ip.access Remote IP Address", HFILL }, |
| 662 | + }, |
| 663 | }; |
| 664 | static gint *ett[] = { |
| 665 | &ett_rsl, |
Harald Welte | 0a53727 | 2009-07-01 11:22:01 +0200 | [diff] [blame] | 666 | @@ -3941,6 +4497,14 @@ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 667 | &ett_ie_meas_res_no, |
| 668 | &ett_ie_message_id, |
| 669 | &ett_ie_sys_info_type, |
| 670 | + &ett_ie_f4, |
| 671 | + &ett_ie_f6, |
| 672 | + &ett_ie_f8, |
| 673 | + &ett_ie_remote_ip, |
| 674 | + &ett_ie_remote_port, |
| 675 | + &ett_ie_local_port, |
| 676 | + &ett_ie_local_ip, |
| 677 | + &ett_ie_fc, |
| 678 | }; |
| 679 | |
| 680 | /* Register the protocol name and description */ |