Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-netgear-ensemble.c
blobff0fd466fad55e262542c3d3d2d6ef1739c8e761
1 /* packet-netgear-ensemble.c
3 * Routines for Netgear AP Ensemble Protocol
4 * Charlie Lenahan <clenahan@sonicbison.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "config.h"
15 #include <epan/packet.h>
17 void proto_register_nge(void);
18 void proto_reg_handoff_nge(void);
20 static dissector_handle_t nge_handle;
22 #define NETGEAR_ENSEMBLE_PORT 4554
24 static int proto_nge;
26 static int hf_nge_version;
27 static int hf_nge_unknown;
28 static int hf_nge_unknown_int32;
29 static int hf_nge_sequence;
30 static int hf_nge_tlv_length;
31 static int hf_nge_ensemble_name;
32 static int hf_nge_firmware_name;
33 static int hf_nge_region_name;
34 static int hf_nge_firmware_version;
35 static int hf_nge_ap_name;
36 static int hf_nge_uptime;
37 static int hf_nge_mac;
38 static int hf_nge_ip;
39 static int hf_nge_uuid;
41 static int ett_nge;
42 static int ett_nge_lv;
43 static int ett_nge_ensemble;
46 static void
47 dissect_nge_esemble(tvbuff_t *tvb,proto_tree *tree, int offset)
49 unsigned strLen=0;
51 uint32_t length = tvb_get_uint32(tvb, offset,ENC_BIG_ENDIAN);
52 proto_tree *ensemble_tree = proto_tree_add_subtree(tree, tvb, offset, length+4, ett_nge_ensemble, NULL,"Ensemble");
54 proto_tree_add_uint(ensemble_tree, hf_nge_tlv_length, tvb, offset, 4, length);
55 offset += 4;
57 proto_tree_add_item(ensemble_tree, hf_nge_unknown, tvb, offset, 17, ENC_NA);
58 offset += 17;
60 /* type == 1 ? */
61 proto_tree_add_item(ensemble_tree, hf_nge_unknown_int32, tvb, offset, 4, ENC_BIG_ENDIAN);
62 offset += 4;
64 /* uuid ? */
65 proto_tree_add_item(ensemble_tree, hf_nge_uuid, tvb, offset, 16, ENC_BIG_ENDIAN);
66 offset += 16;
68 proto_tree_add_item(ensemble_tree, hf_nge_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
69 offset += 4;
71 proto_tree_add_item(ensemble_tree, hf_nge_unknown, tvb, offset, 20, ENC_NA);
72 offset += 20;
74 proto_tree_add_item(ensemble_tree, hf_nge_mac, tvb, offset, 6, ENC_NA);
75 offset += 6;
77 /* type == 2 ? */
78 proto_tree_add_item(ensemble_tree, hf_nge_unknown_int32, tvb, offset, 4, ENC_BIG_ENDIAN);
79 offset += 4;
81 proto_tree_add_item_ret_length(ensemble_tree, hf_nge_ensemble_name, tvb, offset, 4, ENC_ASCII|ENC_BIG_ENDIAN, &strLen);
82 offset += strLen;
84 proto_tree_add_item_ret_length(ensemble_tree, hf_nge_firmware_name, tvb, offset, 4, ENC_ASCII|ENC_BIG_ENDIAN, &strLen);
85 offset += strLen;
87 proto_tree_add_item_ret_length(ensemble_tree, hf_nge_region_name, tvb, offset, 4, ENC_ASCII|ENC_BIG_ENDIAN, &strLen);
88 offset += strLen;
90 /* type == 0 ? */
91 proto_tree_add_item(ensemble_tree, hf_nge_unknown_int32, tvb, offset, 4, ENC_BIG_ENDIAN);
92 offset += 4;
94 proto_tree_add_item_ret_length(ensemble_tree, hf_nge_firmware_version, tvb, offset, 4, ENC_ASCII|ENC_BIG_ENDIAN, &strLen);
95 offset += strLen;
97 proto_tree_add_item(ensemble_tree, hf_nge_unknown, tvb, offset, 16, ENC_NA);
98 offset += 16;
100 /* timestamp? */
101 proto_tree_add_item(ensemble_tree, hf_nge_uptime, tvb, offset, 4, ENC_BIG_ENDIAN);
102 offset += 4;
104 proto_tree_add_item_ret_length(ensemble_tree, hf_nge_ap_name, tvb, offset, 4, ENC_ASCII|ENC_BIG_ENDIAN, &strLen);
105 offset += strLen;
107 proto_tree_add_item(ensemble_tree, hf_nge_unknown, tvb, offset, -1, ENC_NA);
111 static int
112 dissect_nge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
114 int offset = 0;
116 proto_item *ti = proto_tree_add_item(tree, proto_nge, tvb, 0, -1, ENC_NA);
117 proto_tree *nge_tree = proto_item_add_subtree(ti, ett_nge);
119 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NGE");
120 /* Clear out stuff in the info column */
121 col_clear(pinfo->cinfo,COL_INFO);
123 /* presumed version */
124 proto_tree_add_item(nge_tree, hf_nge_version, tvb, offset, 1, ENC_BIG_ENDIAN);
125 offset += 1;
127 proto_tree_add_item(nge_tree, hf_nge_unknown, tvb, offset, 3, ENC_NA);
128 offset += 3;
130 proto_tree_add_item(nge_tree, hf_nge_sequence, tvb, offset, 4, ENC_BIG_ENDIAN);
131 offset += 4;
133 dissect_nge_esemble(tvb, nge_tree, offset);
135 return tvb_captured_length(tvb);
139 void
140 proto_register_nge(void)
142 static hf_register_info hf[] = {
143 { &hf_nge_version,
144 { "Version", "nge.version",FT_UINT8, BASE_DEC,
145 NULL, 0x0,NULL, HFILL }},
146 { &hf_nge_unknown,
147 { "Unknown", "nge.unknown", FT_BYTES, BASE_NONE,
148 NULL, 0x0,NULL, HFILL }},
149 { &hf_nge_unknown_int32,
150 { "Unknown", "nge.unknown.int32", FT_UINT32, BASE_DEC,
151 NULL, 0x0, NULL, HFILL }},
152 { &hf_nge_sequence,
153 { "Sequence", "nge.sequence", FT_UINT32, BASE_DEC,
154 NULL, 0x0, NULL, HFILL }},
155 { &hf_nge_uptime,
156 { "Uptime", "nge.uptime", FT_UINT32, BASE_DEC,
157 NULL, 0x0, NULL, HFILL }},
158 { &hf_nge_mac,
159 { "MAC", "nge.mac", FT_ETHER, BASE_NONE,
160 NULL, 0x0,NULL, HFILL }},
161 { &hf_nge_ip,
162 { "IP", "nge.ip", FT_IPv4, BASE_NONE,
163 NULL, 0x0,NULL, HFILL }},
164 { &hf_nge_uuid,
165 { "Device UUID", "nge.uuid", FT_GUID, BASE_NONE,
166 NULL, 0x0,NULL, HFILL }},
167 { &hf_nge_ensemble_name,
168 { "Ensemble Name", "nge.ensemble_name", FT_UINT_STRING, BASE_NONE,
169 NULL, 0x0, NULL, HFILL }},
170 { &hf_nge_firmware_name,
171 { "Firmware Name", "nge.firmware_name", FT_UINT_STRING, BASE_NONE,
172 NULL, 0x0, NULL, HFILL }},
173 { &hf_nge_region_name,
174 { "Region Name", "nge.region_name", FT_UINT_STRING, BASE_NONE,
175 NULL, 0x0, NULL, HFILL }},
176 { &hf_nge_firmware_version,
177 { "Firmware Version", "nge.firmware_version", FT_UINT_STRING, BASE_NONE,
178 NULL, 0x0, NULL, HFILL }},
179 { &hf_nge_ap_name,
180 { "AP Name", "nge.ap_name", FT_UINT_STRING, BASE_NONE,
181 NULL, 0x0, NULL, HFILL }},
182 { &hf_nge_tlv_length,
183 { "Length", "nge.tlv_len", FT_UINT32, BASE_DEC,
184 NULL, 0x0, NULL, HFILL }},
187 /* Setup protocol subtree array */
188 static int *ett[] = {
189 &ett_nge,
190 &ett_nge_lv,
191 &ett_nge_ensemble
194 proto_nge = proto_register_protocol ("Netgear Ensemble Protocol", "NGE", "nge");
196 proto_register_field_array(proto_nge, hf, array_length(hf));
197 proto_register_subtree_array(ett, array_length(ett));
199 nge_handle = register_dissector("nge", dissect_nge, proto_nge);
202 void
203 proto_reg_handoff_nge(void)
205 dissector_add_for_decode_as_with_preference("udp.port", nge_handle);
209 * Editor modelines - https://www.wireshark.org/tools/modelines.html
211 * Local variables:
212 * c-basic-offset: 4
213 * tab-width: 8
214 * indent-tabs-mode: nil
215 * End:
217 * vi: set shiftwidth=4 tabstop=8 expandtab:
218 * :indentSize=4:tabSize=8:noTabs=true: