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-vlan.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-vlan.c')
-rw-r--r-- | epan/dissectors/packet-vlan.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/epan/dissectors/packet-vlan.c b/epan/dissectors/packet-vlan.c index d12a74c341..ff9c0209f4 100644 --- a/epan/dissectors/packet-vlan.c +++ b/epan/dissectors/packet-vlan.c @@ -47,6 +47,9 @@ static gboolean vlan_summary_in_tree = TRUE; static dissector_handle_t vlan_handle; static dissector_handle_t ethertype_handle; +static capture_dissector_handle_t llc_cap_handle; +static capture_dissector_handle_t ipx_cap_handle; + static header_field_info *hfi_vlan = NULL; #define VLAN_HFI_INIT HFI_INIT(proto_vlan) @@ -112,9 +115,9 @@ capture_vlan(const guchar *pd, int offset, int len, capture_packet_info_t *cpinf encap_proto = pntoh16( &pd[offset+2] ); if ( encap_proto <= IEEE_802_3_MAX_LEN) { if ( pd[offset+4] == 0xff && pd[offset+5] == 0xff ) { - return capture_ipx(pd,offset+4,len, cpinfo, pseudo_header); + return call_capture_dissector(ipx_cap_handle, pd,offset+4,len, cpinfo, pseudo_header); } else { - return capture_llc(pd,offset+4,len, cpinfo, pseudo_header); + return call_capture_dissector(llc_cap_handle, pd,offset+4,len, cpinfo, pseudo_header); } } @@ -273,11 +276,13 @@ proto_reg_handoff_vlan(void) { static gboolean prefs_initialized = FALSE; static unsigned int old_q_in_q_ethertype; + capture_dissector_handle_t vlan_cap_handle; if (!prefs_initialized) { dissector_add_uint("ethertype", ETHERTYPE_VLAN, vlan_handle); - register_capture_dissector("ethertype", ETHERTYPE_VLAN, capture_vlan, hfi_vlan->id); + vlan_cap_handle = create_capture_dissector_handle(capture_vlan, hfi_vlan->id); + capture_dissector_add_uint("ethertype", ETHERTYPE_VLAN, vlan_cap_handle); prefs_initialized = TRUE; } @@ -290,6 +295,9 @@ proto_reg_handoff_vlan(void) ethertype_handle = find_dissector_add_dependency("ethertype", hfi_vlan->id); dissector_add_uint("ethertype", q_in_q_ethertype, vlan_handle); + + llc_cap_handle = find_capture_dissector("llc"); + ipx_cap_handle = find_capture_dissector("ipx"); } /* |