diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-03-23 03:14:46 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-03-23 03:14:46 +0000 |
commit | ef3dfe2077c3fd49997b7d9f3c31ba9f65ff27e2 (patch) | |
tree | 50607383870e1a22da46616611b6af517557c1e3 /packet-eth.c | |
parent | e3db269e00f32936d8385aa04df895edcbed1547 (diff) |
Removed all references to gtk objects from packet*.[ch] files. They now
reference the protocol tree with struct proto_tree and struct proto_item
objects. That way, the packet decoding source code file can be used with
non-gtk packet decoders, like a curses-based ethereal, e.g. I also re-arranged
some of the information in packet.h to more appropriate places (like other
packet-*.[ch] files).
svn path=/trunk/; revision=223
Diffstat (limited to 'packet-eth.c')
-rw-r--r-- | packet-eth.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/packet-eth.c b/packet-eth.c index 51c41f080c..ea018989ac 100644 --- a/packet-eth.c +++ b/packet-eth.c @@ -1,7 +1,7 @@ /* packet-eth.c * Routines for ethernet packet disassembly * - * $Id: packet-eth.c,v 1.8 1999/02/09 00:35:36 guy Exp $ + * $Id: packet-eth.c,v 1.9 1999/03/23 03:14:37 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -31,16 +31,13 @@ # include <sys/types.h> #endif -#include <gtk/gtk.h> - -#include <stdio.h> - - -#include "ethereal.h" +#include <glib.h> #include "packet.h" #include "etypes.h" #include "resolv.h" +#define IEEE_802_3_MAX_LEN 1500 + /* These are the Netware-ish names for the different Ethernet frame types. EthernetII: The ethernet with a Type field instead of a length field Ethernet802.2: An 802.3 header followed by an 802.3 header @@ -96,10 +93,11 @@ capture_eth(const u_char *pd, guint32 cap_len, packet_counts *ld) { } void -dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) { +dissect_eth(const u_char *pd, frame_data *fd, proto_tree *tree) { guint16 etype, length; int offset = 14; - GtkWidget *fh_tree = NULL, *ti; + proto_tree *fh_tree = NULL; + proto_item *ti; int ethhdr_type; /* the type of ethernet frame */ if (check_col(fd, COL_RES_DL_DST)) @@ -137,30 +135,30 @@ dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) { if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, "802.3"); if (tree) { - ti = add_item_to_tree(GTK_WIDGET(tree), 0, offset, + ti = proto_tree_add_item(tree, 0, offset, "IEEE 802.3 %s", (ethhdr_type == ETHERNET_802_3 ? "Raw " : "")); - fh_tree = gtk_tree_new(); - add_subtree(ti, fh_tree, ETT_IEEE8023); - add_item_to_tree(fh_tree, 0, 6, "Destination: %s (%s)", + fh_tree = proto_tree_new(); + proto_item_add_subtree(ti, fh_tree, ETT_IEEE8023); + proto_tree_add_item(fh_tree, 0, 6, "Destination: %s (%s)", ether_to_str((guint8 *) &pd[0]), get_ether_name((u_char *) &pd[0])); - add_item_to_tree(fh_tree, 6, 6, "Source: %s (%s)", + proto_tree_add_item(fh_tree, 6, 6, "Source: %s (%s)", ether_to_str((guint8 *) &pd[6]), get_ether_name((u_char *)&pd[6])); - add_item_to_tree(fh_tree, 12, 2, "Length: %d", length); + proto_tree_add_item(fh_tree, 12, 2, "Length: %d", length); } } else { ethhdr_type = ETHERNET_II; if (tree) { - ti = add_item_to_tree(GTK_WIDGET(tree), 0, 14, "Ethernet II"); - fh_tree = gtk_tree_new(); - add_subtree(ti, fh_tree, ETT_ETHER2); - add_item_to_tree(fh_tree, 0, 6, "Destination: %s (%s)", + ti = proto_tree_add_item(tree, 0, 14, "Ethernet II"); + fh_tree = proto_tree_new(); + proto_item_add_subtree(ti, fh_tree, ETT_ETHER2); + proto_tree_add_item(fh_tree, 0, 6, "Destination: %s (%s)", ether_to_str((guint8 *) &pd[0]), get_ether_name((u_char *)&pd[0])); - add_item_to_tree(fh_tree, 6, 6, "Source: %s (%s)", + proto_tree_add_item(fh_tree, 6, 6, "Source: %s (%s)", ether_to_str((guint8 *) &pd[6]), get_ether_name((u_char *)&pd[6])); } |