Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-aruba-iap.c
blob9be96b6865b7be241292f77b34c306343c9294db
1 /* packet-aruba-iap.c
2 * Routines for Aruba IAP header disassembly
3 * Copyright 2014, Alexis La Goutte <alexis.lagoutte at gmail dot com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 * Aruba Instant AP broadcast on L2 Layer with ethertype 0x8ffd
15 * All frame start with 0xbeef (Magic number)
16 * Octet 1 : Header (version)
17 * Octet 2 : Type (only see type 3, 4, 5, 7 with IP Address...)
18 * Octet 3 : Length
19 * Octet 4 : Id
21 * Only for Type 3, 4, 5 and 7
22 * Octet 5 : Status (Master / Slave..)
23 * Octet 6-9 : timestamp
24 * Octet 10-13 : The address IP(v4) of VC (Virtual Controller)
25 * Octet 14 : Model
26 * Octet 15-16 : Vlan ID (of Uplink)
27 * Octet 17-20 : Unknown...
29 #include "config.h"
31 #include <epan/packet.h>
32 #include <epan/addr_resolv.h>
34 #define ETHERTYPE_IAP 0x8ffd
35 #define MAGIC_IAP 0xbeef
37 void proto_register_aruba_iap(void);
38 void proto_reg_handoff_aruba_iap(void);
40 static dissector_handle_t iap_handle;
42 static int proto_aruba_iap;
43 static int ett_aruba_iap;
45 static int hf_iap_magic;
46 static int hf_iap_version;
47 static int hf_iap_type;
48 static int hf_iap_length;
49 static int hf_iap_id;
50 static int hf_iap_status;
51 static int hf_iap_uptime;
52 static int hf_iap_vc_ip;
53 static int hf_iap_pvid;
54 static int hf_iap_model;
55 static int hf_iap_unknown_uint;
56 static int hf_iap_unknown_bytes;
58 static const value_string iap_model[] = {
59 { 0x0a, "Orion (IAP-104, IAP-105, IAP-175, RAP-3WN and RAP-3WNP)" },
60 { 0x0f, "Cassiopeia (IAP-130 Series)" },
61 { 0x17, "Aries (RAP-155 and RAP-155P)" },
62 { 0x19, "Centaurus (IAP-224, IAP-225, IAP-214/215, IAP-274, IAP-275 and IAP-277)" },
63 { 0x1a, "Pegasus (RAP-108, RAP-109, IAP-114, IAP-115 and IAP-103)" },
64 { 0x1e, "Taurus (IAP-204/205, IAP-205H)" },
65 { 0x28, "Hercules (IAP-314/315, IAP-324/325, IAP 318 and IAP 374/375/377)" },
66 { 0x2b, "Lupus (IAP-334/335)" },
67 { 0x2e, "Vela (IAP-203H, IAP-207, IAP-203R and IAP-203RP)" },
68 { 0x30, "Ursa (IAP-303, IAP-304/305, IAP-365/367 and IAP-303H)" },
69 { 0x37, "Draco (IAP-344/345)" },
70 { 0x39, "Scorpio (IAP-514 and IAP-515)" },
71 { 0x40, "Gemini (IAP-500 Series)" },
72 { 0x47, "Norma (IAP-635)" },
73 { 0, NULL }
76 static int
77 dissect_aruba_iap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
79 proto_tree *ti;
80 proto_tree *aruba_iap_tree;
81 uint16_t magic;
82 uint8_t type;
83 int offset = 0;
85 magic = tvb_get_ntohs(tvb, offset);
87 if(magic != MAGIC_IAP)
89 return 0;
92 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IAP");
93 col_clear(pinfo->cinfo, COL_INFO);
95 ti = proto_tree_add_item(tree, proto_aruba_iap, tvb, 0, -1, ENC_NA);
96 aruba_iap_tree = proto_item_add_subtree(ti, ett_aruba_iap);
98 proto_tree_add_item(aruba_iap_tree, hf_iap_magic, tvb, offset, 2, ENC_BIG_ENDIAN);
99 offset += 2;
101 proto_tree_add_item(aruba_iap_tree, hf_iap_version, tvb, offset, 1, ENC_BIG_ENDIAN);
102 offset += 1;
103 col_set_str(pinfo->cinfo, COL_INFO, "Aruba Instant AP");
105 proto_tree_add_item(aruba_iap_tree, hf_iap_type, tvb, offset, 1, ENC_BIG_ENDIAN);
106 type = tvb_get_uint8(tvb, offset);
107 offset += 1;
109 proto_tree_add_item(aruba_iap_tree, hf_iap_length, tvb, offset, 1, ENC_BIG_ENDIAN);
110 offset += 1;
112 proto_tree_add_item(aruba_iap_tree, hf_iap_id, tvb, offset, 1, ENC_BIG_ENDIAN);
113 offset += 1;
115 if(type == 3 || type == 4 || type == 5 || type == 7){
117 proto_tree_add_item(aruba_iap_tree, hf_iap_status, tvb, offset, 1, ENC_BIG_ENDIAN);
118 offset += 1;
120 proto_tree_add_item(aruba_iap_tree, hf_iap_uptime, tvb, offset, 4, ENC_BIG_ENDIAN);
121 offset += 4;
123 proto_tree_add_item(aruba_iap_tree, hf_iap_vc_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
124 col_append_fstr(pinfo->cinfo, COL_INFO, " VC IP: %s", tvb_ip_to_str(pinfo->pool, tvb, offset));
125 offset += 4;
127 proto_tree_add_item(aruba_iap_tree, hf_iap_model, tvb, offset, 1, ENC_BIG_ENDIAN);
128 offset += 1;
130 proto_tree_add_item(aruba_iap_tree, hf_iap_pvid, tvb, offset, 2, ENC_BIG_ENDIAN);
131 offset += 2;
133 proto_tree_add_item(aruba_iap_tree, hf_iap_unknown_uint, tvb, offset, 4, ENC_BIG_ENDIAN);
134 offset += 4;
136 proto_tree_add_item(aruba_iap_tree, hf_iap_unknown_bytes, tvb, offset, -1, ENC_NA);
138 } else {
139 proto_tree_add_item(aruba_iap_tree, hf_iap_unknown_bytes, tvb, offset, -1, ENC_NA);
142 return tvb_reported_length(tvb);
145 void
146 proto_register_aruba_iap(void)
148 static hf_register_info hf[] = {
149 { &hf_iap_magic,
150 { "Magic", "aruba_iap.magic", FT_UINT16, BASE_HEX, NULL,0x0,
151 "Magic Number of IAP traffic (Always 0x8ffd)", HFILL}},
153 { &hf_iap_version,
154 { "Version", "aruba_iap.version", FT_UINT8, BASE_DEC, NULL, 0x0,
155 NULL, HFILL}},
157 { &hf_iap_type,
158 { "Type", "aruba_iap.type", FT_UINT8, BASE_DEC, NULL, 0x0,
159 "Type of message", HFILL}},
161 { &hf_iap_length,
162 { "Length", "aruba_iap.length", FT_UINT8, BASE_DEC, NULL, 0x0,
163 NULL, HFILL}},
165 { &hf_iap_id,
166 { "Id", "aruba_iap.id", FT_UINT8, BASE_DEC, NULL, 0x0,
167 NULL, HFILL}},
169 { &hf_iap_status,
170 { "Status", "aruba_iap.status", FT_UINT8, BASE_DEC, NULL, 0x0,
171 NULL, HFILL}},
173 { &hf_iap_uptime,
174 { "Uptime", "aruba_iap.uptime", FT_UINT32, BASE_DEC, NULL, 0x0,
175 NULL, HFILL}},
177 { &hf_iap_vc_ip,
178 { "VC IP", "aruba_iap.vc_ip", FT_IPv4, BASE_NONE, NULL, 0x0,
179 "Address IP of Virtual Controller", HFILL}},
181 { &hf_iap_pvid,
182 { "PVID (Port Vlan ID)", "aruba_iap.pvid", FT_UINT16, BASE_DEC, NULL, 0x0,
183 "Vlan ID (of Uplink)", HFILL}},
185 { &hf_iap_model,
186 { "Model", "aruba_iap.model", FT_UINT8, BASE_DEC_HEX, VALS(iap_model), 0x0,
187 NULL, HFILL}},
189 { &hf_iap_unknown_bytes,
190 { "Unknown", "aruba_iap.unknown.bytes", FT_BYTES, BASE_NONE, NULL, 0x0,
191 "Unknown Data...", HFILL}},
193 { &hf_iap_unknown_uint,
194 { "Unknown", "aruba_iap.unknown.uint", FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
195 "Unknown (UINT) Data...", HFILL}},
200 static int *ett[] = {
201 &ett_aruba_iap,
204 proto_aruba_iap = proto_register_protocol("Aruba Instant AP Protocol",
205 "aruba_iap", "aruba_iap");
206 proto_register_field_array(proto_aruba_iap, hf, array_length(hf));
207 proto_register_subtree_array(ett, array_length(ett));
209 iap_handle = register_dissector("aruba_iap", dissect_aruba_iap, proto_aruba_iap);
213 void
214 proto_reg_handoff_aruba_iap(void)
216 dissector_add_uint("ethertype", ETHERTYPE_IAP, iap_handle);
220 * Editor modelines - https://www.wireshark.org/tools/modelines.html
222 * Local variables:
223 * c-basic-offset: 4
224 * tab-width: 8
225 * indent-tabs-mode: nil
226 * End:
228 * vi: set shiftwidth=4 tabstop=8 expandtab:
229 * :indentSize=4:tabSize=8:noTabs=true: