From 9e93bf474710d9ef0eb4ba33bde284b6685fd360 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sat, 5 Feb 2005 17:39:12 +0000 Subject: 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 --- wiretap/ascend-scanner.l | 75 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 12 deletions(-) (limited to 'wiretap/ascend-scanner.l') 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 + %% -{XPFX} { +{ETHER_PFX} { + BEGIN(sc_ether_direction); + ascendlval.d = ASCEND_PFX_ETHER; + return ETHER_PREFIX; +} + +{ISDN_XPFX} { + BEGIN(sc_isdn_call); + ascendlval.d = ASCEND_PFX_ISDN_X; + return ISDN_PREFIX; +} + +{ISDN_RPFX} { + BEGIN(sc_isdn_call); + ascendlval.d = ASCEND_PFX_ISDN_R; + return ISDN_PREFIX; +} + +{WAN_XPFX} { BEGIN(sc_wds_user); ascendlval.d = ASCEND_PFX_WDS_X; return WDS_PREFIX; } -{RPFX} { +{WAN_RPFX} { BEGIN(sc_wds_user); ascendlval.d = ASCEND_PFX_WDS_R; return WDS_PREFIX; } +{PPP_XPFX} { + BEGIN(sc_wds_user); + ascendlval.d = ASCEND_PFX_WDS_X; + return WDS_PREFIX; +} + +{PPP_RPFX} { + BEGIN(sc_wds_user); + ascendlval.d = ASCEND_PFX_WDS_R; + return WDS_PREFIX; +} + +[^\(]+ { + BEGIN(sc_gen_task); + return STRING; +} + +[^\/\(:]+ { + BEGIN(sc_gen_task); + return DECNUM; +} + [^:]+ { char *atcopy = strdup(ascendtext); char colon = input(); @@ -163,14 +211,13 @@ WDD_TYPE "type "[^\n\r\t ]+ } {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; } +\/{D}+ { + return SLASH_SUFFIX; +} + (0x|0X)?{H}+ { return HEXNUM; } task:|task|at|time:|octets { return KEYWORD; } -- cgit v1.2.3