diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-03-28 21:59:12 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-03-28 21:59:12 +0000 |
commit | 86518e40f55fa6249547b85383453ee67a04ff0f (patch) | |
tree | 9247a96bdcf32b8eddd2433938254e4730b65ef4 /wiretap | |
parent | 15fdb273f7996cd04053379c776d29f72fa4a885 (diff) | |
download | wireshark-86518e40f55fa6249547b85383453ee67a04ff0f.tar.gz wireshark-86518e40f55fa6249547b85383453ee67a04ff0f.tar.bz2 wireshark-86518e40f55fa6249547b85383453ee67a04ff0f.zip |
Ian Schorr discovered that, for gigabit pod captures, if hdr.timeunit is
2 the time stamps are in units of 1/31250000 seconds rather than
nanoseconds - and, by generating Windows Sniffer captures with various
hdr.timeunit values, that for all the non-zero values he tested, the
time stamps for non-gigabit pod captures are in units of 1/1193000
second.
Instead of having a TpS array, just test for the exception value (0 for
non-gigabit pod captures, 2 for gigabit pod captures).
svn path=/trunk/; revision=7380
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/netxray.c | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/wiretap/netxray.c b/wiretap/netxray.c index 556f9488cd..7a8a280510 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -1,6 +1,6 @@ /* netxray.c * - * $Id: netxray.c,v 1.79 2003/03/04 02:04:00 guy Exp $ + * $Id: netxray.c,v 1.80 2003/03/28 21:59:12 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -82,12 +82,6 @@ struct netxray_hdr { #define CAPTYPE_BROUTER4 11 /* Bridge/router captured with pod */ #define CAPTYPE_BROUTER5 12 /* Bridge/router captured with pod */ -/* - * # of ticks that equal 1 second - */ -static double TpS[] = { 1e6, 1193000.0, 1193180.0 }; -#define NUM_NETXRAY_TIMEUNITS (sizeof TpS / sizeof TpS[0]) - /* Version number strings. */ static const char vers_1_0[] = { '0', '0', '1', '.', '0', '0', '0', '\0' @@ -253,27 +247,41 @@ int netxray_open(wtap *wth, int *err) } else if (memcmp(hdr.version, vers_2_000, sizeof vers_2_000) == 0 || memcmp(hdr.version, vers_2_001, sizeof vers_2_001) == 0 || memcmp(hdr.version, vers_2_002, sizeof vers_2_002) == 0) { - if (hdr.timeunit > NUM_NETXRAY_TIMEUNITS) { - g_message("netxray: Unknown timeunit %u", - hdr.timeunit); - *err = WTAP_ERR_UNSUPPORTED; - return -1; - } - timeunit = TpS[hdr.timeunit]; - version_major = 2; - file_type = WTAP_FILE_NETXRAY_2_00x; - /* - * It appears that if hdr.xxb[20] is 2, that indicates + * It appears that, at least for Ethernet + * captures, if hdr.xxb[20] is 2, that indicates * that it's a gigabit Ethernet capture, possibly * from a special whizzo gigabit pod, and also - * indicates that the time stamps have nanosecond - * resolution (or, at least, 1000 times greater - * resolution), possibly thanks to a high-resolution + * indicates that the time stamps have some + * higher resolution than in other captures, + * possibly thanks to a high-resolution * timer on the pod. */ - if (hdr.xxb[20] == CAPTYPE_GIGPOD) - timeunit = timeunit*1000.0; + if (hdr.network == 0 && hdr.xxb[20] == CAPTYPE_GIGPOD) { + /* + * It appears that the time units for these + * captures are nanoseconds, unless + * hdr.timeunit is 2, in which case it's + * 1/31250000.0 of a second. + */ + if (hdr.timeunit == 2) + timeunit = 31250000.0; + else + timeunit = 1e9; + } else { + /* + * It appears that the time units for + * these captures are 1/1193000.0 of + * a second, unless hdr.timeunit is 0, + * in which case it's microseconds. + */ + if (hdr.timeunit == 0) + timeunit = 1e6; + else + timeunit = 1193000.0; + } + version_major = 2; + file_type = WTAP_FILE_NETXRAY_2_00x; } else { g_message("netxray: version \"%.8s\" unsupported", hdr.version); *err = WTAP_ERR_UNSUPPORTED; |