aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-pktap.c
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2016-10-26 17:07:47 +0100
committerMichael Mann <mmann78@netscape.net>2016-10-28 17:39:04 +0000
commitd47551982b343664cafa3ddfa3b3bb960ed9f34a (patch)
tree8c88e54355d399d3b43a57098c3ad76276cd5112 /epan/dissectors/packet-pktap.c
parent01147f8369e76927d7a90cfa0b592457a1878839 (diff)
Implement registration of capture dissectors by name
Mirror it after protocol dissector API. Change-Id: I7985bcfa9e07654c7cf005efec94efc205d7a304 Reviewed-on: https://code.wireshark.org/review/18496 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-pktap.c')
-rw-r--r--epan/dissectors/packet-pktap.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/epan/dissectors/packet-pktap.c b/epan/dissectors/packet-pktap.c
index a886f8e9d1..195115cb0e 100644
--- a/epan/dissectors/packet-pktap.c
+++ b/epan/dissectors/packet-pktap.c
@@ -78,6 +78,7 @@ static gint ett_pktap = -1;
static expert_field ei_pktap_hdrlen_too_short = EI_INIT;
static dissector_handle_t pktap_handle;
+static capture_dissector_handle_t eth_cap_handle;
/*
* XXX - these are little-endian in the captures I've seen, but Apple
@@ -110,7 +111,7 @@ capture_pktap(const guchar *pd, int offset _U_, int len, capture_packet_info_t *
switch (dlt) {
case 1: /* DLT_EN10MB */
- return capture_eth(pd, hdrlen, len, cpinfo, pseudo_header);
+ return call_capture_dissector(eth_cap_handle, pd, hdrlen, len, cpinfo, pseudo_header);
}
@@ -274,6 +275,8 @@ proto_register_pktap(void)
void
proto_reg_handoff_pktap(void)
{
+ capture_dissector_handle_t pktap_cap_handle;
+
dissector_add_uint("wtap_encap", WTAP_ENCAP_PKTAP, pktap_handle);
pcap_pktdata_handle = find_dissector_add_dependency("pcap_pktdata", proto_pktap);
@@ -282,8 +285,11 @@ proto_reg_handoff_pktap(void)
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", WTAP_ENCAP_PKTAP, capture_pktap, proto_pktap);
- register_capture_dissector("wtap_encap", WTAP_ENCAP_USER2, capture_pktap, proto_pktap);
+ pktap_cap_handle = create_capture_dissector_handle(capture_pktap, proto_pktap);
+ capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_PKTAP, pktap_cap_handle);
+ capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_USER2, pktap_cap_handle);
+
+ eth_cap_handle = find_capture_dissector("eth");
}
/*