summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--capture_info.c119
-rw-r--r--debian/libwireshark0.symbols26
-rw-r--r--epan/CMakeLists.txt1
-rw-r--r--epan/Makefile.common2
-rw-r--r--epan/capture_dissectors.c85
-rw-r--r--epan/capture_dissectors.h52
-rw-r--r--epan/dissectors/Makefile.common14
-rw-r--r--epan/dissectors/packet-ap1394.c8
-rw-r--r--epan/dissectors/packet-ap1394.h30
-rw-r--r--epan/dissectors/packet-arcnet.c24
-rw-r--r--epan/dissectors/packet-arcnet.h30
-rw-r--r--epan/dissectors/packet-atalk.c7
-rw-r--r--epan/dissectors/packet-atalk.h4
-rw-r--r--epan/dissectors/packet-atm.c15
-rw-r--r--epan/dissectors/packet-atm.h6
-rw-r--r--epan/dissectors/packet-ax25-kiss.c12
-rw-r--r--epan/dissectors/packet-ax25-kiss.h33
-rw-r--r--epan/dissectors/packet-ax25.c5
-rw-r--r--epan/dissectors/packet-ax25.h6
-rw-r--r--epan/dissectors/packet-bpq.c4
-rw-r--r--epan/dissectors/packet-bpq.h2
-rw-r--r--epan/dissectors/packet-chdlc.c5
-rw-r--r--epan/dissectors/packet-chdlc.h6
-rw-r--r--epan/dissectors/packet-clip.c10
-rw-r--r--epan/dissectors/packet-clip.h30
-rw-r--r--epan/dissectors/packet-enc.c8
-rw-r--r--epan/dissectors/packet-enc.h30
-rw-r--r--epan/dissectors/packet-eth.c8
-rw-r--r--epan/dissectors/packet-eth.h6
-rw-r--r--epan/dissectors/packet-ethertype.c4
-rw-r--r--epan/dissectors/packet-fddi.c19
-rw-r--r--epan/dissectors/packet-fddi.h36
-rw-r--r--epan/dissectors/packet-fr.c12
-rw-r--r--epan/dissectors/packet-fr.h30
-rw-r--r--epan/dissectors/packet-i2c.c9
-rw-r--r--epan/dissectors/packet-i2c.h30
-rw-r--r--epan/dissectors/packet-ieee80211-prism.c11
-rw-r--r--epan/dissectors/packet-ieee80211-radiotap.c21
-rw-r--r--epan/dissectors/packet-ieee80211-radiotap.h46
-rw-r--r--epan/dissectors/packet-ieee80211-wlancap.c6
-rw-r--r--epan/dissectors/packet-ieee80211.c10
-rw-r--r--epan/dissectors/packet-ieee80211.h10
-rw-r--r--epan/dissectors/packet-ieee8021ah.c2
-rw-r--r--epan/dissectors/packet-ipfc.c10
-rw-r--r--epan/dissectors/packet-ipfc.h30
-rw-r--r--epan/dissectors/packet-isl.c6
-rw-r--r--epan/dissectors/packet-isl.h2
-rw-r--r--epan/dissectors/packet-llc.c2
-rw-r--r--epan/dissectors/packet-llc.h2
-rw-r--r--epan/dissectors/packet-null.c15
-rw-r--r--epan/dissectors/packet-null.h33
-rw-r--r--epan/dissectors/packet-pktap.c15
-rw-r--r--epan/dissectors/packet-pktap.h30
-rw-r--r--epan/dissectors/packet-ppi.c11
-rw-r--r--epan/dissectors/packet-ppi.h30
-rw-r--r--epan/dissectors/packet-ppp.c7
-rw-r--r--epan/dissectors/packet-ppp.h4
-rw-r--r--epan/dissectors/packet-raw.c14
-rw-r--r--epan/dissectors/packet-raw.h30
-rw-r--r--epan/dissectors/packet-sll.c13
-rw-r--r--epan/dissectors/packet-sll.h3
-rw-r--r--epan/dissectors/packet-tr.c6
-rw-r--r--epan/dissectors/packet-tr.h4
-rw-r--r--epan/dissectors/packet-vlan.c2
-rw-r--r--epan/epan.c3
-rw-r--r--epan/wslua/taps1
-rw-r--r--tools/delete_includes.py12
67 files changed, 358 insertions, 761 deletions
diff --git a/capture_info.c b/capture_info.c
index 548e8a68f0..1f9f104963 100644
--- a/capture_info.c
+++ b/capture_info.c
@@ -35,29 +35,7 @@
#include "capture_info.h"
-#include <epan/dissectors/packet-ap1394.h>
-#include <epan/dissectors/packet-atalk.h>
-#include <epan/dissectors/packet-atm.h>
-#include <epan/dissectors/packet-ax25.h>
-#include <epan/dissectors/packet-clip.h>
-#include <epan/dissectors/packet-eth.h>
-#include <epan/dissectors/packet-fddi.h>
-#include <epan/dissectors/packet-fr.h>
-#include <epan/dissectors/packet-null.h>
-#include <epan/dissectors/packet-ppi.h>
-#include <epan/dissectors/packet-ppp.h>
-#include <epan/dissectors/packet-raw.h>
-#include <epan/dissectors/packet-sll.h>
-#include <epan/dissectors/packet-tr.h>
-#include <epan/dissectors/packet-ieee80211.h>
-#include <epan/dissectors/packet-ieee80211-radiotap.h>
-#include <epan/dissectors/packet-chdlc.h>
-#include <epan/dissectors/packet-ipfc.h>
-#include <epan/dissectors/packet-arcnet.h>
-#include <epan/dissectors/packet-enc.h>
-#include <epan/dissectors/packet-i2c.h>
-#include <epan/dissectors/packet-ax25-kiss.h>
-#include <epan/dissectors/packet-pktap.h>
+#include <epan/capture_dissectors.h>
#include <wsutil/filesystem.h>
@@ -273,100 +251,7 @@ static void
capture_info_packet(packet_counts *counts, gint wtap_linktype, const guchar *pd, guint32 caplen, union wtap_pseudo_header *pseudo_header)
{
counts->total++;
- switch (wtap_linktype) {
- case WTAP_ENCAP_ETHERNET:
- capture_eth(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_FDDI:
- case WTAP_ENCAP_FDDI_BITSWAPPED:
- capture_fddi(pd, caplen, counts);
- break;
- case WTAP_ENCAP_IEEE_802_11_PRISM:
- capture_prism(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_TOKEN_RING:
- capture_tr(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_NULL:
- capture_null(pd, caplen, counts);
- break;
- case WTAP_ENCAP_LOOP:
- capture_loop(pd, caplen, counts);
- break;
- case WTAP_ENCAP_PPP:
- capture_ppp_hdlc(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_RAW_IP:
- capture_raw(pd, caplen, counts);
- break;
- case WTAP_ENCAP_SLL:
- capture_sll(pd, caplen, counts);
- break;
- case WTAP_ENCAP_LINUX_ATM_CLIP:
- capture_clip(pd, caplen, counts);
- break;
- case WTAP_ENCAP_IEEE_802_11:
- case WTAP_ENCAP_IEEE_802_11_WITH_RADIO:
- capture_ieee80211(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_IEEE_802_11_RADIOTAP:
- capture_radiotap(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_IEEE_802_11_AVS:
- capture_wlancap(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_CHDLC:
- capture_chdlc(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_LOCALTALK:
- capture_llap(counts);
- break;
- case WTAP_ENCAP_ATM_PDUS:
- capture_atm(pseudo_header, pd, caplen, counts);
- break;
- case WTAP_ENCAP_IP_OVER_FC:
- capture_ipfc(pd, caplen, counts);
- break;
- case WTAP_ENCAP_ARCNET:
- capture_arcnet(pd, caplen, counts, FALSE, TRUE);
- break;
- case WTAP_ENCAP_ARCNET_LINUX:
- capture_arcnet(pd, caplen, counts, TRUE, FALSE);
- break;
- case WTAP_ENCAP_APPLE_IP_OVER_IEEE1394:
- capture_ap1394(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_FRELAY:
- case WTAP_ENCAP_FRELAY_WITH_PHDR:
- capture_fr(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_ENC:
- capture_enc(pd, caplen, counts);
- break;
- case WTAP_ENCAP_PPI:
- capture_ppi(pd, caplen, counts);
- break;
- case WTAP_ENCAP_I2C:
- capture_i2c(pseudo_header, counts);
- break;
- case WTAP_ENCAP_AX25_KISS:
- capture_ax25_kiss(pd, 0, caplen, counts);
- break;
- case WTAP_ENCAP_AX25:
- capture_ax25(pd, 0, caplen, counts);
- break;
- /* XXX - some ATM drivers on FreeBSD might prepend a 4-byte ATM
- pseudo-header to DLT_ATM_RFC1483, with LLC header following;
- we might have to implement that at some point. */
- case WTAP_ENCAP_PKTAP:
- case WTAP_ENCAP_USER2:
- /* XXX - WTAP_ENCAP_USER2 to handle Mavericks' botch wherein it
- uses DLT_USER2 for PKTAP; if you are using DLT_USER2 for your
- own purposes, feel free to call your own capture_ routine for
- WTAP_ENCAP_USER2. */
- capture_pktap(pd, caplen, counts);
- break;
- }
+ call_capture_dissector(wtap_linktype, pd, 0, caplen, counts, pseudo_header);
}
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols
index cba142bbde..0698776623 100644
--- a/debian/libwireshark0.symbols
+++ b/debian/libwireshark0.symbols
@@ -94,32 +94,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
call_per_oid_callback@Base 1.99.1
camelSRTtype_naming@Base 1.9.1
camel_opr_code_strings@Base 1.9.1
- capture_ap1394@Base 1.9.1
- capture_arcnet@Base 1.9.1
- capture_atm@Base 1.9.1
- capture_ax25@Base 1.9.1
- capture_ax25_kiss@Base 1.9.1
- capture_chdlc@Base 1.9.1
- capture_clip@Base 1.9.1
- capture_enc@Base 1.9.1
- capture_eth@Base 1.9.1
- capture_fddi@Base 1.9.1
- capture_fr@Base 1.9.1
- capture_i2c@Base 1.9.1
- capture_ieee80211@Base 1.9.1
- capture_ipfc@Base 1.9.1
- capture_llap@Base 1.9.1
- capture_loop@Base 1.99.3
- capture_null@Base 1.9.1
- capture_pktap@Base 1.12.0~rc1
- capture_ppi@Base 1.9.1
- capture_ppp_hdlc@Base 1.9.1
- capture_prism@Base 1.9.1
- capture_radiotap@Base 1.9.1
- capture_raw@Base 1.9.1
- capture_sll@Base 1.9.1
- capture_tr@Base 1.9.1
- capture_wlancap@Base 1.9.1
check_xdlc_control@Base 1.9.1
circuit_add_proto_data@Base 1.9.1
circuit_get_proto_data@Base 1.9.1
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index e004150b24..613e5715c8 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -1591,6 +1591,7 @@ set(LIBWIRESHARK_FILES
aftypes.c
app_mem_usage.c
asn1.c
+ capture_dissectors.c
charsets.c
circuit.c
column.c
diff --git a/epan/Makefile.common b/epan/Makefile.common
index c4ff293ed5..bc57f50b42 100644
--- a/epan/Makefile.common
+++ b/epan/Makefile.common
@@ -29,6 +29,7 @@ LIBWIRESHARK_SRC = \
aftypes.c \
app_mem_usage.c \
asn1.c \
+ capture_dissectors.c \
charsets.c \
circuit.c \
column.c \
@@ -156,6 +157,7 @@ LIBWIRESHARK_INCLUDES = \
asn1.h \
ax25_pids.h \
bridged_pids.h \
+ capture_dissectors.h \
charsets.h \
chdlctypes.h \
circuit.h \
diff --git a/epan/capture_dissectors.c b/epan/capture_dissectors.c
new file mode 100644
index 0000000000..45f65e5239
--- /dev/null
+++ b/epan/capture_dissectors.c
@@ -0,0 +1,85 @@
+/* capture_dissectors.c
+ * Routines for handling capture dissectors
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include "packet.h"
+
+#include "capture_dissectors.h"
+
+struct capture_dissector_handle
+{
+ gint linktype;
+ capture_dissector_t dissector;
+ protocol_t* protocol;
+};
+
+static GHashTable *registered_capture_dissectors = NULL;
+
+void capture_dissector_init(void)
+{
+ registered_capture_dissectors = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, NULL);
+}
+
+void capture_dissector_cleanup(void)
+{
+ g_hash_table_destroy(registered_capture_dissectors);
+ registered_capture_dissectors = NULL;
+}
+
+void register_capture_dissector(gint linktype, capture_dissector_t dissector, const int proto)
+{
+ struct capture_dissector_handle *handle;
+
+ /* Make sure the registration is unique */
+ g_assert(g_hash_table_lookup(registered_capture_dissectors, &linktype) == NULL);
+
+ handle = wmem_new(wmem_epan_scope(), struct capture_dissector_handle);
+ handle->linktype = linktype;
+ handle->dissector = dissector;
+ handle->protocol = find_protocol_by_id(proto);
+
+ g_hash_table_insert(registered_capture_dissectors, (gpointer)&linktype, (gpointer) handle);
+}
+
+void call_capture_dissector(gint linktype, const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header)
+{
+ struct capture_dissector_handle* handle = (struct capture_dissector_handle *)g_hash_table_lookup(registered_capture_dissectors, &linktype);
+ if (handle == NULL)
+ return;
+
+ handle->dissector(pd, offset, len, ld, pseudo_header);
+}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/epan/capture_dissectors.h b/epan/capture_dissectors.h
new file mode 100644
index 0000000000..f5313fabf9
--- /dev/null
+++ b/epan/capture_dissectors.h
@@ -0,0 +1,52 @@
+/* capture_dissectors.h
+ * Routines for handling capture dissectors
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CAPTURE_DISSECTORS_H__
+#define __CAPTURE_DISSECTORS_H__
+
+#include "ws_symbol_export.h"
+#include <wiretap/wtap.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** @file
+ */
+
+/** callback function definition: is a filter available for this packet? */
+typedef void (*capture_dissector_t)(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header);
+
+
+/** Register a new capture dissector. */
+WS_DLL_PUBLIC void register_capture_dissector(gint linktype, capture_dissector_t dissector, const int proto);
+
+WS_DLL_PUBLIC void call_capture_dissector(gint linktype, const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header);
+
+extern void capture_dissector_init(void);
+extern void capture_dissector_cleanup(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* capture_dissectors.h */
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index 85b7588031..2736a783af 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -1417,14 +1417,11 @@ DISSECTOR_INCLUDES = \
packet-ansi_a.h \
packet-ansi_map.h \
packet-ansi_tcap.h \
- packet-ap1394.h \
- packet-arcnet.h \
packet-arp.h \
packet-atalk.h \
packet-atm.h \
packet-atn-ulcs.h \
packet-ax25.h \
- packet-ax25-kiss.h \
packet-bacapp.h \
packet-ber.h \
packet-bfd.h \
@@ -1454,7 +1451,6 @@ DISSECTOR_INCLUDES = \
packet-cip.h \
packet-cipsafety.h \
packet-clearcase.h \
- packet-clip.h \
packet-cmip.h \
packet-cmp.h \
packet-cms.h \
@@ -1499,7 +1495,6 @@ DISSECTOR_INCLUDES = \
packet-e164.h \
packet-e212.h \
packet-edonkey.h \
- packet-enc.h \
packet-epmd.h \
packet-ess.h \
packet-eth.h \
@@ -1514,11 +1509,9 @@ DISSECTOR_INCLUDES = \
packet-fcp.h \
packet-fcsb3.h \
packet-fcswils.h \
- packet-fddi.h \
packet-ff.h \
packet-fix.h \
packet-fmp.h \
- packet-fr.h \
packet-frame.h \
packet-ftam.h \
packet-giop.h \
@@ -1547,14 +1540,12 @@ DISSECTOR_INCLUDES = \
packet-h450-ros.h \
packet-hpext.h \
packet-http.h \
- packet-i2c.h \
packet-iana-oui.h \
packet-iax2.h \
packet-icmp.h \
packet-idmp.h \
packet-idp.h \
packet-ieee80211.h \
- packet-ieee80211-radiotap.h \
packet-ieee80211-radiotap-iter.h \
packet-ieee80211-radiotap-defs.h \
packet-ieee802154.h \
@@ -1566,7 +1557,6 @@ DISSECTOR_INCLUDES = \
packet-inap.h \
packet-infiniband.h \
packet-ip.h \
- packet-ipfc.h \
packet-ipmi.h \
packet-ipsec.h \
packet-ipv6.h \
@@ -1624,7 +1614,6 @@ DISSECTOR_INCLUDES = \
packet-nlm.h \
packet-ntlmssp.h \
packet-ntp.h \
- packet-null.h \
packet-ocsp.h \
packet-opensafety.h \
packet-osi.h \
@@ -1647,9 +1636,7 @@ DISSECTOR_INCLUDES = \
packet-pkixtsp.h \
packet-pkinit.h \
packet-pktc.h \
- packet-pktap.h \
packet-portmap.h \
- packet-ppi.h \
packet-ppi-geolocation-common.h \
packet-ppp.h \
packet-pres.h \
@@ -1662,7 +1649,6 @@ DISSECTOR_INCLUDES = \
packet-qsig.h \
packet-radius.h \
packet-ranap.h \
- packet-raw.h \
packet-rdm.h \
packet-rdt.h \
packet-reload.h \
diff --git a/epan/dissectors/packet-ap1394.c b/epan/dissectors/packet-ap1394.c
index 7fb6d162b9..7db71c5712 100644
--- a/epan/dissectors/packet-ap1394.c
+++ b/epan/dissectors/packet-ap1394.c
@@ -23,10 +23,10 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wsutil/pint.h>
#include <epan/addr_resolv.h>
-#include "packet-ap1394.h"
#include <epan/etypes.h>
void proto_register_ap1394(void);
@@ -43,8 +43,8 @@ static dissector_table_t ethertype_subdissector_table;
static dissector_handle_t data_handle;
-void
-capture_ap1394(const guchar *pd, int offset, int len, packet_counts *ld)
+static void
+capture_ap1394(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint16 etype;
@@ -118,6 +118,8 @@ proto_register_ap1394(void)
proto_ap1394 = proto_register_protocol("Apple IP-over-IEEE 1394", "IP/IEEE1394", "ap1394");
proto_register_field_array(proto_ap1394, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ register_capture_dissector(WTAP_ENCAP_APPLE_IP_OVER_IEEE1394, capture_ap1394, proto_ap1394);
}
void
diff --git a/epan/dissectors/packet-ap1394.h b/epan/dissectors/packet-ap1394.h
deleted file mode 100644
index 5f8b32c806..0000000000
--- a/epan/dissectors/packet-ap1394.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-ap1394.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_AP1394_H__
-#define __PACKET_AP1394_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_ap1394(const guchar *, int, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c
index 30ab244674..8c7c4669fc 100644
--- a/epan/dissectors/packet-arcnet.c
+++ b/epan/dissectors/packet-arcnet.c
@@ -24,8 +24,8 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wiretap/wtap.h>
-#include "packet-arcnet.h"
#include <epan/address_types.h>
#include <epan/arcnet_pids.h>
#include <epan/to_str.h>
@@ -81,12 +81,9 @@ static int arcnet_len(void)
return 1;
}
-void
-capture_arcnet (const guchar *pd, int len, packet_counts *ld,
- gboolean has_offset, gboolean has_exception)
+static void
+capture_arcnet_common(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_, gboolean has_exception)
{
- int offset = has_offset ? 4 : 2;
-
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
ld->other++;
return;
@@ -160,6 +157,18 @@ capture_arcnet (const guchar *pd, int len, packet_counts *ld,
}
static void
+capture_arcnet (const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
+{
+ capture_arcnet_common(pd, 4, len, ld, pseudo_header, FALSE);
+}
+
+static void
+capture_arcnet_has_exception(const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
+{
+ capture_arcnet_common(pd, 2, len, ld, pseudo_header, TRUE);
+}
+
+static void
dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
gboolean has_offset, gboolean has_exception)
{
@@ -387,6 +396,9 @@ proto_register_arcnet (void)
proto_register_field_array (proto_arcnet, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
+ register_capture_dissector(WTAP_ENCAP_ARCNET_LINUX, capture_arcnet, proto_arcnet);
+ register_capture_dissector(WTAP_ENCAP_ARCNET, capture_arcnet_has_exception, proto_arcnet);
+
arcnet_address_type = address_type_dissector_register("AT_ARCNET", "ARCNET Address", arcnet_to_str, arcnet_str_len, arcnet_col_filter_str, arcnet_len, NULL, NULL);
}
diff --git a/epan/dissectors/packet-arcnet.h b/epan/dissectors/packet-arcnet.h
deleted file mode 100644
index 87c810494e..0000000000
--- a/epan/dissectors/packet-arcnet.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-arcnet.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_ARCNET_H__
-#define __PACKET_ARCNET_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_arcnet (const guchar *, int, packet_counts *, gboolean, gboolean);
-
-#endif
diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c
index 8759f9c145..efe84ca76c 100644
--- a/epan/dissectors/packet-atalk.c
+++ b/epan/dissectors/packet-atalk.c
@@ -37,6 +37,7 @@
#include <epan/address_types.h>
#include <epan/to_str.h>
#include <wiretap/wtap.h>
+#include <epan/capture_dissectors.h>
#include "packet-atalk.h"
#include "packet-afp.h"
@@ -1579,8 +1580,8 @@ static const value_string llap_type_vals[] = {
};
static value_string_ext llap_type_vals_ext = VALUE_STRING_EXT_INIT(llap_type_vals);
-void
-capture_llap(packet_counts *ld)
+static void
+capture_llap(const guchar *pd _U_, int offset _U_, int len _U_, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
ld->other++;
}
@@ -2065,6 +2066,8 @@ proto_register_atalk(void)
proto_zip = proto_register_protocol("Zone Information Protocol", "ZIP", "zip");
proto_register_field_array(proto_zip, hf_zip, array_length(hf_zip));
+ register_capture_dissector(WTAP_ENCAP_LOCALTALK, capture_llap, proto_llap);
+
atp_module = prefs_register_protocol(proto_atp, NULL);
prefs_register_bool_preference(atp_module, "desegment",
"Reassemble ATP messages spanning multiple DDP packets",
diff --git a/epan/dissectors/packet-atalk.h b/epan/dissectors/packet-atalk.h
index 979b068990..fecddd696a 100644
--- a/epan/dissectors/packet-atalk.h
+++ b/epan/dissectors/packet-atalk.h
@@ -19,8 +19,6 @@
#ifndef __PACKET_ATALK_H__
#define __PACKET_ATALK_H__
-#include "ws_symbol_export.h"
-
/*
* DDP packet types.
*/
@@ -33,6 +31,4 @@
#define DDP_ADSP 0x07
#define DDP_EIGRP 0x58
-WS_DLL_PUBLIC void capture_llap(packet_counts *ld);
-
#endif
diff --git a/epan/dissectors/packet-atm.c b/epan/dissectors/packet-atm.c
index d7793244b2..195c71a83e 100644
--- a/epan/dissectors/packet-atm.c
+++ b/epan/dissectors/packet-atm.c
@@ -23,6 +23,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wsutil/pint.h>
#include <epan/oui.h>
#include <epan/addr_resolv.h>
@@ -672,13 +673,13 @@ capture_lane(const union wtap_pseudo_header *pseudo_header, const guchar *pd,
case TRAF_ST_LANE_802_3:
case TRAF_ST_LANE_802_3_MC:
/* Dissect as Ethernet */
- capture_eth(pd, 2, len, ld);
+ capture_eth(pd, 2, len, ld, pseudo_header);
break;
case TRAF_ST_LANE_802_5:
case TRAF_ST_LANE_802_5_MC:
/* Dissect as Token-Ring */
- capture_tr(pd, 2, len, ld);
+ capture_tr(pd, 2, len, ld, pseudo_header);
break;
default:
@@ -804,9 +805,9 @@ static const value_string ipsilon_type_vals[] = {
{ 0, NULL }
};
-void
-capture_atm(const union wtap_pseudo_header *pseudo_header, const guchar *pd,
- int len, packet_counts *ld)
+static void
+capture_atm(const guchar *pd, int offset _U_,
+ int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header)
{
if (pseudo_header->atm.aal == AAL_5) {
switch (pseudo_header->atm.type) {
@@ -815,7 +816,7 @@ capture_atm(const union wtap_pseudo_header *pseudo_header, const guchar *pd,
/* Dissect as WTAP_ENCAP_ATM_RFC1483 */
/* The ATM iptrace capture that we have shows LLC at this point,
* so that's what I'm calling */
- capture_llc(pd, 0, len, ld);
+ capture_llc(pd, 0, len, ld, pseudo_header);
break;
case TRAF_LANE:
@@ -2007,6 +2008,8 @@ proto_register_atm(void)
register_dissector("atm_oam_cell", dissect_atm_oam_cell, proto_oamaal);
register_dissector("atm_pw_oam_cell", dissect_atm_pw_oam_cell, proto_oamaal);
+ register_capture_dissector(WTAP_ENCAP_ATM_PDUS, capture_atm, proto_atm);
+
atm_module = prefs_register_protocol ( proto_atm, NULL );
prefs_register_bool_preference(atm_module, "dissect_lane_as_sscop", "Dissect LANE as SSCOP",
"Autodection between LANE and SSCOP is hard. As default LANE is preferred",
diff --git a/epan/dissectors/packet-atm.h b/epan/dissectors/packet-atm.h
index d0bb6f0a27..20a3b9a76e 100644
--- a/epan/dissectors/packet-atm.h
+++ b/epan/dissectors/packet-atm.h
@@ -22,12 +22,6 @@
#ifndef __PACKET_ATM_H__
#define __PACKET_ATM_H__
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_atm(const union wtap_pseudo_header *, const guchar *, int,
- packet_counts *);
-
gboolean atm_is_oam_cell(const guint16 vci, const guint8 pt); /*For pw-atm dissector*/
extern const value_string atm_pt_vals[]; /*For pw-atm dissector*/
diff --git a/epan/dissectors/packet-ax25-kiss.c b/epan/dissectors/packet-ax25-kiss.c
index 062df6ca17..e355bd15d0 100644
--- a/epan/dissectors/packet-ax25-kiss.c
+++ b/epan/dissectors/packet-ax25-kiss.c
@@ -111,9 +111,9 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/prefs.h>
#include <wiretap/wtap.h>
-#include "packet-ax25-kiss.h"
#include "packet-ax25.h"
#define STRLEN 80
@@ -178,8 +178,8 @@ static const value_string kiss_frame_types[] = {
{ 0, NULL }
};
-void
-capture_ax25_kiss( const guchar *pd, int offset, int len, packet_counts *ld)
+static void
+capture_ax25_kiss( const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
int l_offset;
guint8 kiss_cmd;
@@ -195,14 +195,14 @@ capture_ax25_kiss( const guchar *pd, int offset, int len, packet_counts *ld)
l_offset += KISS_HEADER_SIZE; /* step over kiss header */
switch ( kiss_cmd & KISS_CMD_MASK )
{
- case KISS_DATA_FRAME : capture_ax25( pd, l_offset, len, ld ); break;
+ case KISS_DATA_FRAME : capture_ax25( pd, l_offset, len, ld, pseudo_header ); break;
case KISS_TXDELAY : break;
case KISS_PERSISTENCE : break;
case KISS_SLOT_TIME : break;
case KISS_TXTAIL : break;
case KISS_FULLDUPLEX : break;
case KISS_SETHARDWARE : break;
- case KISS_DATA_FRAME_ACK: l_offset += 2; capture_ax25( pd, l_offset, len, ld ); break;
+ case KISS_DATA_FRAME_ACK: l_offset += 2; capture_ax25( pd, l_offset, len, ld, pseudo_header ); break;
case KISS_POLL_MODE : break;
case KISS_RETURN : break;
default : break;
@@ -432,6 +432,8 @@ proto_register_ax25_kiss(void)
proto_register_field_array( proto_ax25_kiss, hf, array_length( hf ) );
proto_register_subtree_array( ett, array_length( ett ) );
+ register_capture_dissector(WTAP_ENCAP_AX25_KISS, capture_ax25_kiss, proto_ax25_kiss);
+
/* Register preferences module */
ax25_kiss_module = prefs_register_protocol( proto_ax25_kiss, NULL);
diff --git a/epan/dissectors/packet-ax25-kiss.h b/epan/dissectors/packet-ax25-kiss.h
deleted file mode 100644
index ad0de8eb53..0000000000
--- a/epan/dissectors/packet-ax25-kiss.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* packet-ax25-kiss.h
- *
- * Routines for AX.25 KISS protocol dissection
- * Copyright 2010,2012 R.W. Stearn <richard@rns-stearn.demon.co.uk>
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_AX25_KISS_H__
-#define __PACKET_AX25_KISS_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_ax25_kiss(const guchar *, int, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-ax25.c b/epan/dissectors/packet-ax25.c
index d29203dcfb..cb6512dc55 100644
--- a/epan/dissectors/packet-ax25.c
+++ b/epan/dissectors/packet-ax25.c
@@ -45,6 +45,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wiretap/wtap.h>
#include <epan/to_str.h>
#include <epan/xdlc.h>
@@ -254,7 +255,7 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
}
void
-capture_ax25( const guchar *pd, int offset, int len, packet_counts *ld)
+capture_ax25( const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint8 control;
guint8 pid;
@@ -426,6 +427,8 @@ proto_register_ax25(void)
proto_register_field_array( proto_ax25, hf, array_length(hf ) );
proto_register_subtree_array(ett, array_length(ett ) );
+ register_capture_dissector(WTAP_ENCAP_AX25, capture_ax25, proto_ax25);
+
/* Register dissector table for protocol IDs */
ax25_dissector_table = register_dissector_table("ax25.pid", "AX.25 protocol ID", FT_UINT8, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
}
diff --git a/epan/dissectors/packet-ax25.h b/epan/dissectors/packet-ax25.h
index a9f4904165..eb99711428 100644
--- a/epan/dissectors/packet-ax25.h
+++ b/epan/dissectors/packet-ax25.h
@@ -25,9 +25,7 @@
#ifndef __PACKET_AX25_H__
#define __PACKET_AX25_H__
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_ax25(const guchar *, int, int, packet_counts *);
+extern
+void capture_ax25(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
#endif
diff --git a/epan/dissectors/packet-bpq.c b/epan/dissectors/packet-bpq.c
index 0a6421b6cb..f6b127338e 100644
--- a/epan/dissectors/packet-bpq.c
+++ b/epan/dissectors/packet-bpq.c
@@ -102,7 +102,7 @@ dissect_bpq( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
}
void
-capture_bpq( const guchar *pd, int offset, int len, packet_counts *ld)
+capture_bpq( const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
int l_offset;
@@ -114,7 +114,7 @@ capture_bpq( const guchar *pd, int offset, int len, packet_counts *ld)
l_offset = offset;
l_offset += BPQ_HEADER_SIZE; /* step over bpq header to point at the AX.25 packet*/
- capture_ax25( pd, l_offset, len, ld );
+ capture_ax25( pd, l_offset, len, ld, pseudo_header );
}
void
diff --git a/epan/dissectors/packet-bpq.h b/epan/dissectors/packet-bpq.h
index 5e94f0168b..e0d7055cd9 100644
--- a/epan/dissectors/packet-bpq.h
+++ b/epan/dissectors/packet-bpq.h
@@ -25,6 +25,6 @@
#ifndef __PACKET_BPQ_H__
#define __PACKET_BPQ_H__
-void capture_bpq(const guchar *, int, int, packet_counts *);
+void capture_bpq(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
#endif
diff --git a/epan/dissectors/packet-chdlc.c b/epan/dissectors/packet-chdlc.c
index d56c294ae9..b81796af59 100644
--- a/epan/dissectors/packet-chdlc.c
+++ b/epan/dissectors/packet-chdlc.c
@@ -23,6 +23,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wsutil/pint.h>
#include <epan/etypes.h>
#include <epan/prefs.h>
@@ -113,7 +114,7 @@ const value_string chdlc_vals[] = {
};
void
-capture_chdlc( const guchar *pd, int offset, int len, packet_counts *ld ) {
+capture_chdlc( const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_ ) {
if (!BYTES_ARE_IN_FRAME(offset, len, 4)) {
ld->other++;
return;
@@ -232,6 +233,8 @@ proto_register_chdlc(void)
proto_register_field_array(proto_chdlc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ register_capture_dissector(WTAP_ENCAP_CHDLC, capture_chdlc, proto_chdlc);
+
/* subdissector code */
subdissector_table = register_dissector_table("chdlc.protocol",
"Cisco HDLC protocol",
diff --git a/epan/dissectors/packet-chdlc.h b/epan/dissectors/packet-chdlc.h
index fac6c049a3..be7f96995c 100644
--- a/epan/dissectors/packet-chdlc.h
+++ b/epan/dissectors/packet-chdlc.h
@@ -31,10 +31,8 @@
#define CHDLC_ADDR_UNICAST 0x0f
#define CHDLC_ADDR_MULTICAST 0x8f
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_chdlc(const guchar *, int, int, packet_counts *);
+extern
+void capture_chdlc(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
extern const value_string chdlc_vals[];
diff --git a/epan/dissectors/packet-clip.c b/epan/dissectors/packet-clip.c
index 465a6b02b4..17027c3dbc 100644
--- a/epan/dissectors/packet-clip.c
+++ b/epan/dissectors/packet-clip.c
@@ -26,10 +26,10 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/expert.h>
#include <wiretap/wtap.h>
-#include "packet-clip.h"
#include "packet-ip.h"
void proto_register_clip(void);
@@ -43,10 +43,10 @@ static expert_field ei_no_link_info = EI_INIT;
static dissector_handle_t ip_handle;
-void
-capture_clip( const guchar *pd, int len, packet_counts *ld ) {
+static void
+capture_clip( const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_ ) {
- capture_ip(pd, 0, len, ld);
+ capture_ip(pd, offset, len, ld);
}
static int
@@ -109,6 +109,8 @@ proto_register_clip(void)
proto_register_subtree_array(ett, array_length(ett));
expert_clip = expert_register_protocol(proto_clip);
expert_register_field_array(expert_clip, ei, array_length(ei));
+
+ register_capture_dissector(WTAP_ENCAP_LINUX_ATM_CLIP, capture_clip, proto_clip);
}
void
diff --git a/epan/dissectors/packet-clip.h b/epan/dissectors/packet-clip.h
deleted file mode 100644
index 0fd849ce6a..0000000000
--- a/epan/dissectors/packet-clip.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-clip.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_CLIP_H__
-#define __PACKET_CLIP_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_clip(const guchar *, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-enc.c b/epan/dissectors/packet-enc.c
index abab500169..a78d643e1b 100644
--- a/epan/dissectors/packet-enc.c
+++ b/epan/dissectors/packet-enc.c
@@ -26,10 +26,10 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/addr_resolv.h>
#include <epan/aftypes.h>
#include <wsutil/pint.h>
-#include "packet-enc.h"
#include "packet-ip.h"
#include "packet-ipv6.h"
@@ -65,8 +65,8 @@ static int hf_enc_flags = -1;
static gint ett_enc = -1;
-void
-capture_enc(const guchar *pd, int len, packet_counts *ld)
+static void
+capture_enc(const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint32 af;
@@ -181,6 +181,8 @@ proto_register_enc(void)
"ENC", "enc");
proto_register_field_array(proto_enc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ register_capture_dissector(WTAP_ENCAP_ENC, capture_enc, proto_enc);
}
void
diff --git a/epan/dissectors/packet-enc.h b/epan/dissectors/packet-enc.h
deleted file mode 100644
index 6f1ae3f530..0000000000
--- a/epan/dissectors/packet-enc.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-enc.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_ENC_H__
-#define __PACKET_ENC_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_enc(const guchar *, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c
index a8ca40162c..c04995ca22 100644
--- a/epan/dissectors/packet-eth.c
+++ b/epan/dissectors/packet-eth.c
@@ -30,6 +30,7 @@
#include <epan/expert.h>
#include <epan/conversation_table.h>
#include <epan/dissector_filters.h>
+#include <epan/capture_dissectors.h>
#include <wsutil/pint.h>
#include "packet-eth.h"
#include "packet-ieee8023.h"
@@ -191,7 +192,7 @@ eth_build_filter(packet_info *pinfo)
#define ETHERNET_SNAP 3
void
-capture_eth(const guchar *pd, int offset, int len, packet_counts *ld)
+capture_eth(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint16 etype, length;
int ethhdr_type; /* the type of ethernet frame */
@@ -211,7 +212,7 @@ capture_eth(const guchar *pd, int offset, int len, packet_counts *ld)
if ((pd[offset] == 0x01 || pd[offset] == 0x0C) && pd[offset+1] == 0x00
&& pd[offset+2] == 0x0C && pd[offset+3] == 0x00
&& pd[offset+4] == 0x00) {
- capture_isl(pd, offset, len, ld);
+ capture_isl(pd, offset, len, ld, pseudo_header);
return;
}
}
@@ -274,7 +275,7 @@ capture_eth(const guchar *pd, int offset, int len, packet_counts *ld)
capture_ipx(ld);
break;
case ETHERNET_802_2:
- capture_llc(pd, offset, len, ld);
+ capture_llc(pd, offset, len, ld, pseudo_header);
break;
case ETHERNET_II:
capture_ethertype(etype, pd, offset, len, ld);
@@ -1013,6 +1014,7 @@ proto_register_eth(void)
register_dissector("eth_withoutfcs", dissect_eth_withoutfcs, proto_eth);
register_dissector("eth_withfcs", dissect_eth_withfcs, proto_eth);
register_dissector("eth", dissect_eth_maybefcs, proto_eth);
+ register_capture_dissector(WTAP_ENCAP_ETHERNET, capture_eth, proto_eth);
eth_tap = register_tap("eth");
register_conversation_table(proto_eth, TRUE, eth_conversation_packet, eth_hostlist_packet);
diff --git a/epan/dissectors/packet-eth.h b/epan/dissectors/packet-eth.h
index 22a2bf4419..2d42ecf2f5 100644
--- a/epan/dissectors/packet-eth.h
+++ b/epan/dissectors/packet-eth.h
@@ -22,16 +22,14 @@
#ifndef __PACKET_ETH_H__
#define __PACKET_ETH_H__
-#include "ws_symbol_export.h"
-
typedef struct _eth_hdr {
address dst;
address src;
guint16 type;
} eth_hdr;
-WS_DLL_PUBLIC
-void capture_eth(const guchar *, int, int, packet_counts *);
+extern
+void capture_eth(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
void add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
int trailer_id, tvbuff_t *tvb, tvbuff_t *trailer_tvb,
diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c
index 1d9d9cc6a5..97256e00fe 100644
--- a/epan/dissectors/packet-ethertype.c
+++ b/epan/dissectors/packet-ethertype.c
@@ -233,10 +233,10 @@ capture_ethertype(guint16 etype, const guchar *pd, int offset, int len,
capture_vines(ld);
break;
case ETHERTYPE_BPQ:
- capture_bpq(pd, offset, len, ld);
+ capture_bpq(pd, offset, len, ld, NULL);
break;
case ETHERTYPE_JUMBO_LLC:
- capture_llc(pd, offset, len, ld);
+ capture_llc(pd, offset, len, ld, NULL);
break;
default:
ld->other++;
diff --git a/epan/dissectors/packet-fddi.c b/epan/dissectors/packet-fddi.c
index c52cc21bbc..afb6b92535 100644
--- a/epan/dissectors/packet-fddi.c
+++ b/epan/dissectors/packet-fddi.c
@@ -32,7 +32,7 @@
#include <wsutil/bitswap.h>
#include <epan/prefs.h>
#include <epan/conversation_table.h>
-#include "packet-fddi.h"
+#include <epan/capture_dissectors.h>
#include "packet-llc.h"
#include "packet-sflow.h"
@@ -123,6 +123,12 @@ static const value_string mac_subtype_vals[] = {
{ 0, NULL }
};
+typedef struct _fddi_hdr {
+ guint8 fc;
+ address dst;
+ address src;
+} fddi_hdr;
+
#define FDDI_HEADER_SIZE 13
/* field positions */
@@ -193,10 +199,10 @@ fddi_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, con
return 1;
}
-void
-capture_fddi(const guchar *pd, int len, packet_counts *ld)
+static void
+capture_fddi(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
- int offset = 0, fc;
+ int fc;
if (!BYTES_ARE_IN_FRAME(0, len, FDDI_HEADER_SIZE + FDDI_PADDING)) {
ld->other++;
@@ -226,7 +232,7 @@ capture_fddi(const guchar *pd, int len, packet_counts *ld)
case FDDI_FC_LLC_ASYNC + 13 :
case FDDI_FC_LLC_ASYNC + 14 :
case FDDI_FC_LLC_ASYNC + 15 :
- capture_llc(pd, offset, len, ld);
+ capture_llc(pd, offset, len, ld, pseudo_header);
return;
default :
ld->other++;
@@ -513,6 +519,9 @@ proto_register_fddi(void)
*/
register_dissector("fddi", dissect_fddi_not_bitswapped, proto_fddi);
+ register_capture_dissector(WTAP_ENCAP_FDDI, capture_fddi, proto_fddi);
+ register_capture_dissector(WTAP_ENCAP_FDDI_BITSWAPPED, capture_fddi, proto_fddi);
+
fddi_module = prefs_register_protocol(proto_fddi, NULL);
prefs_register_bool_preference(fddi_module, "padding",
"Add 3-byte padding to all FDDI packets",
diff --git a/epan/dissectors/packet-fddi.h b/epan/dissectors/packet-fddi.h
deleted file mode 100644
index 4806b6594a..0000000000
--- a/epan/dissectors/packet-fddi.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* packet-fddi.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_FDDI_H__
-#define __PACKET_FDDI_H__
-
-#include "ws_symbol_export.h"
-
-typedef struct _fddi_hdr {
- guint8 fc;
- address dst;
- address src;
-} fddi_hdr;
-
-WS_DLL_PUBLIC
-void capture_fddi(const guchar *, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-fr.c b/epan/dissectors/packet-fr.c
index cbc3d817f1..a762e22169 100644
--- a/epan/dissectors/packet-fr.c
+++ b/epan/dissectors/packet-fr.c
@@ -35,6 +35,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#include <wiretap/wtap.h>
@@ -45,7 +46,6 @@
#include "packet-ip.h"
#include "packet-ipv6.h"
#include "packet-ppp.h"
-#include "packet-fr.h"
#include "packet-juniper.h"
#include "packet-sflow.h"
#include "packet-l2tp.h"
@@ -207,7 +207,7 @@ static const xdlc_cf_items fr_cf_items_ext = {
};
void
-capture_fr(const guchar *pd, int offset, int len, packet_counts *ld)
+capture_fr(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint8 fr_octet;
guint32 addr;
@@ -345,7 +345,7 @@ capture_fr(const guchar *pd, int offset, int len, packet_counts *ld)
break;
case NLPID_PPP:
- capture_ppp_hdlc(pd, offset, len, ld);
+ capture_ppp_hdlc(pd, offset, len, ld, pseudo_header);
break;
case NLPID_SNAP:
@@ -383,7 +383,7 @@ capture_fr(const guchar *pd, int offset, int len, packet_counts *ld)
* If the data does not start with unnumbered information (03) and
* the DLCI# is not 0, then there may be Cisco Frame Relay encapsulation.
*/
- capture_chdlc(pd, offset, len, ld);
+ capture_chdlc(pd, offset, len, ld, pseudo_header);
}
break;
@@ -393,7 +393,7 @@ capture_fr(const guchar *pd, int offset, int len, packet_counts *ld)
case RAW_ETHER:
if (addr != 0)
- capture_eth(pd, offset, len, ld);
+ capture_eth(pd, offset, len, ld, pseudo_header);
else
ld->other++;
break;
@@ -988,6 +988,8 @@ proto_register_fr(void)
register_dissector("fr_uncompressed", dissect_fr_uncompressed, proto_fr);
register_dissector("fr", dissect_fr, proto_fr);
register_dissector("fr_stripped_address", dissect_fr_stripped_address, proto_fr);
+ register_capture_dissector(WTAP_ENCAP_FRELAY, capture_fr, proto_fr);
+ register_capture_dissector(WTAP_ENCAP_FRELAY_WITH_PHDR, capture_fr, proto_fr);
frencap_module = prefs_register_protocol(proto_fr, NULL);
/*
diff --git a/epan/dissectors/packet-fr.h b/epan/dissectors/packet-fr.h
deleted file mode 100644
index 1b35e888f8..0000000000
--- a/epan/dissectors/packet-fr.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-fr.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_FR_H__
-#define __PACKET_FR_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_fr(const guchar *, int, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-i2c.c b/epan/dissectors/packet-i2c.c
index 305a56e314..63a8bb152c 100644
--- a/epan/dissectors/packet-i2c.c
+++ b/epan/dissectors/packet-i2c.c
@@ -25,12 +25,11 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/prefs.h>
#include <epan/decode_as.h>
#include <wiretap/wtap.h>
-#include "packet-i2c.h"
-
void proto_register_i2c(void);
void proto_reg_handoff_i2c(void);
@@ -85,8 +84,8 @@ static gpointer i2c_value(packet_info *pinfo _U_)
return 0;
}
-void
-capture_i2c(union wtap_pseudo_header *pseudo_header, packet_counts *ld)
+static void
+capture_i2c(const guchar *pd _U_, int offset _U_, int len _U_, packet_counts *ld, const union wtap_pseudo_header *pseudo_header)
{
if (pseudo_header->i2c.is_event) {
ld->i2c_event++;
@@ -248,6 +247,8 @@ proto_register_i2c(void)
proto_register_field_array(proto_i2c, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ register_capture_dissector(WTAP_ENCAP_I2C, capture_i2c, proto_i2c);
+
subdissector_table = register_dissector_table("i2c.message", "I2C messages dissector", FT_UINT32, BASE_DEC, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
m = prefs_register_protocol(proto_i2c, NULL);
diff --git a/epan/dissectors/packet-i2c.h b/epan/dissectors/packet-i2c.h
deleted file mode 100644
index 231e6f1a23..0000000000
--- a/epan/dissectors/packet-i2c.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-i2c.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_I2C_H__
-#define __PACKET_I2C_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_i2c(union wtap_pseudo_header *, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-ieee80211-prism.c b/epan/dissectors/packet-ieee80211-prism.c
index 4d9d734f1d..6d223d8dee 100644
--- a/epan/dissectors/packet-ieee80211-prism.c
+++ b/epan/dissectors/packet-ieee80211-prism.c
@@ -25,6 +25,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wiretap/wtap.h>
#include <wsutil/pint.h>
#include "packet-ieee80211.h"
@@ -236,8 +237,8 @@ prism_rate_return(guint32 rate)
}
-void
-capture_prism(const guchar *pd, int offset, int len, packet_counts *ld)
+static void
+capture_prism(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint32 cookie;
@@ -250,7 +251,7 @@ capture_prism(const guchar *pd, int offset, int len, packet_counts *ld)
cookie = pntoh32(pd);
if ((cookie == WLANCAP_MAGIC_COOKIE_V1) ||
(cookie == WLANCAP_MAGIC_COOKIE_V2)) {
- capture_wlancap(pd, offset, len, ld);
+ capture_wlancap(pd, offset, len, ld, pseudo_header);
return;
}
@@ -262,7 +263,7 @@ capture_prism(const guchar *pd, int offset, int len, packet_counts *ld)
offset += PRISM_HEADER_LENGTH;
/* 802.11 header follows */
- capture_ieee80211(pd, offset, len, ld);
+ capture_ieee80211(pd, offset, len, ld, pseudo_header);
}
static int
@@ -557,6 +558,8 @@ void proto_register_ieee80211_prism(void)
"prism");
proto_register_field_array(proto_prism, hf_prism, array_length(hf_prism));
proto_register_subtree_array(tree_array, array_length(tree_array));
+
+ register_capture_dissector(WTAP_ENCAP_IEEE_802_11_PRISM, capture_prism, proto_prism);
}
void proto_reg_handoff_ieee80211_prism(void)
diff --git a/epan/dissectors/packet-ieee80211-radiotap.c b/epan/dissectors/packet-ieee80211-radiotap.c
index dd10179893..2831e43081 100644
--- a/epan/dissectors/packet-ieee80211-radiotap.c
+++ b/epan/dissectors/packet-ieee80211-radiotap.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wsutil/pint.h>
#include <epan/crc32-tvb.h>
#include <wsutil/frequency-utils.h>
@@ -36,9 +37,10 @@
#include <epan/addr_resolv.h>
#include <epan/expert.h>
#include "packet-ieee80211.h"
-#include "packet-ieee80211-radiotap.h"
#include "packet-ieee80211-radiotap-iter.h"
+void proto_register_radiotap(void);
+void proto_reg_handoff_radiotap(void);
/* protocol */
static int proto_radiotap = -1;
@@ -222,6 +224,16 @@ static int radiotap_tap = -1;
/* Settings */
static gboolean radiotap_bit14_fcs = FALSE;
+struct _radiotap_info {
+ guint radiotap_length;
+ guint32 rate;
+ gint8 dbm_antsignal;
+ gint8 dbm_antnoise;
+ guint32 freq;
+ guint32 flags;
+ guint64 tsft;
+};
+
#define BITNO_32(x) (((x) >> 16) ? 16 + BITNO_16((x) >> 16) : BITNO_16((x)))
#define BITNO_16(x) (((x) >> 8) ? 8 + BITNO_8((x) >> 8) : BITNO_8((x)))
#define BITNO_8(x) (((x) >> 4) ? 4 + BITNO_4((x) >> 4) : BITNO_4((x)))
@@ -443,8 +455,8 @@ static const true_false_string preamble_type = {
* dissectors, such as tcpdump(8), expect the padding.
*/
-void
-capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld)
+static void
+capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint16 it_len;
guint32 present, xpresent;
@@ -536,7 +548,7 @@ capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld)
if (rflags & IEEE80211_RADIOTAP_F_DATAPAD)
capture_ieee80211_datapad(pd, offset + it_len, len, ld);
else
- capture_ieee80211(pd, offset + it_len, len, ld);
+ capture_ieee80211(pd, offset + it_len, len, ld, pseudo_header);
}
static int
@@ -2650,6 +2662,7 @@ void proto_register_radiotap(void)
expert_radiotap = expert_register_protocol(proto_radiotap);
expert_register_field_array(expert_radiotap, ei, array_length(ei));
register_dissector("radiotap", dissect_radiotap, proto_radiotap);
+ register_capture_dissector(WTAP_ENCAP_IEEE_802_11_RADIOTAP, capture_radiotap, proto_radiotap);
radiotap_tap = register_tap("radiotap");
diff --git a/epan/dissectors/packet-ieee80211-radiotap.h b/epan/dissectors/packet-ieee80211-radiotap.h
deleted file mode 100644
index 22c8d27d60..0000000000
--- a/epan/dissectors/packet-ieee80211-radiotap.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * packet-ieee80211-radiotap.h
- * Declarations for packet-ieee80211-radiotap.c
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * Copied from README.developer
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_IEEE80211_RADIOTAP_H__
-#define __PACKET_IEEE80211_RADIOTAP_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_radiotap(const guchar *pd, int offset, int len, packet_counts *ld);
-void proto_register_radiotap(void);
-void proto_reg_handoff_radiotap(void);
-
-struct _radiotap_info {
- guint radiotap_length;
- guint32 rate;
- gint8 dbm_antsignal;
- gint8 dbm_antnoise;
- guint32 freq;
- guint32 flags;
- guint64 tsft;
-};
-
-#endif
diff --git a/epan/dissectors/packet-ieee80211-wlancap.c b/epan/dissectors/packet-ieee80211-wlancap.c
index 89bb326f90..ad53c78a30 100644
--- a/epan/dissectors/packet-ieee80211-wlancap.c
+++ b/epan/dissectors/packet-ieee80211-wlancap.c
@@ -25,6 +25,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wiretap/wtap.h>
#include <wsutil/pint.h>
#include <wsutil/frequency-utils.h>
@@ -72,7 +73,7 @@ static gint ett_wlancap = -1;
static dissector_handle_t wlancap_handle;
void
-capture_wlancap(const guchar *pd, int offset, int len, packet_counts *ld)
+capture_wlancap(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint32 length;
@@ -91,7 +92,7 @@ capture_wlancap(const guchar *pd, int offset, int len, packet_counts *ld)
offset += length;
/* 802.11 header follows */
- capture_ieee80211(pd, offset, len, ld);
+ capture_ieee80211(pd, offset, len, ld, pseudo_header);
}
/*
@@ -848,6 +849,7 @@ void proto_register_ieee80211_wlancap(void)
proto_register_field_array(proto_wlancap, hf_wlancap,
array_length(hf_wlancap));
register_dissector("wlancap", dissect_wlancap, proto_wlancap);
+ register_capture_dissector(WTAP_ENCAP_IEEE_802_11_AVS, capture_wlancap, proto_wlancap);
wlancap_handle = create_dissector_handle(dissect_wlancap, proto_wlancap);
dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_AVS,
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index 6e6a9784c3..4c0beb3bbc 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -81,6 +81,7 @@
#include <math.h>
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/exceptions.h>
#include <wsutil/pint.h>
#include <wsutil/str_util.h>
@@ -5742,10 +5743,10 @@ capture_ieee80211_common (const guchar * pd, int offset, int len,
if ((pd[offset+hdr_length] == 0xff) && (pd[offset+hdr_length+1] == 0xff))
capture_ipx (ld);
else if ((pd[offset+hdr_length] == 0x00) && (pd[offset+hdr_length+1] == 0x00))
- capture_llc (pd, offset + hdr_length + 2, len, ld);
+ capture_llc (pd, offset + hdr_length + 2, len, ld, NULL);
}
else {
- capture_llc (pd, offset + hdr_length, len, ld);
+ capture_llc (pd, offset + hdr_length, len, ld, NULL);
}
break;
}
@@ -5760,7 +5761,7 @@ capture_ieee80211_common (const guchar * pd, int offset, int len,
* Handle 802.11 with a variable-length link-layer header.
*/
void
-capture_ieee80211 (const guchar * pd, int offset, int len, packet_counts * ld)
+capture_ieee80211 (const guchar * pd, int offset, int len, packet_counts * ld, const union wtap_pseudo_header *pseudo_header _U_)
{
capture_ieee80211_common (pd, offset, len, ld, FALSE);
}
@@ -27073,6 +27074,9 @@ proto_register_ieee80211 (void)
register_dissector("wlan_withoutfcs", dissect_ieee80211_withoutfcs, proto_wlan);
register_dissector("wlan_bsfc", dissect_ieee80211_bsfc, proto_wlan);
+ register_capture_dissector(WTAP_ENCAP_IEEE_802_11, capture_ieee80211, proto_wlan);
+ register_capture_dissector(WTAP_ENCAP_IEEE_802_11_WITH_RADIO, capture_ieee80211, proto_wlan);
+
register_init_routine(wlan_defragment_init);
register_cleanup_routine(wlan_defragment_cleanup);
register_init_routine(wlan_retransmit_init);
diff --git a/epan/dissectors/packet-ieee80211.h b/epan/dissectors/packet-ieee80211.h
index ea24b173be..29c36bf8e5 100644
--- a/epan/dissectors/packet-ieee80211.h
+++ b/epan/dissectors/packet-ieee80211.h
@@ -31,14 +31,12 @@
extern "C" {
#endif /* __cplusplus */
-WS_DLL_PUBLIC
-void capture_ieee80211 (const guchar *, int, int, packet_counts *);
+extern
+void capture_ieee80211 (const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
void capture_ieee80211_datapad (const guchar *, int, int, packet_counts *);
-WS_DLL_PUBLIC
-void capture_prism(const guchar *, int, int, packet_counts *);
-WS_DLL_PUBLIC
-void capture_wlancap(const guchar *, int, int, packet_counts *);
+extern
+void capture_wlancap(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
void dissect_wifi_p2p_ie(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
int offset, gint size);
diff --git a/epan/dissectors/packet-ieee8021ah.c b/epan/dissectors/packet-ieee8021ah.c
index 1fea137b20..c830ffd4f1 100644
--- a/epan/dissectors/packet-ieee8021ah.c
+++ b/epan/dissectors/packet-ieee8021ah.c
@@ -91,7 +91,7 @@ capture_ieee8021ah(const guchar *pd, int offset, int len, packet_counts *ld)
capture_ipx(ld);
}
else {
- capture_llc(pd, offset + IEEE8021AH_LEN,len,ld);
+ capture_llc(pd, offset + IEEE8021AH_LEN,len,ld, NULL);
}
}
else {
diff --git a/epan/dissectors/packet-ipfc.c b/epan/dissectors/packet-ipfc.c
index 5c885e61a5..b7b4f16c6d 100644
--- a/epan/dissectors/packet-ipfc.c
+++ b/epan/dissectors/packet-ipfc.c
@@ -27,10 +27,10 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wiretap/wtap.h>
#include <epan/to_str.h>
-#include "packet-ipfc.h"
#include "packet-llc.h"
void proto_register_ipfc(void);
@@ -45,15 +45,15 @@ static int hf_ipfc_network_sa = -1;
static gint ett_ipfc = -1;
static dissector_handle_t llc_handle;
-void
-capture_ipfc (const guchar *pd, int len, packet_counts *ld)
+static void
+capture_ipfc (const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
if (!BYTES_ARE_IN_FRAME(0, len, 16)) {
ld->other++;
return;
}
- capture_llc(pd, 16, len, ld);
+ capture_llc(pd, 16, len, ld, pseudo_header);
}
static int
@@ -114,6 +114,8 @@ proto_register_ipfc (void)
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_ipfc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ register_capture_dissector(WTAP_ENCAP_IP_OVER_FC, capture_ipfc, proto_ipfc);
}
/* If this dissector uses sub-dissector registration add a registration routine.
diff --git a/epan/dissectors/packet-ipfc.h b/epan/dissectors/packet-ipfc.h
deleted file mode 100644
index 8fc077af54..0000000000
--- a/epan/dissectors/packet-ipfc.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-ipfc.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_IPFC_H__
-#define __PACKET_IPFC_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_ipfc(const guchar *, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-isl.c b/epan/dissectors/packet-isl.c
index 462b484623..e3a34eab16 100644
--- a/epan/dissectors/packet-isl.c
+++ b/epan/dissectors/packet-isl.c
@@ -89,7 +89,7 @@ static dissector_handle_t tr_handle;
static dissector_handle_t data_handle;
void
-capture_isl(const guchar *pd, int offset, int len, packet_counts *ld)
+capture_isl(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint8 type;
@@ -104,12 +104,12 @@ capture_isl(const guchar *pd, int offset, int len, packet_counts *ld)
case TYPE_ETHER:
offset += 14+12; /* skip the header */
- capture_eth(pd, offset, len, ld);
+ capture_eth(pd, offset, len, ld, pseudo_header);
break;
case TYPE_TR:
offset += 14+17; /* skip the header */
- capture_tr(pd, offset, len, ld);
+ capture_tr(pd, offset, len, ld, pseudo_header);
break;
default:
diff --git a/epan/dissectors/packet-isl.h b/epan/dissectors/packet-isl.h
index b406408b63..1f08570089 100644
--- a/epan/dissectors/packet-isl.h
+++ b/epan/dissectors/packet-isl.h
@@ -22,7 +22,7 @@
#ifndef __PACKET_ISL_H__
#define __PACKET_ISL_H__
-void capture_isl(const guchar *, int, int, packet_counts *);
+void capture_isl(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
void dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int fcs_len);
diff --git a/epan/dissectors/packet-llc.c b/epan/dissectors/packet-llc.c
index 0b39bb2e8d..588f5c2581 100644
--- a/epan/dissectors/packet-llc.c
+++ b/epan/dissectors/packet-llc.c
@@ -251,7 +251,7 @@ llc_add_oui(guint32 oui, const char *table_name, const char *table_ui_name,
}
void
-capture_llc(const guchar *pd, int offset, int len, packet_counts *ld) {
+capture_llc(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_) {
int is_snap;
guint16 control;
diff --git a/epan/dissectors/packet-llc.h b/epan/dissectors/packet-llc.h
index 3b61f4df1d..153c122ac1 100644
--- a/epan/dissectors/packet-llc.h
+++ b/epan/dissectors/packet-llc.h
@@ -24,7 +24,7 @@
#include "ws_symbol_export.h"
-void capture_llc(const guchar *, int, int, packet_counts *);
+void capture_llc(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
extern const value_string sap_vals[];
diff --git a/epan/dissectors/packet-null.c b/epan/dissectors/packet-null.c
index 369478b032..de405238d0 100644
--- a/epan/dissectors/packet-null.c
+++ b/epan/dissectors/packet-null.c
@@ -27,7 +27,7 @@
#include <wsutil/pint.h>
#include <epan/packet.h>
-#include "packet-null.h"
+#include <epan/capture_dissectors.h>
#include "packet-ip.h"
#include "packet-ipv6.h"
#include "packet-ppp.h"
@@ -65,8 +65,8 @@ static const value_string family_vals[] = {
static dissector_handle_t ppp_hdlc_handle;
static dissector_handle_t data_handle;
-void
-capture_null( const guchar *pd, int len, packet_counts *ld )
+static void
+capture_null( const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_ )
{
guint32 null_header;
@@ -260,7 +260,7 @@ capture_null( const guchar *pd, int len, packet_counts *ld )
/*
* Hand it to PPP.
*/
- capture_ppp_hdlc(pd, 0, len, ld);
+ capture_ppp_hdlc(pd, 0, len, ld, pseudo_header);
} else {
/*
* Treat it as a normal DLT_NULL header.
@@ -340,8 +340,8 @@ capture_null( const guchar *pd, int len, packet_counts *ld )
}
}
-void
-capture_loop( const guchar *pd, int len, packet_counts *ld )
+static void
+capture_loop( const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_ )
{
guint32 loop_family;
@@ -535,6 +535,9 @@ proto_register_null(void)
proto_register_field_array(proto_null, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ register_capture_dissector(WTAP_ENCAP_NULL, capture_null, proto_null);
+ register_capture_dissector(WTAP_ENCAP_LOOP, capture_loop, proto_null);
+
/* subdissector code */
null_dissector_table = register_dissector_table("null.type",
"Null type", FT_UINT32, BASE_DEC, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
diff --git a/epan/dissectors/packet-null.h b/epan/dissectors/packet-null.h
deleted file mode 100644
index b5354dcd9f..0000000000
--- a/epan/dissectors/packet-null.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* packet-null.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_NULL_H__
-#define __PACKET_NULL_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_null(const guchar *, int, packet_counts *);
-
-WS_DLL_PUBLIC
-void capture_loop(const guchar *, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-pktap.c b/epan/dissectors/packet-pktap.c
index f2158770ee..bf7c08658b 100644
--- a/epan/dissectors/packet-pktap.c
+++ b/epan/dissectors/packet-pktap.c
@@ -24,13 +24,13 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/expert.h>
#include <wsutil/pint.h>
#include "packet-frame.h"
#include "packet-eth.h"
-#include "packet-pktap.h"
/* Needed for wtap_pcap_encap_to_wtap_encap(). */
#include <wiretap/pcap-encap.h>
@@ -94,8 +94,8 @@ static dissector_handle_t pktap_handle;
* to host byte order in libwiretap.
*/
-void
-capture_pktap(const guchar *pd, int len, packet_counts *ld)
+static void
+capture_pktap(const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint32 hdrlen, rectype, dlt;
@@ -117,7 +117,7 @@ capture_pktap(const guchar *pd, int len, packet_counts *ld)
switch (dlt) {
case 1: /* DLT_EN10MB */
- capture_eth(pd, hdrlen, len, ld);
+ capture_eth(pd, hdrlen, len, ld, pseudo_header);
return;
default:
@@ -278,6 +278,13 @@ proto_register_pktap(void)
expert_pktap = expert_register_protocol(proto_pktap);
expert_register_field_array(expert_pktap, ei, array_length(ei));
+ /* XXX - WTAP_ENCAP_USER2 to handle Mavericks' botch wherein it
+ uses DLT_USER2 for PKTAP; if you are using DLT_USER2 for your
+ own purposes, feel free to call your own capture_ routine for
+ WTAP_ENCAP_USER2. */
+ register_capture_dissector(WTAP_ENCAP_PKTAP, capture_pktap, proto_pktap);
+ register_capture_dissector(WTAP_ENCAP_USER2, capture_pktap, proto_pktap);
+
pktap_handle = register_dissector("pktap", dissect_pktap, proto_pktap);
}
diff --git a/epan/dissectors/packet-pktap.h b/epan/dissectors/packet-pktap.h
deleted file mode 100644
index 82ef757382..0000000000
--- a/epan/dissectors/packet-pktap.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-pktap.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_PKTAP_H__
-#define __PACKET_PKTAP_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_pktap(const guchar *, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-ppi.c b/epan/dissectors/packet-ppi.c
index d79a3b241a..101af89a86 100644
--- a/epan/dissectors/packet-ppi.c
+++ b/epan/dissectors/packet-ppi.c
@@ -46,6 +46,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/exceptions.h>
#include <epan/ptvcursor.h>
#include <epan/prefs.h>
@@ -61,7 +62,6 @@
#include "packet-frame.h"
#include "packet-eth.h"
#include "packet-ieee80211.h"
-#include "packet-ppi.h"
/*
* Per-Packet Information (PPI) header.
@@ -386,8 +386,8 @@ static reassembly_table ampdu_reassembly_table;
static gboolean ppi_ampdu_reassemble = TRUE;
-void
-capture_ppi(const guchar *pd, int len, packet_counts *ld)
+static void
+capture_ppi(const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint32 dlt;
guint ppi_len;
@@ -403,10 +403,10 @@ capture_ppi(const guchar *pd, int len, packet_counts *ld)
/* XXX - We should probably combine this with capture_info.c:capture_info_packet() */
switch(dlt) {
case 1: /* DLT_EN10MB */
- capture_eth(pd, ppi_len, len, ld);
+ capture_eth(pd, ppi_len, len, ld, pseudo_header);
return;
case 105: /* DLT_DLT_IEEE802_11 */
- capture_ieee80211(pd, ppi_len, len, ld);
+ capture_ieee80211(pd, ppi_len, len, ld, pseudo_header);
return;
default:
break;
@@ -1494,6 +1494,7 @@ proto_register_ppi(void)
expert_register_field_array(expert_ppi, ei, array_length(ei));
ppi_handle = register_dissector("ppi", dissect_ppi, proto_ppi);
+ register_capture_dissector(WTAP_ENCAP_PPI, capture_ppi, proto_ppi);
register_init_routine(ampdu_reassemble_init);
register_cleanup_routine(ampdu_reassemble_cleanup);
diff --git a/epan/dissectors/packet-ppi.h b/epan/dissectors/packet-ppi.h
deleted file mode 100644
index 6515099553..0000000000
--- a/epan/dissectors/packet-ppi.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-ppi.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_PPI_H__
-#define __PACKET_PPI_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_ppi(const guchar *pd, int len, packet_counts *ld);
-
-#endif
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index 4b3bda8458..6803988543 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -26,6 +26,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wsutil/pint.h>
#include <wsutil/str_util.h>
#include <epan/prefs.h>
@@ -1950,14 +1951,14 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset)
}
void
-capture_ppp_hdlc(const guchar *pd, int offset, int len, packet_counts *ld)
+capture_ppp_hdlc(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
ld->other++;
return;
}
if (pd[0] == CHDLC_ADDR_UNICAST || pd[0] == CHDLC_ADDR_MULTICAST) {
- capture_chdlc(pd, offset, len, ld);
+ capture_chdlc(pd, offset, len, ld, pseudo_header);
return;
}
if (!BYTES_ARE_IN_FRAME(offset, len, 4)) {
@@ -5597,6 +5598,8 @@ proto_register_ppp_raw_hdlc(void)
"PPP-HDLC", "ppp_hdlc");
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_ppp_hdlc, hf, array_length(hf));
+
+ register_capture_dissector(WTAP_ENCAP_PPP, capture_ppp_hdlc, proto_ppp_hdlc);
}
void
diff --git a/epan/dissectors/packet-ppp.h b/epan/dissectors/packet-ppp.h
index 821992ff3b..aeb5e54981 100644
--- a/epan/dissectors/packet-ppp.h
+++ b/epan/dissectors/packet-ppp.h
@@ -28,8 +28,8 @@
/* PPP options */
extern gboolean ppp_vj_decomp;/* FALSE = No VJ header decompression,
TRUE = Decompress VJ */
-WS_DLL_PUBLIC
-void capture_ppp_hdlc(const guchar *, int, int, packet_counts *);
+extern
+void capture_ppp_hdlc(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header _U_);
tvbuff_t *decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset);
diff --git a/epan/dissectors/packet-raw.c b/epan/dissectors/packet-raw.c
index 3601a19217..c6e64d755d 100644
--- a/epan/dissectors/packet-raw.c
+++ b/epan/dissectors/packet-raw.c
@@ -25,8 +25,8 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <wiretap/wtap.h>
-#include "packet-raw.h"
#include "packet-ip.h"
#include "packet-ppp.h"
@@ -43,8 +43,8 @@ static dissector_handle_t ipv6_handle;
static dissector_handle_t data_handle;
static dissector_handle_t ppp_hdlc_handle;
-void
-capture_raw(const guchar *pd, int len, packet_counts *ld)
+static void
+capture_raw(const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
/* So far, the only time we get raw connection types are with Linux and
* Irix PPP connections. We can't tell what type of data is coming down
@@ -55,16 +55,16 @@ capture_raw(const guchar *pd, int len, packet_counts *ld)
* sometimes. This check should be removed when 2.2 is out.
*/
if (BYTES_ARE_IN_FRAME(0,len,2) && pd[0] == 0xff && pd[1] == 0x03) {
- capture_ppp_hdlc(pd, 0, len, ld);
+ capture_ppp_hdlc(pd, 0, len, ld, pseudo_header);
}
/* The Linux ISDN driver sends a fake MAC address before the PPP header
* on its ippp interfaces... */
else if (BYTES_ARE_IN_FRAME(0,len,8) && pd[6] == 0xff && pd[7] == 0x03) {
- capture_ppp_hdlc(pd, 6, len, ld);
+ capture_ppp_hdlc(pd, 6, len, ld, pseudo_header);
}
/* ...except when it just puts out one byte before the PPP header... */
else if (BYTES_ARE_IN_FRAME(0,len,3) && pd[1] == 0xff && pd[2] == 0x03) {
- capture_ppp_hdlc(pd, 1, len, ld);
+ capture_ppp_hdlc(pd, 1, len, ld, pseudo_header);
}
/* ...and if the connection is currently down, it sends 10 bytes of zeroes
* instead of a fake MAC address and PPP header. */
@@ -172,6 +172,8 @@ proto_register_raw(void)
proto_raw = proto_register_protocol("Raw packet data", "Raw", "raw");
proto_register_subtree_array(ett, array_length(ett));
+
+ register_capture_dissector(WTAP_ENCAP_RAW_IP, capture_raw, proto_raw);
}
void
diff --git a/epan/dissectors/packet-raw.h b/epan/dissectors/packet-raw.h
deleted file mode 100644
index 1ab3a61efb..0000000000
--- a/epan/dissectors/packet-raw.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* packet-raw.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_RAW_H__
-#define __PACKET_RAW_H__
-
-#include "ws_symbol_export.h"
-
-WS_DLL_PUBLIC
-void capture_raw(const guchar *, int, packet_counts *);
-
-#endif
diff --git a/epan/dissectors/packet-sll.c b/epan/dissectors/packet-sll.c
index 49830b4b26..029ab31ad1 100644
--- a/epan/dissectors/packet-sll.c
+++ b/epan/dissectors/packet-sll.c
@@ -25,6 +25,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/arptypes.h>
#include <wsutil/pint.h>
#include "packet-sll.h"
@@ -136,8 +137,8 @@ static dissector_table_t sll_linux_dissector_table;
static dissector_table_t gre_dissector_table;
static dissector_handle_t data_handle;
-void
-capture_sll(const guchar *pd, int len, packet_counts *ld)
+static void
+capture_sll(const guchar *pd, int offset _U_, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_)
{
guint16 protocol;
@@ -157,14 +158,14 @@ capture_sll(const guchar *pd, int len, packet_counts *ld)
/*
* 802.2 LLC.
*/
- capture_llc(pd, len, SLL_HEADER_SIZE, ld);
+ capture_llc(pd, len, SLL_HEADER_SIZE, ld, pseudo_header);
break;
case LINUX_SLL_P_ETHERNET:
/*
* Ethernet.
*/
- capture_eth(pd, SLL_HEADER_SIZE, len, ld);
+ capture_eth(pd, SLL_HEADER_SIZE, len, ld, pseudo_header);
break;
case LINUX_SLL_P_802_3:
@@ -179,7 +180,7 @@ capture_sll(const guchar *pd, int len, packet_counts *ld)
/*
* PPP HDLC.
*/
- capture_ppp_hdlc(pd, len, SLL_HEADER_SIZE, ld);
+ capture_ppp_hdlc(pd, len, SLL_HEADER_SIZE, ld, pseudo_header);
break;
default:
@@ -335,6 +336,8 @@ proto_register_sll(void)
proto_register_fields(proto_sll, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
+ register_capture_dissector(WTAP_ENCAP_SLL, capture_sll, proto_sll);
+
sll_handle = create_dissector_handle(dissect_sll, proto_sll);
sll_linux_dissector_table = register_dissector_table (
diff --git a/epan/dissectors/packet-sll.h b/epan/dissectors/packet-sll.h
index 228e9ccd67..6489b6e7b6 100644
--- a/epan/dissectors/packet-sll.h
+++ b/epan/dissectors/packet-sll.h
@@ -36,7 +36,4 @@
#define LINUX_SLL_P_ISI 0x00F5 /* Intelligent Service Interface */
#define LINUX_SLL_P_IEEE802154 0x00f6 /* 802.15.4 on monitor inteface */
-WS_DLL_PUBLIC
-void capture_sll(const guchar *, int, packet_counts *);
-
#endif
diff --git a/epan/dissectors/packet-tr.c b/epan/dissectors/packet-tr.c
index 3264304212..bebdfdfc3a 100644
--- a/epan/dissectors/packet-tr.c
+++ b/epan/dissectors/packet-tr.c
@@ -24,6 +24,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/capture_dissectors.h>
#include <epan/expert.h>
#include <epan/exceptions.h>
#include <epan/conversation_table.h>
@@ -246,7 +247,7 @@ static void
add_ring_bridge_pairs(int rcf_len, tvbuff_t*, proto_tree *tree);
void
-capture_tr(const guchar *pd, int offset, int len, packet_counts *ld) {
+capture_tr(const guchar *pd, int offset, int len, packet_counts *ld, const union wtap_pseudo_header *pseudo_header _U_) {
int source_routed = 0;
int frame_type;
@@ -365,7 +366,7 @@ capture_tr(const guchar *pd, int offset, int len, packet_counts *ld) {
ld->other++;
break;
case 1:
- capture_llc(pd, offset, len, ld);
+ capture_llc(pd, offset, len, ld, pseudo_header);
break;
default:
/* non-MAC, non-LLC, i.e., "Reserved" */
@@ -800,6 +801,7 @@ proto_register_tr(void)
&fix_linux_botches);
register_dissector("tr", dissect_tr, proto_tr);
+ register_capture_dissector(WTAP_ENCAP_TOKEN_RING, capture_tr, proto_tr);
tr_tap=register_tap("tr");
register_conversation_table(proto_tr, TRUE, tr_conversation_packet, tr_hostlist_packet);
diff --git a/epan/dissectors/packet-tr.h b/epan/dissectors/packet-tr.h
index 6bfae2ff87..6880f23c7f 100644
--- a/epan/dissectors/packet-tr.h
+++ b/epan/dissectors/packet-tr.h
@@ -31,7 +31,7 @@ typedef struct _tr_hdr {
address src;
} tr_hdr;
-WS_DLL_PUBLIC
-void capture_tr(const guchar *, int, int, packet_counts *);
+extern
+void capture_tr(const guchar *, int, int, packet_counts *, const union wtap_pseudo_header *pseudo_header);
#endif
diff --git a/epan/dissectors/packet-vlan.c b/epan/dissectors/packet-vlan.c
index 4f45ef1d20..f2f9270f8a 100644
--- a/epan/dissectors/packet-vlan.c
+++ b/epan/dissectors/packet-vlan.c
@@ -110,7 +110,7 @@ capture_vlan(const guchar *pd, int offset, int len, packet_counts *ld ) {
if ( pd[offset+4] == 0xff && pd[offset+5] == 0xff ) {
capture_ipx(ld);
} else {
- capture_llc(pd,offset+4,len,ld);
+ capture_llc(pd,offset+4,len,ld, NULL);
}
} else {
capture_ethertype(encap_proto, pd, offset+4, len, ld);
diff --git a/epan/epan.c b/epan/epan.c
index b2a1f5d4f6..18d31dfce3 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -52,6 +52,7 @@
#include "wmem/wmem.h"
#include "expert.h"
#include "print.h"
+#include "capture_dissectors.h"
#ifdef HAVE_LUA
#include <lua.h>
@@ -124,6 +125,7 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da
proto_init(register_all_protocols_func, register_all_handoffs_func,
cb, client_data);
packet_cache_proto_handles();
+ capture_dissector_init();
dfilter_init();
final_registration_all_protocols();
print_cache_field_handles();
@@ -162,6 +164,7 @@ epan_cleanup(void)
prefs_cleanup();
packet_cleanup();
expert_cleanup();
+ capture_dissector_cleanup();
#ifdef HAVE_LUA
wslua_cleanup();
#endif
diff --git a/epan/wslua/taps b/epan/wslua/taps
index eee8176bcf..d418896062 100644
--- a/epan/wslua/taps
+++ b/epan/wslua/taps
@@ -47,7 +47,6 @@ ansi_map ../dissectors/packet-ansi_map.h ansi_map_tap_rec_t
#epl ../dissectors/packet-epl.h epl_info_t
eth ../dissectors/packet-eth.h eth_hdr
#fc ../dissectors/packet-fc.h fc_hdr
-#fddi ../dissectors/packet-fddi.h fddi_info_t
#gsm_a ../dissectors/packet-gsm_a.h gsm_a_info_t
#gsm_map ../dissectors/packet-gsm_map.h gsm_map_info_t
#h245 ../dissectors/packet-h245.h h245_info_t
diff --git a/tools/delete_includes.py b/tools/delete_includes.py
index 8ad1e79b4a..20cdf6f1dd 100644
--- a/tools/delete_includes.py
+++ b/tools/delete_includes.py
@@ -119,26 +119,14 @@ includes_to_keep.append('string.h')
# These are probably mostly redundant in that they are now covered by the check
# for 'self-includes'...
includes_to_keep.append('x11-keysym.h')
-includes_to_keep.append('packet-ppi.h')
includes_to_keep.append('packet-dcom-dispatch.h')
includes_to_keep.append('packet-ax25.h')
-includes_to_keep.append('packet-ax25-kiss.h')
-includes_to_keep.append('packet-i2c.h')
-includes_to_keep.append('packet-enc.h')
-includes_to_keep.append('packet-fr.h')
-includes_to_keep.append('packet-ap1394.h')
-includes_to_keep.append('packet-arcnet.h')
-includes_to_keep.append('packet-ipfc.h')
includes_to_keep.append('packet-atm.h')
includes_to_keep.append('packet-atalk.h')
-includes_to_keep.append('packet-clip.h')
-includes_to_keep.append('packet-raw.h')
includes_to_keep.append('packet-ppp.h')
-includes_to_keep.append('packet-null.h')
includes_to_keep.append('packet-scsi-mmc.h')
includes_to_keep.append('packet-t30.h')
includes_to_keep.append('packet-ssl.h')
-includes_to_keep.append('packet-pktap.h')