HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-snaeth.c
blobc3d0e0cf7817e06143c833fba803cdd2df48a7f4
1 /* packet-snaeth.c
2 * Routines for SNA-over-Ethernet (Ethernet type 80d5)
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "config.h"
27 #include <glib.h>
28 #include <epan/packet.h>
29 #include <epan/etypes.h>
32 * See
34 * http://www.cisco.com/univercd/cc/td/doc/product/software/ssr90/rpc_r/18059.pdf
37 static int proto_snaeth = -1;
38 static int hf_snaeth_len = -1;
40 static gint ett_snaeth = -1;
42 static dissector_handle_t llc_handle;
44 static void
45 dissect_snaeth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
47 proto_tree *snaeth_tree;
48 proto_item *snaeth_ti;
49 guint16 len;
50 tvbuff_t *next_tvb;
52 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNAETH");
53 col_set_str(pinfo->cinfo, COL_INFO, "SNA over Ethernet");
55 /* length */
56 len = tvb_get_ntohs(tvb, 0);
58 if (tree) {
59 snaeth_ti = proto_tree_add_item(tree, proto_snaeth, tvb, 0, 3,
60 ENC_NA);
61 snaeth_tree = proto_item_add_subtree(snaeth_ti, ett_snaeth);
62 proto_tree_add_uint(snaeth_tree, hf_snaeth_len, tvb, 0, 2, len);
63 proto_tree_add_text(snaeth_tree, tvb, 2, 1, "Padding");
67 * Adjust the length of this tvbuff to include only the SNA-over-
68 * Ethernet header and data.
70 set_actual_length(tvb, 3 + len);
73 * Rest of packet starts with an 802.2 LLC header.
75 next_tvb = tvb_new_subset_remaining(tvb, 3);
76 call_dissector(llc_handle, next_tvb, pinfo, tree);
79 void
80 proto_register_snaeth(void)
82 static hf_register_info hf[] = {
83 { &hf_snaeth_len,
84 { "Length", "snaeth.len", FT_UINT16, BASE_DEC, NULL, 0x0,
85 "Length of LLC payload", HFILL }},
87 static gint *ett[] = {
88 &ett_snaeth,
91 proto_snaeth = proto_register_protocol("SNA-over-Ethernet",
92 "SNAETH", "snaeth");
93 proto_register_field_array(proto_snaeth, hf, array_length(hf));
94 proto_register_subtree_array(ett, array_length(ett));
97 void
98 proto_reg_handoff_snaeth(void)
100 dissector_handle_t snaeth_handle;
103 * Get handle for the LLC dissector.
105 llc_handle = find_dissector("llc");
107 snaeth_handle = create_dissector_handle(dissect_snaeth, proto_snaeth);
108 dissector_add_uint("ethertype", ETHERTYPE_SNA, snaeth_handle);