MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / plugins / wimax / msg_dsa.c
blobb00b0f2905c990f03d4b2355044783e90c499f20
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 * $Id$
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 /* Include files */
31 #include "config.h"
34 #define DEBUG
37 #include <glib.h>
38 #include <epan/packet.h>
39 #include "wimax_tlv.h"
40 #include "wimax_mac.h"
41 #include "wimax_utils.h"
43 static gint proto_mac_mgmt_msg_dsa_decoder = -1;
44 static gint ett_mac_mgmt_msg_dsa_req_decoder = -1;
45 static gint ett_mac_mgmt_msg_dsa_rsp_decoder = -1;
46 static gint ett_mac_mgmt_msg_dsa_ack_decoder = -1;
48 /* fix fields */
49 static gint hf_dsa_transaction_id = -1;
50 static gint hf_dsa_confirmation_code = -1;
52 static void dissect_mac_mgmt_msg_dsa_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
54 guint offset = 0;
55 proto_item *dsa_item;
56 proto_tree *dsa_tree;
58 { /* we are being asked for details */
60 /* display MAC message type */
61 dsa_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsa_decoder, tvb, offset, -1,
62 "Dynamic Service Addition Request (DSA-REQ)");
63 /* add MAC DSx subtree */
64 dsa_tree = proto_item_add_subtree(dsa_item, ett_mac_mgmt_msg_dsa_req_decoder);
65 /* Decode and display the Uplink Channel Descriptor (UCD) */
66 /* display the Transaction ID */
67 proto_tree_add_item(dsa_tree, hf_dsa_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN);
68 /* move to next field */
69 offset += 2;
70 /* process DSA-REQ message TLV Encode Information */
71 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, dsa_tree);
75 static void dissect_mac_mgmt_msg_dsa_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
77 guint offset = 0;
78 proto_item *dsa_item;
79 proto_tree *dsa_tree;
81 { /* we are being asked for details */
82 /* display MAC message type */
83 dsa_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsa_decoder, tvb, offset, -1,
84 "Dynamic Service Addition Response (DSA-RSP)");
85 /* add MAC DSx subtree */
86 dsa_tree = proto_item_add_subtree(dsa_item, ett_mac_mgmt_msg_dsa_rsp_decoder);
87 /* Decode and display the Uplink Channel Descriptor (UCD) */
88 /* display the Transaction ID */
89 proto_tree_add_item(dsa_tree, hf_dsa_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN);
90 /* move to next field */
91 offset += 2;
92 /* display the Confirmation Code */
93 proto_tree_add_item(dsa_tree, hf_dsa_confirmation_code, tvb, offset, 1, ENC_BIG_ENDIAN);
94 /* move to next field */
95 offset++;
96 /* process DSA RSP message TLV Encode Information */
97 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, dsa_tree);
101 static void dissect_mac_mgmt_msg_dsa_ack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
103 guint offset = 0;
104 proto_item *dsa_item;
105 proto_tree *dsa_tree;
107 { /* we are being asked for details */
108 /* display MAC message type */
109 dsa_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dsa_decoder, tvb, offset, -1,
110 "Dynamic Service Addition Acknowledge (DSA-ACK)");
111 /* add MAC DSx subtree */
112 dsa_tree = proto_item_add_subtree(dsa_item, ett_mac_mgmt_msg_dsa_ack_decoder);
113 /* Decode and display the Uplink Channel Descriptor (UCD) */
114 /* display the Transaction ID */
115 proto_tree_add_item(dsa_tree, hf_dsa_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN);
116 /* move to next field */
117 offset += 2;
118 /* display the Confirmation Code */
119 proto_tree_add_item(dsa_tree, hf_dsa_confirmation_code, tvb, offset, 1, ENC_BIG_ENDIAN);
120 /* move to next field */
121 offset++;
122 /* process DSA-REQ message TLV Encode Information */
123 wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, dsa_tree);
127 /* Register Wimax Mac Payload Protocol and Dissector */
128 void proto_register_mac_mgmt_msg_dsa(void)
130 /* DSx display */
131 static hf_register_info hf[] =
134 &hf_dsa_confirmation_code,
136 "Confirmation code", "wmx.dsa.confirmation_code",
137 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
141 &hf_dsa_transaction_id,
143 "Transaction ID", "wmx.dsa.transaction_id",
144 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
149 /* Setup protocol subtree array */
150 static gint *ett[] =
152 &ett_mac_mgmt_msg_dsa_req_decoder,
153 &ett_mac_mgmt_msg_dsa_rsp_decoder,
154 &ett_mac_mgmt_msg_dsa_ack_decoder,
157 proto_mac_mgmt_msg_dsa_decoder = proto_register_protocol (
158 "WiMax DSA Messages", /* name */
159 "WiMax DSA", /* short name */
160 "wmx.dsa" /* abbrev */
163 proto_register_field_array(proto_mac_mgmt_msg_dsa_decoder, hf, array_length(hf));
164 proto_register_subtree_array(ett, array_length(ett));
167 void
168 proto_reg_handoff_mac_mgmt_msg_dsa (void)
170 dissector_handle_t dsa_handle;
172 dsa_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsa_req_decoder, proto_mac_mgmt_msg_dsa_decoder);
173 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_REQ, dsa_handle);
175 dsa_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsa_rsp_decoder, proto_mac_mgmt_msg_dsa_decoder);
176 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_RSP, dsa_handle);
178 dsa_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsa_ack_decoder, proto_mac_mgmt_msg_dsa_decoder);
179 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_ACK, dsa_handle);