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
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
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
;
39 static int hf_nge_uuid
;
42 static int ett_nge_lv
;
43 static int ett_nge_ensemble
;
47 dissect_nge_esemble(tvbuff_t
*tvb
,proto_tree
*tree
, int offset
)
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
);
57 proto_tree_add_item(ensemble_tree
, hf_nge_unknown
, tvb
, offset
, 17, ENC_NA
);
61 proto_tree_add_item(ensemble_tree
, hf_nge_unknown_int32
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
65 proto_tree_add_item(ensemble_tree
, hf_nge_uuid
, tvb
, offset
, 16, ENC_BIG_ENDIAN
);
68 proto_tree_add_item(ensemble_tree
, hf_nge_ip
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
71 proto_tree_add_item(ensemble_tree
, hf_nge_unknown
, tvb
, offset
, 20, ENC_NA
);
74 proto_tree_add_item(ensemble_tree
, hf_nge_mac
, tvb
, offset
, 6, ENC_NA
);
78 proto_tree_add_item(ensemble_tree
, hf_nge_unknown_int32
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
81 proto_tree_add_item_ret_length(ensemble_tree
, hf_nge_ensemble_name
, tvb
, offset
, 4, ENC_ASCII
|ENC_BIG_ENDIAN
, &strLen
);
84 proto_tree_add_item_ret_length(ensemble_tree
, hf_nge_firmware_name
, tvb
, offset
, 4, ENC_ASCII
|ENC_BIG_ENDIAN
, &strLen
);
87 proto_tree_add_item_ret_length(ensemble_tree
, hf_nge_region_name
, tvb
, offset
, 4, ENC_ASCII
|ENC_BIG_ENDIAN
, &strLen
);
91 proto_tree_add_item(ensemble_tree
, hf_nge_unknown_int32
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
94 proto_tree_add_item_ret_length(ensemble_tree
, hf_nge_firmware_version
, tvb
, offset
, 4, ENC_ASCII
|ENC_BIG_ENDIAN
, &strLen
);
97 proto_tree_add_item(ensemble_tree
, hf_nge_unknown
, tvb
, offset
, 16, ENC_NA
);
101 proto_tree_add_item(ensemble_tree
, hf_nge_uptime
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
104 proto_tree_add_item_ret_length(ensemble_tree
, hf_nge_ap_name
, tvb
, offset
, 4, ENC_ASCII
|ENC_BIG_ENDIAN
, &strLen
);
107 proto_tree_add_item(ensemble_tree
, hf_nge_unknown
, tvb
, offset
, -1, ENC_NA
);
112 dissect_nge(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
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
);
127 proto_tree_add_item(nge_tree
, hf_nge_unknown
, tvb
, offset
, 3, ENC_NA
);
130 proto_tree_add_item(nge_tree
, hf_nge_sequence
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
133 dissect_nge_esemble(tvb
, nge_tree
, offset
);
135 return tvb_captured_length(tvb
);
140 proto_register_nge(void)
142 static hf_register_info hf
[] = {
144 { "Version", "nge.version",FT_UINT8
, BASE_DEC
,
145 NULL
, 0x0,NULL
, HFILL
}},
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
}},
153 { "Sequence", "nge.sequence", FT_UINT32
, BASE_DEC
,
154 NULL
, 0x0, NULL
, HFILL
}},
156 { "Uptime", "nge.uptime", FT_UINT32
, BASE_DEC
,
157 NULL
, 0x0, NULL
, HFILL
}},
159 { "MAC", "nge.mac", FT_ETHER
, BASE_NONE
,
160 NULL
, 0x0,NULL
, HFILL
}},
162 { "IP", "nge.ip", FT_IPv4
, BASE_NONE
,
163 NULL
, 0x0,NULL
, HFILL
}},
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
}},
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
[] = {
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
);
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
214 * indent-tabs-mode: nil
217 * vi: set shiftwidth=4 tabstop=8 expandtab:
218 * :indentSize=4:tabSize=8:noTabs=true: