aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-12-20 20:13:28 -0800
committerGuy Harris <guy@alum.mit.edu>2014-12-21 04:14:24 +0000
commit2b006ad30e38b015cfd13c33b265e2f48ddf36b2 (patch)
treec3c9a0de47a59d414477143a7ad24be694f28672 /epan
parent81798009b97549ad0879d1c01a3b9c60ed726ed9 (diff)
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>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-atn-ulcs.c4
-rw-r--r--epan/dissectors/packet-cip.c2
-rw-r--r--epan/dissectors/packet-clnp.c2
-rw-r--r--epan/dissectors/packet-corosync-totemsrp.c2
-rw-r--r--epan/dissectors/packet-credssp.c2
-rw-r--r--epan/dissectors/packet-dccp.c2
-rw-r--r--epan/dissectors/packet-dtls.c2
-rw-r--r--epan/dissectors/packet-epl.c4
-rw-r--r--epan/dissectors/packet-eth.c4
-rw-r--r--epan/dissectors/packet-http.c2
-rw-r--r--epan/dissectors/packet-ieee802154.c4
-rw-r--r--epan/dissectors/packet-infiniband.c4
-rw-r--r--epan/dissectors/packet-ip.c2
-rw-r--r--epan/dissectors/packet-iwarp-ddp-rdmap.c3
-rw-r--r--epan/dissectors/packet-lbmc.c2
-rw-r--r--epan/dissectors/packet-media.c2
-rw-r--r--epan/dissectors/packet-mime-encap.c2
-rw-r--r--epan/dissectors/packet-mp2t.c2
-rw-r--r--epan/dissectors/packet-mpeg-pes.c2
-rw-r--r--epan/dissectors/packet-mq.c2
-rw-r--r--epan/dissectors/packet-netbios.c2
-rw-r--r--epan/dissectors/packet-ositp.c6
-rw-r--r--epan/dissectors/packet-pgm.c2
-rw-r--r--epan/dissectors/packet-q931.c2
-rw-r--r--epan/dissectors/packet-sccp.c2
-rw-r--r--epan/dissectors/packet-sctp.c2
-rw-r--r--epan/dissectors/packet-sercosiii.c2
-rw-r--r--epan/dissectors/packet-sip.c2
-rw-r--r--epan/dissectors/packet-smb-direct.c3
-rw-r--r--epan/dissectors/packet-smb-pipe.c2
-rw-r--r--epan/dissectors/packet-smb2.c2
-rw-r--r--epan/dissectors/packet-soupbintcp.c2
-rw-r--r--epan/dissectors/packet-ssl.c2
-rw-r--r--epan/dissectors/packet-stun.c2
-rw-r--r--epan/dissectors/packet-sua.c2
-rw-r--r--epan/dissectors/packet-t125.c2
-rw-r--r--epan/dissectors/packet-tcp.c2
-rw-r--r--epan/dissectors/packet-tipc.c2
-rw-r--r--epan/dissectors/packet-turnchannel.c2
-rw-r--r--epan/dissectors/packet-udp.c3
-rw-r--r--epan/dissectors/packet-usb.c8
-rw-r--r--epan/dissectors/packet-vines.c6
-rw-r--r--epan/dissectors/packet-websocket.c2
-rw-r--r--epan/dissectors/packet-wsp.c2
-rw-r--r--epan/dissectors/packet-x25.c2
-rw-r--r--epan/packet.c39
-rw-r--r--epan/packet.h12
47 files changed, 86 insertions, 82 deletions
diff --git a/epan/dissectors/packet-atn-ulcs.c b/epan/dissectors/packet-atn-ulcs.c
index 3e2a340395..e1db7d3a32 100644
--- a/epan/dissectors/packet-atn-ulcs.c
+++ b/epan/dissectors/packet-atn-ulcs.c
@@ -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());
diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c
index f2e7664f5f..ab259eaca8 100644
--- a/epan/dissectors/packet-cip.c
+++ b/epan/dissectors/packet-cip.c
@@ -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() */
diff --git a/epan/dissectors/packet-clnp.c b/epan/dissectors/packet-clnp.c
index be33fc73b3..117028b595 100644
--- a/epan/dissectors/packet-clnp.c
+++ b/epan/dissectors/packet-clnp.c
@@ -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);
diff --git a/epan/dissectors/packet-corosync-totemsrp.c b/epan/dissectors/packet-corosync-totemsrp.c
index 89133a99f3..814e295cc8 100644
--- a/epan/dissectors/packet-corosync-totemsrp.c
+++ b/epan/dissectors/packet-corosync-totemsrp.c
@@ -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);
}
diff --git a/epan/dissectors/packet-credssp.c b/epan/dissectors/packet-credssp.c
index 3ccb7b349f..11b43d1ff5 100644
--- a/epan/dissectors/packet-credssp.c
+++ b/epan/dissectors/packet-credssp.c
@@ -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");
}
diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c
index b1593a1b1b..40565911ab 100644
--- a/epan/dissectors/packet-dccp.c
+++ b/epan/dissectors/packet-dccp.c
@@ -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);
diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c
index cb5c288084..d738ecda9a 100644
--- a/epan/dissectors/packet-dtls.c
+++ b/epan/dissectors/packet-dtls.c
@@ -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");
}
diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c
index 7d17f41aa2..001f13e9f4 100644
--- a/epan/dissectors/packet-epl.c
+++ b/epan/dissectors/packet-epl.c
@@ -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);
diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c
index aa539fc957..9b61f5d1e0 100644
--- a/epan/dissectors/packet-eth.c
+++ b/epan/dissectors/packet-eth.c
@@ -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", &eth_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);
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index ef7a90cf06..ebb8e0e306 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -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
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 9c26381151..c10519aa50 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -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);
diff --git a/epan/dissectors/packet-infiniband.c b/epan/dissectors/packet-infiniband.c
index 17eadc37e1..df7f636a50 100644
--- a/epan/dissectors/packet-infiniband.c
+++ b/epan/dissectors/packet-infiniband.c
@@ -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);
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 47ab038baf..50933d5d94 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -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);
diff --git a/epan/dissectors/packet-iwarp-ddp-rdmap.c b/epan/dissectors/packet-iwarp-ddp-rdmap.c
index 50f61f8199..60c411e9a6 100644
--- a/epan/dissectors/packet-iwarp-ddp-rdmap.c
+++ b/epan/dissectors/packet-iwarp-ddp-rdmap.c
@@ -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);
diff --git a/epan/dissectors/packet-lbmc.c b/epan/dissectors/packet-lbmc.c
index 8ee210d6a1..d646ea18a9 100644
--- a/epan/dissectors/packet-lbmc.c
+++ b/epan/dissectors/packet-lbmc.c
@@ -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);
diff --git a/epan/dissectors/packet-media.c b/epan/dissectors/packet-media.c
index 903a5ee852..c96fab9286 100644
--- a/epan/dissectors/packet-media.c
+++ b/epan/dissectors/packet-media.c
@@ -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));
diff --git a/epan/dissectors/packet-mime-encap.c b/epan/dissectors/packet-mime-encap.c
index 85f97a1765..5ea41006e8 100644
--- a/epan/dissectors/packet-mime-encap.c
+++ b/epan/dissectors/packet-mime-encap.c
@@ -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
diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c
index f2d2e9aea5..b3c3d63e00 100644
--- a/epan/dissectors/packet-mp2t.c
+++ b/epan/dissectors/packet-mp2t.c
@@ -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);
}
diff --git a/epan/dissectors/packet-mpeg-pes.c b/epan/dissectors/packet-mpeg-pes.c
index 0af02ccd86..8d5e1ba749 100644
--- a/epan/dissectors/packet-mpeg-pes.c
+++ b/epan/dissectors/packet-mpeg-pes.c
@@ -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");
diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c
index 59ddd37b38..f263b28388 100644
--- a/epan/dissectors/packet-mq.c
+++ b/epan/dissectors/packet-mq.c
@@ -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);
diff --git a/epan/dissectors/packet-netbios.c b/epan/dissectors/packet-netbios.c
index 366271b8c7..3049a7d1bb 100644
--- a/epan/dissectors/packet-netbios.c
+++ b/epan/dissectors/packet-netbios.c
@@ -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",
diff --git a/epan/dissectors/packet-ositp.c b/epan/dissectors/packet-ositp.c
index ddc6a1ed7e..da7ce2260f 100644
--- a/epan/dissectors/packet-ositp.c
+++ b/epan/dissectors/packet-ositp.c
@@ -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
diff --git a/epan/dissectors/packet-pgm.c b/epan/dissectors/packet-pgm.c
index c787ca122e..3ac7f22514 100644
--- a/epan/dissectors/packet-pgm.c
+++ b/epan/dissectors/packet-pgm.c
@@ -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
diff --git a/epan/dissectors/packet-q931.c b/epan/dissectors/packet-q931.c
index 96436f2170..f6b53cfcdf 100644
--- a/epan/dissectors/packet-q931.c
+++ b/epan/dissectors/packet-q931.c
@@ -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",
diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c
index 7345027ac3..39e9ebd290 100644
--- a/epan/dissectors/packet-sccp.c
+++ b/epan/dissectors/packet-sccp.c
@@ -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);
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index ddd67faad2..23bddce262 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -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);
diff --git a/epan/dissectors/packet-sercosiii.c b/epan/dissectors/packet-sercosiii.c
index 8019f46b55..53f9095974 100644
--- a/epan/dissectors/packet-sercosiii.c
+++ b/epan/dissectors/packet-sercosiii.c
@@ -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));
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index 9daf0dde61..063ac4e60f 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -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");
diff --git a/epan/dissectors/packet-smb-direct.c b/epan/dissectors/packet-smb-direct.c
index 7eccb96ef9..34523a6f88 100644
--- a/epan/dissectors/packet-smb-direct.c
+++ b/epan/dissectors/packet-smb-direct.c
@@ -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,
diff --git a/epan/dissectors/packet-smb-pipe.c b/epan/dissectors/packet-smb-pipe.c
index f6e2ad94dc..92371c2af9 100644
--- a/epan/dissectors/packet-smb-pipe.c
+++ b/epan/dissectors/packet-smb-pipe.c
@@ -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);
}
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index 05f724d76a..062fce8a77 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -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 */
diff --git a/epan/dissectors/packet-soupbintcp.c b/epan/dissectors/packet-soupbintcp.c
index dbeb94939d..0c8f13659c 100644
--- a/epan/dissectors/packet-soupbintcp.c
+++ b/epan/dissectors/packet-soupbintcp.c
@@ -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");
}
diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c
index c0d748e8df..becb4272d8 100644
--- a/epan/dissectors/packet-ssl.c
+++ b/epan/dissectors/packet-ssl.c
@@ -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");
diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c
index 255137f8c1..90f99db1c8 100644
--- a/epan/dissectors/packet-stun.c
+++ b/epan/dissectors/packet-stun.c
@@ -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);
diff --git a/epan/dissectors/packet-sua.c b/epan/dissectors/packet-sua.c
index 951be87667..671cd908b8 100644
--- a/epan/dissectors/packet-sua.c
+++ b/epan/dissectors/packet-sua.c
@@ -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");
diff --git a/epan/dissectors/packet-t125.c b/epan/dissectors/packet-t125.c
index ec1ae52922..87514835ce 100644
--- a/epan/dissectors/packet-t125.c
+++ b/epan/dissectors/packet-t125.c
@@ -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);
}
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index f07f375089..5f3503f69e 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -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);
diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c
index cb1a0b8953..36814259f6 100644
--- a/epan/dissectors/packet-tipc.c
+++ b/epan/dissectors/packet-tipc.c
@@ -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);
diff --git a/epan/dissectors/packet-turnchannel.c b/epan/dissectors/packet-turnchannel.c
index 6376e07b31..985b473c66 100644
--- a/epan/dissectors/packet-turnchannel.c
+++ b/epan/dissectors/packet-turnchannel.c
@@ -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));
diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c
index 90af6a820a..704e2f8e43 100644
--- a/epan/dissectors/packet-udp.c
+++ b/epan/dissectors/packet-udp.c
@@ -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);
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c
index 6befa27417..db0a080220 100644
--- a/epan/dissectors/packet-usb.c
+++ b/epan/dissectors/packet-usb.c
@@ -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);
diff --git a/epan/dissectors/packet-vines.c b/epan/dissectors/packet-vines.c
index 2eda52decf..24bd1cb0db 100644
--- a/epan/dissectors/packet-vines.c
+++ b/epan/dissectors/packet-vines.c
@@ -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
diff --git a/epan/dissectors/packet-websocket.c b/epan/dissectors/packet-websocket.c
index 9b6a3d26cc..b29a1c582d 100644
--- a/epan/dissectors/packet-websocket.c
+++ b/epan/dissectors/packet-websocket.c
@@ -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);
diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c
index e3e0d3d269..4635bf1fb2 100644
--- a/epan/dissectors/packet-wsp.c
+++ b/epan/dissectors/packet-wsp.c
@@ -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);
diff --git a/epan/dissectors/packet-x25.c b/epan/dissectors/packet-x25.c
index 7788f31c78..83ed92eace 100644
--- a/epan/dissectors/packet-x25.c
+++ b/epan/dissectors/packet-x25.c
@@ -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);
diff --git a/epan/packet.c b/epan/packet.c
index 8ffdfd8dd9..6a4664eb92 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -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;
}
/*
diff --git a/epan/packet.h b/epan/packet.h
index f37b2c0805..f64870ae5a 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -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.