2 * Routines for raw packet disassembly
4 * $Id: packet-raw.c,v 1.10 1999/07/07 22:51:52 gram 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>
39 capture_raw( const u_char *pd, guint32 cap_len, packet_counts *ld ) {
41 /* So far, the only time we get raw connection types are with Linux and
42 * Irix PPP connections. We can't tell what type of data is coming down
43 * the line, so our safest bet is IP. - GCC
46 /* Currently, the Linux 2.1.xxx PPP driver passes back some of the header
47 * sometimes. This check should be removed when 2.2 is out.
49 if (pd[0] == 0xff && pd[1] == 0x03)
50 capture_ip(pd, 4, cap_len, ld);
52 capture_ip(pd, 0, cap_len, ld);
56 dissect_raw( const u_char *pd, frame_data *fd, proto_tree *tree ) {
60 /* load the top pane info. This should be overwritten by
61 the next protocol in the stack */
62 if(check_col(fd, COL_RES_DL_SRC))
63 col_add_str(fd, COL_RES_DL_SRC, "N/A" );
64 if(check_col(fd, COL_RES_DL_DST))
65 col_add_str(fd, COL_RES_DL_DST, "N/A" );
66 if(check_col(fd, COL_PROTOCOL))
67 col_add_str(fd, COL_PROTOCOL, "N/A" );
68 if(check_col(fd, COL_INFO))
69 col_add_str(fd, COL_INFO, "Raw packet data" );
71 /* populate a tree in the second pane with the status of the link
74 ti = proto_tree_add_text(tree, 0, 0, "Raw packet data" );
75 fh_tree = proto_item_add_subtree(ti, ETT_RAW);
76 proto_tree_add_text(fh_tree, 0, 0, "No link information available");
79 /* So far, the only time we get raw connection types are with Linux and
80 * Irix PPP connections. We can't tell what type of data is coming down
81 * the line, so our safest bet is IP. - GCC
84 /* Currently, the Linux 2.1.xxx PPP driver passes back some of the header
85 * sometimes. This check should be removed when 2.2 is out.
87 if (pd[0] == 0xff && pd[1] == 0x03)
88 dissect_ip(pd, 4, fd, tree);
90 dissect_ip(pd, 0, fd, tree);