Have a heur_dissector_list_t be an opaque handle.
This allows dissector lists to be looked up by name, so they can be shared by multiple dissectors. (This means that there's no "udplite" heuristic dissector list, but there shouldn't be one - protocols can run atop UDP or UDPLite equally well, and they share a port namespace and uint dissector table, so they should share a heuristic dissector table as well.) Change-Id: Ifb2d2c294938c06d348a159adea7a57db8d770a7 Reviewed-on: https://code.wireshark.org/review/5936 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
81798009b9
commit
2b006ad30e
|
@ -880,9 +880,7 @@ void proto_register_atn_ulcs (void)
|
|||
atn_cpdlc_handle = find_dissector("atn-cpdlc");
|
||||
|
||||
/* initiate sub dissector list */
|
||||
register_heur_dissector_list(
|
||||
"atn-ulcs",
|
||||
&atn_ulcs_heur_subdissector_list);
|
||||
atn_ulcs_heur_subdissector_list = register_heur_dissector_list("atn-ulcs");
|
||||
|
||||
/* init aare/aare data */
|
||||
aarq_data_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
|
||||
|
|
|
@ -169,7 +169,7 @@ void proto_register_credssp(void) {
|
|||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
/* heuristic dissectors for any premable e.g. CredSSP before RDP */
|
||||
register_heur_dissector_list("credssp", &credssp_heur_subdissector_list);
|
||||
credssp_heur_subdissector_list = register_heur_dissector_list("credssp");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -661,7 +661,7 @@ proto_register_mpeg_pes(void)
|
|||
proto_mpeg = proto_register_protocol(
|
||||
"Moving Picture Experts Group", "MPEG", "mpeg");
|
||||
register_dissector("mpeg", dissect_mpeg, proto_mpeg);
|
||||
register_heur_dissector_list("mpeg", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("mpeg");
|
||||
|
||||
proto_mpeg_pes = proto_register_protocol(
|
||||
"Packetized Elementary Stream", "MPEG PES", "mpeg-pes");
|
||||
|
|
|
@ -138,7 +138,7 @@ void proto_register_t125(void) {
|
|||
proto_register_field_array(proto_t125, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_heur_dissector_list("t125", &t125_heur_subdissector_list);
|
||||
t125_heur_subdissector_list= register_heur_dissector_list("t125");
|
||||
|
||||
new_register_dissector("t125", dissect_t125, proto_t125);
|
||||
}
|
||||
|
|
|
@ -2606,9 +2606,7 @@ void proto_register_atn_ulcs (void)
|
|||
atn_cpdlc_handle = find_dissector("atn-cpdlc");
|
||||
|
||||
/* initiate sub dissector list */
|
||||
register_heur_dissector_list(
|
||||
"atn-ulcs",
|
||||
&atn_ulcs_heur_subdissector_list);
|
||||
atn_ulcs_heur_subdissector_list = register_heur_dissector_list("atn-ulcs");
|
||||
|
||||
/* init aare/aare data */
|
||||
aarq_data_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
|
||||
|
|
|
@ -6921,7 +6921,7 @@ proto_register_cip(void)
|
|||
|
||||
/* Register a heuristic dissector on the service of the message so objects
|
||||
* can override the dissector for common services */
|
||||
register_heur_dissector_list("cip.sc", &heur_subdissector_service);
|
||||
heur_subdissector_service = register_heur_dissector_list("cip.sc");
|
||||
|
||||
} /* end of proto_register_cip() */
|
||||
|
||||
|
|
|
@ -737,7 +737,7 @@ proto_register_clnp(void)
|
|||
expert_clnp = expert_register_protocol(proto_clnp);
|
||||
expert_register_field_array(expert_clnp, ei, array_length(ei));
|
||||
register_dissector("clnp", dissect_clnp, proto_clnp);
|
||||
register_heur_dissector_list("clnp", &clnp_heur_subdissector_list);
|
||||
clnp_heur_subdissector_list = register_heur_dissector_list("clnp");
|
||||
register_init_routine(clnp_reassemble_init);
|
||||
|
||||
clnp_module = prefs_register_protocol(proto_clnp, NULL);
|
||||
|
|
|
@ -1159,7 +1159,7 @@ proto_register_corosync_totemsrp(void)
|
|||
proto_register_field_array(proto_corosync_totemsrp, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_heur_dissector_list("corosync_totemsrp.mcast", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("corosync_totemsrp.mcast");
|
||||
|
||||
new_register_dissector( "corosync_totemsrp", dissect_corosync_totemsrp, proto_corosync_totemsrp);
|
||||
}
|
||||
|
|
|
@ -545,7 +545,7 @@ void proto_register_credssp(void) {
|
|||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
/* heuristic dissectors for any premable e.g. CredSSP before RDP */
|
||||
register_heur_dissector_list("credssp", &credssp_heur_subdissector_list);
|
||||
credssp_heur_subdissector_list = register_heur_dissector_list("credssp");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1331,7 +1331,7 @@ proto_register_dccp(void)
|
|||
dccp_subdissector_table =
|
||||
register_dissector_table("dccp.port", "DCCP port", FT_UINT16,
|
||||
BASE_DEC);
|
||||
register_heur_dissector_list("dccp", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("dccp");
|
||||
|
||||
/* reg preferences */
|
||||
dccp_module = prefs_register_protocol(proto_dccp, NULL);
|
||||
|
|
|
@ -1916,7 +1916,7 @@ proto_register_dtls(void)
|
|||
ssl_debug_printf("proto_register_dtls: registered tap %s:%d\n",
|
||||
"dtls", dtls_tap);
|
||||
|
||||
register_heur_dissector_list("dtls", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("dtls");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3997,8 +3997,8 @@ proto_register_epl(void)
|
|||
proto_epl = proto_register_protocol("Ethernet POWERLINK", "EPL", "epl");
|
||||
|
||||
/* subdissector code */
|
||||
register_heur_dissector_list("epl", &heur_epl_subdissector_list);
|
||||
register_heur_dissector_list("epl_data", &heur_epl_data_subdissector_list);
|
||||
heur_epl_subdissector_list = register_heur_dissector_list("epl");
|
||||
heur_epl_data_subdissector_list = register_heur_dissector_list("epl_data");
|
||||
|
||||
/* Registering protocol to be called by another dissector */
|
||||
epl_handle = new_register_dissector("epl", dissect_epl, proto_epl);
|
||||
|
|
|
@ -945,8 +945,8 @@ proto_register_eth(void)
|
|||
expert_register_field_array(expert_eth, ei, array_length(ei));
|
||||
|
||||
/* subdissector code */
|
||||
register_heur_dissector_list("eth", &heur_subdissector_list);
|
||||
register_heur_dissector_list("eth.trailer", ð_trailer_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("eth");
|
||||
eth_trailer_subdissector_list = register_heur_dissector_list("eth.trailer");
|
||||
|
||||
/* Register configuration preferences */
|
||||
eth_module = prefs_register_protocol(proto_eth, NULL);
|
||||
|
|
|
@ -3228,7 +3228,7 @@ proto_register_http(void)
|
|||
* this table using the standard heur_dissector_add()
|
||||
* function.
|
||||
*/
|
||||
register_heur_dissector_list("http", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("http");
|
||||
|
||||
/*
|
||||
* Register for tapping
|
||||
|
|
|
@ -2813,8 +2813,8 @@ void proto_register_ieee802154(void)
|
|||
|
||||
/* Register the subdissector list */
|
||||
panid_dissector_table = register_dissector_table(IEEE802154_PROTOABBREV_WPAN_PANID, "IEEE 802.15.4 PANID", FT_UINT16, BASE_HEX);
|
||||
register_heur_dissector_list(IEEE802154_PROTOABBREV_WPAN, &ieee802154_heur_subdissector_list);
|
||||
register_heur_dissector_list(IEEE802154_PROTOABBREV_WPAN_BEACON, &ieee802154_beacon_subdissector_list);
|
||||
ieee802154_heur_subdissector_list = register_heur_dissector_list(IEEE802154_PROTOABBREV_WPAN);
|
||||
ieee802154_beacon_subdissector_list = register_heur_dissector_list(IEEE802154_PROTOABBREV_WPAN_BEACON);
|
||||
|
||||
/* Register dissectors with Wireshark. */
|
||||
register_dissector(IEEE802154_PROTOABBREV_WPAN, dissect_ieee802154, proto_ieee802154);
|
||||
|
|
|
@ -7463,8 +7463,8 @@ void proto_register_infiniband(void)
|
|||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
/* register the subdissector tables */
|
||||
register_heur_dissector_list("infiniband.payload", &heur_dissectors_payload);
|
||||
register_heur_dissector_list("infiniband.mad.cm.private", &heur_dissectors_cm_private);
|
||||
heur_dissectors_payload = register_heur_dissector_list("infiniband.payload");
|
||||
heur_dissectors_cm_private = register_heur_dissector_list("infiniband.mad.cm.private");
|
||||
|
||||
/* register dissection preferences */
|
||||
infiniband_module = prefs_register_protocol(proto_infiniband, proto_reg_handoff_infiniband);
|
||||
|
|
|
@ -3051,7 +3051,7 @@ proto_register_ip(void)
|
|||
/* subdissector code */
|
||||
ip_dissector_table = register_dissector_table("ip.proto", "IP protocol",
|
||||
FT_UINT8, BASE_DEC);
|
||||
register_heur_dissector_list("ip", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("ip");
|
||||
|
||||
/* Register configuration options */
|
||||
ip_module = prefs_register_protocol(proto_ip, NULL);
|
||||
|
|
|
@ -892,8 +892,7 @@ proto_register_iwarp_ddp_rdmap(void)
|
|||
proto_register_field_array(proto_iwarp_ddp_rdmap, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_heur_dissector_list("iwarp_ddp_rdmap",
|
||||
&rdmap_heur_subdissector_list);
|
||||
rdmap_heur_subdissector_list = register_heur_dissector_list("iwarp_ddp_rdmap");
|
||||
|
||||
register_dissector("iwarp_ddp_rdmap", dissect_iwarp_ddp_rdmap,
|
||||
proto_iwarp_ddp_rdmap);
|
||||
|
|
|
@ -14158,7 +14158,7 @@ void proto_register_lbmc(void)
|
|||
expert_lbmc = expert_register_protocol(proto_lbmc);
|
||||
expert_register_field_array(expert_lbmc, ei, array_length(ei));
|
||||
|
||||
register_heur_dissector_list("lbm_msg_payload", &lbmc_heuristic_subdissector_list);
|
||||
lbmc_heuristic_subdissector_list = register_heur_dissector_list("lbm_msg_payload");
|
||||
|
||||
prefs_register_protocol(tnw_protocol_handle, NULL);
|
||||
lbmc_module = prefs_register_protocol_subtree("29West", proto_lbmc, proto_reg_handoff_lbmc);
|
||||
|
|
|
@ -100,7 +100,7 @@ proto_register_media(void)
|
|||
"media" /* abbrev */
|
||||
);
|
||||
new_register_dissector("media", dissect_media, proto_media);
|
||||
register_heur_dissector_list("media", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("media");
|
||||
proto_register_field_array(proto_media, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ proto_register_mime_encap(void)
|
|||
proto_mime_encap = proto_register_protocol("MIME file", "MIME_FILE", "mime_dlt");
|
||||
|
||||
register_dissector("mime_dlt", dissect_mime_encap, proto_mime_encap);
|
||||
register_heur_dissector_list("wtap_file", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("wtap_file");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1514,7 +1514,7 @@ proto_register_mp2t(void)
|
|||
expert_mp2t = expert_register_protocol(proto_mp2t);
|
||||
expert_register_field_array(expert_mp2t, ei, array_length(ei));
|
||||
|
||||
register_heur_dissector_list("mp2t.pid", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("mp2t.pid");
|
||||
/* Register init of processing of fragmented DEPI packets */
|
||||
register_init_routine(mp2t_init);
|
||||
}
|
||||
|
|
|
@ -1318,7 +1318,7 @@ proto_register_mpeg_pes(void)
|
|||
proto_mpeg = proto_register_protocol(
|
||||
"Moving Picture Experts Group", "MPEG", "mpeg");
|
||||
register_dissector("mpeg", dissect_mpeg, proto_mpeg);
|
||||
register_heur_dissector_list("mpeg", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("mpeg");
|
||||
|
||||
proto_mpeg_pes = proto_register_protocol(
|
||||
"Packetized Elementary Stream", "MPEG PES", "mpeg-pes");
|
||||
|
|
|
@ -4733,7 +4733,7 @@ void proto_register_mq(void)
|
|||
proto_register_field_array(proto_mq, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_heur_dissector_list("mq", &mq_heur_subdissector_list);
|
||||
mq_heur_subdissector_list = register_heur_dissector_list("mq");
|
||||
register_init_routine(mq_init);
|
||||
|
||||
mq_module = prefs_register_protocol(proto_mq, NULL);
|
||||
|
|
|
@ -1465,7 +1465,7 @@ proto_register_netbios(void)
|
|||
expert_register_field_array(expert_netbios, ei, array_length(ei));
|
||||
|
||||
|
||||
register_heur_dissector_list("netbios", &netbios_heur_subdissector_list);
|
||||
netbios_heur_subdissector_list = register_heur_dissector_list("netbios");
|
||||
|
||||
netbios_module = prefs_register_protocol(proto_netbios, NULL);
|
||||
prefs_register_bool_preference(netbios_module, "defragment",
|
||||
|
|
|
@ -2441,10 +2441,10 @@ void proto_register_cotp(void)
|
|||
"settings.", &cotp_decode_atn);
|
||||
|
||||
/* subdissector code in inactive subset */
|
||||
register_heur_dissector_list("cotp_is", &cotp_is_heur_subdissector_list);
|
||||
cotp_is_heur_subdissector_list = register_heur_dissector_list("cotp_is");
|
||||
|
||||
/* other COTP/ISO 8473 subdissectors */
|
||||
register_heur_dissector_list("cotp", &cotp_heur_subdissector_list);
|
||||
cotp_heur_subdissector_list = register_heur_dissector_list("cotp");
|
||||
|
||||
/* XXX - what about CLTP and proto_cltp? */
|
||||
new_register_dissector("ositp", dissect_ositp, proto_cotp);
|
||||
|
@ -2471,7 +2471,7 @@ void proto_register_cltp(void)
|
|||
proto_register_field_array(proto_cltp, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_heur_dissector_list("cltp", &cltp_heur_subdissector_list);
|
||||
cltp_heur_subdissector_list = register_heur_dissector_list("cltp");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1408,7 +1408,7 @@ proto_register_pgm(void)
|
|||
/* subdissector code */
|
||||
subdissector_table = register_dissector_table("pgm.port",
|
||||
"PGM port", FT_UINT16, BASE_DEC);
|
||||
register_heur_dissector_list("pgm", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("pgm");
|
||||
|
||||
/*
|
||||
* Register configuration preferences for UDP encapsulation
|
||||
|
|
|
@ -3861,7 +3861,7 @@ proto_register_q931(void)
|
|||
/* subdissector code */
|
||||
codeset_dissector_table = register_dissector_table("q931.codeset", "Q.931 Codeset", FT_UINT8, BASE_HEX);
|
||||
ie_dissector_table = register_dissector_table("q931.ie", "Q.931 IE", FT_UINT16, BASE_HEX);
|
||||
register_heur_dissector_list("q931_user", &q931_user_heur_subdissector_list);
|
||||
q931_user_heur_subdissector_list = register_heur_dissector_list("q931_user");
|
||||
|
||||
q931_module = prefs_register_protocol(proto_q931, NULL);
|
||||
prefs_register_bool_preference(q931_module, "desegment_h323_messages",
|
||||
|
|
|
@ -4085,7 +4085,7 @@ proto_register_sccp(void)
|
|||
|
||||
sccp_ssn_dissector_table = register_dissector_table("sccp.ssn", "SCCP SSN", FT_UINT8, BASE_DEC);
|
||||
|
||||
register_heur_dissector_list("sccp", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("sccp");
|
||||
|
||||
sccp_module = prefs_register_protocol(proto_sccp, proto_reg_handoff_sccp);
|
||||
|
||||
|
|
|
@ -4954,7 +4954,7 @@ proto_register_sctp(void)
|
|||
sctp_ppi_dissector_table = register_dissector_table("sctp.ppi", "SCTP payload protocol identifier", FT_UINT32, BASE_HEX);
|
||||
|
||||
register_dissector("sctp", dissect_sctp, proto_sctp);
|
||||
register_heur_dissector_list("sctp", &sctp_heur_subdissector_list);
|
||||
sctp_heur_subdissector_list = register_heur_dissector_list("sctp");
|
||||
|
||||
register_init_routine(sctp_init);
|
||||
|
||||
|
|
|
@ -1544,7 +1544,7 @@ proto_register_sercosiii(void)
|
|||
register_dissector("sercosiii", dissect_siii, proto_siii);
|
||||
|
||||
/* subdissector code */
|
||||
register_heur_dissector_list("sercosiii", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("sercosiii");
|
||||
|
||||
/* Required function calls to register the header fields and subtrees used */
|
||||
proto_register_field_array(proto_siii, hf, array_length(hf));
|
||||
|
|
|
@ -5945,7 +5945,7 @@ void proto_register_sip(void)
|
|||
prefs_register_obsolete_preference(sip_module, "tcp.port");
|
||||
|
||||
register_init_routine(&sip_init_protocol);
|
||||
register_heur_dissector_list("sip", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("sip");
|
||||
/* Register for tapping */
|
||||
sip_tap = register_tap("sip");
|
||||
|
||||
|
|
|
@ -680,8 +680,7 @@ void proto_register_smb_direct(void)
|
|||
proto_register_subtree_array(ett, array_length(ett));
|
||||
proto_register_field_array(proto_smb_direct, hf, array_length(hf));
|
||||
|
||||
register_heur_dissector_list("smb_direct",
|
||||
&smb_direct_heur_subdissector_list);
|
||||
smb_direct_heur_subdissector_list = register_heur_dissector_list("smb_direct");
|
||||
|
||||
smb_direct_module = prefs_register_protocol(proto_smb_direct, NULL);
|
||||
prefs_register_bool_preference(smb_direct_module,
|
||||
|
|
|
@ -3411,7 +3411,7 @@ clean_up_and_exit:
|
|||
void
|
||||
proto_register_pipe_dcerpc(void)
|
||||
{
|
||||
register_heur_dissector_list("smb_transact", &smb_transact_heur_subdissector_list);
|
||||
smb_transact_heur_subdissector_list = register_heur_dissector_list("smb_transact");
|
||||
register_init_routine(smb_dcerpc_reassembly_init);
|
||||
}
|
||||
|
||||
|
|
|
@ -8448,7 +8448,7 @@ proto_register_smb2(void)
|
|||
"Whether the export object functionality will take the full path file name as file identifier",
|
||||
&eosmb2_take_name_as_fid);
|
||||
|
||||
register_heur_dissector_list("smb2_heur_subdissectors", &smb2_heur_subdissector_list);
|
||||
smb2_heur_subdissector_list = register_heur_dissector_list("smb2_heur_subdissectors");
|
||||
smb2_tap = register_tap("smb2");
|
||||
smb2_eo_tap = register_tap("smb_eo"); /* SMB Export Object tap */
|
||||
|
||||
|
|
|
@ -608,7 +608,7 @@ proto_register_soupbintcp(void)
|
|||
|
||||
soupbintcp_range = range_empty();
|
||||
|
||||
register_heur_dissector_list("soupbintcp", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("soupbintcp");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4125,7 +4125,7 @@ proto_register_ssl(void)
|
|||
}
|
||||
|
||||
/* heuristic dissectors for any premable e.g. CredSSP before RDP */
|
||||
register_heur_dissector_list("ssl", &ssl_heur_subdissector_list);
|
||||
ssl_heur_subdissector_list = register_heur_dissector_list("ssl");
|
||||
|
||||
new_register_dissector("ssl", dissect_ssl, proto_ssl);
|
||||
ssl_handle = find_dissector("ssl");
|
||||
|
|
|
@ -1625,7 +1625,7 @@ proto_register_stun(void)
|
|||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
/* heuristic subdissectors (used for the DATA field) */
|
||||
register_heur_dissector_list("stun", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("stun");
|
||||
|
||||
new_register_dissector("stun-udp", dissect_stun_udp, proto_stun);
|
||||
new_register_dissector("stun-heur", dissect_stun_heur, proto_stun);
|
||||
|
|
|
@ -2470,7 +2470,7 @@ proto_register_sua(void)
|
|||
"Set the source and destination addresses to the PC or GT digits, depending on the routing indicator."
|
||||
" This may affect TCAP's ability to recognize which messages belong to which TCAP session.", &set_addresses);
|
||||
|
||||
register_heur_dissector_list("sua", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("sua");
|
||||
sua_parameter_table = register_dissector_table("sua.prop.tags", "SUA Proprietary Tags", FT_UINT16, BASE_DEC);
|
||||
sua_tap = register_tap("sua");
|
||||
|
||||
|
|
|
@ -585,7 +585,7 @@ void proto_register_t125(void) {
|
|||
proto_register_field_array(proto_t125, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_heur_dissector_list("t125", &t125_heur_subdissector_list);
|
||||
t125_heur_subdissector_list= register_heur_dissector_list("t125");
|
||||
|
||||
new_register_dissector("t125", dissect_t125, proto_t125);
|
||||
}
|
||||
|
|
|
@ -5908,7 +5908,7 @@ proto_register_tcp(void)
|
|||
/* subdissector code */
|
||||
subdissector_table = register_dissector_table("tcp.port",
|
||||
"TCP port", FT_UINT16, BASE_DEC);
|
||||
register_heur_dissector_list("tcp", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("tcp");
|
||||
|
||||
/* Register configuration preferences */
|
||||
tcp_module = prefs_register_protocol(proto_tcp, NULL);
|
||||
|
|
|
@ -2938,7 +2938,7 @@ proto_register_tipc(void)
|
|||
"TIPC port name type", FT_UINT32, BASE_DEC);
|
||||
|
||||
/* make heuristic dissectors possible */
|
||||
register_heur_dissector_list("tipc", &tipc_heur_subdissector_list);
|
||||
tipc_heur_subdissector_list = register_heur_dissector_list("tipc");
|
||||
|
||||
/* Register by name */
|
||||
new_register_dissector("tipc", dissect_tipc, proto_tipc);
|
||||
|
|
|
@ -190,7 +190,7 @@ proto_register_turnchannel(void)
|
|||
proto_turnchannel);
|
||||
|
||||
/* subdissectors */
|
||||
register_heur_dissector_list("turnchannel", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("turnchannel");
|
||||
|
||||
/* Required function calls to register the header fields and subtrees used */
|
||||
proto_register_field_array(proto_turnchannel, hf, array_length(hf));
|
||||
|
|
|
@ -985,8 +985,7 @@ proto_register_udp(void)
|
|||
/* subdissector code */
|
||||
udp_dissector_table = register_dissector_table("udp.port",
|
||||
"UDP port", FT_UINT16, BASE_DEC);
|
||||
register_heur_dissector_list("udp", &heur_subdissector_list);
|
||||
register_heur_dissector_list("udplite", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("udp");
|
||||
|
||||
/* Register configuration preferences */
|
||||
udp_module = prefs_register_protocol(proto_udp, NULL);
|
||||
|
|
|
@ -2796,7 +2796,7 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
|
|||
break;
|
||||
}
|
||||
|
||||
if (try_heuristics) {
|
||||
if (try_heuristics && heur_subdissector_list) {
|
||||
ret = dissector_try_heuristic(heur_subdissector_list,
|
||||
next_tvb, pinfo, parent, &hdtbl_entry, usb_conv_info);
|
||||
if (ret)
|
||||
|
@ -4301,13 +4301,13 @@ proto_register_usb(void)
|
|||
|
||||
usb_bulk_dissector_table = register_dissector_table("usb.bulk",
|
||||
"USB bulk endpoint", FT_UINT8, BASE_DEC);
|
||||
register_heur_dissector_list("usb.bulk", &heur_bulk_subdissector_list);
|
||||
heur_bulk_subdissector_list = register_heur_dissector_list("usb.bulk");
|
||||
usb_control_dissector_table = register_dissector_table("usb.control",
|
||||
"USB control endpoint", FT_UINT8, BASE_DEC);
|
||||
register_heur_dissector_list("usb.control", &heur_control_subdissector_list);
|
||||
heur_control_subdissector_list = register_heur_dissector_list("usb.control");
|
||||
usb_interrupt_dissector_table = register_dissector_table("usb.interrupt",
|
||||
"USB interrupt endpoint", FT_UINT8, BASE_DEC);
|
||||
register_heur_dissector_list("usb.interrupt", &heur_interrupt_subdissector_list);
|
||||
heur_interrupt_subdissector_list = register_heur_dissector_list("usb.interrupt");
|
||||
usb_descriptor_dissector_table = register_dissector_table("usb.descriptor",
|
||||
"USB descriptor", FT_UINT8, BASE_DEC);
|
||||
|
||||
|
|
|
@ -990,8 +990,7 @@ proto_register_vines_ipc(void)
|
|||
proto_register_field_array(proto_vines_ipc, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_heur_dissector_list("vines_ipc",
|
||||
&vines_ipc_heur_subdissector_list);
|
||||
vines_ipc_heur_subdissector_list = register_heur_dissector_list("vines_ipc");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1157,8 +1156,7 @@ proto_register_vines_spp(void)
|
|||
proto_register_field_array(proto_vines_spp, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_heur_dissector_list("vines_spp",
|
||||
&vines_spp_heur_subdissector_list);
|
||||
vines_spp_heur_subdissector_list = register_heur_dissector_list("vines_spp");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -601,7 +601,7 @@ proto_register_websocket(void)
|
|||
* this table using the standard heur_dissector_add()
|
||||
* function.
|
||||
*/
|
||||
register_heur_dissector_list("ws", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("ws");
|
||||
|
||||
port_subdissector_table = register_dissector_table("ws.port",
|
||||
"TCP port for protocols using WebSocket", FT_UINT16, BASE_DEC);
|
||||
|
|
|
@ -7124,7 +7124,7 @@ proto_register_wsp(void)
|
|||
|
||||
register_dissector("wsp-co", dissect_wsp_fromwap_co, proto_wsp);
|
||||
register_dissector("wsp-cl", dissect_wsp_fromwap_cl, proto_wsp);
|
||||
register_heur_dissector_list("wsp", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("wsp");
|
||||
|
||||
wsp_fromudp_handle = create_dissector_handle(dissect_wsp_fromudp,
|
||||
proto_wsp);
|
||||
|
|
|
@ -2429,7 +2429,7 @@ proto_register_x25(void)
|
|||
|
||||
x25_subdissector_table = register_dissector_table("x.25.spi",
|
||||
"X.25 secondary protocol identifier", FT_UINT8, BASE_HEX);
|
||||
register_heur_dissector_list("x.25", &x25_heur_subdissector_list);
|
||||
x25_heur_subdissector_list = register_heur_dissector_list("x.25");
|
||||
|
||||
register_dissector("x.25_dir", dissect_x25_dir, proto_x25);
|
||||
register_dissector("x.25", dissect_x25, proto_x25);
|
||||
|
|
|
@ -106,6 +106,10 @@ static GHashTable *dissector_tables = NULL;
|
|||
*/
|
||||
static GHashTable *registered_dissectors = NULL;
|
||||
|
||||
struct heur_dissector_list {
|
||||
GSList *list;
|
||||
};
|
||||
|
||||
static GHashTable *heur_dissector_lists = NULL;
|
||||
|
||||
static void
|
||||
|
@ -1878,10 +1882,10 @@ get_dissector_table_param(const char *name)
|
|||
}
|
||||
|
||||
/* Finds a heuristic dissector table by table name. */
|
||||
heur_dissector_list_t *
|
||||
heur_dissector_list_t
|
||||
find_heur_dissector_list(const char *name)
|
||||
{
|
||||
return (heur_dissector_list_t *)g_hash_table_lookup(heur_dissector_lists, name);
|
||||
return (heur_dissector_list_t)g_hash_table_lookup(heur_dissector_lists, name);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -1892,7 +1896,7 @@ has_heur_dissector_list(const gchar *name) {
|
|||
void
|
||||
heur_dissector_add(const char *name, heur_dissector_t dissector, const int proto)
|
||||
{
|
||||
heur_dissector_list_t *sub_dissectors = find_heur_dissector_list(name);
|
||||
heur_dissector_list_t sub_dissectors = find_heur_dissector_list(name);
|
||||
const char *proto_name;
|
||||
heur_dtbl_entry_t *hdtbl_entry;
|
||||
|
||||
|
@ -1921,7 +1925,7 @@ heur_dissector_add(const char *name, heur_dissector_t dissector, const int proto
|
|||
hdtbl_entry->enabled = TRUE;
|
||||
|
||||
/* do the table insertion */
|
||||
*sub_dissectors = g_slist_prepend(*sub_dissectors, (gpointer)hdtbl_entry);
|
||||
sub_dissectors->list = g_slist_prepend(sub_dissectors->list, (gpointer)hdtbl_entry);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1937,7 +1941,7 @@ find_matching_heur_dissector( gconstpointer a, gconstpointer b) {
|
|||
|
||||
void
|
||||
heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto) {
|
||||
heur_dissector_list_t *sub_dissectors = find_heur_dissector_list(name);
|
||||
heur_dissector_list_t sub_dissectors = find_heur_dissector_list(name);
|
||||
heur_dtbl_entry_t hdtbl_entry;
|
||||
GSList *found_entry;
|
||||
|
||||
|
@ -1948,18 +1952,18 @@ heur_dissector_delete(const char *name, heur_dissector_t dissector, const int pr
|
|||
|
||||
hdtbl_entry.protocol = find_protocol_by_id(proto);
|
||||
|
||||
found_entry = g_slist_find_custom(*sub_dissectors, (gpointer) &hdtbl_entry, find_matching_heur_dissector);
|
||||
found_entry = g_slist_find_custom(sub_dissectors->list, (gpointer) &hdtbl_entry, find_matching_heur_dissector);
|
||||
|
||||
if (found_entry) {
|
||||
g_free(((heur_dtbl_entry_t *)(found_entry->data))->list_name);
|
||||
g_slice_free(heur_dtbl_entry_t, found_entry->data);
|
||||
*sub_dissectors = g_slist_delete_link(*sub_dissectors, found_entry);
|
||||
sub_dissectors->list = g_slist_delete_link(sub_dissectors->list, found_entry);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
heur_dissector_set_enabled(const char *name, heur_dissector_t dissector, const int proto, const gboolean enabled) {
|
||||
heur_dissector_list_t *sub_dissectors = find_heur_dissector_list(name);
|
||||
heur_dissector_list_t sub_dissectors = find_heur_dissector_list(name);
|
||||
GSList *found_entry;
|
||||
heur_dtbl_entry_t hdtbl_entry;
|
||||
|
||||
|
@ -1970,7 +1974,7 @@ heur_dissector_set_enabled(const char *name, heur_dissector_t dissector, const i
|
|||
|
||||
hdtbl_entry.protocol = find_protocol_by_id(proto);
|
||||
|
||||
found_entry = g_slist_find_custom(*sub_dissectors, (gpointer) &hdtbl_entry, find_matching_heur_dissector);
|
||||
found_entry = g_slist_find_custom(sub_dissectors->list, (gpointer) &hdtbl_entry, find_matching_heur_dissector);
|
||||
|
||||
if (found_entry) {
|
||||
heur_dtbl_entry_t *hdtbl_entry_p;
|
||||
|
@ -2012,7 +2016,8 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, tvbuff_t *tvb,
|
|||
saved_layers_len = wmem_list_count(pinfo->layers);
|
||||
*heur_dtbl_entry = NULL;
|
||||
|
||||
for (entry = sub_dissectors; entry != NULL; entry = g_slist_next(entry)) {
|
||||
for (entry = sub_dissectors->list; entry != NULL;
|
||||
entry = g_slist_next(entry)) {
|
||||
/* XXX - why set this now and above? */
|
||||
pinfo->can_desegment = saved_can_desegment-(saved_can_desegment>0);
|
||||
hdtbl_entry = (heur_dtbl_entry_t *)entry->data;
|
||||
|
@ -2100,12 +2105,12 @@ heur_dissector_table_foreach (const char *table_name,
|
|||
gpointer user_data)
|
||||
{
|
||||
heur_dissector_foreach_info_t info;
|
||||
heur_dissector_list_t *list = find_heur_dissector_list(table_name);
|
||||
heur_dissector_list_t sub_dissectors = find_heur_dissector_list(table_name);
|
||||
|
||||
info.table_name = table_name;
|
||||
info.caller_func = func;
|
||||
info.caller_data = user_data;
|
||||
g_slist_foreach (*list, heur_dissector_table_foreach_func, &info);
|
||||
g_slist_foreach (sub_dissectors->list, heur_dissector_table_foreach_func, &info);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2199,15 +2204,19 @@ dissector_dump_heur_decodes(void)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
register_heur_dissector_list(const char *name, heur_dissector_list_t *sub_dissectors)
|
||||
heur_dissector_list_t
|
||||
register_heur_dissector_list(const char *name)
|
||||
{
|
||||
heur_dissector_list_t sub_dissectors;
|
||||
|
||||
/* Make sure the registration is unique */
|
||||
g_assert(g_hash_table_lookup(heur_dissector_lists, name) == NULL);
|
||||
|
||||
*sub_dissectors = NULL; /* initially empty */
|
||||
sub_dissectors = g_slice_new(struct heur_dissector_list);
|
||||
sub_dissectors->list = NULL; /* initially empty */
|
||||
g_hash_table_insert(heur_dissector_lists, (gpointer)name,
|
||||
(gpointer) sub_dissectors);
|
||||
return sub_dissectors;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -341,8 +341,11 @@ WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_tabl
|
|||
/* List of "heuristic" dissectors (which get handed a packet, look at it,
|
||||
and either recognize it as being for their protocol, dissect it, and
|
||||
return TRUE, or don't recognize it and return FALSE) to be called
|
||||
by another dissector. */
|
||||
typedef GSList *heur_dissector_list_t;
|
||||
by another dissector.
|
||||
|
||||
This is opaque outside of "packet.c". */
|
||||
struct heur_dissector_list;
|
||||
typedef struct heur_dissector_list *heur_dissector_list_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -358,8 +361,7 @@ typedef struct {
|
|||
* @param name the name of this protocol
|
||||
* @param list the list of heuristic sub-dissectors to be registered
|
||||
*/
|
||||
WS_DLL_PUBLIC void register_heur_dissector_list(const char *name,
|
||||
heur_dissector_list_t *list);
|
||||
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name);
|
||||
|
||||
typedef void (*DATFunc_heur) (const gchar *table_name,
|
||||
heur_dtbl_entry_t *entry, gpointer user_data);
|
||||
|
@ -412,7 +414,7 @@ WS_DLL_PUBLIC gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissect
|
|||
* @param name name of the dissector table
|
||||
* @return pointer to the table on success, NULL if no such table exists
|
||||
*/
|
||||
WS_DLL_PUBLIC heur_dissector_list_t *find_heur_dissector_list(const char *name);
|
||||
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name);
|
||||
|
||||
/** Add a sub-dissector to a heuristic dissector list.
|
||||
* Call this in the proto_handoff function of the sub-dissector.
|
||||
|
|
|
@ -1703,7 +1703,7 @@ void proto_register_ecat(void)
|
|||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
/* Sub dissector code */
|
||||
register_heur_dissector_list("ecat.data", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("ecat.data");
|
||||
}
|
||||
|
||||
/* The registration hand-off routing */
|
||||
|
|
|
@ -12043,7 +12043,7 @@ proto_register_pn_io (void)
|
|||
|
||||
/* subdissector code */
|
||||
new_register_dissector("pn_io", dissect_PNIO_heur, proto_pn_io);
|
||||
register_heur_dissector_list("pn_io", &heur_pn_subdissector_list);
|
||||
heur_pn_subdissector_list = register_heur_dissector_list("pn_io");
|
||||
|
||||
register_init_routine(pnio_reinit);
|
||||
|
||||
|
|
|
@ -987,7 +987,7 @@ proto_register_pn_rt(void)
|
|||
&pnio_desegment);
|
||||
|
||||
/* register heuristics anchor for payload dissectors */
|
||||
register_heur_dissector_list("pn_rt", &heur_subdissector_list);
|
||||
heur_subdissector_list = register_heur_dissector_list("pn_rt");
|
||||
|
||||
init_pn (proto_pn_rt);
|
||||
register_init_routine(pnio_defragment_init);
|
||||
|
|
Loading…
Reference in New Issue