aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mpeg-ca.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-mpeg-ca.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-mpeg-ca.c')
-rw-r--r--epan/dissectors/packet-mpeg-ca.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/dissectors/packet-mpeg-ca.c b/epan/dissectors/packet-mpeg-ca.c
index 77a2d24cae..96d9042d4a 100644
--- a/epan/dissectors/packet-mpeg-ca.c
+++ b/epan/dissectors/packet-mpeg-ca.c
@@ -18,6 +18,8 @@
void proto_register_mpeg_ca(void);
void proto_reg_handoff_mpeg_ca(void);
+static dissector_handle_t mpeg_ca_handle;
+
static int proto_mpeg_ca = -1;
static int hf_mpeg_ca_reserved = -1;
static int hf_mpeg_ca_version_number = -1;
@@ -118,14 +120,12 @@ proto_register_mpeg_ca(void)
proto_register_field_array(proto_mpeg_ca, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ mpeg_ca_handle = register_dissector("mpeg_ca", dissect_mpeg_ca, proto_mpeg_ca);
}
void proto_reg_handoff_mpeg_ca(void)
{
- dissector_handle_t mpeg_ca_handle;
-
- mpeg_ca_handle = create_dissector_handle(dissect_mpeg_ca, proto_mpeg_ca);
dissector_add_uint("mpeg_sect.tid", MPEG_CA_TID, mpeg_ca_handle);
}