diff options
author | David Perry <boolean263@protonmail.com> | 2023-06-14 16:15:20 -0400 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2023-06-14 21:24:16 +0000 |
commit | 5d0f253d231af57bffbb92624444ab78322e6374 (patch) | |
tree | 474ef6a1de2f714996678e40110a6d5b11f078ad /epan/dissectors/packet-gsmtap_log.c | |
parent | 04d621ba22c3ee5837cba81c63a485de9fa1b4fb (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-gsmtap_log.c')
-rw-r--r-- | epan/dissectors/packet-gsmtap_log.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/dissectors/packet-gsmtap_log.c b/epan/dissectors/packet-gsmtap_log.c index b373b40e55..92e984a817 100644 --- a/epan/dissectors/packet-gsmtap_log.c +++ b/epan/dissectors/packet-gsmtap_log.c @@ -18,6 +18,8 @@ void proto_register_gsmtap_log(void); void proto_reg_handoff_gsmtap_log(void); +static dissector_handle_t gsmtap_log_handle; + static int proto_gsmtap_log = -1; static int hf_log_ident = -1; @@ -113,14 +115,13 @@ proto_register_gsmtap_log(void) proto_gsmtap_log = proto_register_protocol("GSMTAP libosmocore logging", "GSMTAP-LOG", "gsmtap_log"); proto_register_field_array(proto_gsmtap_log, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + gsmtap_log_handle = register_dissector("gsmtap_log", dissect_gsmtap_log, proto_gsmtap_log); } void proto_reg_handoff_gsmtap_log(void) { - dissector_handle_t gsmtap_log_handle; - - gsmtap_log_handle = create_dissector_handle(dissect_gsmtap_log, proto_gsmtap_log); dissector_add_uint("gsmtap.type", GSMTAP_TYPE_OSMOCORE_LOG, gsmtap_log_handle); } |