aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ppp.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-ppp.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-ppp.c')
-rw-r--r--epan/dissectors/packet-ppp.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index 9a5333bc98..ef421d3dbb 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -450,6 +450,8 @@ static dissector_handle_t chdlc_handle;
static dissector_handle_t eth_withfcs_handle;
static dissector_handle_t eth_withoutfcs_handle;
+static capture_dissector_handle_t chdlc_cap_handle;
+
static const value_string ppp_direction_vals[] = {
{P2P_DIR_RECV, "DCE->DTE"},
{P2P_DIR_SENT, "DTE->DCE"},
@@ -1941,7 +1943,7 @@ capture_ppp_hdlc(const guchar *pd, int offset, int len, capture_packet_info_t *c
return FALSE;
if (pd[0] == CHDLC_ADDR_UNICAST || pd[0] == CHDLC_ADDR_MULTICAST)
- return capture_chdlc(pd, offset, len, cpinfo, pseudo_header);
+ return call_capture_dissector(chdlc_cap_handle, pd, offset, len, cpinfo, pseudo_header);
if (!BYTES_ARE_IN_FRAME(offset, len, 4))
return FALSE;
@@ -5595,12 +5597,14 @@ proto_register_ppp_raw_hdlc(void)
proto_register_field_array(proto_ppp_hdlc, hf, array_length(hf));
register_capture_dissector_table("ppp_hdlc", "PPP-HDLC");
+ register_capture_dissector("ppp_hdlc", capture_ppp_hdlc, proto_ppp_hdlc);
}
void
proto_reg_handoff_ppp_raw_hdlc(void)
{
dissector_handle_t ppp_raw_hdlc_handle;
+ capture_dissector_handle_t ppp_hdlc_cap_handle;
ppp_raw_hdlc_handle = create_dissector_handle(dissect_ppp_raw_hdlc, proto_ppp);
@@ -5608,8 +5612,13 @@ proto_reg_handoff_ppp_raw_hdlc(void)
dissector_add_uint("gre.proto", ETHERTYPE_3GPP2, ppp_raw_hdlc_handle);
heur_dissector_add("usb.bulk", dissect_ppp_usb, "PPP USB bulk endpoint", "ppp_usb_bulk", proto_ppp, HEURISTIC_ENABLE);
- register_capture_dissector("wtap_encap", WTAP_ENCAP_PPP, capture_ppp_hdlc, proto_ppp_hdlc);
- register_capture_dissector("sll.ltype", LINUX_SLL_P_PPPHDLC, capture_ppp_hdlc, proto_ppp_hdlc);
+
+ ppp_hdlc_cap_handle = find_capture_dissector("ppp_hdlc");
+ capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_PPP, ppp_hdlc_cap_handle);
+ capture_dissector_add_uint("sll.ltype", LINUX_SLL_P_PPPHDLC, ppp_hdlc_cap_handle);
+ capture_dissector_add_uint("fr.nlpid", NLPID_PPP, ppp_hdlc_cap_handle);
+
+ chdlc_cap_handle = find_capture_dissector("chdlc");
}
/*