/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.133 1999/12/04 08:59:12 guy Exp $
+ * $Id: file.c,v 1.134 1999/12/04 11:32:24 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
cf->user_saved = !is_tempfile;
cf->cd_t = wtap_file_type(cf->wth);
- cf->first_packet = TRUE;
cf->count = 0;
cf->drops = 0;
cf->esec = 0;
freeze_clist(cf);
proto_tree_is_visible = FALSE;
success = wtap_loop(cf->wth, 0, wtap_dispatch_cb, (u_char *) cf, &err);
+ /* Set the file encapsulation type now; we don't know what it is until
+ we've looked at all the packets, as we don't know until then whether
+ there's more than one type (and thus whether it's
+ WTAP_ENCAP_PER_PACKET). */
+ cf->lnk_t = wtap_file_encap(cf->wth);
wtap_close(cf->wth);
cf->wth = NULL;
cf->filed = open(cf->filename, O_RDONLY);
gtk_clist_moveto(GTK_CLIST(packet_list),
cf->plist_end->row, -1, 1.0, 1.0);
+ /* Set the file encapsulation type now; we don't know what it is until
+ we've looked at all the packets, as we don't know until then whether
+ there's more than one type (and thus whether it's
+ WTAP_ENCAP_PER_PACKET). */
+ cf->lnk_t = wtap_file_encap(cf->wth);
+
/* There's nothing more to read from the capture file - close it. */
wtap_close(cf->wth);
cf->wth = NULL;
gtk_main_iteration();
}
- if (cf->first_packet) {
- /* Tentatively make the encapsulation type the type of the first
- packet. */
- cf->lnk_t = phdr->pkt_encap;
- } else {
- /* If this packet's encapsulation type isn't the same as the type
- type we've chosen so far, make the type for this file
- WTAP_ENCAP_PER_PACKET, because there is no single encapsulation
- type for the entire file. */
- if (cf->lnk_t != phdr->pkt_encap)
- cf->lnk_t = WTAP_ENCAP_PER_PACKET;
- }
-
/* Allocate the next list entry, and add it to the list. */
fdata = (frame_data *) g_malloc(sizeof(frame_data));
/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.59 1999/12/04 08:59:13 guy Exp $
+ * $Id: file.h,v 1.60 1999/12/04 11:32:25 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
gboolean user_saved;/* If capture file is temporary, has it been saved by user yet? */
long f_len; /* Length of capture file */
guint16 cd_t; /* File type of capture file */
- gboolean first_packet; /* TRUE if we're looking at the first packet */
int lnk_t; /* Link-layer type with which to save capture */
guint32 vers; /* Version. For tcpdump minor is appended to major */
guint32 count; /* Packet count */