/* file.c
*
- * $Id: file.c,v 1.51 2000/05/18 09:09:25 guy Exp $
+ * $Id: file.c,v 1.56 2000/07/26 06:04:32 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
#include <io.h> /* open/close on win32 */
#endif
-#include "wtap.h"
+#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "lanalyzer.h"
};
int wtap_def_seek_read(wtap *wth, int seek_off,
- union pseudo_header *pseudo_header, guint8 *pd, int len)
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
{
file_seek(wth->random_fh, seek_off, SEEK_SET);
}
#ifndef WIN32
if (! S_ISREG(statb.st_mode) && ! S_ISFIFO(statb.st_mode)) {
- *err = WTAP_ERR_NOT_REGULAR_FILE;
+ if (S_ISDIR(statb.st_mode))
+ *err = EISDIR;
+ else
+ *err = WTAP_ERR_NOT_REGULAR_FILE;
return NULL;
}
#endif
/* Open the file */
errno = WTAP_ERR_CANT_OPEN;
- if (!(wth->fd = open(filename, O_RDONLY|O_BINARY))) {
+ wth->fd = open(filename, O_RDONLY|O_BINARY);
+ if (wth->fd < 0) {
*err = errno;
g_free(wth);
return NULL;
/* initialization */
wth->file_encap = WTAP_ENCAP_UNKNOWN;
wth->data_offset = 0;
+ wth->subtype_sequential_close = NULL;
wth->subtype_close = NULL;
/* Try all file types */
{ "libpcap (tcpdump, Ethereal, etc.)", "libpcap",
libpcap_dump_can_write_encap, libpcap_dump_open },
- /* WTAP_FILE_PCAP_MODIFIED */
- { "modified libpcap (tcpdump)", "modlibpcap",
+ /* WTAP_FILE_PCAP_SS990417 */
+ { "Red Hat Linux 6.1 libpcap (tcpdump)", "rh6_1libpcap",
libpcap_dump_can_write_encap, libpcap_dump_open },
- /* WTAP_FILE_PCAP_RH_6_1 */
- { "Red Hat Linux 6.1 libpcap (tcpdump)", "rh6_1libpcap",
+ /* WTAP_FILE_PCAP_SS990915 */
+ { "SuSE Linux 6.3 libpcap (tcpdump)", "suse6_3libpcap",
+ libpcap_dump_can_write_encap, libpcap_dump_open },
+
+ /* WTAP_FILE_PCAP_SS991029 */
+ { "modified libpcap (tcpdump)", "modlibpcap",
libpcap_dump_can_write_encap, libpcap_dump_open },
/* WTAP_FILE_LANALYZER */
{ "Novell LANalyzer", NULL,
NULL, NULL },
- /* WTAP_FILE_NGSNIFFER */
+ /* WTAP_FILE_NGSNIFFER_UNCOMPRESSED */
{ "Network Associates Sniffer (DOS-based)", "ngsniffer",
ngsniffer_dump_can_write_encap, ngsniffer_dump_open },
+ /* WTAP_FILE_NGSNIFFER_COMPRESSED */
+ { "Network Associates Sniffer (DOS-based), compressed", "ngsniffer_comp",
+ NULL, NULL },
+
/* WTAP_FILE_SNOOP */
{ "Sun snoop", "snoop",
snoop_dump_can_write_encap, snoop_dump_open },
{ "Network Associates Sniffer (Windows-based) 1.1", "ngwsniffer_1_1",
netxray_dump_can_write_encap, netxray_dump_open_1_1 },
- /* WTAP_FILE_NETXRAY_2_001 */
- { "Network Associates Sniffer (Windows-based) 2.001", NULL,
+ /* WTAP_FILE_NETXRAY_2_00x */
+ { "Network Associates Sniffer (Windows-based) 2.00x", NULL,
NULL, NULL },
/* WTAP_FILE_RADCOM */
}
gboolean wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const union pseudo_header *pseudo_header, const u_char *pd, int *err)
+ const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err)
{
return (wdh->subtype_write)(wdh, phdr, pseudo_header, pd, err);
}