2 * Routines for null packet disassembly
4 * $Id: packet-null.c,v 1.5 1998/11/17 04:29:00 gerald 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 <sys/socket.h>
43 dissect_null( const u_char *pd, frame_data *fd, GtkTree *tree ) {
45 GtkWidget *ti, *fh_tree;
49 memcpy((char *)&nh.null_family, (char *)&pd[2], sizeof(nh.null_family));
51 /* load the top pane info. This should be overwritten by
52 the next protocol in the stack */
53 if(check_col(fd, COL_RES_DL_SRC))
54 col_add_str(fd, COL_RES_DL_SRC, "N/A" );
55 if(check_col(fd, COL_RES_DL_DST))
56 col_add_str(fd, COL_RES_DL_DST, "N/A" );
57 if(check_col(fd, COL_PROTOCOL))
58 col_add_str(fd, COL_PROTOCOL, "N/A" );
59 if(check_col(fd, COL_INFO))
60 col_add_str(fd, COL_INFO, "Null/Loopback" );
62 /* populate a tree in the second pane with the status of the link
65 ti = add_item_to_tree( GTK_WIDGET(tree), 0, 4,
67 fh_tree = gtk_tree_new();
68 add_subtree(ti, fh_tree, ETT_NULL);
69 add_item_to_tree(fh_tree, 0, 1, "Next: %02x", nh.null_next);
70 add_item_to_tree(fh_tree, 1, 1, "Length: %02x", nh.null_len);
71 add_item_to_tree(fh_tree, 2, 2, "Family: %04x", nh.null_family);
75 From what I've read in various sources, this is supposed to be an
76 address family, e.g. AF_INET. However, a FreeBSD ISDN PPP dump that
77 Andreas Klemm sent to ethereal-dev has a packet type of DLT_NULL, and
78 the family bits look like PPP's protocol field. A dump of the loopback
79 interface on my Linux box also has a link type of DLT_NULL (as it should
80 be), but the family bits look like ethernet's protocol type. To
81 further confuse matters, nobody seems to be paying attention to byte
86 switch (nh.null_family) {
91 dissect_ip(pd, 4, fd, tree);
94 dissect_data(pd, 4, fd, tree);