Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-wfleet-hdlc.c
blob0f01ec562bc7d677962dacc15e8ca293b3e4b831
1 /* packet-chdlc.c
2 * Routines for Wellfleet HDLC packet disassembly
3 * Copied from the Cisco HDLC packet disassembly routines
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
12 #include "config.h"
14 #include <epan/packet.h>
15 #include <epan/addr_resolv.h>
17 void proto_register_wfleet_hdlc(void);
18 void proto_reg_handoff_wfleet_hdlc(void);
20 static int proto_wfleet_hdlc;
21 static int hf_wfleet_hdlc_addr;
22 static int hf_wfleet_hdlc_cmd;
24 static int ett_wfleet_hdlc;
26 static dissector_handle_t eth_withoutfcs_handle;
27 static dissector_handle_t wfleet_hdlc_handle;
29 static const value_string wfleet_hdlc_cmd_vals[] = {
30 { 0x03, "Un-numbered I frame"},
31 { 0, NULL}
34 static int
35 dissect_wfleet_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
37 proto_item *ti;
38 proto_tree *fh_tree = NULL;
39 tvbuff_t *next_tvb;
40 uint8_t addr;
41 uint8_t cmd;
43 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "N/A");
44 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "N/A");
45 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WHDLC");
46 col_clear(pinfo->cinfo, COL_INFO);
48 addr = tvb_get_uint8(tvb, 0);
49 cmd = tvb_get_uint8(tvb, 1);
51 if (tree) {
52 ti = proto_tree_add_item(tree, proto_wfleet_hdlc, tvb, 0, 2, ENC_NA);
53 fh_tree = proto_item_add_subtree(ti, ett_wfleet_hdlc);
55 proto_tree_add_uint(fh_tree, hf_wfleet_hdlc_addr, tvb, 0, 1, addr);
56 proto_tree_add_uint(fh_tree, hf_wfleet_hdlc_cmd, tvb, 1, 1, cmd);
61 * Build a tvb of the piece past the first two bytes and call the
62 * ethernet dissector
65 next_tvb = tvb_new_subset_remaining(tvb, 2);
67 call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
68 return tvb_captured_length(tvb);
71 void
72 proto_register_wfleet_hdlc(void)
74 static hf_register_info hf[] = {
75 { &hf_wfleet_hdlc_addr,
76 { "Address", "wfleet_hdlc.address", FT_UINT8, BASE_HEX,
77 NULL, 0x0, NULL, HFILL }},
78 { &hf_wfleet_hdlc_cmd,
79 { "Command", "wfleet_hdlc.command", FT_UINT8, BASE_HEX,
80 VALS(wfleet_hdlc_cmd_vals), 0x0, NULL, HFILL }},
82 static int *ett[] = {
83 &ett_wfleet_hdlc,
86 proto_wfleet_hdlc = proto_register_protocol("Wellfleet HDLC", "WHDLC", "whdlc");
87 proto_register_field_array(proto_wfleet_hdlc, hf, array_length(hf));
88 proto_register_subtree_array(ett, array_length(ett));
90 wfleet_hdlc_handle = register_dissector("wfleet_hdlc", dissect_wfleet_hdlc, proto_wfleet_hdlc);
94 void
95 proto_reg_handoff_wfleet_hdlc(void)
97 dissector_add_uint("wtap_encap", WTAP_ENCAP_WFLEET_HDLC, wfleet_hdlc_handle);
100 * Find the eth dissector and save a ref to it
103 eth_withoutfcs_handle = find_dissector_add_dependency("eth_withoutfcs", proto_wfleet_hdlc);
107 * Editor modelines - https://www.wireshark.org/tools/modelines.html
109 * Local Variables:
110 * c-basic-offset: 2
111 * tab-width: 8
112 * indent-tabs-mode: nil
113 * End:
115 * ex: set shiftwidth=2 tabstop=8 expandtab:
116 * :indentSize=2:tabSize=8:noTabs=true: