aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rmt-norm.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2023-09-19 14:12:28 -0400
committerAndersBroman <a.broman58@gmail.com>2023-09-19 19:06:51 +0000
commitfb9d01556dbc28a507778f66cbaca234a55e6305 (patch)
tree6bd4e8351e33d1519492b96ae9baf69eef6ee678 /epan/dissectors/packet-rmt-norm.c
parentd4f47c60b7eb12a84348d5c0228f6b5afd013660 (diff)
Use `register_dissector()` for more protocols
Changes several calls of `create_dissector_handle()` to instead call `register_dissector()` with a name for the dissector. This should handle all dissectors in `epan/` from `packet-p*` to `packet-v*`. This change allows affected dissectors to be findable by calls to `find_dissector()`. In turn, this opens up more command-line use for these protocols, including fuzzshark and rawshark, as well as lua use via `Dissector.get()`. Where needed, move the call from the protocol handoff function to the protocol register function, save the result in a static variable, and use that variable in the handoff function. There were some calls to `create_dissector_handle()` or `register_dissector()` which passed `-1` as the protocol argument. When I saw those I corrected them to pass the actual `proto_foo` identifier instead. Partially addresses #5612
Diffstat (limited to 'epan/dissectors/packet-rmt-norm.c')
-rw-r--r--epan/dissectors/packet-rmt-norm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/epan/dissectors/packet-rmt-norm.c b/epan/dissectors/packet-rmt-norm.c
index a965462ed4..98889896e6 100644
--- a/epan/dissectors/packet-rmt-norm.c
+++ b/epan/dissectors/packet-rmt-norm.c
@@ -38,6 +38,8 @@
void proto_register_norm(void);
void proto_reg_handoff_norm(void);
+static dissector_handle_t norm_handle;
+
/* String tables */
#define NORM_INFO 1
@@ -954,6 +956,8 @@ void proto_register_norm(void)
expert_rmt_norm = expert_register_protocol(proto_rmt_norm);
expert_register_field_array(expert_rmt_norm, ei, array_length(ei));
+ /* Register the subdissector handle */
+ norm_handle = register_dissector("norm", dissect_norm, proto_rmt_norm);
/* Register preferences */
module = prefs_register_protocol(proto_rmt_norm, NULL);
@@ -962,10 +966,7 @@ void proto_register_norm(void)
void proto_reg_handoff_norm(void)
{
- static dissector_handle_t handle;
-
- handle = create_dissector_handle(dissect_norm, proto_rmt_norm);
- dissector_add_for_decode_as_with_preference("udp.port", handle);
+ dissector_add_for_decode_as_with_preference("udp.port", norm_handle);
heur_dissector_add("udp", dissect_norm_heur, "NORM over UDP", "rmt_norm_udp", proto_rmt_norm, HEURISTIC_DISABLE);
rmt_fec_handle = find_dissector_add_dependency("rmt-fec", proto_rmt_norm);