Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / plugins / epan / wimax / msg_dsc.c
blob7ac6a290fe968014056c54605bb5e338fb82a7a8
1 /* msg_dsc.c
2 * WiMax MAC Management DSC-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
15 /* Include files */
17 #include "config.h"
20 #define DEBUG
23 #include <epan/packet.h>
24 #include "wimax_mac.h"
25 #include "wimax_utils.h"
27 void proto_register_mac_mgmt_msg_dsc(void);
28 void proto_reg_handoff_mac_mgmt_msg_dsc(void);
30 static dissector_handle_t dsc_req_handle;
31 static dissector_handle_t dsc_rsp_handle;
32 static dissector_handle_t dsc_ack_handle;
34 static int proto_mac_mgmt_msg_dsc_decoder;
35 static int ett_mac_mgmt_msg_dsc_req_decoder;
36 static int ett_mac_mgmt_msg_dsc_rsp_decoder;
37 static int ett_mac_mgmt_msg_dsc_ack_decoder;
39 /* fix fields */
40 static int hf_dsc_transaction_id;
41 static int hf_dsc_confirmation_code;
44 static int dissect_mac_mgmt_msg_dsc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
46 unsigned offset = 0;
47 proto_item *dsc_item;
48 proto_tree *dsc_tree;
50 { /* we are being asked for details */
52 /* display MAC message type */
53 dsc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsc_decoder, tvb, offset, -1,
54 "Dynamic Service Change Request (DSC-REQ)");
55 /* add MAC DSx subtree */
56 dsc_tree = proto_item_add_subtree(dsc_item, ett_mac_mgmt_msg_dsc_req_decoder);
57 /* Decode and display the Uplink Channel Descriptor (UCD) */
58 /* display the Transaction ID */
59 proto_tree_add_item(dsc_tree, hf_dsc_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN);
60 /* move to next field */
61 offset += 2;
62 /* process DSC REQ message TLV Encode Information */
63 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, dsc_tree);
65 return tvb_captured_length(tvb);
68 static int dissect_mac_mgmt_msg_dsc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
70 unsigned offset = 0;
71 proto_item *dsc_item;
72 proto_tree *dsc_tree;
74 { /* we are being asked for details */
75 /* display MAC message type */
76 dsc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsc_decoder, tvb, offset, -1,
77 "Dynamic Service Change Response (DSC-RSP)");
78 /* add MAC DSx subtree */
79 dsc_tree = proto_item_add_subtree(dsc_item, ett_mac_mgmt_msg_dsc_rsp_decoder);
80 /* Decode and display the Uplink Channel Descriptor (UCD) */
81 /* display the Transaction ID */
82 proto_tree_add_item(dsc_tree, hf_dsc_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN);
83 /* move to next field */
84 offset += 2;
85 /* display the Confirmation Code */
86 proto_tree_add_item(dsc_tree, hf_dsc_confirmation_code, tvb, offset, 1, ENC_BIG_ENDIAN);
87 /* move to next field */
88 offset++;
89 /* process DSC RSP message TLV Encode Information */
90 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, dsc_tree);
92 return tvb_captured_length(tvb);
95 static int dissect_mac_mgmt_msg_dsc_ack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
97 unsigned offset = 0;
98 proto_item *dsc_item;
99 proto_tree *dsc_tree;
101 { /* we are being asked for details */
102 /* display MAC message type */
103 dsc_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsc_decoder, tvb, offset, -1,
104 "Dynamic Service Change Acknowledge (DSC-ACK)");
105 /* add MAC DSx subtree */
106 dsc_tree = proto_item_add_subtree(dsc_item, ett_mac_mgmt_msg_dsc_ack_decoder);
107 /* Decode and display the Uplink Channel Descriptor (UCD) */
108 /* display the Transaction ID */
109 proto_tree_add_item(dsc_tree, hf_dsc_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN);
110 /* move to next field */
111 offset += 2;
112 /* display the Confirmation Code */
113 proto_tree_add_item(dsc_tree, hf_dsc_confirmation_code, tvb, offset, 1, ENC_BIG_ENDIAN);
114 /* move to next field */
115 offset++;
116 /* process DSC ACK message TLV Encode Information */
117 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, dsc_tree);
119 return tvb_captured_length(tvb);
122 /* Register Wimax Mac Payload Protocol and Dissector */
123 void proto_register_mac_mgmt_msg_dsc(void)
125 /* DSx display */
126 static hf_register_info hf[] =
129 &hf_dsc_confirmation_code,
131 "Confirmation code", "wmx.dsc.confirmation_code",
132 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
136 &hf_dsc_transaction_id,
138 "Transaction ID", "wmx.dsc.transaction_id",
139 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
144 /* Setup protocol subtree array */
145 static int *ett[] =
147 &ett_mac_mgmt_msg_dsc_req_decoder,
148 &ett_mac_mgmt_msg_dsc_rsp_decoder,
149 &ett_mac_mgmt_msg_dsc_ack_decoder
152 proto_mac_mgmt_msg_dsc_decoder = proto_register_protocol (
153 "WiMax DSC Messages", /* name */
154 "WiMax DSC", /* short name */
155 "wmx.dsc" /* abbrev */
158 proto_register_field_array(proto_mac_mgmt_msg_dsc_decoder, hf, array_length(hf));
159 proto_register_subtree_array(ett, array_length(ett));
161 dsc_req_handle = register_dissector("mac_mgmt_msg_dsc_req_handler", dissect_mac_mgmt_msg_dsc_req_decoder, proto_mac_mgmt_msg_dsc_decoder);
162 dsc_rsp_handle = register_dissector("mac_mgmt_msg_dsc_rsp_handler", dissect_mac_mgmt_msg_dsc_rsp_decoder, proto_mac_mgmt_msg_dsc_decoder);
163 dsc_ack_handle = register_dissector("mac_mgmt_msg_dsc_ack_handler", dissect_mac_mgmt_msg_dsc_ack_decoder, proto_mac_mgmt_msg_dsc_decoder);
166 void
167 proto_reg_handoff_mac_mgmt_msg_dsc(void)
169 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_REQ, dsc_req_handle);
170 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_RSP, dsc_rsp_handle);
171 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_ACK, dsc_ack_handle);
175 * Editor modelines - https://www.wireshark.org/tools/modelines.html
177 * Local variables:
178 * c-basic-offset: 8
179 * tab-width: 8
180 * indent-tabs-mode: t
181 * End:
183 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
184 * :indentSize=8:tabSize=8:noTabs=false: