2 * Routines for raw packet disassembly
4 * $Id: packet-raw.c,v 1.15 2000/05/19 05:29:42 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
9 * This file created and by Mike Hall <mlh@io.com>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #ifdef HAVE_SYS_TYPES_H
32 # include <sys/types.h>
37 #include "packet-raw.h"
38 #include "packet-ip.h"
40 static gint ett_raw = -1;
43 capture_raw( const u_char *pd, packet_counts *ld ) {
45 /* So far, the only time we get raw connection types are with Linux and
46 * Irix PPP connections. We can't tell what type of data is coming down
47 * the line, so our safest bet is IP. - GCC
50 /* Currently, the Linux 2.1.xxx PPP driver passes back some of the header
51 * sometimes. This check should be removed when 2.2 is out.
53 if (pd[0] == 0xff && pd[1] == 0x03)
54 capture_ip(pd, 4, ld);
56 capture_ip(pd, 0, ld);
60 dissect_raw( const u_char *pd, frame_data *fd, proto_tree *tree ) {
64 /* load the top pane info. This should be overwritten by
65 the next protocol in the stack */
66 if(check_col(fd, COL_RES_DL_SRC))
67 col_add_str(fd, COL_RES_DL_SRC, "N/A" );
68 if(check_col(fd, COL_RES_DL_DST))
69 col_add_str(fd, COL_RES_DL_DST, "N/A" );
70 if(check_col(fd, COL_PROTOCOL))
71 col_add_str(fd, COL_PROTOCOL, "N/A" );
72 if(check_col(fd, COL_INFO))
73 col_add_str(fd, COL_INFO, "Raw packet data" );
75 /* populate a tree in the second pane with the status of the link
78 ti = proto_tree_add_text(tree, NullTVB, 0, 0, "Raw packet data" );
79 fh_tree = proto_item_add_subtree(ti, ett_raw);
80 proto_tree_add_text(fh_tree, NullTVB, 0, 0, "No link information available");
83 /* So far, the only time we get raw connection types are with Linux and
84 * Irix PPP connections. We can't tell what type of data is coming down
85 * the line, so our safest bet is IP. - GCC
88 /* Currently, the Linux 2.1.xxx PPP driver passes back some of the header
89 * sometimes. This check should be removed when 2.2 is out.
91 if (pd[0] == 0xff && pd[1] == 0x03)
92 dissect_ip(pd, 4, fd, tree);
94 dissect_ip(pd, 0, fd, tree);
98 proto_register_raw(void)
100 static gint *ett[] = {
104 proto_register_subtree_array(ett, array_length(ett));