diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-10-26 17:07:47 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-10-28 17:39:04 +0000 |
commit | d47551982b343664cafa3ddfa3b3bb960ed9f34a (patch) | |
tree | 8c88e54355d399d3b43a57098c3ad76276cd5112 /epan/dissectors/packet-chdlc.c | |
parent | 01147f8369e76927d7a90cfa0b592457a1878839 (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-chdlc.c')
-rw-r--r-- | epan/dissectors/packet-chdlc.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/epan/dissectors/packet-chdlc.c b/epan/dissectors/packet-chdlc.c index c0aca21cbf..6cb9611985 100644 --- a/epan/dissectors/packet-chdlc.c +++ b/epan/dissectors/packet-chdlc.c @@ -88,6 +88,8 @@ static gint ett_slarp = -1; static dissector_table_t subdissector_table; +static capture_dissector_handle_t ip_cap_handle; + static const value_string chdlc_address_vals[] = { {CHDLC_ADDR_UNICAST, "Unicast"}, {CHDLC_ADDR_MULTICAST, "Multicast"}, @@ -118,7 +120,7 @@ capture_chdlc( const guchar *pd, int offset, int len, capture_packet_info_t *cpi switch (pntoh16(&pd[offset + 2])) { case ETHERTYPE_IP: - return capture_ip(pd, offset + 4, len, cpinfo, pseudo_header); + return call_capture_dissector(ip_cap_handle, pd, offset + 4, len, cpinfo, pseudo_header); } return FALSE; @@ -245,12 +247,15 @@ proto_register_chdlc(void) &chdlc_fcs_decode, fcs_options, ENC_BIG_ENDIAN); + register_capture_dissector("chdlc", capture_chdlc, proto_chdlc); + } void proto_reg_handoff_chdlc(void) { dissector_handle_t chdlc_handle; + capture_dissector_handle_t chdlc_cap_handle; chdlc_handle = find_dissector("chdlc"); dissector_add_uint("wtap_encap", WTAP_ENCAP_CHDLC, chdlc_handle); @@ -258,7 +263,10 @@ proto_reg_handoff_chdlc(void) dissector_add_uint("juniper.proto", JUNIPER_PROTO_CHDLC, chdlc_handle); dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_CHDLC, chdlc_handle); - register_capture_dissector("wtap_encap", WTAP_ENCAP_CHDLC, capture_chdlc, proto_chdlc); + chdlc_cap_handle = find_capture_dissector("chdlc"); + capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_CHDLC, chdlc_cap_handle); + + ip_cap_handle = find_capture_dissector("ip"); } |