HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-clip.c
blobc114a9551604774bd67298af88e12555e9bb975b
1 /* packet-clip.c
2 * Routines for clip packet disassembly
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
9 * This file created by Thierry Andry <Thierry.Andry@advalvas.be>
10 * from nearly-the-same packet-raw.c created by Mike Hall <mlh@io.com>
11 * Copyright 1999
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include "config.h"
30 #include <glib.h>
31 #include <epan/packet.h>
32 #include "packet-clip.h"
33 #include "packet-ip.h"
35 void proto_register_clip(void);
36 void proto_reg_handoff_clip(void);
38 static gint ett_clip = -1;
40 static dissector_handle_t ip_handle;
42 void
43 capture_clip( const guchar *pd, int len, packet_counts *ld ) {
45 capture_ip(pd, 0, len, ld);
48 static void
49 dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
51 proto_tree *fh_tree;
52 proto_item *ti;
54 pinfo->current_proto = "CLIP";
56 /* load the top pane info. This should be overwritten by
57 the next protocol in the stack */
58 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "N/A");
59 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "N/A");
60 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CLIP");
61 col_set_str(pinfo->cinfo, COL_INFO, "Classical IP frame");
63 /* populate a tree in the second pane with the status of the link
64 layer (ie none)
66 XXX - the Linux Classical IP code supports both LLC Encapsulation,
67 which puts an LLC header and possibly a SNAP header in front of
68 the network-layer header, and VC Based Multiplexing, which puts
69 no headers in front of the network-layer header.
71 The ATM on Linux code includes a patch to "tcpdump"
72 that compares the first few bytes of the packet with the
73 LLC header that Classical IP frames may have and, if there's
74 a SNAP LLC header at the beginning of the packet, it gets
75 the packet type from that header and uses that, otherwise
76 it treats the packet as being raw IP with no link-level
77 header, in order to handle both of those.
79 This code, however, won't handle LLC Encapsulation. We've
80 not yet seen a capture taken on a machine using LLC Encapsulation,
81 however. If we see one, we can modify the code.
83 A future version of libpcap, however, will probably use DLT_LINUX_SLL
84 for both of those cases, to avoid the headache of having to
85 generate capture-filter code to handle both of those cases. */
86 if(tree) {
87 ti = proto_tree_add_text(tree, tvb, 0, 0, "Classical IP frame" );
88 fh_tree = proto_item_add_subtree(ti, ett_clip);
89 proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available");
91 call_dissector(ip_handle, tvb, pinfo, tree);
94 void
95 proto_register_clip(void)
97 static gint *ett[] = {
98 &ett_clip,
101 proto_register_subtree_array(ett, array_length(ett));
104 void
105 proto_reg_handoff_clip(void)
107 dissector_handle_t clip_handle;
110 * Get a handle for the IP dissector.
112 ip_handle = find_dissector("ip");
114 clip_handle = create_dissector_handle(dissect_clip, -1);
115 /* XXX - no protocol, can't be disabled */
116 dissector_add_uint("wtap_encap", WTAP_ENCAP_LINUX_ATM_CLIP, clip_handle);