aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-11-12 04:57:39 +0000
committerGuy Harris <guy@alum.mit.edu>2000-11-12 04:57:39 +0000
commit3d7d4a297d8f4318a7fb0b745d6e93b051ba774b (patch)
tree50ee8f5eb890f0070368f0d8835b9a42fcf4d6cc /wiretap
parentbedae04c2ecac559466f1ab783fa086ca1160571 (diff)
Not all packets in a "wdd" dump necessarily have a "Cause an attempt to
place call to" header (I presume this can happen if there was a call in progress when the packet was sent or received); don't require the Date: 01/12/1990. Time: 12:22:33 Cause an attempt to place call to 14082750382 to be present in every packet. (Only the date on the first packet is used, and only if it's present in the first packet; if the first packet doesn't have a date, we can't easily go back and fix up the previous packets, *especially* in programs such as Tethereal and editcap which make only one pass through the capture. We set the called number to a null string if that's the case; we could assume, in the sequential pass, that it's the phone number from the last call, and remember that for use when doing random access.) svn path=/trunk/; revision=2617
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/ascend-grammar.y47
-rw-r--r--wiretap/ascend-scanner.l8
-rw-r--r--wiretap/ascend.c8
3 files changed, 42 insertions, 21 deletions
diff --git a/wiretap/ascend-grammar.y b/wiretap/ascend-grammar.y
index b4eb45d86c..9d9e279bb2 100644
--- a/wiretap/ascend-grammar.y
+++ b/wiretap/ascend-grammar.y
@@ -1,7 +1,7 @@
%{
/* ascend-grammar.y
*
- * $Id: ascend-grammar.y,v 1.16 2000/11/11 03:15:07 guy Exp $
+ * $Id: ascend-grammar.y,v 1.17 2000/11/12 04:57:39 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -82,7 +82,7 @@ guint32 d;
char b;
}
-%token <s> STRING KEYWORD COUNTER
+%token <s> STRING KEYWORD WDD_DATE WDD_CHUNK COUNTER
%token <d> WDS_PREFIX DECNUM HEXNUM
%token <b> HEXBYTE
@@ -94,6 +94,7 @@ char b;
data_packet:
| wds_hdr datagroup
+ | wdd_date wdd_hdr datagroup
| wdd_hdr datagroup
;
@@ -128,14 +129,13 @@ wds_hdr: wds_prefix string decnum KEYWORD hexnum KEYWORD decnum decnum decnum KE
bcur = 0;
}
;
+
/*
Date: 01/12/1990. Time: 12:22:33
Cause an attempt to place call to 14082750382
-WD_DIALOUT_DISP: chunk 2515EE type IP.
-(task: 251790, time: 994953.28) 44 octets @ 2782B8
*/
-/* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21*/
-wdd_hdr: KEYWORD decnum decnum decnum KEYWORD decnum decnum decnum KEYWORD string KEYWORD hexnum KEYWORD KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM {
+/* 1 2 3 4 5 6 7 8 9 10*/
+wdd_date: WDD_DATE decnum decnum decnum KEYWORD decnum decnum decnum KEYWORD string {
/*
* Supply the date/time value to the code above us; it will use the
* first date/time value supplied as the capture start date/time.
@@ -151,23 +151,31 @@ wdd_hdr: KEYWORD decnum decnum decnum KEYWORD decnum decnum decnum KEYWORD strin
wddt.tm_isdst = -1;
start_time = mktime(&wddt);
-
- wirelen = $19;
- caplen = ($19 < ASCEND_MAX_PKT_LEN) ? $19 : ASCEND_MAX_PKT_LEN;
+}
+;
+
+/*
+WD_DIALOUT_DISP: chunk 2515EE type IP.
+(task: 251790, time: 994953.28) 44 octets @ 2782B8
+*/
+/* 1 2 3 4 5 6 7 8 9 10 11*/
+wdd_hdr: WDD_CHUNK hexnum KEYWORD KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM {
+ wirelen = $9;
+ caplen = ($9 < ASCEND_MAX_PKT_LEN) ? $9 : ASCEND_MAX_PKT_LEN;
/* If we don't have as many bytes of data as the octet count in
the header, make the capture length the number of bytes we
actually have. */
if (bcount > 0 && bcount <= caplen)
caplen = bcount;
- secs = $17;
- usecs = $18;
+ secs = $7;
+ usecs = $8;
if (pseudo_header != NULL) {
/* pseudo_header->call_num is set in ascend-scanner.l */
pseudo_header->type = ASCEND_PFX_WDD;
pseudo_header->user[0] = '\0';
pseudo_header->sess = 0;
- pseudo_header->chunk = $12;
- pseudo_header->task = $15;
+ pseudo_header->chunk = $2;
+ pseudo_header->task = $5;
}
bcur = 0;
@@ -255,6 +263,19 @@ parse_ascend(FILE_T fh, void *pd, struct ascend_phdr *phdr,
header = hdr;
bcount = len;
+ /*
+ * Not all packets in a "wdd" dump necessarily have a "Cause an
+ * attempt to place call to" header (I presume this can happen if
+ * there was a call in progress when the packet was sent or
+ * received), so we won't necessarily have the phone number for
+ * the packet.
+ *
+ * XXX - we could assume, in the sequential pass, that it's the
+ * phone number from the last call, and remember that for use
+ * when doing random access.
+ */
+ pseudo_header->call_num[0] = '\0';
+
if (yyparse())
return 0;
else
diff --git a/wiretap/ascend-scanner.l b/wiretap/ascend-scanner.l
index 3200a30827..0df8531530 100644
--- a/wiretap/ascend-scanner.l
+++ b/wiretap/ascend-scanner.l
@@ -1,7 +1,7 @@
%{
/* ascend-scanner.l
*
- * $Id: ascend-scanner.l,v 1.16 2000/05/19 23:06:46 gram Exp $
+ * $Id: ascend-scanner.l,v 1.17 2000/11/12 04:57:39 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -166,7 +166,7 @@ WDD_TYPE "type "[^\n\r\t ]+
<INITIAL,sc_gen_byte>{WDD_DATE} {
BEGIN(sc_wdd_date_d);
- return KEYWORD;
+ return WDD_DATE;
}
<sc_wdd_date_d>{D}{2} {
@@ -224,9 +224,9 @@ WDD_TYPE "type "[^\n\r\t ]+
return STRING;
}
-<sc_wdd_chunk>{WDD_CHUNK} {
+<INITIAL,sc_wdd_chunk,sc_gen_byte>{WDD_CHUNK} {
BEGIN(sc_wdd_chunknum);
- return KEYWORD;
+ return WDD_CHUNK;
}
<sc_wdd_chunknum>{H}+ {
diff --git a/wiretap/ascend.c b/wiretap/ascend.c
index 4425fd5f3f..3d5bbf9e27 100644
--- a/wiretap/ascend.c
+++ b/wiretap/ascend.c
@@ -1,6 +1,6 @@
/* ascend.c
*
- * $Id: ascend.c,v 1.19 2000/11/11 03:15:07 guy Exp $
+ * $Id: ascend.c,v 1.20 2000/11/12 04:57:39 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -142,9 +142,9 @@ static int ascend_seek(wtap *wth, int max_seek)
}
if (byte == ascend_w2magic[w2_level]) {
w2_level++;
- if (w2_level >= ASCEND_W2_SIZE && date_off) {
- file_seek(wth->fh, date_off - 1, SEEK_SET);
- return date_off;
+ if (w2_level >= ASCEND_W2_SIZE) {
+ file_seek(wth->fh, -(ASCEND_W2_SIZE), SEEK_CUR);
+ return file_tell(wth->fh) + 1;
}
} else {
w2_level = 0;