aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-hp-erm.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2023-06-14 16:15:20 -0400
committerAndersBroman <a.broman58@gmail.com>2023-06-14 21:24:16 +0000
commit5d0f253d231af57bffbb92624444ab78322e6374 (patch)
tree474ef6a1de2f714996678e40110a6d5b11f078ad /epan/dissectors/packet-hp-erm.c
parent04d621ba22c3ee5837cba81c63a485de9fa1b4fb (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-g*` to `packet-i*`. 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-hp-erm.c')
-rw-r--r--epan/dissectors/packet-hp-erm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/dissectors/packet-hp-erm.c b/epan/dissectors/packet-hp-erm.c
index c579c03239..209e1a67dc 100644
--- a/epan/dissectors/packet-hp-erm.c
+++ b/epan/dissectors/packet-hp-erm.c
@@ -38,6 +38,8 @@
void proto_register_hp_erm(void);
void proto_reg_handoff_hp_erm(void);
+static dissector_handle_t hp_erm_handle;
+
#define PROTO_SHORT_NAME "HP_ERM"
#define PROTO_LONG_NAME "HP encapsulated remote mirroring"
@@ -143,15 +145,14 @@ proto_register_hp_erm(void)
proto_register_field_array(proto_hp_erm, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ hp_erm_handle = register_dissector("hp_erm", dissect_hp_erm, proto_hp_erm);
}
void
proto_reg_handoff_hp_erm(void)
{
- dissector_handle_t hp_erm_handle;
-
eth_withoutfcs_handle = find_dissector_add_dependency("eth_withoutfcs", proto_hp_erm);
- hp_erm_handle = create_dissector_handle(dissect_hp_erm, proto_hp_erm);
dissector_add_for_decode_as_with_preference("udp.port", hp_erm_handle);
}
/*