Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / plugins / epan / wimax / msg_dsa.c
blobe6c9e98e2e88ba41c7f6594e025681c892924171
1 /* msg_dsa.c
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
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_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;
39 /* fix fields */
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_)
45 unsigned offset = 0;
46 proto_item *dsa_item;
47 proto_tree *dsa_tree;
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 */
60 offset += 2;
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_)
69 unsigned offset = 0;
70 proto_item *dsa_item;
71 proto_tree *dsa_tree;
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 */
83 offset += 2;
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 */
87 offset++;
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_)
96 unsigned offset = 0;
97 proto_item *dsa_item;
98 proto_tree *dsa_tree;
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 */
110 offset += 2;
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 */
114 offset++;
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)
124 /* DSx display */
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 */
144 static int *ett[] =
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);
165 void
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
176 * Local variables:
177 * c-basic-offset: 8
178 * tab-width: 8
179 * indent-tabs-mode: t
180 * End:
182 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
183 * :indentSize=8:tabSize=8:noTabs=false: