aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fcels.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2023-06-13 15:51:49 -0400
committerAndersBroman <a.broman58@gmail.com>2023-06-13 21:53:31 +0000
commitf02f47dadfca0f79f62df6274f032d9841260e35 (patch)
treec4d13b7489df600ceb66c21a5a3b245668fb15bc /epan/dissectors/packet-fcels.c
parent274e67998e84ba12a55b3e9456e500e4c632ac21 (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-e*` to `packet-f*`. 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-fcels.c')
-rw-r--r--epan/dissectors/packet-fcels.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c
index b40ff0219b..cde67885ec 100644
--- a/epan/dissectors/packet-fcels.c
+++ b/epan/dissectors/packet-fcels.c
@@ -25,6 +25,8 @@
void proto_register_fcels(void);
void proto_reg_handoff_fcels(void);
+static dissector_handle_t els_handle;
+
#define FC_ELS_RPLY 0
#define FC_ELS_REQ 1
@@ -2592,14 +2594,13 @@ proto_register_fcels (void)
expert_fcels = expert_register_protocol(proto_fcels);
expert_register_field_array(expert_fcels, ei, array_length(ei));
fcels_req_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), fcels_hash, fcels_equal);
+
+ els_handle = register_dissector("fcels", dissect_fcels, proto_fcels);
}
void
proto_reg_handoff_fcels (void)
{
- dissector_handle_t els_handle;
-
- els_handle = create_dissector_handle (dissect_fcels, proto_fcels);
dissector_add_uint("fc.ftype", FC_FTYPE_ELS, els_handle);
fcsp_handle = find_dissector_add_dependency ("fcsp", proto_fcels);