Wrap the dissect_fddi() call (with a 4th argument) with
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 29 Nov 2000 05:16:15 +0000 (05:16 +0000)
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 29 Nov 2000 05:16:15 +0000 (05:16 +0000)
dissect_fddi_not_bitswapped() and dissect_fddi_bitswapped(), both of which
use the standard 3-argument tvbuffified-dissector argument list.

Add a dissector table called "wtap_encap" which is used to call dissectors
from dissect_frame(). The switch() statement from this top-level dissector
is removed.

The link-layer dissectors register themselves with the "wtap_encap"
dissector table. The dissectors are now static where possible.

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

27 files changed:
Makefile.am
packet-ascend.c
packet-ascend.h [deleted file]
packet-atm.c
packet-atm.h [deleted file]
packet-clip.c
packet-clip.h
packet-eth.c
packet-fddi.c
packet-fddi.h
packet-frame.c
packet-ieee80211.c
packet-ieee80211.h
packet-lapb.c
packet-lapb.h [deleted file]
packet-lapd.c
packet-lapd.h [deleted file]
packet-llc.c
packet-null.c
packet-null.h
packet-ppp.c
packet-ppp.h
packet-raw.c
packet-raw.h
packet-tr.c
packet-v120.c
packet-v120.h [deleted file]

index 98a78dcdfdf7028f776538b4c19748de157ba35a..ded19b43c9fed81f06c15e38eb54293e2f2037e2 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile.am
 # Automake file for Ethereal
 #
-# $Id: Makefile.am,v 1.252 2000/11/22 04:03:22 gram Exp $
+# $Id: Makefile.am,v 1.253 2000/11/29 05:16:14 gram Exp $
 #
 # Ethereal - Network traffic analyzer
 # By Gerald Combs <gerald@zing.org>
@@ -184,9 +184,7 @@ noinst_HEADERS = \
        packet-afs-register-info.h \
        packet-afs-defs.h \
        packet-arp.h   \
-       packet-ascend.h\
        packet-atalk.h \
-       packet-atm.h   \
        packet-bgp.h   \
        packet-bootparams.h \
        packet-cdp.h   \
@@ -214,8 +212,6 @@ noinst_HEADERS = \
        packet-isis-snp.h \
        packet-isl.h   \
        packet-kerberos.h \
-       packet-lapb.h  \
-       packet-lapd.h  \
        packet-ldap.h  \
        packet-llc.h   \
        packet-mount.h \
@@ -252,7 +248,6 @@ noinst_HEADERS = \
        packet-tr.h    \
        packet-trmac.h \
        packet-udp.h   \
-       packet-v120.h \
        packet-vines.h \
        packet-vlan.h \
        packet-vtp.h  \
index 2efc22061c7f770f057b2cf67e31df17704e42fa..8a5a7e0d8beb7935962fa3de9f064e11c6ef463a 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ascend.c
  * Routines for decoding Lucent/Ascend packet traces
  *
- * $Id: packet-ascend.c,v 1.20 2000/11/19 08:53:54 guy Exp $
+ * $Id: packet-ascend.c,v 1.21 2000/11/29 05:16:14 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -32,7 +32,6 @@
 #include <glib.h>
 #include <string.h>
 #include "packet.h"
-#include "packet-ascend.h"
 
 static int proto_ascend  = -1;
 static int hf_link_type  = -1;
@@ -53,7 +52,7 @@ static const value_string encaps_vals[] = {
 static dissector_handle_t eth_handle;
 static dissector_handle_t ppp_handle;
 
-void
+static void
 dissect_ascend(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
   proto_tree                   *fh_tree;
@@ -157,4 +156,5 @@ proto_reg_handoff_ascend(void)
    */
   eth_handle = find_dissector("eth");
   ppp_handle = find_dissector("ppp");
+  dissector_add("wtap_encap", WTAP_ENCAP_ASCEND, dissect_ascend);
 }
diff --git a/packet-ascend.h b/packet-ascend.h
deleted file mode 100644 (file)
index 165f5f8..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-ascend.h
- *
- * $Id: packet-ascend.h,v 1.5 2000/08/11 13:34:18 deniel Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Gerald Combs
- *
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef __PACKET_ASCEND_H__
-#define __PACKET_ASCEND_H__
-
-void dissect_ascend(tvbuff_t *, packet_info *, proto_tree *);
-
-#endif
index 223cb1543dc3d1634522b0e438f6d29b9403654b..8ce586b955cbac57cf74c5be0ae68cf995d6a6b9 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-atm.c
  * Routines for ATM packet disassembly
  *
- * $Id: packet-atm.c,v 1.27 2000/11/19 08:53:55 guy Exp $
+ * $Id: packet-atm.c,v 1.28 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -37,7 +37,6 @@
 #include "oui.h"
 #include "resolv.h"
 
-#include "packet-atm.h"
 #include "packet-eth.h"
 #include "packet-llc.h"
 #include "packet-snmp.h"
@@ -556,7 +555,7 @@ atm_guess_content(tvbuff_t *tvb, packet_info *pinfo)
        }
 }
 
-void
+static void
 dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
   proto_tree   *atm_tree;
@@ -790,3 +789,9 @@ proto_register_atm(void)
        proto_atm_lane = proto_register_protocol("ATM LANE", "lane");
        proto_register_subtree_array(ett, array_length(ett));
 }
+
+void
+proto_reg_handoff_atm(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_ATM_SNIFFER, dissect_atm);
+}
diff --git a/packet-atm.h b/packet-atm.h
deleted file mode 100644 (file)
index cd312d0..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-atm.h
- *
- * $Id: packet-atm.h,v 1.5 2000/08/11 13:34:17 deniel Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Gerald Combs
- *
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef __PACKET_ATM_H__
-#define __PACKET_ATM_H__
-
-void dissect_atm(tvbuff_t *, packet_info *, proto_tree *);
-
-#endif
index ced6962878991fdca74364eb05e8c10b3f87b67f..750bd576b341969cf18afe1b9cc82f1239a73909 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-clip.c
  * Routines for clip packet disassembly
  *
- * $Id: packet-clip.c,v 1.12 2000/11/19 08:53:56 guy Exp $
+ * $Id: packet-clip.c,v 1.13 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -48,7 +48,7 @@ capture_clip( const u_char *pd, packet_counts *ld ) {
     capture_ip(pd, 0, ld);
 }
 
-void
+static void
 dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
   proto_tree   *fh_tree;
@@ -102,4 +102,5 @@ proto_reg_handoff_clip(void)
    * Get a handle for the IP dissector.
    */
   ip_handle = find_dissector("ip");
+  dissector_add("wtap_encap", WTAP_ENCAP_LINUX_ATM_CLIP, dissect_clip);
 }
index eb87f51deb22e2d0de8c44466452de3febdc2dda..11190b0cc526958b83a9fba4a0da816ce0790f9d 100644 (file)
@@ -1,6 +1,6 @@
 /* packet-clip.h
  *
- * $Id: packet-clip.h,v 1.3 2000/08/11 13:34:15 deniel Exp $
+ * $Id: packet-clip.h,v 1.4 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -26,6 +26,5 @@
 #define __PACKET_CLIP_H__
 
 void capture_clip(const u_char *, packet_counts *);
-void dissect_clip(tvbuff_t *, packet_info *, proto_tree *);
 
 #endif
index cbf297e2c5bc8cecb9f47e6325f59990bf898ab9..8e2b802a76583fb061cbed4f9728b30572aaaf01 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-eth.c
  * Routines for ethernet packet disassembly
  *
- * $Id: packet-eth.c,v 1.49 2000/11/19 08:53:57 guy Exp $
+ * $Id: packet-eth.c,v 1.50 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -376,3 +376,9 @@ proto_register_eth(void)
 
        register_dissector("eth", dissect_eth);
 }
+
+void
+proto_reg_handoff_eth(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_ETHERNET, dissect_eth);
+}
index ae3737e6f9744fb14f64b8386049508be7ce69dd..72351bc4b4d92cbf4326cd0e4ed06c3ee13d93c8 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Laurent Deniel <deniel@worldnet.fr>
  *
- * $Id: packet-fddi.c,v 1.42 2000/11/19 08:53:57 guy Exp $
+ * $Id: packet-fddi.c,v 1.43 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -219,7 +219,8 @@ fddifc_to_str(int fc)
   }
 }
 
-void
+
+static void
 dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                gboolean bitswapped)
 {
@@ -324,6 +325,19 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
   } /* fc */
 } /* dissect_fddi */
 
+       
+static void
+dissect_fddi_bitswapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+       dissect_fddi(tvb, pinfo, tree, TRUE);
+}
+
+static void
+dissect_fddi_not_bitswapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+       dissect_fddi(tvb, pinfo, tree, FALSE);
+}
+
 void
 proto_register_fddi(void)
 {
@@ -359,3 +373,10 @@ proto_register_fddi(void)
        proto_register_field_array(proto_fddi, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
 }
+
+void
+proto_reg_handoff_fddi(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_FDDI, dissect_fddi_not_bitswapped);
+       dissector_add("wtap_encap", WTAP_ENCAP_FDDI_BITSWAPPED, dissect_fddi_bitswapped);
+}
index 4f48f5c1575a7b8d21c354d3bf1d402786fa7d59..d66dda91d08e481501b99a9b7c1cde5ef146a000 100644 (file)
@@ -1,6 +1,6 @@
 /* packet-fddi.h
  *
- * $Id: packet-fddi.h,v 1.3 2000/08/11 13:34:13 deniel Exp $
+ * $Id: packet-fddi.h,v 1.4 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -26,6 +26,5 @@
 #define __PACKET_FDDI_H__
 
 void capture_fddi(const u_char *, packet_counts *);
-void dissect_fddi(tvbuff_t*, packet_info*, proto_tree*, gboolean bitswapped);
 
 #endif
index ac44f81d5c3070db2f93af2d5159e6487f5539b3..4b3620527f11db965309bb2782f9fe674f735584 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Top-most dissector. Decides dissector based on Wiretap Encapsulation Type.
  *
- * $Id: packet-frame.c,v 1.2 2000/11/15 05:41:42 guy Exp $
+ * $Id: packet-frame.c,v 1.3 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
 #include "tvbuff.h"
 #include "packet-frame.h"
 
-#include "packet-ascend.h"
-#include "packet-atalk.h"
-#include "packet-atm.h"
-#include "packet-clip.h"
-#include "packet-eth.h"
-#include "packet-fddi.h"
-#include "packet-ipv6.h"
-#include "packet-lapb.h"
-#include "packet-lapd.h"
-#include "packet-llc.h"
-#include "packet-null.h"
-#include "packet-ppp.h"
-#include "packet-raw.h"
-#include "packet-sna.h"
-#include "packet-tr.h"
-#include "packet-v120.h"
-#include "packet-vines.h"
-#include "packet-ieee80211.h"
-
 static int proto_frame = -1;
 static int hf_frame_arrival_time = -1;
 static int hf_frame_time_delta = -1;
@@ -70,6 +51,8 @@ static const value_string p2p_dirs[] = {
        { P2P_DIR_RECV, "Received" },
        { 0, NULL }
 };
+
+static dissector_table_t wtap_encap_dissector_table;
        
 void
 dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -130,56 +113,14 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
 
        TRY {
-               switch (pinfo->fd->lnk_t) {
-                       case WTAP_ENCAP_ETHERNET :
-                               dissect_eth(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_FDDI :
-                               dissect_fddi(tvb, pinfo, tree, FALSE);
-                               break;
-                       case WTAP_ENCAP_FDDI_BITSWAPPED :
-                               dissect_fddi(tvb, pinfo, tree, TRUE);
-                               break;
-                       case WTAP_ENCAP_TOKEN_RING :
-                               dissect_tr(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_NULL :
-                               dissect_null(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_PPP :
-                       case WTAP_ENCAP_PPP_WITH_PHDR :
-                               dissect_ppp(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_LAPB :
-                               dissect_lapb(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_RAW_IP :
-                               dissect_raw(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_LINUX_ATM_CLIP :
-                               dissect_clip(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_ATM_SNIFFER :
-                               dissect_atm(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_ASCEND :
-                               dissect_ascend(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_LAPD :
-                               dissect_lapd(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_V120 :
-                               dissect_v120(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_ATM_RFC1483:
-                               dissect_llc(tvb, pinfo, tree);
-                               break;
-                       case WTAP_ENCAP_IEEE_802_11 :
-                               dissect_ieee80211(tvb,pinfo,tree);
-                               break;
-                       default:
-                               g_assert_not_reached();
-                               break;
+               if (!dissector_try_port(wtap_encap_dissector_table, pinfo->fd->lnk_t,
+                                       tvb, pinfo, tree)) {
+
+                       if (check_col(pinfo->fd, COL_PROTOCOL))
+                               col_set_str(pinfo->fd, COL_PROTOCOL, "UNKNOWN");
+                       if (check_col(pinfo->fd, COL_INFO))
+                               col_add_fstr(pinfo->fd, COL_INFO, "WTAP_ENCAP = 0x%x", pinfo->fd->lnk_t);
+                       dissect_data(tvb, 0, pinfo, tree);
                }
        }
        CATCH(BoundsError) {
@@ -226,6 +167,8 @@ proto_register_frame(void)
                &ett_frame,
        };
 
+       wtap_encap_dissector_table = register_dissector_table("wtap_encap");
+
        proto_frame = proto_register_protocol("Frame", "frame");
        proto_register_field_array(proto_frame, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
index cef385c824b0827716916b75fb11c59f191a89f1..14666661af3a783413cad7e987d33f59e5002386 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.3 2000/11/19 08:53:58 guy Exp $
+ * $Id: packet-ieee80211.c,v 1.4 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -1737,3 +1737,9 @@ proto_register_wlan (void)
   proto_register_field_array (proto_wlan, hf, array_length (hf));
   proto_register_subtree_array (tree_array, array_length (tree_array));
 }
+
+void
+proto_reg_handoff_iee380211(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_IEEE_802_11, dissect_ieee80211);
+}
index 7f50ab0c0983b6a9dd5e1bd3d4bef67aa5fe9526..0db900e014e0dc5c5431710c2260be11ec3e18e2 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright 2000, Axis Communications AB 
  * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
  *
- * $Id: packet-ieee80211.h,v 1.1 2000/11/15 05:41:42 guy Exp $
+ * $Id: packet-ieee80211.h,v 1.2 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -28,4 +28,3 @@
  */
 
 void capture_ieee80211 (const u_char *, int, packet_counts *);
-void dissect_ieee80211 (tvbuff_t *, packet_info *, proto_tree *);
index 732b5833dc15742f90c2472e78de4df5187442b4..b817095d7359b6717a5073cc6eeeda7b374e6954 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for lapb frame disassembly
  * Olivier Abad <oabad@cybercable.fr>
  *
- * $Id: packet-lapb.c,v 1.23 2000/11/19 08:53:59 guy Exp $
+ * $Id: packet-lapb.c,v 1.24 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -36,7 +36,6 @@
 #include <glib.h>
 #include <string.h>
 #include "packet.h"
-#include "packet-lapb.h"
 #include "packet-x25.h"
 #include "xdlc.h"
 
@@ -49,7 +48,7 @@ static int hf_lapb_control = -1;
 static gint ett_lapb = -1;
 static gint ett_lapb_control = -1;
 
-void
+static void
 dissect_lapb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     proto_tree         *lapb_tree, *ti;
@@ -136,3 +135,9 @@ proto_register_lapb(void)
     proto_register_field_array (proto_lapb, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
 }
+
+void
+proto_reg_handoff_lapb(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_LAPB, dissect_lapb);
+}
diff --git a/packet-lapb.h b/packet-lapb.h
deleted file mode 100644 (file)
index 300aba3..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-lapb.h
- *
- * $Id: packet-lapb.h,v 1.5 2000/08/11 13:34:10 deniel Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Gerald Combs
- *
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef __PACKET_LAPB_H__
-#define __PACKET_LAPB_H__
-
-void dissect_lapb(tvbuff_t *, packet_info *, proto_tree *);
-
-#endif
index 592c8f5ed682f56173bbc9b1e50d45b4c70f9b3b..7941c6c090bc1dc74af608e2d2c53ad609b3cee5 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for LAPD frame disassembly
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-lapd.c,v 1.16 2000/11/19 08:53:59 guy Exp $
+ * $Id: packet-lapd.c,v 1.17 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -36,7 +36,6 @@
 #include <glib.h>
 #include <string.h>
 #include "packet.h"
-#include "packet-lapd.h"
 #include "packet-q931.h"
 #include "xdlc.h"
 
@@ -83,7 +82,7 @@ static const value_string lapd_sapi_vals[] = {
        { 0,                    NULL }
 };
 
-void
+static void
 dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
        proto_tree      *lapd_tree, *addr_tree;
@@ -202,3 +201,9 @@ proto_register_lapd(void)
     proto_register_field_array (proto_lapd, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
 }
+
+void
+proto_reg_handoff_lapd(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_LAPD, dissect_lapd);
+}
diff --git a/packet-lapd.h b/packet-lapd.h
deleted file mode 100644 (file)
index 0ff949d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-lapd.h
- *
- * $Id: packet-lapd.h,v 1.5 2000/08/11 13:33:59 deniel Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Gerald Combs
- *
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef __PACKET_LAPD_H__
-#define __PACKET_LAPD_H__
-
-void dissect_lapd(tvbuff_t *, packet_info *, proto_tree *);
-
-#endif
index e1dba553870bb13bd3188d7e3533cfd89bad5ea5..3a98eb0d6de1783aa3990107ffb296b6cddcd893 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for IEEE 802.2 LLC layer
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-llc.c,v 1.71 2000/11/19 08:53:59 guy Exp $
+ * $Id: packet-llc.c,v 1.72 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -504,4 +504,5 @@ proto_reg_handoff_llc(void)
         * Get a handle for the BPDU dissector.
         */
        bpdu_handle = find_dissector("bpdu");
+       dissector_add("wtap_encap", WTAP_ENCAP_ATM_RFC1483, dissect_llc);
 }
index b86401e5dd4d51b9f0e0780bb403eea7b304ab2a..ed90101684a51aaabd90d28ecf07375b989778a4 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-null.c
  * Routines for null packet disassembly
  *
- * $Id: packet-null.c,v 1.34 2000/11/19 08:54:00 guy Exp $
+ * $Id: packet-null.c,v 1.35 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -209,7 +209,7 @@ capture_null( const u_char *pd, packet_counts *ld )
   }
 }
 
-void
+static void
 dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
   guint32      null_header;
@@ -320,4 +320,5 @@ proto_reg_handoff_null(void)
         * Get a handle for the PPP dissector.
         */
        ppp_handle = find_dissector("ppp");
+       dissector_add("wtap_encap", WTAP_ENCAP_NULL, dissect_null);
 }
index 4323c409ad99758cc2baacb1a37abe007027d4d1..1962f560f5cb3225bfea663c4d6649f70d5b10a6 100644 (file)
@@ -1,6 +1,6 @@
 /* packet-null.h
  *
- * $Id: packet-null.h,v 1.3 2000/08/11 13:34:05 deniel Exp $
+ * $Id: packet-null.h,v 1.4 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -26,6 +26,5 @@
 #define __PACKET_NULL_H__
 
 void capture_null(const u_char *, packet_counts *);
-void dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
 
 #endif
index a96e6cf55c23676a3da3d39b4d7801c926e799d5..031cfacee12de970277ed0ee8b905d2d6be7ceb7 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ppp.c
  * Routines for ppp packet disassembly
  *
- * $Id: packet-ppp.c,v 1.44 2000/11/19 08:54:01 guy Exp $
+ * $Id: packet-ppp.c,v 1.45 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -1224,3 +1224,10 @@ proto_register_mp(void)
   proto_register_field_array(proto_mp, hf, array_length(hf));
   proto_register_subtree_array(ett, array_length(ett));
 }
+
+void
+proto_reg_handoff_ppp(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_PPP, dissect_ppp);
+       dissector_add("wtap_encap", WTAP_ENCAP_PPP_WITH_PHDR, dissect_ppp);
+}
index 0badd03a995a847b6b5fdef2ebe3cfadf7d524b7..d8c2e86e0dc850c6affe69ebf0aa07043b1cc890 100644 (file)
@@ -1,6 +1,6 @@
 /* packet-ppp.h
  *
- * $Id: packet-ppp.h,v 1.5 2000/11/19 02:00:03 guy Exp $
+ * $Id: packet-ppp.h,v 1.6 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -26,6 +26,5 @@
 #define __PACKET_PPP_H__
 
 void capture_ppp(const u_char *, int, packet_counts *);
-void dissect_ppp(tvbuff_t *, packet_info *, proto_tree *);
 
 #endif
index 41b815c6e84d99b512c2ac20272284e32442e83a..077b78555a86e4bbd9dbb3675ac379f5158b3521 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-raw.c
  * Routines for raw packet disassembly
  *
- * $Id: packet-raw.c,v 1.22 2000/11/19 08:54:04 guy Exp $
+ * $Id: packet-raw.c,v 1.23 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -79,7 +79,7 @@ capture_raw(const u_char *pd, packet_counts *ld)
   }
 }
 
-void
+static void
 dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
   proto_tree   *fh_tree;
@@ -163,4 +163,5 @@ proto_reg_handoff_raw(void)
    */
   ip_handle = find_dissector("ip");
   ppp_handle = find_dissector("ppp");
+  dissector_add("wtap_encap", WTAP_ENCAP_RAW_IP, dissect_raw);
 }
index fab2607db0411d3c9ddcd57a1c090dae17322378..3bfba25c4eb09b2a00ab6e74bed3ba39b820345e 100644 (file)
@@ -1,6 +1,6 @@
 /* packet-raw.h
  *
- * $Id: packet-raw.h,v 1.3 2000/08/11 13:34:02 deniel Exp $
+ * $Id: packet-raw.h,v 1.4 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -26,6 +26,5 @@
 #define __PACKET_RAW_H__
 
 void capture_raw(const u_char *, packet_counts *);
-void dissect_raw(tvbuff_t *, packet_info *, proto_tree *);
 
 #endif
index 16060cfad0e4935ab855a8486abeb0a70819eed6..3e383303ddb81368d8ee4310a6882ff040a41065 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for Token-Ring packet disassembly
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-tr.c,v 1.51 2000/11/19 08:54:10 guy Exp $
+ * $Id: packet-tr.c,v 1.52 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -671,3 +671,8 @@ proto_register_tr(void)
        proto_register_subtree_array(ett, array_length(ett));
 }
 
+void
+proto_reg_handoff_tr(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_TOKEN_RING, dissect_tr);
+}
index 3847180bb5a131ec9ed8bbf47fc3d3c6ab0dc65a..c0a1223aa14363e61f8f90ac3d2e89e9a4bcf80c 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for v120 frame disassembly
  * Bert Driehuis <driehuis@playbeing.org>
  *
- * $Id: packet-v120.c,v 1.14 2000/11/19 08:54:10 guy Exp $
+ * $Id: packet-v120.c,v 1.15 2000/11/29 05:16:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -36,7 +36,6 @@
 #include <glib.h>
 #include <string.h>
 #include "packet.h"
-#include "packet-v120.h"
 #include "xdlc.h"
 
 #define FROM_DCE       0x80
@@ -53,7 +52,7 @@ static gint ett_v120_header = -1;
 
 static int dissect_v120_header(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
 
-void
+static void
 dissect_v120(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     proto_tree *v120_tree, *tc, *address_tree;
@@ -231,3 +230,9 @@ proto_register_v120(void)
     proto_register_field_array (proto_v120, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
 }
+
+void
+proto_reg_handoff_v120(void)
+{
+       dissector_add("wtap_encap", WTAP_ENCAP_V120, dissect_v120);
+}
diff --git a/packet-v120.h b/packet-v120.h
deleted file mode 100644 (file)
index 2bc49e3..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-v120.h
- *
- * $Id: packet-v120.h,v 1.5 2000/08/11 13:33:57 deniel Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Gerald Combs
- *
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef __PACKET_V120_H__
-#define __PACKET_V120_H__
-
-void dissect_v120(tvbuff_t *, packet_info *, proto_tree *);
-
-#endif