aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-lmi.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2023-06-20 13:59:45 -0400
committerAndersBroman <a.broman58@gmail.com>2023-06-21 15:09:54 +0000
commitfacff6706764da354e215a471960a065e85edf59 (patch)
tree85a36f40f2ef28f3e542500dfb9f12cd161bb2ee /epan/dissectors/packet-lmi.c
parent7e07c29b09ff7333241945a012d453779ca43963 (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-j*` to `packet-o*`. 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-lmi.c')
-rw-r--r--epan/dissectors/packet-lmi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/dissectors/packet-lmi.c b/epan/dissectors/packet-lmi.c
index 5c23c2cec3..c81f511733 100644
--- a/epan/dissectors/packet-lmi.c
+++ b/epan/dissectors/packet-lmi.c
@@ -28,6 +28,8 @@
void proto_register_lmi(void);
void proto_reg_handoff_lmi(void);
+static dissector_handle_t lmi_handle;
+
static int proto_lmi = -1;
static int hf_lmi_call_ref = -1;
static int hf_lmi_msg_type = -1;
@@ -218,14 +220,12 @@ proto_register_lmi(void)
proto_register_field_array (proto_lmi, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ lmi_handle = register_dissector("lmi", dissect_lmi, proto_lmi);
}
void
proto_reg_handoff_lmi(void)
{
- dissector_handle_t lmi_handle;
-
- lmi_handle = create_dissector_handle(dissect_lmi, proto_lmi);
dissector_add_uint("fr.nlpid", NLPID_LMI, lmi_handle);
}