summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-arcnet.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-12-12 23:38:21 -0500
committerMichael Mann <mmann78@netscape.net>2015-12-13 14:34:13 +0000
commit56aa05227f6bc18211d9ddec669af77ba5cd78e9 (patch)
treefa21cc83f52889681b3461e1f511521a6d43275d /epan/dissectors/packet-arcnet.c
parent23379ae3624df82c170f48e5bb3250a97ec61c13 (diff)
downloadwireshark-56aa05227f6bc18211d9ddec669af77ba5cd78e9.tar.gz
Create a way to register "capture" dissectors.
Capture dissectors could be architected like dissection dissectors, with tables and subtables and possibly using tvbs to pass there data instead of raw byte arrays. This is a first step towards that by refactoring capture_info_packet() to work off of a "capture dissector table" Registering the capture dissection functions instead of calling them directly also clears up a bunch of dissector header files who sole purpose was providing the capture dissection function definition. Change-Id: I10e9b79e061f32d2572f009823601d4f048d37aa Reviewed-on: https://code.wireshark.org/review/12581 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-arcnet.c')
-rw-r--r--epan/dissectors/packet-arcnet.c24
1 files changed, 18 insertions, 6 deletions
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);
}