2 * WiMax MAC Management REG-RSP Message decoder
4 * Copyright (c) 2007 by Intel Corporation.
6 * Author: John R. Underwood <junderx@yahoo.com>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1999 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #define WIMAX_16E_2005
39 #include "moduleinfo.h"
42 #include <epan/packet.h>
43 #include "wimax_tlv.h"
44 #include "wimax_mac.h"
45 #include "wimax_utils.h"
47 extern gint proto_mac_mgmt_msg_reg_req_decoder;
48 extern gboolean include_cor2_changes;
50 extern gint man_ofdma;
52 extern void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb, guint tlv_offset, guint tlv_len, packet_info *pinfo, guint offset, gint proto_registry);
53 extern void dissect_mac_mgmt_msg_dsc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
55 /* forward reference */
56 void dissect_mac_mgmt_msg_reg_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
59 static gint proto_mac_mgmt_msg_reg_rsp_decoder = -1;
60 static gint ett_mac_mgmt_msg_reg_rsp_decoder = -1;
61 static gint ett_reg_rsp_message_tree = -1;
63 /* Setup protocol subtree array */
66 &ett_mac_mgmt_msg_reg_rsp_decoder,
67 &ett_reg_rsp_message_tree
73 static gint hf_reg_rsp_message_type = -1;
74 static gint hf_reg_rsp_status = -1;
75 static gint hf_tlv_type = -1;
76 static gint hf_tlv_value = -1;
77 static gint hf_reg_rsp_secondary_mgmt_cid = -1;
78 static gint hf_reg_invalid_tlv = -1;
79 static gint hf_reg_rsp_new_cid_after_ho = -1;
80 static gint hf_reg_rsp_service_flow_id = -1;
81 static gint hf_reg_rsp_system_resource_retain_time = -1;
82 static gint hf_reg_total_provisioned_sf = -1;
84 /* STRING RESOURCES */
86 static const value_string vals_reg_rsp_status [] = {
88 {1, "Message authentication failure"},
93 /* REG-RSP fields display */
94 static hf_register_info hf[] =
97 &hf_reg_rsp_message_type,
99 "MAC Management Message Type", "wmx.macmgtmsgtype.reg_rsp",
100 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
106 "Invalid TLV", "wmx.reg_rsp.invalid_tlv",
107 FT_BYTES, BASE_HEX, NULL, 0, "", HFILL
111 &hf_reg_rsp_new_cid_after_ho,
113 "New CID after handover to new BS", "wmx.reg_rsp.new_cid_after_ho",
114 FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL
120 "Response", "wmx.reg_rsp.response",
121 FT_UINT8, BASE_HEX, VALS(vals_reg_rsp_status), 0x0, "", HFILL
125 &hf_reg_rsp_secondary_mgmt_cid,
127 "Secondary Management CID", "wmx.reg_rsp.secondary_mgmt_cid",
128 FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL
132 &hf_reg_total_provisioned_sf,
134 "Total Number of Provisional Service Flow", "wmx.reg_rsp.total_provisional_sf",
135 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
139 &hf_reg_rsp_service_flow_id,
141 "Service flow ID", "wmx.reg_rsp.service_flow_id",
142 FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL
146 &hf_reg_rsp_system_resource_retain_time,
148 "System Resource Retain Time", "wmx.reg_rsp.system_resource_retain_time",
149 FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL
155 "Unknown TLV Type", "wmx.reg_rsp.unknown_tlv_type",
156 FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL
162 "Value", "wmx.reg_rsp.tlv_value",
163 FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL
168 /* Register Wimax Mac Payload Protocol and Dissector */
169 void proto_register_mac_mgmt_msg_reg_rsp(void)
171 if (proto_mac_mgmt_msg_reg_rsp_decoder == -1)
173 proto_mac_mgmt_msg_reg_rsp_decoder = proto_mac_mgmt_msg_reg_req_decoder;
175 proto_register_field_array(proto_mac_mgmt_msg_reg_rsp_decoder, hf, array_length(hf));
176 proto_register_subtree_array(ett, array_length(ett));
180 /* Decode REG-RSP messages. */
181 void dissect_mac_mgmt_msg_reg_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
185 guint tvb_len, payload_type;
186 proto_item *reg_rsp_item = NULL;
187 proto_tree *reg_rsp_tree = NULL;
188 proto_item *tlv_item = NULL;
189 proto_tree *tlv_tree = NULL;
190 proto_tree *sub_tree = NULL;
191 gboolean hmac_found = FALSE;
195 guint this_offset = 0;
196 tlv_info_t sub_tlv_info;
199 guint sub_tlv_offset;
201 /* Ensure the right payload type */
202 payload_type = tvb_get_guint8(tvb, offset);
203 if (payload_type != MAC_MGMT_MSG_REG_RSP)
209 { /* we are being asked for details */
211 /* Get the tvb reported length */
212 tvb_len = tvb_reported_length(tvb);
213 /* display MAC payload type REG-RSP */
214 reg_rsp_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, offset, tvb_len, "MAC Management Message, REG-RSP (7)");
215 /* add MAC REG-RSP subtree */
216 reg_rsp_tree = proto_item_add_subtree(reg_rsp_item, ett_mac_mgmt_msg_reg_rsp_decoder);
217 /* display the Message Type */
218 proto_tree_add_item(reg_rsp_tree, hf_reg_rsp_message_type, tvb, offset, 1, FALSE);
219 proto_tree_add_item(reg_rsp_tree, hf_reg_rsp_status, tvb, offset + 1, 1, FALSE);
222 while (offset < tvb_len)
224 /* Get the TLV data. */
225 init_tlv_info(&tlv_info, tvb, offset);
226 /* get the TLV type */
227 tlv_type = get_tlv_type(&tlv_info);
228 /* get the TLV length */
229 tlv_len = get_tlv_length(&tlv_info);
230 if (tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
231 { /* invalid tlv info */
234 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REG-RSP TLV error");
236 proto_tree_add_item(reg_rsp_tree, hf_reg_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE);
239 /* get the offset to the TLV data */
240 tlv_offset = offset + get_tlv_value_offset(&tlv_info);
243 case REG_ARQ_PARAMETERS:
244 case REG_SS_MGMT_SUPPORT:
245 case REG_IP_MGMT_MODE:
247 case REG_UL_TRANSPORT_CIDS_SUPPORTED:
248 case REG_IP_PHS_SDU_ENCAP:
249 case REG_MAX_CLASSIFIERS_SUPPORTED:
250 case REG_PHS_SUPPORT:
251 case REG_ARQ_SUPPORT:
252 case REG_DSX_FLOW_CONTROL:
253 case REG_MCA_FLOW_CONTROL:
254 case REG_MCAST_POLLING_CIDS:
255 case REG_NUM_DL_TRANS_CID:
256 case REG_MAC_ADDRESS:
257 #ifdef WIMAX_16E_2005
258 case REG_TLV_T_20_MAX_MAC_DATA_PER_FRAME_SUPPORT:
259 case REG_TLV_T_21_PACKING_SUPPORT:
260 case REG_TLV_T_22_MAC_EXTENDED_RTPS_SUPPORT:
261 case REG_TLV_T_23_MAX_NUM_BURSTS_TRANSMITTED_CONCURRENTLY_TO_THE_MS:
262 case REG_TLV_T_26_METHOD_FOR_ALLOCATING_IP_ADDR_SECONDARY_MGMNT_CONNECTION:
263 case REG_TLV_T_27_HANDOVER_SUPPORTED:
264 case REG_TLV_T_29_HO_PROCESS_OPTIMIZATION_MS_TIMER:
265 case REG_TLV_T_31_MOBILITY_FEATURES_SUPPORTED:
266 case REG_TLV_T_40_ARQ_ACK_TYPE:
267 case REG_TLV_T_41_MS_HO_CONNECTIONS_PARAM_PROCESSING_TIME:
268 case REG_TLV_T_42_MS_HO_TEK_PROCESSING_TIME:
269 case REG_TLV_T_43_MAC_HEADER_AND_EXTENDED_SUBHEADER_SUPPORT:
270 case REG_POWER_SAVING_CLASS_CAPABILITY:
272 dissect_extended_tlv(reg_rsp_tree, tlv_type, tvb, tlv_offset, tlv_len, pinfo, offset, proto_mac_mgmt_msg_reg_rsp_decoder);
274 case REG_RSP_SECONDARY_MGMT_CID:
275 tlv_tree = add_tlv_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, hf_reg_rsp_secondary_mgmt_cid, tvb, tlv_offset, tlv_len, FALSE);
276 proto_tree_add_item(tlv_tree, hf_reg_rsp_secondary_mgmt_cid, tvb, tlv_offset, tlv_len, FALSE);
279 case REG_RSP_TLV_T_36_TOTAL_PROVISIONED_SERVICE_FLOW_DSAs:
280 tlv_tree = add_tlv_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, hf_reg_total_provisioned_sf, tvb, tlv_offset, tlv_len, FALSE);
281 proto_tree_add_item(tlv_tree, hf_reg_total_provisioned_sf, tvb, tlv_offset, tlv_len, FALSE);
284 case REG_RSP_TLV_T_24_CID_UPDATE_ENCODINGS:
285 /* Display CID update encodings */
287 sub_tree = add_protocol_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "CID update encodings (%u byte(s))", tlv_len);
288 /* Use a local copy of tlv_offset */
289 this_offset = tlv_offset;
290 while(this_offset < tlv_len) {
291 /* Get the sub TLV data. */
292 init_tlv_info(&sub_tlv_info, tvb, this_offset);
293 /* get the sub TLV type */
294 sub_tlv_type = get_tlv_type(&sub_tlv_info);
295 /* get the TLV length */
296 sub_tlv_len = get_tlv_length(&sub_tlv_info);
297 if (tlv_type == -1 || sub_tlv_len > MAX_TLV_LEN || sub_tlv_len < 1)
298 { /* invalid tlv info */
301 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "REG-RSP TLV error");
303 proto_tree_add_item(reg_rsp_tree, hf_reg_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE);
306 /* get the offset to the sub TLV data */
307 sub_tlv_offset = this_offset + get_tlv_value_offset(&sub_tlv_info);
308 switch (sub_tlv_type) {
309 case REG_RSP_TLV_T_24_1_CID_UPDATE_ENCODINGS_NEW_CID:
310 tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_reg_rsp_message_tree, sub_tree, hf_reg_rsp_new_cid_after_ho, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
311 proto_tree_add_item(tlv_tree, hf_reg_rsp_new_cid_after_ho, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
313 case REG_RSP_TLV_T_24_2_CID_UPDATE_ENCODINGS_SFID:
314 tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_reg_rsp_message_tree, sub_tree, hf_reg_rsp_service_flow_id, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
315 proto_tree_add_item(tlv_tree, hf_reg_rsp_service_flow_id, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
317 case REG_RSP_TLV_T_24_3_CID_UPDATE_ENCODINGS_CONNECTION_INFO:
318 tlv_tree = add_protocol_subtree(&sub_tlv_info, ett_reg_rsp_message_tree, sub_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, sub_tlv_offset, sub_tlv_len, "CID Update Encodings Connection Info (%u byte(s))", tlv_len);
319 /* Decode the DSC_RSP subTLV's */
320 dissect_mac_mgmt_msg_dsc_rsp_decoder(tvb_new_subset(tvb, sub_tlv_offset, sub_tlv_len, sub_tlv_len), pinfo, tlv_tree);
323 tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_reg_rsp_message_tree, sub_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
324 proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
327 this_offset = sub_tlv_len + sub_tlv_offset;
330 case REG_RSP_TLV_T_28_HO_SYSTEM_RESOURCE_RETAIN_TIME:
331 tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "System Resource Retain Time (%u byte(s))", tlv_len);
332 tlv_item = proto_tree_add_item(tlv_tree, hf_reg_rsp_system_resource_retain_time, tvb, tlv_offset, tlv_len, FALSE);
333 if (include_cor2_changes) {
334 proto_item_append_text(tlv_item, " (in units of 100 milliseconds)");
336 proto_item_append_text(tlv_item, " (multiple of 100 milliseconds)");
339 case DSx_UPLINK_FLOW:
340 /* display Uplink Service Flow Encodings info */
342 tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "Uplink Service Flow Encodings (%u byte(s))", tlv_len);
343 /* decode and display the DL Service Flow Encodings */
344 wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, tlv_tree);
346 case DSx_DOWNLINK_FLOW:
347 /* display Downlink Service Flow Encodings info */
349 tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "Downlink Service Flow Encodings (%u byte(s))", tlv_len);
350 /* decode and display the DL Service Flow Encodings */
351 wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, tlv_tree);
353 case HMAC_TUPLE: /* Table 348d */
354 /* decode and display the HMAC Tuple */
355 tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len);
356 wimax_hmac_tuple_decoder(tlv_tree, tvb, offset+2, tlv_len);
359 case CMAC_TUPLE: /* Table 348b */
360 /* decode and display the CMAC Tuple */
361 tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len);
362 wimax_cmac_tuple_decoder(tlv_tree, tvb, offset+2, tlv_len);
364 case SHORT_HMAC_TUPLE:
365 case SHORT_HMAC_TUPLE_COR2:
366 if ((!include_cor2_changes && (tlv_type == SHORT_HMAC_TUPLE)) ||
367 (include_cor2_changes && (tlv_type == SHORT_HMAC_TUPLE_COR2))) {
368 /* decode and display the Short HMAC Tuple */
369 tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_reg_rsp_decoder, reg_rsp_tree, proto_mac_mgmt_msg_reg_rsp_decoder, tvb, tlv_offset, tlv_len, "Short HMAC Tuple (%u byte(s))", tlv_len);
370 wimax_short_hmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tlv_len);
372 /* Unknown TLV Type */
373 tlv_tree = add_tlv_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE);
374 proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE);
377 case VENDOR_SPECIFIC_INFO:
378 case VENDOR_ID_ENCODING:
379 case MAC_VERSION_ENCODING:
380 wimax_common_tlv_encoding_decoder(tvb_new_subset(tvb, offset, (tvb_len - offset), (tvb_len - offset)), pinfo, reg_rsp_tree);
383 tlv_tree = add_tlv_subtree(&tlv_info, ett_reg_rsp_message_tree, reg_rsp_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE);
384 proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE);
388 offset = tlv_len + tlv_offset;
389 } /* end of TLV process while loop */
391 proto_item_append_text(reg_rsp_tree, " (HMAC Tuple is missing !)");