Create a header file for every packet-*.c file. Prune the packet.h file.
[obnox/wireshark/wip.git] / packet-clip.c
1 /* packet-clip.c
2  * Routines for clip packet disassembly
3  *
4  * $Id: packet-clip.c,v 1.5 2000/02/15 21:02:05 gram Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  *
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
12  * 
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.
17  * 
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.
22  * 
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.
26  */
27
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #ifdef HAVE_SYS_TYPES_H
33 # include <sys/types.h>
34 #endif
35
36 #include <glib.h>
37 #include "packet.h"
38 #include "packet-ip.h"
39
40 static gint ett_clip = -1;
41
42 void
43 capture_clip( const u_char *pd, packet_counts *ld ) {
44
45     capture_ip(pd, 0, ld);
46 }
47
48 void
49 dissect_clip( const u_char *pd, frame_data *fd, proto_tree *tree ) {
50   proto_tree *fh_tree;
51   proto_item *ti;
52
53   /* load the top pane info. This should be overwritten by
54      the next protocol in the stack */
55   if(check_col(fd, COL_RES_DL_SRC))
56     col_add_str(fd, COL_RES_DL_SRC, "N/A" );
57   if(check_col(fd, COL_RES_DL_DST))
58     col_add_str(fd, COL_RES_DL_DST, "N/A" );
59   if(check_col(fd, COL_PROTOCOL))
60     col_add_str(fd, COL_PROTOCOL, "CLIP" );
61   if(check_col(fd, COL_INFO))
62     col_add_str(fd, COL_INFO, "Classical IP frame" );
63
64   /* populate a tree in the second pane with the status of the link
65      layer (ie none)
66
67      XXX - the ATM on Linux code includes a patch to "tcpdump"
68      that compares the first few bytes of the packet with the
69      LLC header that Classical IP frames may have and, if there's
70      a SNAP LLC header at the beginning of the packet, it gets
71      the packet type from that header and uses that, otherwise
72      it treats the packet as being raw IP with no link-level
73      header. */
74   if(tree) {
75     ti = proto_tree_add_text(tree, 0, 0, "Classical IP frame" );
76     fh_tree = proto_item_add_subtree(ti, ett_clip);
77     proto_tree_add_text(fh_tree, 0, 0, "No link information available");
78   }
79   dissect_ip(pd, 0, fd, tree);
80 }
81
82 void
83 proto_register_clip(void)
84 {
85   static gint *ett[] = {
86     &ett_clip,
87   };
88
89   proto_register_subtree_array(ett, array_length(ett));
90 }