epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / plugins / epan / wimax / msg_pkm.c
blobfc12f06735af32bc137742085e2c59fc72a6fe22
1 /* msg_pkm.c
2 * WiMax MAC Management PKM-REQ/RSP Messages decoders
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 #if 0
16 #define DEBUG /* for debug only */
17 #endif
19 /* Include files */
21 #include "config.h"
23 #include <epan/packet.h>
24 #include "wimax_tlv.h"
25 #include "wimax_mac.h"
26 #include "wimax_utils.h"
28 void proto_register_mac_mgmt_msg_pkm(void);
29 void proto_reg_handoff_mac_mgmt_msg_pkm(void);
31 static dissector_handle_t mac_mgmt_msg_pkm_req_handle;
32 static dissector_handle_t mac_mgmt_msg_pkm_rsp_handle;
35 static int proto_mac_mgmt_msg_pkm_decoder;
36 static int ett_mac_mgmt_msg_pkm_req_decoder;
37 static int ett_mac_mgmt_msg_pkm_rsp_decoder;
39 static const value_string vals_pkm_msg_code[] =
41 { 3, "SA ADD"},
42 { 4, "Auth Request"},
43 { 5, "Auth Reply"},
44 { 6, "Auth Reject"},
45 { 7, "Key Request"},
46 { 8, "Key Reply"},
47 { 9, "Key Reject"},
48 {10, "Auth Invalid"},
49 {11, "TEK Invalid"},
50 {12, "Auth Info"},
51 {13, "PKMv2 RSA-Request"},
52 {14, "PKMv2 RSA-Reply"},
53 {15, "PKMv2 RSA-Reject"},
54 {16, "PKMv2 RSA-Acknowledgement"},
55 {17, "PKMv2 EAP Start"},
56 {18, "PKMv2 EAP-Transfer"},
57 {19, "PKMv2 Authenticated EAP-Transfer"},
58 {20, "PKMv2 SA TEK Challenge"},
59 {21, "PKMv2 SA TEK Request"},
60 {22, "PKMv2 SA TEK Response"},
61 {23, "PKMv2 Key-Request"},
62 {24, "PKMv2 Key-Reply"},
63 {25, "PKMv2 Key-Reject"},
64 {26, "PKMv2 SA-Addition"},
65 {27, "PKMv2 TEK-Invalid"},
66 {28, "PKMv2 Group-Key-Update-Command"},
67 {29, "PKMv2 EAP Complete"},
68 {30, "PKMv2 Authenticated EAP Start"},
69 { 0, NULL}
72 /* fix fields */
73 static int hf_pkm_msg_code;
74 static int hf_pkm_msg_pkm_id;
77 /* Wimax Mac PKM-REQ Message Dissector */
78 static int dissect_mac_mgmt_msg_pkm_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
80 unsigned offset = 0;
81 proto_item *pkm_item;
82 proto_tree *pkm_tree;
84 /* display MAC payload type PKM-REQ */
85 pkm_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_pkm_decoder, tvb, offset, -1, "Privacy Key Management Request (PKM-REQ)");
86 /* add MAC PKM subtree */
87 pkm_tree = proto_item_add_subtree(pkm_item, ett_mac_mgmt_msg_pkm_req_decoder);
88 /* Decode and display the Privacy Key Management Request Message (PKM-REQ) (table 24) */
89 /* display the PKM Code */
90 proto_tree_add_item(pkm_tree, hf_pkm_msg_code, tvb, offset, 1, ENC_BIG_ENDIAN);
91 /* set the offset for the PKM ID */
92 offset++;
93 /* display the PKM ID */
94 proto_tree_add_item(pkm_tree, hf_pkm_msg_pkm_id, tvb, offset, 1, ENC_BIG_ENDIAN);
95 /* set the offset for the TLV Encoded info */
96 offset++;
97 wimax_pkm_tlv_encoded_attributes_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, pkm_tree);
98 return tvb_captured_length(tvb);
101 /* Wimax Mac PKM-RSP Message Dissector */
102 static int dissect_mac_mgmt_msg_pkm_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
104 unsigned offset = 0;
105 proto_item *pkm_item;
106 proto_tree *pkm_tree;
108 /* display MAC payload type PKM-RSP */
109 pkm_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_pkm_decoder, tvb, offset, -1, "Privacy Key Management Response (PKM-RSP)");
110 /* add MAC PKM subtree */
111 pkm_tree = proto_item_add_subtree(pkm_item, ett_mac_mgmt_msg_pkm_rsp_decoder);
112 /* Decode and display the Privacy Key Management Response (PKM-RSP) (table 25) */
113 /* display the PKM Code */
114 proto_tree_add_item(pkm_tree, hf_pkm_msg_code, tvb, offset, 1, ENC_BIG_ENDIAN);
115 /* set the offset for the PKM ID */
116 offset++;
117 /* display the PKM ID */
118 proto_tree_add_item(pkm_tree, hf_pkm_msg_pkm_id, tvb, offset, 1, ENC_BIG_ENDIAN);
119 /* set the offset for the TLV Encoded info */
120 offset++;
121 /* process the PKM TLV Encoded Attributes */
122 wimax_pkm_tlv_encoded_attributes_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, pkm_tree);
123 return tvb_captured_length(tvb);
126 /* Register Wimax Mac PKM-REQ/RSP Messages Dissectors */
127 void proto_register_mac_mgmt_msg_pkm(void)
129 /* PKM display */
130 static hf_register_info hf_pkm[] =
133 &hf_pkm_msg_code,
134 {"Code", "wmx.pkm.msg_code",FT_UINT8, BASE_DEC, VALS(vals_pkm_msg_code),0x0, NULL, HFILL}
137 &hf_pkm_msg_pkm_id,
138 {"PKM Identifier", "wmx.pkm.msg_pkm_identifier",FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
142 /* Setup protocol subtree array */
143 static int *ett_pkm[] =
145 &ett_mac_mgmt_msg_pkm_req_decoder,
146 &ett_mac_mgmt_msg_pkm_rsp_decoder,
149 proto_mac_mgmt_msg_pkm_decoder = proto_register_protocol (
150 "WiMax PKM-REQ/RSP Messages", /* name */
151 "WiMax PKM-REQ/RSP (pkm)", /* short name */
152 "wmx.pkm" /* abbrev */
155 proto_register_field_array(proto_mac_mgmt_msg_pkm_decoder, hf_pkm, array_length(hf_pkm));
156 proto_register_subtree_array(ett_pkm, array_length(ett_pkm));
157 mac_mgmt_msg_pkm_req_handle = register_dissector("mac_mgmt_msg_pkm_req_handler", dissect_mac_mgmt_msg_pkm_req_decoder, proto_mac_mgmt_msg_pkm_decoder);
158 mac_mgmt_msg_pkm_rsp_handle = register_dissector("mac_mgmt_msg_pkm_rsp_handler", dissect_mac_mgmt_msg_pkm_rsp_decoder, proto_mac_mgmt_msg_pkm_decoder);
161 void proto_reg_handoff_mac_mgmt_msg_pkm(void)
163 dissector_add_uint( "wmx.mgmtmsg", MAC_MGMT_MSG_PKM_REQ, mac_mgmt_msg_pkm_req_handle );
164 dissector_add_uint( "wmx.mgmtmsg", MAC_MGMT_MSG_PKM_RSP, mac_mgmt_msg_pkm_rsp_handle );
168 * Editor modelines - https://www.wireshark.org/tools/modelines.html
170 * Local variables:
171 * c-basic-offset: 8
172 * tab-width: 8
173 * indent-tabs-mode: t
174 * End:
176 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
177 * :indentSize=8:tabSize=8:noTabs=false: