Remove some more "CHECK_DISPLAY_AS_DATA()" calls and code to set
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 21 Jan 2001 22:51:46 +0000 (22:51 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 21 Jan 2001 22:51:46 +0000 (22:51 +0000)
"pinfo->current_proto", in dissectors always called through dissector
tables and handles.

Make the IEEE 802.11 dissector static, as it's not called externally.

Clear the Info column in the Linux cooked capture and 802.1q VLAN
dissectors, before extracting anything from the packet, so that if an
exception is thrown, the Info column doesn't reflect the previous
protocol.

Don't extract the encapsulated protocol in the VLAN dissector until you
use it, so that if the frame contains the VLAN ID but not the
encapsulated protocol, we at least put the VLAN ID into the protocol
tree.

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

packet-ieee80211.c
packet-llc.c
packet-pppoe.c
packet-sll.c
packet-trmac.c
packet-vlan.c

index e242e8bd150fc75d45f1d94fa432a6965a974b90..006c92d1745b5b4032e7f3491a7f0be60157bd05 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright 2000, Axis Communications AB 
  * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
  *
- * $Id: packet-ieee80211.c,v 1.10 2001/01/10 23:28:46 guy Exp $
+ * $Id: packet-ieee80211.c,v 1.11 2001/01/21 22:51:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -175,12 +175,6 @@ col_add_str(fd,COL_INFO,info);
 #define TAG_CHALLENGE_TEXT 0x10
 
 
-/* ************************************************************************* */
-/*                Various constants used in this module                      */
-/* ************************************************************************* */
-static const char *capture_proto_name = "IEEE 802.11";
-
-
 static int proto_wlan = -1;
 /* ************************************************************************* */
 /*                Header field info values for FC-field                      */
@@ -728,7 +722,7 @@ add_tagged_field (proto_tree * tree, tvbuff_t * tvb, int offset)
 /* ************************************************************************* */
 /*                          Dissect 802.11 frame                             */
 /* ************************************************************************* */
-void
+static void
 dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
 {
   guint16 fcf, flags;
@@ -749,10 +743,6 @@ dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
   cap_len = pinfo->captured_len;
   fcf = tvb_get_letohs (tvb, 0);
 
-  CHECK_DISPLAY_AS_DATA(proto_wlan, tvb, pinfo, tree);
-
-  pinfo->current_proto = capture_proto_name;
-
   if (check_col (pinfo->fd, COL_PROTOCOL))
     col_set_str (pinfo->fd, COL_PROTOCOL, "IEEE 802.11");
 
index c517b19f7408b113d0e1e62e78136bee0ed1bcb7..f4e7e3d5f99364d9c39cb4a31395aa5708bd5ea2 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for IEEE 802.2 LLC layer
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-llc.c,v 1.81 2001/01/18 07:44:39 guy Exp $
+ * $Id: packet-llc.c,v 1.82 2001/01/21 22:51:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -280,10 +280,6 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        guint8          dsap, ssap;
        tvbuff_t        *next_tvb;
 
-       CHECK_DISPLAY_AS_DATA(proto_llc, tvb, pinfo, tree);
-    
-       pinfo->current_proto = "LLC";
-
        if (check_col(pinfo->fd, COL_PROTOCOL)) {
                col_set_str(pinfo->fd, COL_PROTOCOL, "LLC");
        }
index 64a78430d2fd2af02b14f9269416d5250a92d8fe..58230d5050114b496cbf254dbeebad27ab78a46e 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-pppoe.c
  * Routines for PPP Over Ethernet (PPPoE) packet disassembly (RFC2516)
  *
- * $Id: packet-pppoe.c,v 1.15 2001/01/09 06:31:40 guy Exp $
+ * $Id: packet-pppoe.c,v 1.16 2001/01/21 22:51:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -163,10 +163,6 @@ dissect_pppoed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
        proto_tree  *pppoe_tree;
        proto_item  *ti;
 
-       CHECK_DISPLAY_AS_DATA(proto_pppoed, tvb, pinfo, tree);
-
-       pinfo->current_proto = "PPPoED";
-
        if (check_col(pinfo->fd, COL_PROTOCOL)) {
                col_set_str(pinfo->fd,COL_PROTOCOL, "PPPoED");
        }
@@ -239,10 +235,6 @@ dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
        proto_item  *ti;
        tvbuff_t    *next_tvb;
 
-       CHECK_DISPLAY_AS_DATA(proto_pppoes, tvb, pinfo, tree);
-
-       pinfo->current_proto = "PPPoES";
-
        if (check_col(pinfo->fd, COL_PROTOCOL)) {
                col_set_str(pinfo->fd,COL_PROTOCOL, "PPPoES");
        }
index 78bec6f64c30de4ca3cb26e1e26d4e4dc6bab755..1dbf75b2ef532e897382226955146428ad81c160 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-sll.c
  * Routines for disassembly of packets from Linux "cooked mode" captures
  *
- * $Id: packet-sll.c,v 1.6 2001/01/18 07:44:39 guy Exp $
+ * $Id: packet-sll.c,v 1.7 2001/01/21 22:51:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -141,11 +141,10 @@ dissect_sll(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        tvbuff_t *next_tvb;
        proto_tree *fh_tree = NULL;
 
-       CHECK_DISPLAY_AS_DATA(proto_sll, tvb, pinfo, tree);
-
-       pinfo->current_proto = "SLL";
        if (check_col(pinfo->fd, COL_PROTOCOL))
                col_set_str(pinfo->fd, COL_PROTOCOL, "SLL");
+       if (check_col(pinfo->fd, COL_INFO))
+               col_clear(pinfo->fd, COL_INFO);
 
        pkttype = tvb_get_ntohs(tvb, 0);
 
index 8eda4136c0eba2a59b729229ce3995b096845539..3f3907d0376724d18eac75167d48110f07698ea2 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for Token-Ring Media Access Control
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-trmac.c,v 1.30 2001/01/09 06:31:44 guy Exp $
+ * $Id: packet-trmac.c,v 1.31 2001/01/21 22:51:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -280,9 +280,6 @@ dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        guint8          mv_val;
        char            *mv_text;
 
-       CHECK_DISPLAY_AS_DATA(proto_trmac, tvb, pinfo, tree);
-
-       pinfo->current_proto = "TR MAC";
        if (check_col(pinfo->fd, COL_PROTOCOL))
                col_set_str(pinfo->fd, COL_PROTOCOL, "TR MAC");
        if (check_col(pinfo->fd, COL_INFO))
index 595ec8f8e908e895be99c121b8ebc9f69fe4f02f..a85c1070db83058721977abfe532d219e129b775 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-vlan.c
  * Routines for VLAN 802.1Q ethernet header disassembly
  *
- * $Id: packet-vlan.c,v 1.30 2001/01/18 07:44:39 guy Exp $
+ * $Id: packet-vlan.c,v 1.31 2001/01/21 22:51:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -83,15 +83,12 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   tvbuff_t *volatile trailer_tvb;
   proto_tree *volatile vlan_tree;
 
-  CHECK_DISPLAY_AS_DATA(proto_vlan, tvb, pinfo, tree);
-
-  pinfo->current_proto = "VLAN";
-
   if (check_col(pinfo->fd, COL_PROTOCOL))
     col_set_str(pinfo->fd, COL_PROTOCOL, "VLAN");
+  if (check_col(pinfo->fd, COL_INFO))
+    col_clear(pinfo->fd, COL_INFO);
 
   tci = tvb_get_ntohs( tvb, 0 );
-  encap_proto = tvb_get_ntohs( tvb, 2 );
 
   if (check_col(pinfo->fd, COL_INFO)) {
     col_add_fstr(pinfo->fd, COL_INFO, "PRI: %d  CFI: %d  ID: %d",
@@ -109,6 +106,7 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     proto_tree_add_uint(vlan_tree, hf_vlan_id, tvb, 0, 2, tci);
   }
 
+  encap_proto = tvb_get_ntohs( tvb, 2 );
   if ( encap_proto <= IEEE_802_3_MAX_LEN) {
     /* Give the next dissector only 'encap_proto' number of bytes */
     proto_tree_add_uint(vlan_tree, hf_vlan_len, tvb, 2, 2, encap_proto);