aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/ascend-scanner.l
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2005-02-05 17:39:12 +0000
committerGerald Combs <gerald@wireshark.org>2005-02-05 17:39:12 +0000
commit9e93bf474710d9ef0eb4ba33bde284b6685fd360 (patch)
tree59d8d2204fb8fef65bf8a637ed5c4284558230fc /wiretap/ascend-scanner.l
parent17608107ff86cd057a7a46983616a01b4ff25cd8 (diff)
From Josh Bailey:
Attached is an update to Lucent/Ascend trace parsing: fix a few bugs, add support for ISDN and Ethernet captures - diffs to 0.10.9. svn path=/trunk/; revision=13311
Diffstat (limited to 'wiretap/ascend-scanner.l')
-rw-r--r--wiretap/ascend-scanner.l75
1 files changed, 63 insertions, 12 deletions
diff --git a/wiretap/ascend-scanner.l b/wiretap/ascend-scanner.l
index 0f3658f6b8..655db6254e 100644
--- a/wiretap/ascend-scanner.l
+++ b/wiretap/ascend-scanner.l
@@ -56,17 +56,22 @@ int mul, scratch;
#define YY_NO_UNISTD_H
#endif
+
%}
-/* %option debug */
%option nostdinit
%option noyywrap
D [0-9]
H [A-Fa-f0-9]
-XPFX XMIT-
-RPFX RECV-
+PPP_XPFX PPP-IN
+PPP_RPFX PPP-OUT
+ISDN_XPFX PRI-XMIT-
+ISDN_RPFX PRI-RCV-
+WAN_XPFX XMIT[\-:]*
+WAN_RPFX RECV[\-:]*
+ETHER_PFX ETHER
WDD_DATE "Date:"
WDD_TIME "Time:"
@@ -100,20 +105,63 @@ WDD_TYPE "type "[^\n\r\t ]+
%s sc_chardisp
+%s sc_isdn_call
+%s sc_ether_direction
+
%%
-<INITIAL,sc_gen_byte>{XPFX} {
+<INITIAL,sc_gen_byte>{ETHER_PFX} {
+ BEGIN(sc_ether_direction);
+ ascendlval.d = ASCEND_PFX_ETHER;
+ return ETHER_PREFIX;
+}
+
+<INITIAL,sc_gen_byte>{ISDN_XPFX} {
+ BEGIN(sc_isdn_call);
+ ascendlval.d = ASCEND_PFX_ISDN_X;
+ return ISDN_PREFIX;
+}
+
+<INITIAL,sc_gen_byte>{ISDN_RPFX} {
+ BEGIN(sc_isdn_call);
+ ascendlval.d = ASCEND_PFX_ISDN_R;
+ return ISDN_PREFIX;
+}
+
+<INITIAL,sc_gen_byte>{WAN_XPFX} {
BEGIN(sc_wds_user);
ascendlval.d = ASCEND_PFX_WDS_X;
return WDS_PREFIX;
}
-<INITIAL,sc_gen_byte>{RPFX} {
+<INITIAL,sc_gen_byte>{WAN_RPFX} {
BEGIN(sc_wds_user);
ascendlval.d = ASCEND_PFX_WDS_R;
return WDS_PREFIX;
}
+<INITIAL,sc_gen_byte>{PPP_XPFX} {
+ BEGIN(sc_wds_user);
+ ascendlval.d = ASCEND_PFX_WDS_X;
+ return WDS_PREFIX;
+}
+
+<INITIAL,sc_gen_byte>{PPP_RPFX} {
+ BEGIN(sc_wds_user);
+ ascendlval.d = ASCEND_PFX_WDS_R;
+ return WDS_PREFIX;
+}
+
+<sc_ether_direction>[^\(]+ {
+ BEGIN(sc_gen_task);
+ return STRING;
+}
+
+<sc_isdn_call>[^\/\(:]+ {
+ BEGIN(sc_gen_task);
+ return DECNUM;
+}
+
<sc_wds_user>[^:]+ {
char *atcopy = strdup(ascendtext);
char colon = input();
@@ -163,14 +211,13 @@ WDD_TYPE "type "[^\n\r\t ]+
}
<sc_gen_time_u>{D}+ {
+ char *atcopy = strdup(ascendtext);
BEGIN(sc_gen_octets);
- /* We have the fractional portion of the time. We want it converted
- to microseconds. */
- mul = 1000000;
- ascendlval.d = strtol(ascendtext, NULL, 10);
- for (scratch = ascendlval.d; scratch > 0; scratch /= 10)
- mul /= 10;
- ascendlval.d *= mul;
+ /* only want the most significant 2 digits. convert to usecs */
+ if (strlen(atcopy) > 2)
+ atcopy[2] = '\0';
+ ascendlval.d = strtol(atcopy, NULL, 10) * 10000;
+ free(atcopy);
return DECNUM;
}
@@ -274,6 +321,10 @@ WDD_TYPE "type "[^\n\r\t ]+
return KEYWORD;
}
+<sc_gen_task>\/{D}+ {
+ return SLASH_SUFFIX;
+}
+
(0x|0X)?{H}+ { return HEXNUM; }
task:|task|at|time:|octets { return KEYWORD; }