summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--capture.c3
-rw-r--r--doc/ethereal.pod16
-rw-r--r--ethereal.128
-rw-r--r--ethereal.c49
-rw-r--r--ethereal.h25
-rw-r--r--ethertype.c10
-rw-r--r--file.c61
-rw-r--r--filter.c16
-rw-r--r--follow.c7
-rw-r--r--follow.h7
-rw-r--r--packet-arp.c28
-rw-r--r--packet-bootp.c17
-rw-r--r--packet-dns.c12
-rw-r--r--packet-eth.c67
-rw-r--r--packet-ip.c22
-rw-r--r--packet-ipv6.c8
-rw-r--r--packet-ipx.c53
-rw-r--r--packet-llc.c18
-rw-r--r--packet-lpd.c12
-rw-r--r--packet-ncp.c8
-rw-r--r--packet-null.c14
-rw-r--r--packet-osi.c119
-rw-r--r--packet-ospf.c51
-rw-r--r--packet-ppp.c14
-rw-r--r--packet-raw.c12
-rw-r--r--packet-rip.c10
-rw-r--r--packet-tcp.c9
-rw-r--r--packet-tr.c16
-rw-r--r--packet-trmac.c12
-rw-r--r--packet-udp.c8
-rw-r--r--packet-vines.c38
-rw-r--r--packet.c67
-rw-r--r--packet.h101
-rw-r--r--prefs.c3
-rw-r--r--print.c15
-rw-r--r--print.h9
-rw-r--r--resolv.c5
-rw-r--r--util.c4
-rw-r--r--util.h4
39 files changed, 564 insertions, 414 deletions
diff --git a/capture.c b/capture.c
index 4d8dafc131..1c908c648f 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.2 1998/09/16 03:21:51 gerald Exp $
+ * $Id: capture.c,v 1.3 1998/09/27 22:12:20 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -39,6 +39,7 @@
# include <sys/sockio.h>
#endif
+#include "ethereal.h"
#include "packet.h"
#include "file.h"
#include "capture.h"
diff --git a/doc/ethereal.pod b/doc/ethereal.pod
index 61cab06ac9..cd06031b6b 100644
--- a/doc/ethereal.pod
+++ b/doc/ethereal.pod
@@ -17,6 +17,7 @@ S<[ B<-P> packet list height ]>
S<[ B<-r> infile ]>
S<[ B<-s> snaplen ]>
S<[ B<-T> tree view height ]>
+S<[ B<-t> time stamp format ]>
S<[ B<-v> ]>
S<[ B<-w> savefile]>
@@ -79,6 +80,11 @@ to disk.
Sets the initial height of the tree view (top) pane
+=item -t
+
+Sets the format of the packet timestamp displayed in the packet list
+window.
+
=item -v
Prints the version and exits.
@@ -134,11 +140,11 @@ using a "thumb" at the right end of each divider line. An informational
message is also displayed at the bottom of the main window.
The top section contains the list of network packets that you can scroll
-through and select. The packet number, source and destination addresses,
-protocol, and description are printed for each packet. An effort is made
-to display information as high up the protocol stack as possible, e.g. IP
-addresses are displayed for IP packets, but the MAC layer address is
-displayed for unknown packet types.
+through and select. The packet number, packet timestamp, source and
+destination addresses, protocol, and description are printed for each
+packet. An effort is made to display information as high up the protocol
+stack as possible, e.g. IP addresses are displayed for IP packets, but the
+MAC layer address is displayed for unknown packet types.
The middle section contains a I<protocol tree> for the currently-selected
packet. The tree displays each field and its value in each protocol header
diff --git a/ethereal.1 b/ethereal.1
index bfa4d13387..8473fab57a 100644
--- a/ethereal.1
+++ b/ethereal.1
@@ -1,11 +1,11 @@
.rn '' }`
-''' $RCSfile: ethereal.1,v $$Revision: 1.2 $$Date: 1998/09/17 02:01:47 $
+''' $RCSfile: ethereal.1,v $$Revision: 1.3 $$Date: 1998/09/27 22:12:21 $
'''
''' $Log: ethereal.1,v $
-''' Revision 1.2 1998/09/17 02:01:47 gerald
-''' * Added in Laurent's OSI/ISO CNLP and COTP support.
-''' * Added Laurent's changes to the man (actually pod) page.
-''' * Copied in VERSION file so that others can make doc/Makefile
+''' Revision 1.3 1998/09/27 22:12:21 gerald
+''' Merged in a _huge_ patch from Guy Harris. It adds a time stap column,
+''' generalizes the column printing code, adds a "frame" tree item to
+''' the tree view, and fixes a bunch of miscellaneous coding bugs.
'''
'''
.de Sh
@@ -98,7 +98,7 @@
.nr % 0
.rr F
.\}
-.TH ETHEREAL 1 "0.3.16" "16/Sep/98" "The Ethereal Network Analyzer"
+.TH ETHEREAL 1 "0.3.17" "27/Sep/98" "The Ethereal Network Analyzer"
.UC
.if n .hy 0
.if n .na
@@ -207,6 +207,7 @@ Ethereal \- Interactively browse network traffic
[\ \fB\-r\fR\ infile\ ]
[\ \fB\-s\fR\ snaplen\ ]
[\ \fB\-T\fR\ tree\ view\ height\ ]
+[\ \fB\-t\fR\ time\ stamp\ format\ ]
[\ \fB\-v\fR\ ]
[\ \fB\-w\fR\ savefile]
.SH "DESCRIPTION"
@@ -241,6 +242,9 @@ The default snapshot length to use when capturing live data. No more than
to disk.
.Ip "-T" 4
Sets the initial height of the tree view (top) pane
+.Ip "-t" 4
+Sets the format of the packet timestamp displayed in the packet list
+window.
.Ip "-v" 4
Prints the version and exits.
.Ip "-w" 4
@@ -268,11 +272,11 @@ using a \*(L"thumb\*(R" at the right end of each divider line. An informational
message is also displayed at the bottom of the main window.
.Sp
The top section contains the list of network packets that you can scroll
-through and select. The packet number, source and destination addresses,
-protocol, and description are printed for each packet. An effort is made
-to display information as high up the protocol stack as possible, e.g. \s-1IP\s0
-addresses are displayed for \s-1IP\s0 packets, but the \s-1MAC\s0 layer address is
-displayed for unknown packet types.
+through and select. The packet number, packet timestamp, source and
+destination addresses, protocol, and description are printed for each
+packet. An effort is made to display information as high up the protocol
+stack as possible, e.g. \s-1IP\s0 addresses are displayed for \s-1IP\s0 packets, but the
+\s-1MAC\s0 layer address is displayed for unknown packet types.
.Sp
The middle section contains a \fIprotocol tree\fR for the currently-selected
packet. The tree displays each field and its value in each protocol header
@@ -397,6 +401,8 @@ routine to be used.
.IX Item "-T"
+.IX Item "-t"
+
.IX Item "-v"
.IX Item "-w"
diff --git a/ethereal.c b/ethereal.c
index b2be053ab7..1cb66a3c43 100644
--- a/ethereal.c
+++ b/ethereal.c
@@ -1,6 +1,6 @@
/* ethereal.c
*
- * $Id: ethereal.c,v 1.3 1998/09/17 03:12:23 gerald Exp $
+ * $Id: ethereal.c,v 1.4 1998/09/27 22:12:21 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -47,6 +47,7 @@
#endif
#include <gtk/gtk.h>
+#include <pcap.h>
#include <stdio.h>
#include <string.h>
@@ -56,9 +57,10 @@
#include <fcntl.h>
#include <netinet/in.h>
+#include "ethereal.h"
+#include "capture.h"
#include "packet.h"
#include "file.h"
-#include "ethereal.h"
#include "menu.h"
#include "etypes.h"
#include "print.h"
@@ -80,6 +82,8 @@ const gchar *list_item_data_key = "list_item_data";
extern pr_opts printer_opts;
+ts_type timestamp_type = RELATIVE;
+
/* Things to do when the OK button is pressed */
void
file_sel_ok_cb(GtkWidget *w, GtkFileSelection *fs) {
@@ -107,7 +111,6 @@ file_progress_cb(gpointer p) {
void
follow_stream_cb( GtkWidget *widget, gpointer data ) {
char filename1[128];
- char buf[128];
GtkWidget *streamwindow, *box, *text, *vscrollbar, *table;
if( pi.ipproto == 6 ) {
/* we got tcp so we can follow */
@@ -241,7 +244,7 @@ packet_list_select_cb(GtkWidget *w, gint row, gint col, gpointer evt) {
fd = (frame_data *) l->data;
fseek(cf.fh, fd->file_off, SEEK_SET);
fread(cf.pd, sizeof(guint8), fd->cap_len, cf.fh);
- dissect_packet(cf.pd, fd, GTK_TREE(tree_view));
+ dissect_packet(cf.pd, 0, 0, fd, GTK_TREE(tree_view));
packet_hex_print(GTK_TEXT(byte_view), cf.pd, fd->cap_len, -1, -1);
}
gtk_text_thaw(GTK_TEXT(byte_view));
@@ -316,8 +319,8 @@ print_usage(void) {
fprintf(stderr, "%s [-v] [-b bold font] [-B byte view height] [-c count] [-h]\n",
PACKAGE);
fprintf(stderr, " [-i interface] [-m medium font] [-n] [-P packet list height]\n");
- fprintf(stderr, " [-r infile] [-s snaplen] [-T tree view height]\n");
- fprintf(stderr, " [-w savefile] \n");
+ fprintf(stderr, " [-r infile] [-s snaplen] [-t <time stamp format>]\n");
+ fprintf(stderr, " [-T tree view height] [-w savefile] \n");
}
int
@@ -332,7 +335,7 @@ main(int argc, char *argv[])
GtkAcceleratorTable *accel;
gint col_width, pl_size = 280, tv_size = 95, bv_size = 75;
gchar *rc_file, *cf_name = NULL;
- gchar *cl_title[] = {"No.", "Source", "Destination",
+ gchar *cl_title[] = {"No.", "Time", "Source", "Destination",
"Protocol", "Info"};
gchar *medium_font = MONO_MEDIUM_FONT;
gchar *bold_font = MONO_BOLD_FONT;
@@ -351,7 +354,7 @@ main(int argc, char *argv[])
gtk_init (&argc, &argv);
/* Now get our args */
- while ((opt = getopt(argc, argv, "b:B:c:hi:m:nP:r:s:T:w:v")) != EOF) {
+ while ((opt = getopt(argc, argv, "b:B:c:hi:m:nP:r:s:t:T:w:v")) != EOF) {
switch (opt) {
case 'b': /* Bold font */
bold_font = g_strdup(optarg);
@@ -387,6 +390,21 @@ main(int argc, char *argv[])
case 's': /* Set the snapshot (capture) length */
cf.snap = atoi(optarg);
break;
+ case 't': /* Time stamp type */
+ if (strcmp(optarg, "r") == 0)
+ timestamp_type = RELATIVE;
+ else if (strcmp(optarg, "a") == 0)
+ timestamp_type = ABSOLUTE;
+ else if (strcmp(optarg, "d") == 0)
+ timestamp_type = DELTA;
+ else {
+ fprintf(stderr, "ethereal: Invalid time stamp type \"%s\"\n",
+ optarg);
+ fprintf(stderr, "It must be \"r\" for relative, \"a\" for absolute,\n");
+ fprintf(stderr, "or \"d\" for delta.\n");
+ exit(1);
+ }
+ break;
case 'T': /* Tree view pane height */
tv_size = atoi(optarg);
break;
@@ -459,7 +477,7 @@ main(int argc, char *argv[])
gtk_widget_show(l_pane);
/* Packet list */
- packet_list = gtk_clist_new_with_titles(5, cl_title);
+ packet_list = gtk_clist_new_with_titles(NUM_COLS, cl_title);
pl_style = gtk_style_new();
gdk_font_unref(pl_style->font);
pl_style->font = m_r_font;
@@ -472,12 +490,17 @@ main(int argc, char *argv[])
gtk_clist_set_column_justification(GTK_CLIST(packet_list), 0,
GTK_JUSTIFY_RIGHT);
col_width = (gdk_string_width(pl_style->font, "0") * 7) + 2;
- gtk_clist_set_column_width(GTK_CLIST(packet_list), 0, col_width);
+ gtk_clist_set_column_width(GTK_CLIST(packet_list), COL_NUM, col_width);
+ if (timestamp_type == ABSOLUTE)
+ col_width = gdk_string_width(pl_style->font, "00:00:00.000000");
+ else
+ col_width = gdk_string_width(pl_style->font, "0000.000000");
+ gtk_clist_set_column_width(GTK_CLIST(packet_list), COL_TIME, col_width);
col_width = gdk_string_width(pl_style->font, "00:00:00:00:00:00") + 2;
- gtk_clist_set_column_width(GTK_CLIST(packet_list), 1, col_width);
- gtk_clist_set_column_width(GTK_CLIST(packet_list), 2, col_width);
+ gtk_clist_set_column_width(GTK_CLIST(packet_list), COL_SOURCE, col_width);
+ gtk_clist_set_column_width(GTK_CLIST(packet_list), COL_DESTINATION, col_width);
col_width = gdk_string_width(pl_style->font, "AppleTalk") + 2;
- gtk_clist_set_column_width(GTK_CLIST(packet_list), 3, col_width);
+ gtk_clist_set_column_width(GTK_CLIST(packet_list), COL_PROTOCOL, col_width);
gtk_widget_set_usize(packet_list, -1, pl_size);
gtk_paned_add1(GTK_PANED(u_pane), packet_list);
gtk_widget_show(packet_list);
diff --git a/ethereal.h b/ethereal.h
index 79c4202d47..6b70dd3c0d 100644
--- a/ethereal.h
+++ b/ethereal.h
@@ -1,7 +1,7 @@
/* ethereal.h
* Global defines, etc.
*
- * $Id: ethereal.h,v 1.3 1998/09/17 03:12:24 gerald Exp $
+ * $Id: ethereal.h,v 1.4 1998/09/27 22:12:23 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -71,6 +71,29 @@ typedef struct _selection_info {
GtkWidget *text;
} selection_info;
+/*
+ * Columns in summary listing.
+ */
+#define COL_NUM 0
+#define COL_TIME 1
+#define COL_SOURCE 2
+#define COL_DESTINATION 3
+#define COL_PROTOCOL 4
+#define COL_INFO 5
+
+#define NUM_COLS 6
+
+/*
+ * Type of time-stamp shown in the summary display.
+ */
+typedef enum {
+ RELATIVE,
+ ABSOLUTE,
+ DELTA
+} ts_type;
+
+extern ts_type timestamp_type;
+
void file_sel_ok_cb(GtkWidget *, GtkFileSelection *);
void blank_packetinfo();
gint file_progress_cb(gpointer);
diff --git a/ethertype.c b/ethertype.c
index 77e9b87fe4..a92af5b84a 100644
--- a/ethertype.c
+++ b/ethertype.c
@@ -2,7 +2,7 @@
* Routines for calling the right protocol for the ethertype.
* This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP)
*
- * $Id: ethertype.c,v 1.3 1998/09/17 02:37:45 gerald Exp $
+ * $Id: ethertype.c,v 1.4 1998/09/27 22:12:23 gerald Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -36,8 +36,8 @@
#include <pcap.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
#include "etypes.h"
void
@@ -81,14 +81,14 @@ ethertype(guint16 etype, int offset,
add_item_to_tree(fh_tree, offset - 2, 2,
"Type: AppleTalk (0x%04x)", etype);
}
- if (fd->win_info[0]) { strcpy(fd->win_info[3], etype_str[3]); }
+ if (fd->win_info[COL_NUM]) { strcpy(fd->win_info[COL_PROTOCOL], etype_str[3]); }
break;
case ETHERTYPE_AARP:
if (tree) {
add_item_to_tree(fh_tree, offset - 2, 2,
"Type: AARP (0x%04x)", etype);
}
- if (fd->win_info[0]) { strcpy(fd->win_info[3], etype_str[4]); }
+ if (fd->win_info[COL_NUM]) { strcpy(fd->win_info[COL_PROTOCOL], etype_str[4]); }
break;
case ETHERTYPE_IPX:
if (tree) {
@@ -110,7 +110,7 @@ ethertype(guint16 etype, int offset,
"Type: Unknown (0x%04x)", etype);
dissect_data(pd, offset, fd, tree);
}
- if (fd->win_info[0]) { sprintf(fd->win_info[3], "0x%04x", etype); }
+ if (fd->win_info[COL_NUM]) { sprintf(fd->win_info[COL_PROTOCOL], "0x%04x", etype); }
break;
}
}
diff --git a/file.c b/file.c
index 77c8f5b23e..beec62d06b 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.4 1998/09/25 23:23:59 gerald Exp $
+ * $Id: file.c,v 1.5 1998/09/27 22:12:24 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <unistd.h>
+#include <string.h>
#include <sys/stat.h>
#include <errno.h>
@@ -43,16 +44,17 @@
# include <netinet/in.h>
#endif
-
+#include "menu.h"
+#include "ethereal.h"
#include "packet.h"
#include "file.h"
-#include "ethereal.h"
#include "util.h"
extern GtkWidget *packet_list, *prog_bar, *info_bar, *byte_view, *tree_view;
extern guint file_ctx;
-guint32 ssec, susec;
+static guint32 ssec, susec;
+static guint32 lastsec, lastusec;
int
open_cap_file(char *fname, capture_file *cf) {
@@ -103,6 +105,7 @@ open_cap_file(char *fname, capture_file *cf) {
cf->plist = g_list_first(cf->plist);
}
ssec = 0, susec = 0;
+ lastsec = 0, lastusec = 0;
if (magic[0] == PCAP_MAGIC || magic[0] == SWAP32(PCAP_MAGIC)) {
@@ -251,9 +254,10 @@ pcap_dispatch_cb(u_char *user, const struct pcap_pkthdr *phdr,
const u_char *buf) {
frame_data *fdata;
/* To do: make sure this is big enough. */
- gchar p_info[5][256];
+ gchar p_info[NUM_COLS][256];
gint i, row;
capture_file *cf = (capture_file *) user;
+ guint32 tssecs, tsusecs;
while (gtk_events_pending())
gtk_main_iteration();
@@ -268,24 +272,55 @@ pcap_dispatch_cb(u_char *user, const struct pcap_pkthdr *phdr,
fdata->secs = phdr->ts.tv_sec;
fdata->usecs = phdr->ts.tv_usec;
- for (i = 0; i < 5; i++) { fdata->win_info[i] = &p_info[i][0]; }
- sprintf(fdata->win_info[0], "%d", cf->count);
- dissect_packet(buf, fdata, NULL);
- row = gtk_clist_append(GTK_CLIST(packet_list), fdata->win_info);
- for (i = 0; i < 5; i++) { fdata->win_info[i] = NULL; }
-
+ /* If we don't have the time stamp of the first packet, it's because this
+ is the first packet. Save the time stamp of this packet as the time
+ stamp of the first packet. */
if (!ssec && !susec) {
ssec = fdata->secs;
susec = fdata->usecs;
}
+
+ /* Do the same for the time stamp of the previous packet. */
+ if (!lastsec && !lastusec) {
+ lastsec = fdata->secs;
+ lastusec = fdata->usecs;
+ }
+
+ /* Get the time elapsed between the first packet and this packet. */
cf->esec = fdata->secs - ssec;
- if (susec < fdata->usecs) {
+ if (susec <= fdata->usecs) {
cf->eusec = fdata->usecs - susec;
} else {
- cf->eusec = susec - fdata->usecs;
+ cf->eusec = (fdata->usecs + 1000000) - susec;
cf->esec--;
}
+ /* Compute the time stamp. */
+ switch (timestamp_type) {
+ case RELATIVE: /* Relative to the first packet */
+ tssecs = cf->esec;
+ tsusecs = cf->eusec;
+ break;
+ case DELTA: /* Relative to the previous packet */
+ tssecs = fdata->secs - lastsec;
+ if (lastusec <= fdata->usecs) {
+ tsusecs = fdata->usecs - lastusec;
+ } else {
+ tsusecs = (fdata->usecs + 1000000) - lastusec;
+ tssecs--;
+ }
+ break;
+ default: /* Absolute time, or bogus timestamp_type value */
+ tssecs = 0; /* Not used */
+ tsusecs = 0;
+ break;
+ }
+ for (i = 0; i < NUM_COLS; i++) { fdata->win_info[i] = &p_info[i][0]; }
+ sprintf(fdata->win_info[COL_NUM], "%d", cf->count);
+ dissect_packet(buf, tssecs, tsusecs, fdata, NULL);
+ row = gtk_clist_append(GTK_CLIST(packet_list), fdata->win_info);
+ for (i = 0; i < NUM_COLS; i++) { fdata->win_info[i] = NULL; }
+
/* Make sure we always have an available list entry */
if (cf->plist->next == NULL) {
fdata = (frame_data *) g_malloc(sizeof(frame_data));
diff --git a/filter.c b/filter.c
index 34e3e25c55..479cf59a34 100644
--- a/filter.c
+++ b/filter.c
@@ -1,7 +1,7 @@
/* filter.c
* Routines for managing filter sets
*
- * $Id: filter.c,v 1.2 1998/09/16 03:21:58 gerald Exp $
+ * $Id: filter.c,v 1.3 1998/09/27 22:12:24 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -32,7 +32,9 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <ctype.h>
+#include "ethereal.h"
#include "filter.h"
#include "packet.h"
#include "file.h"
@@ -68,7 +70,7 @@ read_filter_list() {
while (fgets(f_buf, 256, ff)) {
line++;
len = strlen(f_buf);
- if (f_buf[len - 1] = '\n') {
+ if (f_buf[len - 1] == '\n') {
len--;
f_buf[len] = '\0';
}
@@ -109,7 +111,7 @@ filter_sel_cb(GtkWidget *w, gpointer d) {
*new_bt, *ok_bt, *save_bt, *cancel_bt, *filter_sc, *nl_item,
*nl_lb, *middle_hb, *name_lb, *bottom_hb, *filter_lb;
GtkWidget *l_select = NULL;
- GList *flp = NULL, *nl = NULL;
+ GList *flp = NULL;
filter_def *filt;
fl = read_filter_list();
@@ -285,7 +287,6 @@ filter_sel_list_cb(GtkWidget *l, gpointer data) {
void
filter_sel_new_cb(GtkWidget *w, gpointer data) {
- GList *nl = NULL;
filter_def *filt;
gchar *name, *strval;
GtkWidget *nl_item, *nl_lb;
@@ -317,7 +318,6 @@ filter_sel_chg_cb(GtkWidget *w, gpointer data) {
GList *sl, *flp;
GtkObject *l_item;
GtkLabel *nl_lb;
- gint sensitivity = FALSE;
sl = GTK_LIST(filter_l)->selection;
name = gtk_entry_get_text(GTK_ENTRY(name_te));
@@ -343,9 +343,9 @@ filter_sel_chg_cb(GtkWidget *w, gpointer data) {
void
filter_sel_copy_cb(GtkWidget *w, gpointer data) {
- GList *nl = NULL, *sl, *flp;
+ GList *sl, *flp;
filter_def *filt, *nfilt;
- gchar *name, *strval, *prefix = "Copy of ";
+ gchar *prefix = "Copy of ";
GtkObject *l_item;
GtkWidget *nl_item, *nl_lb;
@@ -378,7 +378,6 @@ filter_sel_del_cb(GtkWidget *w, gpointer data) {
GList *sl, *flp;
filter_def *filt;
GtkObject *l_item;
- GtkWidget *nl_item;
gint pos;
sl = GTK_LIST(filter_l)->selection;
@@ -455,7 +454,6 @@ filter_sel_save_cb(GtkWidget *w, gpointer data) {
void
filter_sel_cancel_cb(GtkWidget *w, gpointer win) {
filter_def *filt;
- GList *sl;
while (fl) {
if (fl->data) {
diff --git a/follow.c b/follow.c
index 9842459908..b68def625f 100644
--- a/follow.c
+++ b/follow.c
@@ -1,6 +1,6 @@
/* follow.c
*
- * $Id: follow.c,v 1.1 1998/09/17 03:12:26 gerald Exp $
+ * $Id: follow.c,v 1.2 1998/09/27 22:12:25 gerald Exp $
*
* Copyright 1998 Mike Hall <mlh@io.com>
*
@@ -29,6 +29,7 @@
#include <string.h>
#include <unistd.h>
+#include "ethereal.h"
#include "packet.h"
#include "follow.h"
@@ -62,7 +63,7 @@ static u_long seq[2];
static u_long src[2] = { 0, 0 };
void
-reassemble_tcp( u_long sequence, u_long length, char* data, int synflag, u_long srcx ) {
+reassemble_tcp( u_long sequence, u_long length, const char* data, int synflag, u_long srcx ) {
int src_index, j, first = 0;
u_long newseq;
tcp_frag *tmp_frag;
@@ -191,7 +192,7 @@ reset_tcp_reassembly() {
}
void
-write_packet_data( u_char* data, int length ) {
+write_packet_data( const u_char* data, int length ) {
fwrite( data, 1, length, data_out_file );
}
diff --git a/follow.h b/follow.h
index 186435e43d..68bf2aef61 100644
--- a/follow.h
+++ b/follow.h
@@ -1,6 +1,6 @@
/* follow.h
*
- * $Id: follow.h,v 1.1 1998/09/17 03:12:26 gerald Exp $
+ * $Id: follow.h,v 1.2 1998/09/27 22:12:26 gerald Exp $
*
* Copyright 1998 Mike Hall <mlh@io.com>
*
@@ -38,8 +38,9 @@ typedef struct _tcp_frag {
} tcp_frag;
char* build_follow_filter( packet_info * );
-void reassemble_tcp( u_long, u_long, char*, int, u_long );
+void reassemble_tcp( u_long, u_long, const char*, int, u_long );
int check_fragments( int );
-void write_packet_data( u_char *, int );
+void reset_tcp_reassembly( void );
+void write_packet_data( const u_char *, int );
#endif
diff --git a/packet-arp.c b/packet-arp.c
index ba3fd6384f..6df7a584eb 100644
--- a/packet-arp.c
+++ b/packet-arp.c
@@ -1,7 +1,7 @@
/* packet-arp.c
* Routines for ARP packet disassembly
*
- * $Id: packet-arp.c,v 1.2 1998/09/16 03:22:01 gerald Exp $
+ * $Id: packet-arp.c,v 1.3 1998/09/27 22:12:26 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -59,7 +59,7 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
/* To do: Check for bounds on ar_op */
ar_op = ntohs(ea->ar_op);
- if (fd->win_info[0]) { strcpy(fd->win_info[3], "ARP"); }
+ if (fd->win_info[COL_NUM]) { strcpy(fd->win_info[COL_PROTOCOL], "ARP"); }
if (tree) {
ti = add_item_to_tree(GTK_WIDGET(tree), offset, 28, req_type[ar_op - 1]);
@@ -85,37 +85,37 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
"Target IP: %s", ip_to_str((guint8 *) ea->arp_tpa));
}
- if (ar_pro != ETHERTYPE_IP && fd->win_info[0]) {
- sprintf(fd->win_info[4], "h/w %d (%d) prot %d (%d) op 0x%04x",
+ if (ar_pro != ETHERTYPE_IP && fd->win_info[COL_NUM]) {
+ sprintf(fd->win_info[COL_INFO], "h/w %d (%d) prot %d (%d) op 0x%04x",
ar_hrd, ea->ar_hln, ar_pro, ea->ar_pln, ar_op);
return;
}
switch (ar_op) {
case ARPOP_REQUEST:
- if (fd->win_info[0]) {
- sprintf(fd->win_info[4], "Who has %s? Tell %s",
+ if (fd->win_info[COL_NUM]) {
+ sprintf(fd->win_info[COL_INFO], "Who has %s? Tell %s",
ip_to_str((guint8 *) ea->arp_tpa), ip_to_str((guint8 *) ea->arp_spa));
}
break;
case ARPOP_REPLY:
- if (fd->win_info[0]) {
- sprintf(fd->win_info[4], "%s is at %s",
+ if (fd->win_info[COL_NUM]) {
+ sprintf(fd->win_info[COL_INFO], "%s is at %s",
ip_to_str((guint8 *) ea->arp_spa),
ether_to_str((guint8 *) ea->arp_sha));
}
break;
case ARPOP_RREQUEST:
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "RARP");
- sprintf(fd->win_info[4], "Who is %s? Tell %s",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "RARP");
+ sprintf(fd->win_info[COL_INFO], "Who is %s? Tell %s",
ether_to_str((guint8 *) ea->arp_tha),
ether_to_str((guint8 *) ea->arp_sha));
}
break;
case ARPOP_RREPLY:
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "RARP");
- sprintf(fd->win_info[4], "%s is at %s",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "RARP");
+ sprintf(fd->win_info[COL_INFO], "%s is at %s",
ether_to_str((guint8 *) ea->arp_sha),
ip_to_str((guint8 *) ea->arp_spa));
}
diff --git a/packet-bootp.c b/packet-bootp.c
index 364bd37a4a..80cf312616 100644
--- a/packet-bootp.c
+++ b/packet-bootp.c
@@ -2,7 +2,7 @@
* Routines for BOOTP/DHCP packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-bootp.c,v 1.5 1998/09/23 05:25:08 gram Exp $
+ * $Id: packet-bootp.c,v 1.6 1998/09/27 22:12:27 gerald Exp $
*
* The information used comes from:
* RFC 2132: DHCP Options and BOOTP Vendor Extensions
@@ -47,8 +47,8 @@
#include <pcap.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
#include "etypes.h"
enum field_type { none, ipv4, string, toggle, yes_no, special, opaque,
@@ -70,7 +70,7 @@ bootp_option(const u_char *pd, GtkWidget *bp_tree, int voff, int eoff)
enum field_type ftype;
u_char code = pd[voff];
int vlen = pd[voff+1];
- int i, consumed;
+ int i, consumed = 0;
GtkWidget *vti, *v_tree;
char *opt53_text[] = {
@@ -264,7 +264,7 @@ bootp_option(const u_char *pd, GtkWidget *bp_tree, int voff, int eoff)
/* End Option */
case 255:
- add_item_to_tree(bp_tree, voff, 1, "End Option", code);
+ add_item_to_tree(bp_tree, voff, 1, "End Option");
consumed = 1;
return consumed;
@@ -387,18 +387,17 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
{
GtkWidget *bp_tree, *ti;
int voff, eoff; /* vender offset, end offset */
- int vlen;
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "BOOTP");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "BOOTP");
/* if hwaddr is 6 bytes, assume MAC */
if (pd[offset] == 1 && pd[offset+2] == 6) {
- sprintf(fd->win_info[4], "Boot Request from %s",
+ sprintf(fd->win_info[COL_INFO], "Boot Request from %s",
ether_to_str((guint8*)&pd[offset+28]));
}
else {
- strcpy(fd->win_info[4], pd[offset] == 1 ? "Boot Request" :
+ strcpy(fd->win_info[COL_INFO], pd[offset] == 1 ? "Boot Request" :
"Boot Reply");
}
}
diff --git a/packet-dns.c b/packet-dns.c
index f493da19db..59f96a1bee 100644
--- a/packet-dns.c
+++ b/packet-dns.c
@@ -1,7 +1,7 @@
/* packet-dns.c
* Routines for DNS packet disassembly
*
- * $Id: packet-dns.c,v 1.3 1998/09/27 03:42:33 gram Exp $
+ * $Id: packet-dns.c,v 1.4 1998/09/27 22:12:28 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -31,6 +31,7 @@
#include <pcap.h>
#include <stdio.h>
+#include <memory.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
@@ -40,6 +41,7 @@
# include <netinet/in.h>
#endif
+#include "ethereal.h"
#include "packet.h"
@@ -405,13 +407,13 @@ dissect_dns(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
query = ! (flags & (1 << 15));
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "DNS (UDP)");
- strcpy(fd->win_info[4], query ? "Query" : "Response");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "DNS (UDP)");
+ strcpy(fd->win_info[COL_INFO], query ? "Query" : "Response");
}
if (tree) {
- ti = add_item_to_tree(GTK_WIDGET(tree), offset, END_OF_FRAME,
+ ti = add_item_to_tree(GTK_WIDGET(tree), offset, 4,
query ? "DNS query" : "DNS response");
dns_tree = gtk_tree_new();
diff --git a/packet-eth.c b/packet-eth.c
index a856e13d61..7806a9f966 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.3 1998/09/25 23:24:01 gerald Exp $
+ * $Id: packet-eth.c,v 1.4 1998/09/27 22:12:29 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -33,8 +33,8 @@
#include <pcap.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
#include "etypes.h"
#include "resolv.h"
@@ -59,10 +59,10 @@ dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
GtkWidget *fh_tree, *ti;
int ethhdr_type; /* the type of ethernet frame */
- if (fd->win_info[0]) {
- strcpy(fd->win_info[2], get_ether_name((u_char *)&pd[0]));
- strcpy(fd->win_info[1], get_ether_name((u_char *)&pd[6]));
- strcpy(fd->win_info[4], "Ethernet II");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_DESTINATION], get_ether_name((u_char *)&pd[0]));
+ strcpy(fd->win_info[COL_SOURCE], get_ether_name((u_char *)&pd[6]));
+ strcpy(fd->win_info[COL_INFO], "Ethernet II");
}
etype = (pd[12] << 8) | pd[13];
@@ -72,24 +72,22 @@ dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
length = etype;
/* Is there an 802.2 layer? I can tell by looking at the first 2
- bytes after the 802.3 header. If they are 0xffff, then what
- follows the 802.3 header is an IPX payload, meaning no 802.2.
- (IPX/SPX is they only thing that can be contained inside a
- straight 802.3 packet). A non-0xffff value means that there's an
- 802.2 layer inside the 802.3 layer */
- if (pd[14] == 0xff && pd[15] == 0xff) {
- ethhdr_type = ETHERNET_802_3;
- }
- else {
- ethhdr_type = ETHERNET_802_2;
- }
-
- if (fd->win_info[0]) { sprintf(fd->win_info[4], "802.3"); }
+ bytes after the 802.3 header. If they are 0xffff, then what
+ follows the 802.3 header is an IPX payload, meaning no 802.2.
+ (IPX/SPX is they only thing that can be contained inside a
+ straight 802.3 packet). A non-0xffff value means that there's an
+ 802.2 layer inside the 802.3 layer */
+ if (pd[14] == 0xff && pd[15] == 0xff) {
+ ethhdr_type = ETHERNET_802_3;
+ }
+ else {
+ ethhdr_type = ETHERNET_802_2;
+ }
+
+ if (fd->win_info[COL_NUM]) { sprintf(fd->win_info[COL_INFO], "802.3"); }
if (tree) {
ti = add_item_to_tree(GTK_WIDGET(tree), 0, offset,
- "IEEE 802.3 %s(%d on wire, %d captured)",
- (ethhdr_type == ETHERNET_802_3 ? "Raw " : ""),
- fd->pkt_len, fd->cap_len);
+ "IEEE 802.3 %s", (ethhdr_type == ETHERNET_802_3 ? "Raw " : ""));
fh_tree = gtk_tree_new();
add_subtree(ti, fh_tree, ETT_IEEE8023);
@@ -102,18 +100,19 @@ dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
add_item_to_tree(fh_tree, 12, 2, "Length: %d", length);
}
- } else if (tree) {
- ethhdr_type = ETHERNET_II;
- ti = add_item_to_tree(GTK_WIDGET(tree), 0, 14,
- "Ethernet II (%d on wire, %d captured)", fd->pkt_len, fd->cap_len);
- fh_tree = gtk_tree_new();
- add_subtree(ti, fh_tree, ETT_ETHER2);
- add_item_to_tree(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)",
- ether_to_str((guint8 *) &pd[6]),
- get_ether_name((u_char *)&pd[6]));
+ } 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)",
+ ether_to_str((guint8 *) &pd[0]),
+ get_ether_name((u_char *)&pd[0]));
+ add_item_to_tree(fh_tree, 6, 6, "Source: %s (%s)",
+ ether_to_str((guint8 *) &pd[6]),
+ get_ether_name((u_char *)&pd[6]));
+ }
}
/* either ethernet802.3 or ethernet802.2 */
diff --git a/packet-ip.c b/packet-ip.c
index a2cc35bc61..7615d29295 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.3 1998/09/17 03:12:27 gerald Exp $
+ * $Id: packet-ip.c,v 1.4 1998/09/27 22:12:29 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -61,7 +61,7 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
iph.ip_off = ntohs(iph.ip_off);
iph.ip_sum = ntohs(iph.ip_sum);
- if (fd->win_info[0]) {
+ if (fd->win_info[COL_NUM]) {
switch (iph.ip_p) {
case IP_PROTO_ICMP:
case IP_PROTO_IGMP:
@@ -71,12 +71,12 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
/* Names are set in the associated dissect_* routines */
break;
default:
- strcpy(fd->win_info[3], "IP");
- sprintf(fd->win_info[4], "Unknown IP protocol (%02x)", iph.ip_p);
+ strcpy(fd->win_info[COL_PROTOCOL], "IP");
+ sprintf(fd->win_info[COL_INFO], "Unknown IP protocol (%02x)", iph.ip_p);
}
- strcpy(fd->win_info[1], get_hostname(iph.ip_src));
- strcpy(fd->win_info[2], get_hostname(iph.ip_dst));
+ strcpy(fd->win_info[COL_SOURCE], get_hostname(iph.ip_src));
+ strcpy(fd->win_info[COL_DESTINATION], get_hostname(iph.ip_dst));
}
iph.ip_tos = IPTOS_TOS(iph.ip_tos);
@@ -248,9 +248,9 @@ dissect_icmp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
strcpy(type_str, "Unknown ICMP (obsolete or malformed?)");
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "ICMP");
- strcpy(fd->win_info[4], type_str);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "ICMP");
+ strcpy(fd->win_info[COL_INFO], type_str);
}
if (tree) {
@@ -307,8 +307,8 @@ dissect_igmp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
strcpy(type_str, "Unknown IGMP");
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "IGMP");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "IGMP");
}
if (tree) {
diff --git a/packet-ipv6.c b/packet-ipv6.c
index f8cd83706e..8a775f9343 100644
--- a/packet-ipv6.c
+++ b/packet-ipv6.c
@@ -1,7 +1,7 @@
/* packet-ipv6.c
* Routines for IPv6 packet disassembly
*
- * $Id: packet-ipv6.c,v 1.2 1998/09/16 03:22:05 gerald Exp $
+ * $Id: packet-ipv6.c,v 1.3 1998/09/27 22:12:30 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -53,7 +53,7 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
memcpy(&ipv6, (void *) &pd[offset], 8);
- if (fd->win_info[0]) {
+ if (fd->win_info[COL_NUM]) {
switch(ipv6.next_header){
/*
case IP_PROTO_ICMP:
@@ -65,8 +65,8 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
/* Names are set in the associated dissect_* routines */
/* break; */
default:
- strcpy(fd->win_info[3], "IPv6");
- sprintf(fd->win_info[4], "IPv6 support is still under development (%d)", ipv6.next_header);
+ strcpy(fd->win_info[COL_PROTOCOL], "IPv6");
+ sprintf(fd->win_info[COL_INFO], "IPv6 support is still under development (%d)", ipv6.next_header);
}
}
if (tree) {
diff --git a/packet-ipx.c b/packet-ipx.c
index c8b0160848..8a5a754359 100644
--- a/packet-ipx.c
+++ b/packet-ipx.c
@@ -2,7 +2,7 @@
* Routines for NetWare's IPX
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-ipx.c,v 1.6 1998/09/27 03:43:44 gram Exp $
+ * $Id: packet-ipx.c,v 1.7 1998/09/27 22:12:31 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -177,9 +177,9 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
snet = network_to_string((guint8*)&pd[offset+18]);
dsocket = pntohs(&pd[offset+16]);
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "IPX");
- sprintf(fd->win_info[4], "%s (0x%04X)", port_text(dsocket), dsocket);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "IPX");
+ sprintf(fd->win_info[COL_INFO], "%s (0x%04X)", port_text(dsocket), dsocket);
}
ipx_type = pd[offset+5];
@@ -283,9 +283,9 @@ dissect_spx(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
GtkWidget *spx_tree, *ti;
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "SPX");
- strcpy(fd->win_info[4], "SPX");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "SPX");
+ strcpy(fd->win_info[COL_INFO], "SPX");
}
if (tree) {
@@ -325,11 +325,6 @@ dissect_spx(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
/* ================================================================= */
/* IPX RIP */
/* ================================================================= */
-/* I don't do NLSP in packet-ipx.c because we don't use Netware Link State
- * Protocol at work, so I can't debug any ethereal code I write for it. If you
- * can supply me a tcpdump output file showing NLSP packets, I'll gladly
- * create dissect_ipxnlsp(). -- gram@verdict.uthscsa.edu
- */
static void
dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
@@ -342,13 +337,13 @@ dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
operation = pntohs(&pd[offset]) - 1;
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "IPX RIP");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "IPX RIP");
if (operation < 2) {
- sprintf(fd->win_info[4], rip_type[operation]);
+ sprintf(fd->win_info[COL_INFO], rip_type[operation]);
}
else {
- strcpy(fd->win_info[4], "Unknown Packet Type");
+ strcpy(fd->win_info[COL_INFO], "Unknown Packet Type");
}
}
@@ -448,13 +443,13 @@ dissect_sap(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
query.query_type = pntohs(&pd[offset]);
query.server_type = pntohs(&pd[offset+2]);
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "SAP");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "SAP");
if (query.query_type < 4) {
- sprintf(fd->win_info[4], sap_type[query.query_type - 1]);
+ sprintf(fd->win_info[COL_INFO], sap_type[query.query_type - 1]);
}
else {
- strcpy(fd->win_info[4], "Unknown Packet Type");
+ strcpy(fd->win_info[COL_INFO], "Unknown Packet Type");
}
}
@@ -496,21 +491,9 @@ dissect_sap(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
ether_to_str((guint8*)&pd[cursor+54]));
add_item_to_tree(s_tree, cursor+60, 2, "Socket: %s (0x%04X)",
port_text(server.server_port), server.server_port);
-
- /* A hop-count of 16 is unreachable. This type of packet
- * is the Server Down notification produced when a server
- * is brought down gracefully.
- */
- if (server.intermediate_network >= 16) {
- add_item_to_tree(s_tree, cursor+62, 2,
- "Intermediate Networks: %d (Unreachable)",
- server.intermediate_network);
- }
- else {
- add_item_to_tree(s_tree, cursor+62, 2,
- "Intermediate Networks: %d",
- server.intermediate_network);
- }
+ add_item_to_tree(s_tree, cursor+62, 2,
+ "Intermediate Networks: %d",
+ server.intermediate_network);
}
}
else { /* queries */
diff --git a/packet-llc.c b/packet-llc.c
index a02f8e4872..462637b801 100644
--- a/packet-llc.c
+++ b/packet-llc.c
@@ -2,7 +2,7 @@
* Routines for IEEE 802.2 LLC layer
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-llc.c,v 1.6 1998/09/23 05:25:10 gram Exp $
+ * $Id: packet-llc.c,v 1.7 1998/09/27 22:12:32 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -34,8 +34,8 @@
#include <stdio.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
#include "etypes.h"
struct sap_info {
@@ -117,7 +117,7 @@ llc_org(const u_char *ptr) {
void
dissect_llc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
- GtkWidget *llc_tree, *ti;
+ GtkWidget *llc_tree = NULL, *ti;
guint16 etype;
int is_snap;
void (*dissect) (const u_char *, int, frame_data *, GtkTree *);
@@ -129,8 +129,8 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
is_snap = (pd[offset] == 0xAA) && (pd[offset+1] == 0xAA);
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "LLC");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "LLC");
}
if (tree) {
@@ -147,8 +147,8 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
}
if (is_snap) {
- if (fd->win_info[0]) {
- strcpy(fd->win_info[4], "802.2 LLC (SNAP)");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_INFO], "802.2 LLC (SNAP)");
}
if (tree) {
add_item_to_tree(llc_tree, offset+3, 3,
@@ -161,8 +161,8 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
ethertype(etype, offset, pd, fd, tree, llc_tree);
}
else {
- if (fd->win_info[0]) {
- sprintf(fd->win_info[4], "802.2 LLC (%s)", sap_text(pd[offset]));
+ if (fd->win_info[COL_NUM]) {
+ sprintf(fd->win_info[COL_INFO], "802.2 LLC (%s)", sap_text(pd[offset]));
}
dissect = sap_func(pd[offset]);
diff --git a/packet-lpd.c b/packet-lpd.c
index 9770ad7575..39740b95f3 100644
--- a/packet-lpd.c
+++ b/packet-lpd.c
@@ -2,7 +2,7 @@
* Routines for LPR and LPRng packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-lpd.c,v 1.2 1998/09/16 03:22:07 gerald Exp $
+ * $Id: packet-lpd.c,v 1.3 1998/09/27 22:12:32 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -43,8 +43,8 @@
#include <pcap.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
#include "etypes.h"
enum lpr_type { request, response };
@@ -90,13 +90,13 @@ dissect_lpd(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "LPD");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "LPD");
if (lpr_packet_type == request) {
- strcpy(fd->win_info[4], lpd_client_code[pd[offset]]);
+ strcpy(fd->win_info[COL_INFO], lpd_client_code[pd[offset]]);
}
else {
- strcpy(fd->win_info[4], "LPD response");
+ strcpy(fd->win_info[COL_INFO], "LPD response");
}
}
diff --git a/packet-ncp.c b/packet-ncp.c
index b8a6a1c714..866d7a5287 100644
--- a/packet-ncp.c
+++ b/packet-ncp.c
@@ -2,7 +2,7 @@
* Routines for NetWare Core Protocol
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-ncp.c,v 1.1 1998/09/23 05:25:11 gram Exp $
+ * $Id: packet-ncp.c,v 1.2 1998/09/27 22:12:33 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -195,9 +195,9 @@ dissect_ncp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
guint16 ncp_type;
int ncp_hdr;
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "NCP");
- strcpy(fd->win_info[4], "NCP");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "NCP");
+ strcpy(fd->win_info[COL_INFO], "NCP");
}
ncp_type = pntohs(&pd[offset]);
diff --git a/packet-null.c b/packet-null.c
index 95ae464cf6..574becfec8 100644
--- a/packet-null.c
+++ b/packet-null.c
@@ -1,7 +1,7 @@
/* packet-null.c
* Routines for null packet disassembly
*
- * $Id: packet-null.c,v 1.1 1998/09/25 23:24:02 gerald Exp $
+ * $Id: packet-null.c,v 1.2 1998/09/27 22:12:33 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -37,8 +37,8 @@
#include <sys/socket.h>
#include <pcap.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
void
dissect_null( const u_char *pd, frame_data *fd, GtkTree *tree ) {
@@ -51,11 +51,11 @@ dissect_null( const u_char *pd, frame_data *fd, GtkTree *tree ) {
/* load the top pane info. This should be overwritten by
the next protocol in the stack */
- if(fd->win_info[0]) {
- strcpy(fd->win_info[1], "N/A" );
- strcpy(fd->win_info[2], "N/A" );
- strcpy(fd->win_info[3], "N/A" );
- strcpy(fd->win_info[4], "Null/Loopback" );
+ if(fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_SOURCE], "N/A" );
+ strcpy(fd->win_info[COL_DESTINATION], "N/A" );
+ strcpy(fd->win_info[COL_PROTOCOL], "N/A" );
+ strcpy(fd->win_info[COL_INFO], "Null/Loopback" );
}
/* populate a tree in the second pane with the status of the link
diff --git a/packet-osi.c b/packet-osi.c
index 3d75769630..29a046668e 100644
--- a/packet-osi.c
+++ b/packet-osi.c
@@ -1,7 +1,7 @@
/* packet-osi.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
- * $Id: packet-osi.c,v 1.1 1998/09/17 02:01:48 gerald Exp $
+ * $Id: packet-osi.c,v 1.2 1998/09/27 22:12:34 gerald Exp $
* Laurent Deniel <deniel@worldnet.fr>
*
* Ethereal - Network traffic analyzer
@@ -40,6 +40,7 @@
#include <pcap.h>
#include <stdio.h>
+#include <string.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
@@ -240,9 +241,9 @@ static int osi_decode_DR(const u_char *pd, int offset,
break;
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "DR TPDU src-ref: 0x%04x dst-ref: 0x%04x %s",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "DR TPDU src-ref: 0x%04x dst-ref: 0x%04x %s",
src_ref, dst_ref);
}
@@ -275,8 +276,8 @@ static int osi_decode_DT(const u_char *pd, int offset,
{
GtkWidget *cotp_tree, *ti;
u_int tpdu_nr ;
- u_short checksum;
- u_char code, length;
+ u_short checksum = 0;
+ u_char code = 0, length = 0;
u_int fragment = 0;
switch (li) {
@@ -331,9 +332,9 @@ static int osi_decode_DT(const u_char *pd, int offset,
break;
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "DT TPDU (%d) dst-ref: 0x%04x %s",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "DT TPDU (%d) dst-ref: 0x%04x %s",
tpdu_nr,
dst_ref,
(fragment)? "(fragment)" : "");
@@ -417,8 +418,8 @@ static int osi_decode_ED(const u_char *pd, int offset,
{
GtkWidget *cotp_tree, *ti;
u_int tpdu_nr ;
- u_short checksum;
- u_char code, length;
+ u_short checksum = 0;
+ u_char code = 0, length = 0;
/* ED TPDUs are never fragmented */
@@ -469,9 +470,9 @@ static int osi_decode_ED(const u_char *pd, int offset,
break;
} /* li */
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "ED TPDU (%d) dst-ref: 0x%04x", tpdu_nr, dst_ref);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "ED TPDU (%d) dst-ref: 0x%04x", tpdu_nr, dst_ref);
}
if (tree) {
@@ -536,7 +537,7 @@ static int osi_decode_RJ(const u_char *pd, int offset,
{
GtkWidget *cotp_tree, *ti;
u_int tpdu_nr ;
- u_short credit;
+ u_short credit = 0;
switch(li) {
case LI_NORMAL_RJ :
@@ -552,9 +553,9 @@ static int osi_decode_RJ(const u_char *pd, int offset,
break;
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "RJ TPDU (%d) dst-ref: 0x%04x", tpdu_nr, dst_ref);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "RJ TPDU (%d) dst-ref: 0x%04x", tpdu_nr, dst_ref);
}
if (tree) {
@@ -628,7 +629,7 @@ static int osi_decode_CC(const u_char *pd, int offset,
/* CC & CR decoding in the same function */
- GtkWidget *cotp_tree, *ti;
+ GtkWidget *cotp_tree = NULL, *ti;
u_short src_ref, checksum;
u_char class_option, code, length;
u_int i = 0;
@@ -638,9 +639,9 @@ static int osi_decode_CC(const u_char *pd, int offset,
if (class_option > 4)
return -1;
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "%s TPDU src-ref: 0x%04x dst-ref: 0x%04x",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "%s TPDU src-ref: 0x%04x dst-ref: 0x%04x",
(tpdu == CR_TPDU) ? "CR" : "CC",
src_ref,
dst_ref);
@@ -667,7 +668,7 @@ static int osi_decode_CC(const u_char *pd, int offset,
if (tree)
while(li > P_VAR_PART_CC + i - 1) {
- u_char c1,c2;
+ u_char c1;
u_short s, s1,s2,s3,s4;
u_int t1,t2,t3,t4;
@@ -889,8 +890,8 @@ static int osi_decode_DC(const u_char *pd, int offset,
frame_data *fd, GtkTree *tree)
{
GtkWidget *cotp_tree, *ti;
- u_short src_ref, checksum;
- u_char length, code = 0;
+ u_short src_ref, checksum = 0;
+ u_char length = 0, code = 0;
if (li > LI_MAX_DC)
return -1;
@@ -912,9 +913,9 @@ static int osi_decode_DC(const u_char *pd, int offset,
break;
} /* li */
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "DC TPDU src-ref: 0x%04x dst-ref: 0x%04x",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "DC TPDU src-ref: 0x%04x dst-ref: 0x%04x",
src_ref,
dst_ref);
}
@@ -955,7 +956,7 @@ static int osi_decode_DC(const u_char *pd, int offset,
static int osi_decode_AK(const u_char *pd, int offset,
frame_data *fd, GtkTree *tree)
{
- GtkWidget *cotp_tree, *ti;
+ GtkWidget *cotp_tree = NULL, *ti;
u_int tpdu_nr,i =0, r_lower_window_edge ;
u_short cdt_in_ak;
u_short checksum, seq_nr, r_seq_nr, r_cdt;
@@ -967,9 +968,9 @@ static int osi_decode_AK(const u_char *pd, int offset,
if (!is_LI_NORMAL_AK(li)) {
tpdu_nr = pd[offset + P_TPDU_NR_234];
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "AK TPDU (%d) dst-ref: 0x%04x",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "AK TPDU (%d) dst-ref: 0x%04x",
tpdu_nr, dst_ref);
}
@@ -1075,9 +1076,9 @@ static int osi_decode_AK(const u_char *pd, int offset,
tpdu_nr = EXTRACT_LONG(&pd[offset + P_TPDU_NR_234]);
cdt_in_ak = EXTRACT_SHORT(&pd[offset + P_CDT_IN_AK]);
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "AK TPDU (%d) dst-ref: 0x%04x",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "AK TPDU (%d) dst-ref: 0x%04x",
tpdu_nr, dst_ref);
}
@@ -1193,9 +1194,9 @@ static int osi_decode_EA(const u_char *pd, int offset,
{
GtkWidget *cotp_tree, *ti;
u_int tpdu_nr ;
- u_short checksum;
- u_char code;
- u_char length;
+ u_short checksum = 0;
+ u_char code = 0;
+ u_char length = 0;
if (li > LI_MAX_EA)
return -1;
@@ -1229,9 +1230,9 @@ static int osi_decode_EA(const u_char *pd, int offset,
break;
} /* li */
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "EA TPDU (%d) dst-ref: 0x%04x", tpdu_nr, dst_ref);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "EA TPDU (%d) dst-ref: 0x%04x", tpdu_nr, dst_ref);
}
if (tree) {
@@ -1315,9 +1316,9 @@ static int osi_decode_ER(const u_char *pd, int offset,
break;
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "COTP");
- sprintf(fd->win_info[4], "ER TPDU dst-ref: 0x%04x", dst_ref);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "COTP");
+ sprintf(fd->win_info[COL_INFO], "ER TPDU dst-ref: 0x%04x", dst_ref);
}
if (tree) {
@@ -1438,7 +1439,7 @@ void dissect_clnp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
{
struct clnp_header clnp;
- GtkWidget *clnp_tree, *ti;
+ GtkWidget *clnp_tree = NULL, *ti;
u_char src_len, dst_len, nsel;
u_int first_offset = offset;
@@ -1514,10 +1515,10 @@ void dissect_clnp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
print_nsap(&pd[offset + dst_len + 2], src_len));
}
- if (fd->win_info[0]) {
- sprintf(fd->win_info[1], "%s",
+ if (fd->win_info[COL_NUM]) {
+ sprintf(fd->win_info[COL_SOURCE], "%s",
print_nsap(&pd[offset + dst_len + 2], src_len));
- sprintf(fd->win_info[2], "%s",
+ sprintf(fd->win_info[COL_DESTINATION], "%s",
print_nsap(&pd[offset + 1], dst_len));
}
@@ -1576,38 +1577,38 @@ void dissect_osi(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
/* only CLNP is currently decoded */
case ISO8473_CLNP:
- if (fd->win_info[0])
+ if (fd->win_info[COL_NUM])
{
- strcpy(fd->win_info[3], "CLNP");
+ strcpy(fd->win_info[COL_PROTOCOL], "CLNP");
}
dissect_clnp(pd, offset, fd, tree);
break;
case ISO9542_ESIS:
- if (fd->win_info[0])
+ if (fd->win_info[COL_NUM])
{
- strcpy(fd->win_info[3], "ESIS");
+ strcpy(fd->win_info[COL_PROTOCOL], "ESIS");
}
dissect_data(pd, offset, fd, tree);
break;
case ISO9542X25_ESIS:
- if (fd->win_info[0])
+ if (fd->win_info[COL_NUM])
{
- strcpy(fd->win_info[3], "ESIS(X25)");
+ strcpy(fd->win_info[COL_PROTOCOL], "ESIS(X25)");
}
dissect_data(pd, offset, fd, tree);
break;
case ISO10589_ISIS:
- if (fd->win_info[0])
+ if (fd->win_info[COL_NUM])
{
- strcpy(fd->win_info[3], "ISIS");
+ strcpy(fd->win_info[COL_PROTOCOL], "ISIS");
}
dissect_data(pd, offset, fd, tree);
break;
default:
- if (fd->win_info[0])
+ if (fd->win_info[COL_NUM])
{
- strcpy(fd->win_info[3], "ISO");
- sprintf(fd->win_info[4], "Unknown ISO protocol (%02x)", pd[offset]);
+ strcpy(fd->win_info[COL_PROTOCOL], "ISO");
+ sprintf(fd->win_info[COL_INFO], "Unknown ISO protocol (%02x)", pd[offset]);
}
dissect_data(pd, offset, fd, tree);
break;
diff --git a/packet-ospf.c b/packet-ospf.c
index b2441225d5..1432aaa860 100644
--- a/packet-ospf.c
+++ b/packet-ospf.c
@@ -2,7 +2,7 @@
* Routines for OSPF packet disassembly
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
*
- * $Id: packet-ospf.c,v 1.2 1998/09/16 03:22:08 gerald Exp $
+ * $Id: packet-ospf.c,v 1.3 1998/09/27 22:12:36 gerald Exp $
*
* At this time, this module is able to analyze OSPF
* packets as specified in RFC2328. MOSPF (RFC1584) and other
@@ -77,11 +77,14 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
case OSPF_LS_ACK:
packet_type="LS Acknowledge";
break;
- default:
+ default:
+ /* XXX - set it to some string with the value of
+ "ospfh->packet_type"? */
+ break;
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "OSPF");
- sprintf(fd->win_info[4], "%s", packet_type);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "OSPF");
+ sprintf(fd->win_info[COL_INFO], "%s", packet_type);
}
if (tree) {
@@ -196,7 +199,7 @@ dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
add_item_to_tree(ospf_hello_tree, offset + 6, 1, "Options: %d (%s)", ospfhello->options, options);
add_item_to_tree(ospf_hello_tree, offset + 7, 1, "Router Priority: %d", ospfhello->priority);
- add_item_to_tree(ospf_hello_tree, offset + 8, 4, "RouterDeadIntervall: %d seconds", ntohl(ospfhello->dead_interval));
+ add_item_to_tree(ospf_hello_tree, offset + 8, 4, "RouterDeadIntervall: %ld seconds", (long)ntohl(ospfhello->dead_interval));
add_item_to_tree(ospf_hello_tree, offset + 12, 4, "Designated Router: %s", ip_to_str((guint8 *) &ospfhello->drouter));
add_item_to_tree(ospf_hello_tree, offset + 16, 4, "Backup Designated Router: %s", ip_to_str((guint8 *) &ospfhello->bdrouter));
@@ -271,7 +274,7 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, GtkTree *tree
}
add_item_to_tree(ospf_db_desc_tree, offset + 3 , 1, "Flags: %d (%s)", ospf_dbd->flags, flags );
- add_item_to_tree(ospf_db_desc_tree, offset + 4 , 4, "DD Sequence: %d", ntohl(ospf_dbd->dd_sequence) );
+ add_item_to_tree(ospf_db_desc_tree, offset + 4 , 4, "DD Sequence: %ld", (long)ntohl(ospf_dbd->dd_sequence) );
}
/* LS Headers will be processed here */
/* skip to the end of DB-Desc header */
@@ -300,28 +303,28 @@ dissect_ospf_ls_req(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
switch( ntohl( ospf_lsr->ls_type ) ){
case OSPF_LSTYPE_ROUTER:
- add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Router-LSA (%d)",
- ntohl( ospf_lsr->ls_type ) );
+ add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Router-LSA (%ld)",
+ (long)ntohl( ospf_lsr->ls_type ) );
break;
case OSPF_LSTYPE_NETWORK:
- add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Network-LSA (%d)",
- ntohl( ospf_lsr->ls_type ) );
+ add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Network-LSA (%ld)",
+ (long)ntohl( ospf_lsr->ls_type ) );
break;
case OSPF_LSTYPE_SUMMERY:
- add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (IP network) (%d)",
- ntohl( ospf_lsr->ls_type ) );
+ add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (IP network) (%ld)",
+ (long)ntohl( ospf_lsr->ls_type ) );
break;
case OSPF_LSTYPE_ASBR:
- add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (ASBR) (%d)",
- ntohl( ospf_lsr->ls_type ) );
+ add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: Summary-LSA (ASBR) (%ld)",
+ (long)ntohl( ospf_lsr->ls_type ) );
break;
case OSPF_LSTYPE_ASEXT:
- add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: AS-External-LSA (ASBR) (%d)",
- ntohl( ospf_lsr->ls_type ) );
+ add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: AS-External-LSA (ASBR) (%ld)",
+ (long)ntohl( ospf_lsr->ls_type ) );
break;
default:
- add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: %d (unknown)",
- ntohl( ospf_lsr->ls_type ) );
+ add_item_to_tree(ospf_lsr_tree, offset, 4, "LS Type: %ld (unknown)",
+ (long)ntohl( ospf_lsr->ls_type ) );
}
add_item_to_tree(ospf_lsr_tree, offset + 4, 4, "Link State ID : %s",
@@ -347,7 +350,7 @@ dissect_ospf_ls_upd(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
ospf_lsa_upd_tree = gtk_tree_new();
add_subtree(ti, ospf_lsa_upd_tree, ETT_OSPF_LSA_UPD);
- add_item_to_tree(ospf_lsa_upd_tree, offset, 4, "Nr oF LSAs: %d", ntohl(upd_hdr->lsa_nr) );
+ add_item_to_tree(ospf_lsa_upd_tree, offset, 4, "Nr oF LSAs: %ld", (long)ntohl(upd_hdr->lsa_nr) );
}
/* skip to the beginning of the first LSA */
offset+=4; /* the LS Upd PAcket contains only a 32 bit #LSAs field */
@@ -390,10 +393,6 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
/* data structures for the summary and ASBR LSAs */
e_ospf_summary_lsa *summary_lsa;
- guint8 *tos;
- guint16 *tos_metric;
-
-
GtkWidget *ospf_lsa_tree, *ti;
@@ -440,8 +439,8 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, GtkTree *tree, in
add_item_to_tree(ospf_lsa_tree, offset + 8, 4, "Advertising Router: %s ",
ip_to_str((guint8 *) &(lsa_hdr->adv_router)));
- add_item_to_tree(ospf_lsa_tree, offset + 12, 4, "LS Sequence Number: 0x%04x ",
- ntohl(lsa_hdr->ls_seq));
+ add_item_to_tree(ospf_lsa_tree, offset + 12, 4, "LS Sequence Number: 0x%04lx ",
+ (unsigned long)ntohl(lsa_hdr->ls_seq));
add_item_to_tree(ospf_lsa_tree, offset + 16, 2, "LS Checksum: %d ", ntohs(lsa_hdr->ls_checksum));
add_item_to_tree(ospf_lsa_tree, offset + 18, 2, "Length: %d ", ntohs(lsa_hdr->length));
diff --git a/packet-ppp.c b/packet-ppp.c
index c0dc47f9b3..546e1a3d45 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -1,7 +1,7 @@
/* packet-ppp.c
* Routines for ppp packet disassembly
*
- * $Id: packet-ppp.c,v 1.3 1998/09/25 23:24:02 gerald Exp $
+ * $Id: packet-ppp.c,v 1.4 1998/09/27 22:12:37 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -32,8 +32,8 @@
#include <stdio.h>
#include <pcap.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
void
dissect_ppp( const u_char *pd, frame_data *fd, GtkTree *tree ) {
@@ -46,11 +46,11 @@ dissect_ppp( const u_char *pd, frame_data *fd, GtkTree *tree ) {
/* load the top pane info. This should be overwritten by
the next protocol in the stack */
- if(fd->win_info[0]) {
- strcpy(fd->win_info[1], "N/A" );
- strcpy(fd->win_info[2], "N/A" );
- strcpy(fd->win_info[3], "N/A" );
- strcpy(fd->win_info[4], "PPP" );
+ if(fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_SOURCE], "N/A" );
+ strcpy(fd->win_info[COL_DESTINATION], "N/A" );
+ strcpy(fd->win_info[COL_PROTOCOL], "N/A" );
+ strcpy(fd->win_info[COL_INFO], "PPP" );
}
/* populate a tree in the second pane with the status of the link
diff --git a/packet-raw.c b/packet-raw.c
index 1f02eaed20..b1ada2500d 100644
--- a/packet-raw.c
+++ b/packet-raw.c
@@ -1,7 +1,7 @@
/* packet-raw.c
* Routines for raw packet disassembly
*
- * $Id: packet-raw.c,v 1.2 1998/09/16 03:22:09 gerald Exp $
+ * $Id: packet-raw.c,v 1.3 1998/09/27 22:12:37 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -32,8 +32,8 @@
#include <stdio.h>
#include <pcap.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
void
dissect_raw( const u_char *pd, frame_data *fd, GtkTree *tree ) {
@@ -41,10 +41,10 @@ dissect_raw( const u_char *pd, frame_data *fd, GtkTree *tree ) {
/* load the top pane info. This should be overwritten by
the next protocol in the stack */
- if(fd->win_info[0]) {
- strcpy(fd->win_info[1], "N/A" );
- strcpy(fd->win_info[2], "N/A" );
- strcpy(fd->win_info[4], "Raw packet data" );
+ if(fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_SOURCE], "N/A" );
+ strcpy(fd->win_info[COL_DESTINATION], "N/A" );
+ strcpy(fd->win_info[COL_INFO], "Raw packet data" );
}
/* populate a tree in the second pane with the status of the link
diff --git a/packet-rip.c b/packet-rip.c
index 54eb027741..589061fdd1 100644
--- a/packet-rip.c
+++ b/packet-rip.c
@@ -2,7 +2,7 @@
* Routines for RIPv1 and RIPv2 packet disassembly
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
*
- * $Id: packet-rip.c,v 1.2 1998/09/16 03:22:10 gerald Exp $
+ * $Id: packet-rip.c,v 1.3 1998/09/27 22:12:38 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -86,9 +86,9 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
}
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], version[rip_header->version] );
- sprintf(fd->win_info[4], "%s", packet_type[rip_header->command]);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], version[rip_header->version] );
+ sprintf(fd->win_info[COL_INFO], "%s", packet_type[rip_header->command]);
}
if (tree) {
@@ -138,7 +138,7 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
ip_to_str((guint8 *) &(rip_vektor.next_hop)));
}
- add_item_to_tree(rip_vektor_tree, offset + 12 , 4, "Metric: %d", ntohl(rip_vektor.metric));
+ add_item_to_tree(rip_vektor_tree, offset + 12 , 4, "Metric: %ld", (long)ntohl(rip_vektor.metric));
offset += RIP_VEKTOR_LENGTH;
};
diff --git a/packet-tcp.c b/packet-tcp.c
index 44d119f419..635f7f17de 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.3 1998/09/17 03:12:28 gerald Exp $
+ * $Id: packet-tcp.c,v 1.4 1998/09/27 22:12:38 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -41,6 +41,7 @@
#include "ethereal.h"
#include "packet.h"
+#include "follow.h"
extern FILE* data_out_file;
extern packet_info pi;
@@ -78,9 +79,9 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
}
flags[fpos] = '\0';
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "TCP");
- sprintf(fd->win_info[4], "Source port: %d Destination port: %d",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "TCP");
+ sprintf(fd->win_info[COL_INFO], "Source port: %d Destination port: %d",
th.th_sport, th.th_dport);
}
diff --git a/packet-tr.c b/packet-tr.c
index 43d303ae9a..8b74a298c4 100644
--- a/packet-tr.c
+++ b/packet-tr.c
@@ -2,7 +2,7 @@
* Routines for Token-Ring packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-tr.c,v 1.4 1998/09/17 22:28:07 gram Exp $
+ * $Id: packet-tr.c,v 1.5 1998/09/27 22:12:39 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -42,8 +42,8 @@
#include <pcap.h>
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
#include "etypes.h"
static void
@@ -179,17 +179,17 @@ dissect_tr(const u_char *pd, frame_data *fd, GtkTree *tree) {
/* information window */
- if (fd->win_info[0]) {
- strcpy(fd->win_info[2], ether_to_str((guint8 *)&pd[2]));
- strcpy(fd->win_info[1], ether_to_str(trn_shost_nonsr));
- strcpy(fd->win_info[3], "TR");
- sprintf(fd->win_info[4], "Token-Ring %s", fc[frame_type]);
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_DESTINATION], ether_to_str((guint8 *)&pd[2]));
+ strcpy(fd->win_info[COL_SOURCE], ether_to_str(trn_shost_nonsr));
+ strcpy(fd->win_info[COL_PROTOCOL], "TR");
+ sprintf(fd->win_info[COL_INFO], "Token-Ring %s", fc[frame_type]);
}
/* protocol analysis tree */
if (tree) {
ti = add_item_to_tree(GTK_WIDGET(tree), 0, 14 + actual_rif_bytes,
- "Token-Ring (%d on wire, %d captured)", fd->pkt_len, fd->cap_len);
+ "Token-Ring");
fh_tree = gtk_tree_new();
add_subtree(ti, fh_tree, ETT_TOKEN_RING);
add_item_to_tree(fh_tree, 0, 1,
diff --git a/packet-trmac.c b/packet-trmac.c
index 075143174d..de810afdbf 100644
--- a/packet-trmac.c
+++ b/packet-trmac.c
@@ -2,7 +2,7 @@
* Routines for Token-Ring Media Access Control
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-trmac.c,v 1.2 1998/09/16 03:22:12 gerald Exp $
+ * $Id: packet-trmac.c,v 1.3 1998/09/27 22:12:40 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -42,8 +42,8 @@
# include <netinet/in.h>
#endif
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
#include "etypes.h"
struct vec_info {
@@ -86,10 +86,10 @@ mv_text(u_char cmd, int offset, frame_data *fd, GtkWidget *tree) {
while (mv[i].text != NULL) {
if (mv[i].cmd == cmd) {
- if (fd->win_info[0]) {
+ if (fd->win_info[COL_NUM]) {
/* I can do this because no higher-level dissect()
will strcpy onto me. */
- fd->win_info[4] = mv[i].text;
+ fd->win_info[COL_INFO] = mv[i].text;
}
if (tree) {
add_item_to_tree(tree, offset, 1, "Major Vector Command: %s",
@@ -288,8 +288,8 @@ dissect_trmac(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
"Configuration Report Server", "Ring Parameter Server",
"Ring Error Monitor" };
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "TR MAC");
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "TR MAC");
}
mv_length = ntohs(*((guint16*)&pd[offset]));
diff --git a/packet-udp.c b/packet-udp.c
index fd9036b8f6..58cce64bbf 100644
--- a/packet-udp.c
+++ b/packet-udp.c
@@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
- * $Id: packet-udp.c,v 1.3 1998/09/21 16:16:01 gram Exp $
+ * $Id: packet-udp.c,v 1.4 1998/09/27 22:12:40 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -56,9 +56,9 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
uh_ulen = ntohs(uh->uh_ulen);
uh_sum = ntohs(uh->uh_sum);
- if (fd->win_info[0]) {
- strcpy(fd->win_info[3], "UDP");
- sprintf(fd->win_info[4], "Source port: %s Destination port: %s",
+ if (fd->win_info[COL_NUM]) {
+ strcpy(fd->win_info[COL_PROTOCOL], "UDP");
+ sprintf(fd->win_info[COL_INFO], "Source port: %s Destination port: %s",
get_udp_port(uh_sport), get_udp_port(uh_dport));
}
diff --git a/packet-vines.c b/packet-vines.c
index 67bf31a75e..5cb05996f2 100644
--- a/packet-vines.c
+++ b/packet-vines.c
@@ -1,7 +1,7 @@
/* packet-vines.c
* Routines for Banyan VINES protocol packet disassembly
*
- * $Id: packet-vines.c,v 1.1 1998/09/17 02:37:46 gerald Exp $
+ * $Id: packet-vines.c,v 1.2 1998/09/27 22:12:41 gerald Exp $
*
* Don Lafontaine <lafont02@cn.ca>
*
@@ -53,7 +53,7 @@ dissect_vines(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
{
e_vip iph;
GtkWidget *vip_tree, *ti;
- gchar tos_str[32];
+/* gchar tos_str[32]; */
/* To do: check for runts, errs, etc. */
/* Avoids alignment problems on many architectures. */
@@ -66,25 +66,25 @@ dissect_vines(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
iph.vip_dsub = pntohs(&pd[offset+10]);
iph.vip_ssub = pntohs(&pd[offset+16]);
- if (fd->win_info[0])
+ if (fd->win_info[COL_NUM])
{
switch (iph.vip_proto)
{
case VINES_VSPP:
- strcpy(fd->win_info[3], "Vines");
- sprintf(fd->win_info[4], "VSPP (%02x)", iph.vip_proto);
+ strcpy(fd->win_info[COL_PROTOCOL], "Vines");
+ sprintf(fd->win_info[COL_INFO], "VSPP (%02x)", iph.vip_proto);
break;
case VINES_DATA:
- strcpy(fd->win_info[3], "Vines IP");
- sprintf(fd->win_info[4], "DATA (%02x)", iph.vip_proto);
+ strcpy(fd->win_info[COL_PROTOCOL], "Vines IP");
+ sprintf(fd->win_info[COL_INFO], "DATA (%02x)", iph.vip_proto);
break;
default:
- strcpy(fd->win_info[3], "Vines IP");
- sprintf(fd->win_info[4], "Unknown VIP protocol (%02x)", iph.vip_proto);
+ strcpy(fd->win_info[COL_PROTOCOL], "Vines IP");
+ sprintf(fd->win_info[COL_INFO], "Unknown VIP protocol (%02x)", iph.vip_proto);
}
- sprintf(fd->win_info[1], "%08x.%04x", iph.vip_snet, iph.vip_ssub);
- sprintf(fd->win_info[2], "%08x.%04x", iph.vip_dnet, iph.vip_dsub);
+ sprintf(fd->win_info[COL_SOURCE], "%08x.%04x", iph.vip_snet, iph.vip_ssub);
+ sprintf(fd->win_info[COL_DESTINATION], "%08x.%04x", iph.vip_dnet, iph.vip_dsub);
}
/*
iph.ip_tos = IPTOS_TOS(iph.ip_tos);
@@ -138,7 +138,7 @@ void dissect_vspp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
{
e_vspp iph;
GtkWidget *vspp_tree, *ti;
- gchar tos_str[32];
+/* gchar tos_str[32];*/
/* To do: check for runts, errs, etc. */
/* Avoids alignment problems on many architectures. */
@@ -149,26 +149,26 @@ void dissect_vspp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree)
iph.vspp_lclid = ntohs(iph.vspp_lclid);
iph.vspp_rmtid = ntohs(iph.vspp_rmtid);
- if (fd->win_info[0])
+ if (fd->win_info[COL_NUM])
{
switch (iph.vspp_pkttype)
{
case VINES_VSPP_DATA:
- strcpy(fd->win_info[3], "Vines");
- sprintf(fd->win_info[4], "VSPP Data Port=%04x(Transient) NS=%04x NR=%04x Window=%04x RID=%04x LID=%04x D=%04x S=%04x",
+ strcpy(fd->win_info[COL_PROTOCOL], "Vines");
+ sprintf(fd->win_info[COL_INFO], "VSPP Data Port=%04x(Transient) NS=%04x NR=%04x Window=%04x RID=%04x LID=%04x D=%04x S=%04x",
iph.vspp_sport, iph.vspp_seq, iph.vspp_ack, iph.vspp_win, iph.vspp_rmtid,
iph.vspp_lclid, iph.vspp_dport, iph.vspp_sport);
break;
case VINES_VSPP_ACK:
- strcpy(fd->win_info[3], "Vines");
- sprintf(fd->win_info[4], "VSPP Ack Port=%04x(Transient) NS=%04x NR=%04x Window=%04x RID=%04x LID=%04x",
+ strcpy(fd->win_info[COL_PROTOCOL], "Vines");
+ sprintf(fd->win_info[COL_INFO], "VSPP Ack Port=%04x(Transient) NS=%04x NR=%04x Window=%04x RID=%04x LID=%04x",
iph.vspp_sport, iph.vspp_seq, iph.vspp_ack, iph.vspp_win, iph.vspp_rmtid,
iph.vspp_lclid);
break;
default:
- strcpy(fd->win_info[3], "Vines IP");
- sprintf(fd->win_info[4], "Unknown VSPP packet type (%02x)", iph.vspp_pkttype);
+ strcpy(fd->win_info[COL_PROTOCOL], "Vines IP");
+ sprintf(fd->win_info[COL_INFO], "Unknown VSPP packet type (%02x)", iph.vspp_pkttype);
}
}
/*
diff --git a/packet.c b/packet.c
index 3f0f63e2be..00f8b3c4d2 100644
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.3 1998/09/25 23:24:03 gerald Exp $
+ * $Id: packet.c,v 1.4 1998/09/27 22:12:42 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -37,8 +37,8 @@
# include <netinet/in.h>
#endif
-#include "packet.h"
#include "ethereal.h"
+#include "packet.h"
#include "etypes.h"
#include "file.h"
@@ -192,17 +192,74 @@ void
decode_start_len(GtkTreeItem *ti, gint *pstart, gint *plen)
{
guint32 t_info;
- int start, len;
t_info = (guint32) gtk_object_get_user_data(GTK_OBJECT(ti));
*pstart = t_info >> 16;
*plen = t_info & 0xffff;
}
+static const char *mon_names[12] = {
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec"
+};
/* this routine checks the frame type from the cf structure */
void
-dissect_packet(const u_char *pd, frame_data *fd, GtkTree *tree) {
+dissect_packet(const u_char *pd, guint32 ts_secs, guint32 ts_usecs,
+ frame_data *fd, GtkTree *tree)
+{
+ GtkWidget *fh_tree, *ti;
+ struct tm *tmp;
+ time_t then;
+
+ /* Put in frame header information. */
+ if (fd->win_info[COL_NUM]) {
+ if (timestamp_type == ABSOLUTE) {
+ then = fd->secs;
+ tmp = localtime(&then);
+ sprintf(fd->win_info[COL_TIME], "%02d:%02d:%02d.%04ld",
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->usecs/100);
+ } else
+ sprintf(fd->win_info[COL_TIME], "%d.%06d", ts_secs, ts_usecs);
+ }
+
+ if (tree) {
+ ti = add_item_to_tree(GTK_WIDGET(tree), 0, fd->cap_len,
+ "Frame (%d on wire, %d captured)",
+ fd->pkt_len, fd->cap_len);
+
+ fh_tree = gtk_tree_new();
+ add_subtree(ti, fh_tree, ETT_FRAME);
+ then = fd->secs;
+ tmp = localtime(&then);
+ add_item_to_tree(fh_tree, 0, 0,
+ "Frame arrived on %s %2d, %d %02d:%02d:%02d.%04ld",
+ mon_names[tmp->tm_mon],
+ tmp->tm_mday,
+ tmp->tm_year + 1900,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)fd->usecs/100);
+
+ add_item_to_tree(fh_tree, 0, 0, "Total frame length: %d bytes",
+ fd->pkt_len);
+ add_item_to_tree(fh_tree, 0, 0, "Capture frame length: %d bytes",
+ fd->cap_len);
+ }
switch (cf.lnk_t) {
case DLT_EN10MB :
@@ -218,7 +275,7 @@ dissect_packet(const u_char *pd, frame_data *fd, GtkTree *tree) {
dissect_ppp(pd, fd, tree);
break;
case DLT_RAW :
- dissect_raw(pd, fd, tree);
+ dissect_raw(pd, fd, tree);
break;
}
}
diff --git a/packet.h b/packet.h
index 48f95e4b77..82a2ca3a40 100644
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.9 1998/09/25 23:24:04 gerald Exp $
+ * $Id: packet.h,v 1.10 1998/09/27 22:12:42 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -67,7 +67,7 @@ typedef struct _frame_data {
guint32 secs; /* Seconds */
guint32 usecs; /* Microseconds */
long file_off; /* File offset */
- gchar *win_info[5]; /* Packet list text */
+ gchar *win_info[NUM_COLS]; /* Text for packet summary list fields */
} frame_data;
typedef struct _packet_info {
@@ -273,51 +273,52 @@ typedef struct _e_udphdr {
/* Tree types. Each dissect_* routine should have one for each
add_subtree() call. */
-#define ETT_IEEE8023 0
-#define ETT_ETHER2 1
-#define ETT_LLC 2
-#define ETT_TOKEN_RING 3
-#define ETT_TR_IERR_CNT 4
-#define ETT_TR_NERR_CNT 5
-#define ETT_TR_MAC 6
-#define ETT_PPP 7
-#define ETT_ARP 8
-#define ETT_IP 9
-#define ETT_UDP 10
-#define ETT_TCP 11
-#define ETT_ICMP 12
-#define ETT_IGMP 13
-#define ETT_IPX 14
-#define ETT_SPX 15
-#define ETT_NCP 16
-#define ETT_DNS 17
-#define ETT_DNS_ANS 18
-#define ETT_DNS_QRY 19
-#define ETT_RIP 20
-#define ETT_RIP_VEC 21
-#define ETT_OSPF 22
-#define ETT_OSPF_HDR 23
-#define ETT_OSPF_HELLO 24
-#define ETT_OSPF_DESC 25
-#define ETT_OSPF_LSR 26
-#define ETT_OSPF_LSA_UPD 27
-#define ETT_OSPF_LSA 28
-#define ETT_LPD 29
-#define ETT_RAW 30
-#define ETT_BOOTP 31
-#define ETT_BOOTP_OPTION 32
-#define ETT_IPv6 33
-#define ETT_CLNP 34
-#define ETT_COTP 35
-#define ETT_VINES 36
-#define ETT_VSPP 37
-#define ETT_IPXRIP 38
-#define ETT_IPXSAP 39
-#define ETT_IPXSAP_SERVER 40
-#define ETT_NULL 41
+#define ETT_FRAME 0
+#define ETT_IEEE8023 1
+#define ETT_ETHER2 2
+#define ETT_LLC 3
+#define ETT_TOKEN_RING 4
+#define ETT_TR_IERR_CNT 5
+#define ETT_TR_NERR_CNT 6
+#define ETT_TR_MAC 7
+#define ETT_PPP 8
+#define ETT_ARP 9
+#define ETT_IP 10
+#define ETT_UDP 11
+#define ETT_TCP 12
+#define ETT_ICMP 13
+#define ETT_IGMP 14
+#define ETT_IPX 15
+#define ETT_SPX 16
+#define ETT_NCP 17
+#define ETT_DNS 18
+#define ETT_DNS_ANS 19
+#define ETT_DNS_QRY 20
+#define ETT_RIP 21
+#define ETT_RIP_VEC 22
+#define ETT_OSPF 23
+#define ETT_OSPF_HDR 24
+#define ETT_OSPF_HELLO 25
+#define ETT_OSPF_DESC 26
+#define ETT_OSPF_LSR 27
+#define ETT_OSPF_LSA_UPD 28
+#define ETT_OSPF_LSA 29
+#define ETT_LPD 30
+#define ETT_RAW 31
+#define ETT_BOOTP 32
+#define ETT_BOOTP_OPTION 33
+#define ETT_IPv6 34
+#define ETT_CLNP 35
+#define ETT_COTP 36
+#define ETT_VINES 37
+#define ETT_VSPP 38
+#define ETT_IPXRIP 39
+#define ETT_IPXSAP 40
+#define ETT_IPXSAP_SERVER 41
+#define ETT_NULL 42
/* Should be the last item number plus one */
-#define NUM_TREE_TYPES 42
+#define NUM_TREE_TYPES 43
/* The version of pcap.h that comes with some systems is missing these
* #defines.
@@ -339,11 +340,17 @@ typedef struct _e_udphdr {
gchar* ether_to_str(guint8 *);
gchar* ip_to_str(guint8 *);
void packet_hex_print(GtkText *, guint8 *, gint, gint, gint);
+#if __GNUC__ == 2
+GtkWidget* add_item_to_tree(GtkWidget *, gint, gint, gchar *, ...)
+ __attribute__((format (printf, 4, 5)));
+#else
GtkWidget* add_item_to_tree(GtkWidget *, gint, gint, gchar *, ...);
+#endif
void decode_start_len(GtkTreeItem *, gint*, gint*);
/* Routines in packet.c */
-void dissect_packet(const u_char *, frame_data *, GtkTree *);
+void dissect_packet(const u_char *, guint32 ts_secs, guint32 ts_usecs,
+ frame_data *, GtkTree *);
void add_subtree(GtkWidget *, GtkWidget*, gint);
void expand_tree(GtkWidget *, gpointer);
void collapse_tree(GtkWidget *, gpointer);
@@ -354,6 +361,7 @@ void collapse_tree(GtkWidget *, gpointer);
* They should never modify the packet data.
*/
void dissect_eth(const u_char *, frame_data *, GtkTree *);
+void dissect_null(const u_char *, frame_data *, GtkTree *);
void dissect_ppp(const u_char *, frame_data *, GtkTree *);
void dissect_raw(const u_char *, frame_data *, GtkTree *);
void dissect_tr(const u_char *, frame_data *, GtkTree *);
@@ -379,6 +387,7 @@ void dissect_ncp(const u_char *, int, frame_data *, GtkTree *);
void dissect_osi(const u_char *, int, frame_data *, GtkTree *);
void dissect_ospf(const u_char *, int, frame_data *, GtkTree *);
void dissect_ospf_hello(const u_char *, int, frame_data *, GtkTree *);
+void dissect_rip(const u_char *, int, frame_data *, GtkTree *);
void dissect_tcp(const u_char *, int, frame_data *, GtkTree *);
void dissect_trmac(const u_char *, int, frame_data *, GtkTree *);
void dissect_udp(const u_char *, int, frame_data *, GtkTree *);
diff --git a/prefs.c b/prefs.c
index eb3ce9fad5..e3df68874d 100644
--- a/prefs.c
+++ b/prefs.c
@@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
- * $Id: prefs.c,v 1.2 1998/09/26 19:28:49 gerald Exp $
+ * $Id: prefs.c,v 1.3 1998/09/27 22:12:43 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -33,6 +33,7 @@
#include <gtk/gtk.h>
+#include "ethereal.h"
#include "packet.h"
#include "file.h"
#include "print.h"
diff --git a/print.c b/print.c
index fe4d996cb9..8faa1a3eb6 100644
--- a/print.c
+++ b/print.c
@@ -1,7 +1,7 @@
/* print.c
* Routines for printing packet analysis trees.
*
- * $Id: print.c,v 1.3 1998/09/26 19:28:50 gerald Exp $
+ * $Id: print.c,v 1.4 1998/09/27 22:12:44 gerald Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -37,8 +37,10 @@
# include <sys/types.h>
#endif
+#include "ethereal.h"
#include "packet.h"
#include "print.h"
+#include "ps.h"
static void printer_opts_file_cb(GtkWidget *w, gpointer te);
static void printer_opts_fs_cancel_cb(GtkWidget *w, gpointer data);
@@ -56,7 +58,6 @@ pr_opts printer_opts;
/* Key for gtk_object_set_data */
const gchar *print_opt_key = "printer_options_data";
-
GtkWidget * printer_opts_pg()
{
GtkWidget *main_vb, *button;
@@ -186,8 +187,10 @@ GtkWidget * printer_opts_pg()
GTK_SIGNAL_FUNC(printer_opts_close_cb), (gpointer)temp_pr_opts);
gtk_container_add(GTK_CONTAINER(bbox), cancel_bt);
gtk_widget_show(cancel_bt);
+
*/
- return(main_vb);
+
+ return(main_vb);
}
@@ -324,9 +327,9 @@ void print_tree_text(FILE *fh, const u_char *pd, frame_data *fd, GtkTree *tree)
{
GList *children, *child, *widgets, *label;
GtkWidget *subtree;
- int num_children, i, j;
+ int num_children, i;
char *text;
- int num_spaces;
+ int num_spaces;
char space[41];
gint data_start, data_len;
@@ -447,7 +450,7 @@ void print_tree_ps(FILE *fh, const u_char *pd, frame_data *fd, GtkTree *tree)
{
GList *children, *child, *widgets, *label;
GtkWidget *subtree;
- int num_children, i, j;
+ int num_children, i;
char *text;
gint data_start, data_len;
char psbuffer[MAX_LINE_LENGTH]; /* static sized buffer! */
diff --git a/print.h b/print.h
index 9c2a637197..360660e71a 100644
--- a/print.h
+++ b/print.h
@@ -1,7 +1,7 @@
/* print.h
* Definitions for printing packet analysis trees.
*
- * $Id: print.h,v 1.3 1998/09/26 19:28:51 gerald Exp $
+ * $Id: print.h,v 1.4 1998/09/27 22:12:45 gerald Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -41,10 +41,11 @@ typedef struct pr_opts {
/* Functions in print.h */
-GtkWidget * printer_opts_pg();
-void print_tree_text(FILE *fh, const u_char *pd, frame_data *fd, GtkTree *tree);
-void print_tree_ps(FILE *fh, const u_char *pd, frame_data *fd, GtkTree *tree);
+void printer_opts_cb(GtkWidget *, gpointer);
void printer_opts_ok(GtkWidget *w);
void printer_opts_close(GtkWidget *w);
+void print_tree(const u_char *pd, frame_data *fd, GtkTree *tree);
+void print_tree_text(FILE *fh, const u_char *pd, frame_data *fd, GtkTree *tree);
+void print_tree_ps(FILE *fh, const u_char *pd, frame_data *fd, GtkTree *tree);
#endif /* print.h */
diff --git a/resolv.c b/resolv.c
index f00f843be4..029a40aa4d 100644
--- a/resolv.c
+++ b/resolv.c
@@ -1,7 +1,7 @@
/* resolv.c
* Routines for network object lookup
*
- * $Id: resolv.c,v 1.3 1998/09/25 23:24:06 gerald Exp $
+ * $Id: resolv.c,v 1.4 1998/09/27 22:12:45 gerald Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@@ -54,6 +54,7 @@
# include <setjmp.h>
#endif
+#include "ethereal.h"
#include "packet.h"
#include "resolv.h"
@@ -195,7 +196,7 @@ static void abort_network_query(int sig)
static u_char *host_name_lookup(u_int addr)
{
- hashname_t *tp;
+ hashname_t * volatile tp;
hashname_t **table = host_table;
struct hostent *hostp;
diff --git a/util.c b/util.c
index 3176e72b52..c85c545481 100644
--- a/util.c
+++ b/util.c
@@ -1,7 +1,7 @@
/* util.c
* Utility routines
*
- * $Id: util.c,v 1.2 1998/09/16 03:22:19 gerald Exp $
+ * $Id: util.c,v 1.3 1998/09/27 22:12:46 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -35,6 +35,8 @@
#include "util.h"
+#include "image/icon-excl.xpm"
+
const gchar *bm_key = "button mask";
/* Simple dialog function - Displays a dialog box with the supplied message
diff --git a/util.h b/util.h
index 38a2ec5dda..140722a2a6 100644
--- a/util.h
+++ b/util.h
@@ -1,7 +1,7 @@
/* util.h
* Utility definitions
*
- * $Id: util.h,v 1.2 1998/09/16 03:22:19 gerald Exp $
+ * $Id: util.h,v 1.3 1998/09/27 22:12:46 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -30,8 +30,6 @@
extern "C" {
#endif /* __cplusplus */
-#include "image/icon-excl.xpm"
-
/* Dialog type. Currently, only ESD_TYPE_WARN is supported. */
#define ESD_TYPE_INFO 0
#define ESD_TYPE_WARN 1