2 * WiMax MAC Management DSA-REQ/RSP/ACK Messages decoder
4 * Copyright (c) 2007 by Intel Corporation.
6 * Author: Lu Pan <lu.pan@intel.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1999 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
23 #include <epan/packet.h>
24 #include "wimax_mac.h"
25 #include "wimax_utils.h"
27 void proto_register_mac_mgmt_msg_dsa(void);
28 void proto_reg_handoff_mac_mgmt_msg_dsa(void);
30 static dissector_handle_t dsa_req_handle
;
31 static dissector_handle_t dsa_rsp_handle
;
32 static dissector_handle_t dsa_ack_handle
;
34 static int proto_mac_mgmt_msg_dsa_decoder
;
35 static int ett_mac_mgmt_msg_dsa_req_decoder
;
36 static int ett_mac_mgmt_msg_dsa_rsp_decoder
;
37 static int ett_mac_mgmt_msg_dsa_ack_decoder
;
40 static int hf_dsa_transaction_id
;
41 static int hf_dsa_confirmation_code
;
43 static int dissect_mac_mgmt_msg_dsa_req_decoder(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
49 { /* we are being asked for details */
51 /* display MAC message type */
52 dsa_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_dsa_decoder
, tvb
, offset
, -1,
53 "Dynamic Service Addition Request (DSA-REQ)");
54 /* add MAC DSx subtree */
55 dsa_tree
= proto_item_add_subtree(dsa_item
, ett_mac_mgmt_msg_dsa_req_decoder
);
56 /* Decode and display the Uplink Channel Descriptor (UCD) */
57 /* display the Transaction ID */
58 proto_tree_add_item(dsa_tree
, hf_dsa_transaction_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
59 /* move to next field */
61 /* process DSA-REQ message TLV Encode Information */
62 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb
, offset
), pinfo
, dsa_tree
);
64 return tvb_captured_length(tvb
);
67 static int dissect_mac_mgmt_msg_dsa_rsp_decoder(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
73 { /* we are being asked for details */
74 /* display MAC message type */
75 dsa_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_dsa_decoder
, tvb
, offset
, -1,
76 "Dynamic Service Addition Response (DSA-RSP)");
77 /* add MAC DSx subtree */
78 dsa_tree
= proto_item_add_subtree(dsa_item
, ett_mac_mgmt_msg_dsa_rsp_decoder
);
79 /* Decode and display the Uplink Channel Descriptor (UCD) */
80 /* display the Transaction ID */
81 proto_tree_add_item(dsa_tree
, hf_dsa_transaction_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
82 /* move to next field */
84 /* display the Confirmation Code */
85 proto_tree_add_item(dsa_tree
, hf_dsa_confirmation_code
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
86 /* move to next field */
88 /* process DSA RSP message TLV Encode Information */
89 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb
, offset
), pinfo
, dsa_tree
);
91 return tvb_captured_length(tvb
);
94 static int dissect_mac_mgmt_msg_dsa_ack_decoder(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
100 { /* we are being asked for details */
101 /* display MAC message type */
102 dsa_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_dsa_decoder
, tvb
, offset
, -1,
103 "Dynamic Service Addition Acknowledge (DSA-ACK)");
104 /* add MAC DSx subtree */
105 dsa_tree
= proto_item_add_subtree(dsa_item
, ett_mac_mgmt_msg_dsa_ack_decoder
);
106 /* Decode and display the Uplink Channel Descriptor (UCD) */
107 /* display the Transaction ID */
108 proto_tree_add_item(dsa_tree
, hf_dsa_transaction_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
109 /* move to next field */
111 /* display the Confirmation Code */
112 proto_tree_add_item(dsa_tree
, hf_dsa_confirmation_code
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
113 /* move to next field */
115 /* process DSA-REQ message TLV Encode Information */
116 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb
, offset
), pinfo
, dsa_tree
);
118 return tvb_captured_length(tvb
);
121 /* Register Wimax Mac Payload Protocol and Dissector */
122 void proto_register_mac_mgmt_msg_dsa(void)
125 static hf_register_info hf
[] =
128 &hf_dsa_confirmation_code
,
130 "Confirmation code", "wmx.dsa.confirmation_code",
131 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
135 &hf_dsa_transaction_id
,
137 "Transaction ID", "wmx.dsa.transaction_id",
138 FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
143 /* Setup protocol subtree array */
146 &ett_mac_mgmt_msg_dsa_req_decoder
,
147 &ett_mac_mgmt_msg_dsa_rsp_decoder
,
148 &ett_mac_mgmt_msg_dsa_ack_decoder
,
151 proto_mac_mgmt_msg_dsa_decoder
= proto_register_protocol (
152 "WiMax DSA Messages", /* name */
153 "WiMax DSA", /* short name */
154 "wmx.dsa" /* abbrev */
157 proto_register_field_array(proto_mac_mgmt_msg_dsa_decoder
, hf
, array_length(hf
));
158 proto_register_subtree_array(ett
, array_length(ett
));
160 dsa_req_handle
= register_dissector("mac_mgmt_msg_dsa_req_handler", dissect_mac_mgmt_msg_dsa_req_decoder
, proto_mac_mgmt_msg_dsa_decoder
);
161 dsa_rsp_handle
= register_dissector("mac_mgmt_msg_dsa_rsp_handler", dissect_mac_mgmt_msg_dsa_rsp_decoder
, proto_mac_mgmt_msg_dsa_decoder
);
162 dsa_ack_handle
= register_dissector("mac_mgmt_msg_dsa_ack_handler", dissect_mac_mgmt_msg_dsa_ack_decoder
, proto_mac_mgmt_msg_dsa_decoder
);
166 proto_reg_handoff_mac_mgmt_msg_dsa (void)
168 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_REQ
, dsa_req_handle
);
169 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_RSP
, dsa_rsp_handle
);
170 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_ACK
, dsa_ack_handle
);
174 * Editor modelines - https://www.wireshark.org/tools/modelines.html
179 * indent-tabs-mode: t
182 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
183 * :indentSize=8:tabSize=8:noTabs=false: