2 * Routines for clip packet disassembly
4 * $Id: packet-clip.c,v 1.15 2001/09/23 23:10:30 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
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>
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 #ifdef HAVE_SYS_TYPES_H
33 # include <sys/types.h>
38 #include "packet-clip.h"
39 #include "packet-ip.h"
41 static gint ett_clip = -1;
43 static dissector_handle_t ip_handle;
46 capture_clip( const u_char *pd, packet_counts *ld ) {
48 capture_ip(pd, 0, ld);
52 dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
57 pinfo->current_proto = "CLIP";
59 /* load the top pane info. This should be overwritten by
60 the next protocol in the stack */
61 if(check_col(pinfo->fd, COL_RES_DL_SRC))
62 col_set_str(pinfo->fd, COL_RES_DL_SRC, "N/A" );
63 if(check_col(pinfo->fd, COL_RES_DL_DST))
64 col_set_str(pinfo->fd, COL_RES_DL_DST, "N/A" );
65 if(check_col(pinfo->fd, COL_PROTOCOL))
66 col_set_str(pinfo->fd, COL_PROTOCOL, "CLIP" );
67 if(check_col(pinfo->fd, COL_INFO))
68 col_set_str(pinfo->fd, COL_INFO, "Classical IP frame" );
70 /* populate a tree in the second pane with the status of the link
73 XXX - the Linux Classical IP code supports both LLC Encapsulation,
74 which puts an LLC header and possibly a SNAP header in front of
75 the network-layer header, and VC Based Multiplexing, which puts
76 no headers in front of the network-layer header.
78 The ATM on Linux code includes a patch to "tcpdump"
79 that compares the first few bytes of the packet with the
80 LLC header that Classical IP frames may have and, if there's
81 a SNAP LLC header at the beginning of the packet, it gets
82 the packet type from that header and uses that, otherwise
83 it treats the packet as being raw IP with no link-level
84 header, in order to handle both of those.
86 This code, however, won't handle LLC Encapsulation. We've
87 not yet seen a capture taken on a machine using LLC Encapsulation,
88 however. If we see one, we can modify the code.
90 A future version of libpcap, however, will probably use DLT_LINUX_SLL
91 for both of those cases, to avoid the headache of having to
92 generate capture-filter code to handle both of those cases. */
94 ti = proto_tree_add_text(tree, tvb, 0, 0, "Classical IP frame" );
95 fh_tree = proto_item_add_subtree(ti, ett_clip);
96 proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available");
98 call_dissector(ip_handle, tvb, pinfo, tree);
102 proto_register_clip(void)
104 static gint *ett[] = {
108 proto_register_subtree_array(ett, array_length(ett));
112 proto_reg_handoff_clip(void)
115 * Get a handle for the IP dissector.
117 ip_handle = find_dissector("ip");
118 dissector_add("wtap_encap", WTAP_ENCAP_LINUX_ATM_CLIP, dissect_clip,