Get rid of the "vpi" and "vci" arguments to "atm_guess_traffic_type()",
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 13 Aug 2002 03:32:57 +0000 (03:32 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 13 Aug 2002 03:32:57 +0000 (03:32 +0000)
have it get that information from the pseudo-header instead, and set the
VPI and VCI fields in the pseudo-header before calling it.

Don't call it for non-ATM NetMon captures.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5982 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/atm.c
wiretap/atm.h
wiretap/iptrace.c
wiretap/netmon.c

index d4bace9a1a20da2b4be98519d962fc55d5e4bb3b..cf95f14d1d0e280f251d496c280b939c40168708 100644 (file)
@@ -1,6 +1,6 @@
 /* atm.c
  *
- * $Id: atm.c,v 1.1 2002/04/30 18:58:15 guy Exp $
+ * $Id: atm.c,v 1.2 2002/08/13 03:32:56 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -37,7 +37,7 @@
 
 void
 atm_guess_traffic_type(const guint8 *pd, guint32 len,
-    guint16 vpi, guint16 vci, union wtap_pseudo_header *pseudo_header)
+    union wtap_pseudo_header *pseudo_header)
 {
        /*
         * Start out assuming nothing other than that it's AAL5.
@@ -46,12 +46,12 @@ atm_guess_traffic_type(const guint8 *pd, guint32 len,
        pseudo_header->atm.type = TRAF_UNKNOWN;
        pseudo_header->atm.subtype = TRAF_ST_UNKNOWN;
 
-       if (vpi == 0) {
+       if (pseudo_header->atm.vpi == 0) {
                /*
                 * Traffic on some PVCs with a VPI of 0 and certain
                 * VCIs is of particular types.
                 */
-               switch (vci) {
+               switch (pseudo_header->atm.vci) {
 
                case 5:
                        /*
index fa6b2d0dbbff675a45b544c0e40e365e7b6b6f2c..dca6db6f75797047df30da1d5e4c201495192dfd 100644 (file)
@@ -1,6 +1,6 @@
 /* atm.h
  *
- * $Id: atm.h,v 1.1 2002/04/30 18:58:15 guy Exp $
+ * $Id: atm.h,v 1.2 2002/08/13 03:32:56 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -31,7 +31,7 @@
 
 extern void
 atm_guess_traffic_type(const guint8 *pd, guint32 len,
-    guint16 vpi, guint16 vci, union wtap_pseudo_header *pseudo_header);
+    union wtap_pseudo_header *pseudo_header);
 
 extern void
 atm_guess_lane_type(const guint8 *pd, guint32 len,
index 03690ad379f4312bcdbc943e6ea89dada31256d2..0e58447c293e15406bf258debf4a94971e99e9ce 100644 (file)
@@ -1,6 +1,6 @@
 /* iptrace.c
  *
- * $Id: iptrace.c,v 1.42 2002/07/29 06:09:58 guy Exp $
+ * $Id: iptrace.c,v 1.43 2002/08/13 03:32:56 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -391,12 +391,6 @@ get_atm_pseudo_header(const guint8 *pd, guint32 len,
                Vci = strtoul(decimal, NULL, 10);
        }
 
-       /*
-        * Attempt to guess from the packet data, the VPI, and the VCI
-        * information about the type of traffic.
-        */
-       atm_guess_traffic_type(pd, len, Vpi, Vci, pseudo_header);
-
        /*
         * OK, which value means "DTE->DCE" and which value means
         * "DCE->DTE"?
@@ -406,6 +400,12 @@ get_atm_pseudo_header(const guint8 *pd, guint32 len,
        pseudo_header->atm.vpi = Vpi;
        pseudo_header->atm.vci = Vci;
 
+       /*
+        * Attempt to guess from the packet data, the VPI, and the VCI
+        * information about the type of traffic.
+        */
+       atm_guess_traffic_type(pd, len, pseudo_header);
+
        /* We don't have this information */
        pseudo_header->atm.cells = 0;
        pseudo_header->atm.aal5t_u2u = 0;
index 02dc9a7d9618249a032aca8510bb3993801b26c0..406f1625dca4ec6bb6c513ca616033addcb3ccfb 100644 (file)
@@ -1,6 +1,6 @@
 /* netmon.c
  *
- * $Id: netmon.c,v 1.59 2002/08/13 03:26:30 guy Exp $
+ * $Id: netmon.c,v 1.60 2002/08/13 03:32:57 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -445,8 +445,10 @@ static gboolean netmon_read(wtap *wth, int *err, long *data_offset)
         * Attempt to guess from the packet data, the VPI, and the VCI
         * information about the type of traffic.
         */
-       atm_guess_traffic_type(data_ptr, packet_size, wth->pseudo_header.atm.vpi,
-           wth->pseudo_header.atm.vci, &wth->pseudo_header);
+       if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER) {
+               atm_guess_traffic_type(data_ptr, packet_size,
+                   &wth->pseudo_header);
+       }
 
        return TRUE;
 }
@@ -476,8 +478,9 @@ netmon_seek_read(wtap *wth, long seek_off,
         * Attempt to guess from the packet data, the VPI, and the VCI
         * information about the type of traffic.
         */
-       atm_guess_traffic_type(pd, length, pseudo_header->atm.vpi,
-           pseudo_header->atm.vci, pseudo_header);
+       if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER)
+               atm_guess_traffic_type(pd, length, pseudo_header);
+
        return TRUE;
 }