/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.134 1999/12/04 11:32:24 guy Exp $
+ * $Id: file.c,v 1.137 1999/12/12 13:25:54 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#include "print.h"
#include "file.h"
#include "util.h"
+#include "ui_util.h"
#include "gtk/proto_draw.h"
#include "dfilter.h"
#include "timestamp.h"
#include "conversation.h"
#include "globals.h"
+#ifdef HAVE_DLFCN_H
+#include "plugins.h"
+#endif
+
#ifndef __RESOLV_H__
#include "resolv.h"
#endif
will there ever be more than one on the stack? */
gtk_statusbar_pop(GTK_STATUSBAR(w), file_ctx);
+ /* Restore the standard title bar message. */
+ set_main_window_name("The Ethereal Network Analyzer");
+
/* Disable all menu items that make sense only if you have a capture. */
set_menu_sensitivity("/File/Save", FALSE);
set_menu_sensitivity("/File/Save As...", FALSE);
set_menu_sensitivity("/Tools/Summary", FALSE);
}
+/* Set the file name in the status line, in the name for the main window,
+ and in the name for the main window's icon. */
static void
-set_statusbar_filename(capture_file *cf)
+set_display_filename(capture_file *cf)
{
gchar *name_ptr;
size_t msg_len;
gchar *done_fmt = " File: %s Drops: %u";
gchar *done_msg;
+ gchar *win_name_fmt = "%s - Ethereal";
+ gchar *win_name;
if (!cf->is_tempfile) {
/* Get the last component of the file name, and put that in the
} else {
/* The file we read is a temporary file from a live capture;
we don't mention its name in the status bar. */
- name_ptr = "<none>";
+ name_ptr = "<capture>";
}
msg_len = strlen(name_ptr) + strlen(done_fmt) + 64;
snprintf(done_msg, msg_len, done_fmt, name_ptr, cf->drops);
gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, done_msg);
g_free(done_msg);
+
+ msg_len = strlen(name_ptr) + strlen(win_name_fmt) + 1;
+ win_name = g_malloc(msg_len);
+ snprintf(win_name, msg_len, win_name_fmt, name_ptr);
+ set_main_window_name(win_name);
+ g_free(win_name);
}
int
gtk_progress_set_value(GTK_PROGRESS(prog_bar), 0);
gtk_statusbar_pop(GTK_STATUSBAR(info_bar), file_ctx);
- set_statusbar_filename(cf);
+ set_display_filename(cf);
/* Enable menu items that make sense if you have a capture file you've
finished reading. */
/* Pop the "<live capture in progress>" message off the status bar. */
gtk_statusbar_pop(GTK_STATUSBAR(info_bar), file_ctx);
- set_statusbar_filename(cf);
+ set_display_filename(cf);
/* Restore the "File/Open" menu item. */
set_menu_sensitivity("/File/Open...", TRUE);
gint i, row;
gint crow;
gint color;
- proto_tree *protocol_tree;
+ proto_tree *protocol_tree = NULL;
fdata->num = cf->count;
proto_tree_free(protocol_tree);
}
else {
- dissect_packet(buf, fdata, NULL);
+#ifdef HAVE_DLFCN_H
+ if (plugin_list)
+ protocol_tree = proto_tree_create_root();
+#endif
+ dissect_packet(buf, fdata, protocol_tree);
fdata->passed_dfilter = TRUE;
color = -1;
+#ifdef HAVE_DLFCN_H
+ if (protocol_tree)
+ proto_tree_free(protocol_tree);
+#endif
}
if (fdata->passed_dfilter) {
/* If we don't have the time stamp of the previous displayed packet,
hdr.caplen = fd->cap_len;
hdr.len = fd->pkt_len;
hdr.pkt_encap = fd->lnk_t;
+ hdr.pseudo_header = fd->pseudo_header;
wtap_seek_read(cf->cd_t, cf->fh, fd->file_off, pd, fd->cap_len);
if (!wtap_dump(pdh, &hdr, pd, &err)) {