aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1999-10-31 17:46:11 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1999-10-31 17:46:11 +0000
commit558e714449ea30104c2bb7f35421328125a2a24a (patch)
treea8d7d038636feee1bb1addd3488aedc7df8716a9 /wiretap/file.c
parent10fdc90bb0784b067d4e77c73907c6adfa5f5d08 (diff)
Add a module to wiretap to be able to read trace files from Toshiba's
line of ISDN routers. Much like the ascend reader, this module reads an ASCII hex dump of trace data. Rearranged the order in which wiretap tries trace files, to keep the ASCII-readers (ascend and toshiba) at the end, and put the binary-readers (everything else) at the front of the list. If a telnet session of and ascend trace or toshiba trace were captured near the beginning of another trace, wiretap might think the trace was ascend or toshiba if it tried that module first. Fixed the way wtap_seek_read() selects functions to call. It was using the encap type instead of the file type. We got lucky because WTAP_ENCAP_ASCEND == WTAP_FILE_ASCEND svn path=/trunk/; revision=952
Diffstat (limited to 'wiretap/file.c')
-rw-r--r--wiretap/file.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/wiretap/file.c b/wiretap/file.c
index dc95eec2a4..742cddcdce 100644
--- a/wiretap/file.c
+++ b/wiretap/file.c
@@ -1,6 +1,6 @@
/* file.c
*
- * $Id: file.c,v 1.26 1999/10/18 01:51:34 guy Exp $
+ * $Id: file.c,v 1.27 1999/10/31 17:46:06 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -42,6 +42,7 @@
#include "iptrace.h"
#include "netmon.h"
#include "netxray.h"
+#include "toshiba.h"
/* The open_file_* routines should return:
*
@@ -58,9 +59,17 @@
* declare a "const" array of pointers to functions; putting "const"
* right after "static" isn't the right answer, at least according
* to GCC, which whines if I do that.
+ *
+ * Put the trace files that are merely saved telnet-sessions last, since it's
+ * possible that you could have captured someone a router telnet-session
+ * using another tool. So, a libpcap trace of an toshiba "snoop" session
+ * should be discovered as a libpcap file, not a toshiba file.
*/
static int (*open_routines[])(wtap *, int *) = {
+ /* Files that have magic bytes in fixed locations. These
+ * are easy to identify.
+ */
libpcap_open,
lanalyzer_open,
ngsniffer_open,
@@ -69,8 +78,14 @@ static int (*open_routines[])(wtap *, int *) = {
netmon_open,
netxray_open,
radcom_open,
+ nettl_open,
+
+ /* Files whose magic headers are in text *somewhere* in the
+ * file (usually because the trace is just a saved copy of
+ * the telnet session).
+ */
ascend_open,
- nettl_open
+ toshiba_open,
};
int wtap_def_seek_read (FILE *fh, int seek_off, guint8 *pd, int len)
@@ -130,6 +145,8 @@ wtap* wtap_open_offline(const char *filename, int *err)
case -1:
/* I/O error - give up */
+ /* XXX - why pass err to open_routines[i]() if err is
+ * overwritten here? */
*err = errno;
file_close(wth->fh);
free(wth);