diff options
author | John Thacker <johnthacker@gmail.com> | 2022-08-04 21:01:16 -0400 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2022-08-06 00:17:14 -0400 |
commit | 057436ff81dcf9ea92a04914f89cab5f61a5fe92 (patch) | |
tree | f5888f303ea5a6bdfb427548117b07a0d2703a38 /epan/dissectors/packet-s101.c | |
parent | 9cfd989abfacfb82e07d5af02ceef0ef3dfdbb14 (diff) |
Prefs: Convert some SCTP port preferences to auto prefs
Convert SCTP port preferences in dissectors starting m-z.
Preferences that were already the name of the table can just
be removed from the dissector and they will migrate. Preferences
with a different name are added to deprecated_port_prefs in
epan/prefs.c (Since that function handles them there is no
need to mark them as obsolete.)
Also change a few TCP and UDP single ports reigstered with
preferences and callbacks that used the sample dissector as
a template.
Uses more auto preferences, makes more port preferences ranges,
and reduces the number of preference callbacks. Ping #14319
Diffstat (limited to 'epan/dissectors/packet-s101.c')
-rw-r--r-- | epan/dissectors/packet-s101.c | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/epan/dissectors/packet-s101.c b/epan/dissectors/packet-s101.c index 0ae1e3378c..5acbdec730 100644 --- a/epan/dissectors/packet-s101.c +++ b/epan/dissectors/packet-s101.c @@ -83,11 +83,9 @@ static void display_expert_info(proto_tree *tree, tvbuff_t *tvb, packet_info *pi /* Initialize the protocol and registered fields */ static int proto_S101 = -1; -/* Global sample port preference - real port preferences should generally - * default to 0 unless there is an IANA-registered (or equivalent) port for your - * protocol. */ -#define S101_TCP_PORT 9000 -static guint tcp_port_pref = S101_TCP_PORT; +/* Real port preferences should generally default to 0 unless there is an + * IANA-registered (or equivalent) port for your protocol. */ +#define S101_TCP_PORT 9000 /* Not IANA-registered */ /* Initialize the subtree pointers */ static gint ett_S101 = -1; @@ -496,7 +494,6 @@ dissect_S101(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void proto_register_S101(void) { - module_t *S101_module; expert_module_t* expert_s101; /* Setup list of header fields See Section 1.5 of README.dissector for @@ -639,41 +636,22 @@ proto_register_S101(void) s101_fragment_info_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal); - S101_module = prefs_register_protocol(proto_S101, - proto_reg_handoff_S101); + /* S101_module = prefs_register_protocol(proto_S101, NULL); */ expert_s101 = expert_register_protocol(proto_S101); expert_register_field_array(expert_s101, ei, array_length(ei)); - - /* Register an example port preference */ - prefs_register_uint_preference(S101_module, "tcp.port", "S101 TCP Port", - "S101 TCP port if other than the default", - 10, &tcp_port_pref); } void proto_reg_handoff_S101(void) { - static gboolean initialized = FALSE; static dissector_handle_t S101_handle; - static int current_port; - - if (!initialized) { - - S101_handle = create_dissector_handle(dissect_S101, - proto_S101); - - glow_handle = find_dissector_add_dependency("glow", proto_S101); - - initialized = TRUE; - - } else { - dissector_delete_uint("tcp.port", current_port, S101_handle); - } - current_port = tcp_port_pref; + S101_handle = create_dissector_handle(dissect_S101, + proto_S101); - dissector_add_uint("tcp.port", current_port, S101_handle); + glow_handle = find_dissector_add_dependency("glow", proto_S101); + dissector_add_uint_with_preference("tcp.port", S101_TCP_PORT, S101_handle); } /* |