diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-03-04 14:22:29 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-03-04 14:22:29 +0000 |
commit | 9bcac0775101485e102bef59105dbdbb483ba297 (patch) | |
tree | 771822ba23b318c343e5071b2ee9fc6d854f33b0 /wiretap | |
parent | a3256bd2883db39e411de4d3fe2fcfe7b226d907 (diff) |
Fix for reading toshiba trace files that were created by using the
"save session" feature in many Windows-based telnet apps. CRT, by VanDyke,
in particular, will put in newlines at 80 columns.
svn path=/trunk/; revision=1692
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/toshiba.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c index bfd899c68a..e075110d68 100644 --- a/wiretap/toshiba.c +++ b/wiretap/toshiba.c @@ -1,6 +1,6 @@ /* toshiba.c * - * $Id: toshiba.c,v 1.7 2000/01/13 07:09:19 guy Exp $ + * $Id: toshiba.c,v 1.8 2000/03/04 14:22:29 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org> @@ -35,14 +35,13 @@ /* This module reads the output of the 'snoop' command in the Toshiba * TR-600 and TR-650 "Compact" ISDN Routers. You can telnet to the * router and run 'snoop' on the different channels, and at different - * detail levels. Be sure to choose 'dump' to get the hex dump. + * detail levels. Be sure to choose the 'dump' level to get the hex dump. * The 'snoop' command has nothing to do with the Solaris 'snoop' * command, except that they both capture packets. */ /* Example 'snoop' output data: - Script started on Thu Sep 9 21:48:49 1999 ]0;gram@nirvana:/tmp$ telnet 10.0.0.254
@@ -282,15 +281,28 @@ parse_toshiba_rec_hdr(wtap *wth, FILE *fh, int *err) return -1; } - /* The next line contains mostly junk, but it does contain the - * packet length. */ - if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) { - *err = file_error(fh); - if (*err == 0) { - *err = WTAP_ERR_SHORT_READ; + /* Scan lines until we find the OFFSET line. In a "telnet" trace, + * this will be the next line. But if you save your telnet session + * to a file from within a Windows-based telnet client, it may + * put in line breaks at 80 columns (or however big your "telnet" box + * is). CRT (a Windows telnet app from VanDyke) does this. + * Here we assume that 80 columns will be the minimum size, and that + * the OFFSET line is not broken in the middle. It's the previous + * line that is normally long and can thus be broken at column 80. + */ + do { + if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) { + *err = file_error(fh); + if (*err == 0) { + *err = WTAP_ERR_SHORT_READ; + } + return -1; } - return -1; - } + + /* Check for "OFFSET 0001-0203" at beginning of line */ + line[16] = '\0'; + + } while (strcmp(line, "OFFSET 0001-0203") != 0); num_items_scanned = sscanf(line+64, "LEN=%d", &pkt_len); if (num_items_scanned != 1) { |