From 3120536012bc85361e2e5cd204bd4aa91fb67ff6 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 3 Sep 2016 22:22:50 -0400 Subject: [PATCH] Have TPKT support a TCP port range preference instead of having "subdissectors?" register their own. There are a number of dissectors who are subdissectors of TPKT (and OSITP) that are not called by TCP dissector directly, yet can possibly register a TCP port "on the behalf" of TPKT. Just allow TPKT to support a range of ports to possibly include these protocols. Remove the preferences from these dissectors, but add backwards compatibility for the preferences by hooking into set_prefs and have the preferences just hook into Decode As functionality directly. Change-Id: Ic1b4959d39607f2b6b20fa6508da8d87d04cf098 Reviewed-on: https://code.wireshark.org/review/17476 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- .../dissectors/asn1/dap/packet-dap-template.c | 37 ++---------- .../asn1/disp/packet-disp-template.c | 37 ++---------- .../dissectors/asn1/dop/packet-dop-template.c | 36 ++---------- .../dissectors/asn1/dsp/packet-dsp-template.c | 36 ++---------- epan/dissectors/asn1/p1/packet-p1-template.c | 36 ++---------- epan/dissectors/asn1/p7/packet-p7-template.c | 37 ++---------- epan/dissectors/packet-dap.c | 55 +++++------------- epan/dissectors/packet-disp.c | 49 ++++------------ epan/dissectors/packet-dop.c | 48 ++++----------- epan/dissectors/packet-dsp.c | 48 ++++----------- epan/dissectors/packet-p1.c | 56 +++++------------- epan/dissectors/packet-p7.c | 57 +++++------------- epan/dissectors/packet-rdp.c | 38 ++---------- epan/dissectors/packet-tpkt.c | 35 ++++++++--- epan/prefs.c | 58 +++++++++++++++++++ 15 files changed, 202 insertions(+), 461 deletions(-) diff --git a/epan/dissectors/asn1/dap/packet-dap-template.c b/epan/dissectors/asn1/dap/packet-dap-template.c index c5592bce1f..5a72d05ea2 100644 --- a/epan/dissectors/asn1/dap/packet-dap-template.c +++ b/epan/dissectors/asn1/dap/packet-dap-template.c @@ -53,11 +53,6 @@ void proto_register_dap(void); void proto_reg_handoff_dap(void); -static guint global_dap_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_dap(void); /* forward declaration for use in preferences registration */ - - /* Initialize the protocol and registered fields */ static int proto_dap = -1; @@ -123,13 +118,13 @@ void proto_register_dap(void) { /* Register our configuration options for DAP, particularly our port */ - dap_module = prefs_register_protocol_subtree("OSI/X.500", proto_dap, prefs_register_dap); + dap_module = prefs_register_protocol_subtree("OSI/X.500", proto_dap, NULL); - prefs_register_uint_preference(dap_module, "tcp.port", "DAP TCP Port", - "Set the port for DAP operations (if other" - " than the default of 102)", - 10, &global_dap_tcp_port); + prefs_register_obsolete_preference(dap_module, "tcp.port"); + prefs_register_static_text_preference(dap_module, "tcp_port_info", + "The TCP ports used by the DAP protocol should be added to the TPKT preference \"TPKT TCP ports\", or the IDMP preference \"IDMP TCP Port\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DAP TCP Port preference moved information"); } @@ -149,9 +144,6 @@ void proto_reg_handoff_dap(void) { register_idmp_protocol_info("2.5.33.0", &dap_ros_info, 0, "dap-ip"); - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - /* AttributeValueAssertions */ x509if_register_fmt(hf_dap_equality, "="); x509if_register_fmt(hf_dap_greaterOrEqual, ">="); @@ -161,22 +153,3 @@ void proto_reg_handoff_dap(void) { x509if_register_fmt(hf_dap_present, "= *"); } - - -static void -prefs_register_dap(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_dap_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", global_dap_tcp_port, tpkt_handle); - -} diff --git a/epan/dissectors/asn1/disp/packet-disp-template.c b/epan/dissectors/asn1/disp/packet-disp-template.c index 877db29565..c667832e77 100644 --- a/epan/dissectors/asn1/disp/packet-disp-template.c +++ b/epan/dissectors/asn1/disp/packet-disp-template.c @@ -54,11 +54,6 @@ void proto_register_disp(void); void proto_reg_handoff_disp(void); -static guint global_disp_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_disp(void); /* forward declaration for use in preferences registration */ - - /* Initialize the protocol and registered fields */ static int proto_disp = -1; @@ -231,12 +226,13 @@ void proto_register_disp(void) { /* Register our configuration options for DISP, particularly our port */ - disp_module = prefs_register_protocol_subtree("OSI/X.500", proto_disp, prefs_register_disp); + disp_module = prefs_register_protocol_subtree("OSI/X.500", proto_disp, NULL); + + prefs_register_obsolete_preference(disp_module, "tcp.port"); - prefs_register_uint_preference(disp_module, "tcp.port", "DISP TCP Port", - "Set the port for DISP operations (if other" - " than the default of 102)", - 10, &global_disp_tcp_port); + prefs_register_static_text_preference(disp_module, "tcp_port_info", + "The TCP ports used by the DISP protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DISP TCP Port preference moved information"); } @@ -260,28 +256,7 @@ void proto_reg_handoff_disp(void) { /* OPERATIONAL BINDING */ oid_add_from_string("id-op-binding-shadow","2.5.1.0.5.1"); - tpkt_handle = find_dissector("tpkt"); - /* DNs */ x509if_register_fmt(hf_disp_contextPrefix, "cp="); } - - -static void -prefs_register_disp(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_disp_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", global_disp_tcp_port, tpkt_handle); - -} diff --git a/epan/dissectors/asn1/dop/packet-dop-template.c b/epan/dissectors/asn1/dop/packet-dop-template.c index 505c93a0a5..f642a2e935 100644 --- a/epan/dissectors/asn1/dop/packet-dop-template.c +++ b/epan/dissectors/asn1/dop/packet-dop-template.c @@ -50,10 +50,6 @@ void proto_register_dop(void); void proto_reg_handoff_dop(void); -static guint global_dop_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_dop(void); /* forward declaration for use in preferences registration */ - /* Initialize the protocol and registered fields */ static int proto_dop = -1; @@ -273,13 +269,13 @@ void proto_register_dop(void) { /* Register our configuration options for DOP, particularly our port */ - dop_module = prefs_register_protocol_subtree("OSI/X.500", proto_dop, prefs_register_dop); + dop_module = prefs_register_protocol_subtree("OSI/X.500", proto_dop, NULL); - prefs_register_uint_preference(dop_module, "tcp.port", "DOP TCP Port", - "Set the port for DOP operations (if other" - " than the default of 102)", - 10, &global_dop_tcp_port); + prefs_register_obsolete_preference(dop_module, "tcp.port"); + prefs_register_static_text_preference(dop_module, "tcp_port_info", + "The TCP ports used by the DOP protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DOP TCP Port preference moved information"); } @@ -321,26 +317,4 @@ void proto_reg_handoff_dop(void) { oid_add_from_string("id-ar-collectiveAttributeInnerArea","2.5.23.6"); oid_add_from_string("id-ar-contextDefaultSpecificArea","2.5.23.7"); oid_add_from_string("id-ar-serviceSpecificArea","2.5.23.8"); - - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - -} - -static void -prefs_register_dop(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_dop_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", tcp_port, tpkt_handle); - } diff --git a/epan/dissectors/asn1/dsp/packet-dsp-template.c b/epan/dissectors/asn1/dsp/packet-dsp-template.c index 5ab2e745ed..71b865b792 100644 --- a/epan/dissectors/asn1/dsp/packet-dsp-template.c +++ b/epan/dissectors/asn1/dsp/packet-dsp-template.c @@ -48,11 +48,6 @@ void proto_register_dsp(void); void proto_reg_handoff_dsp(void); -static guint global_dsp_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_dsp(void); /* forward declaration for use in preferences registration */ - - /* Initialize the protocol and registered fields */ static int proto_dsp = -1; @@ -303,13 +298,13 @@ void proto_register_dsp(void) { /* Register our configuration options for DSP, particularly our port */ - dsp_module = prefs_register_protocol_subtree("OSI/X.500", proto_dsp, prefs_register_dsp); + dsp_module = prefs_register_protocol_subtree("OSI/X.500", proto_dsp, NULL); - prefs_register_uint_preference(dsp_module, "tcp.port", "DSP TCP Port", - "Set the port for DSP operations (if other" - " than the default of 102)", - 10, &global_dsp_tcp_port); + prefs_register_obsolete_preference(dsp_module, "tcp.port"); + prefs_register_static_text_preference(dsp_module, "tcp_port_info", + "The TCP ports used by the DSP protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DSP TCP Port preference moved information"); } @@ -324,28 +319,7 @@ void proto_reg_handoff_dsp(void) { /* ABSTRACT SYNTAXES */ - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - /* Register DSP with ROS (with no use of RTSE) */ register_ros_oid_dissector_handle("2.5.9.2", dsp_handle, 0, "id-as-directory-system", FALSE); } - -static void -prefs_register_dsp(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_dsp_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", global_dsp_tcp_port, tpkt_handle); - -} diff --git a/epan/dissectors/asn1/p1/packet-p1-template.c b/epan/dissectors/asn1/p1/packet-p1-template.c index 0158854de2..70591dd391 100644 --- a/epan/dissectors/asn1/p1/packet-p1-template.c +++ b/epan/dissectors/asn1/p1/packet-p1-template.c @@ -46,10 +46,6 @@ #define PSNAME "P1" #define PFNAME "p1" -static guint global_p1_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_p1(void); /* forward declaration for use in preferences registration */ - /* Initialize the protocol and registered fields */ static int proto_p1 = -1; static int proto_p3 = -1; @@ -381,12 +377,13 @@ void proto_register_p1(void) { /* Register our configuration options for P1, particularly our port */ - p1_module = prefs_register_protocol_subtree("OSI/X.400", proto_p1, prefs_register_p1); + p1_module = prefs_register_protocol_subtree("OSI/X.400", proto_p1, NULL); + + prefs_register_obsolete_preference(p1_module, "tcp.port"); - prefs_register_uint_preference(p1_module, "tcp.port", "P1 TCP Port", - "Set the port for P1 operations (if other" - " than the default of 102)", - 10, &global_p1_tcp_port); + prefs_register_static_text_preference(p1_module, "tcp_port_info", + "The TCP ports used by the P1 protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "P1 TCP Port preference moved information"); register_ber_syntax_dissector("P1 Message", proto_p1, dissect_p1_mts_apdu); #include "packet-p1-syn-reg.c" @@ -413,9 +410,6 @@ void proto_reg_handoff_p1(void) { register_rtse_oid_dissector_handle(id_as_mts_rtse, NULL, 0, "id-as-mts-rtse", TRUE); register_rtse_oid_dissector_handle(id_as_msse, NULL, 0, "id-as-msse", TRUE); - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - /* APPLICATION CONTEXT */ oid_add_from_string("id-ac-mts-access-88", id_ac_mts_access_88); @@ -439,24 +433,6 @@ void proto_reg_handoff_p1(void) { } -static void -prefs_register_p1(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_p1_tcp_port; - - if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", tcp_port, tpkt_handle); - -} - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/epan/dissectors/asn1/p7/packet-p7-template.c b/epan/dissectors/asn1/p7/packet-p7-template.c index 1f56222713..97deaad962 100644 --- a/epan/dissectors/asn1/p7/packet-p7-template.c +++ b/epan/dissectors/asn1/p7/packet-p7-template.c @@ -44,13 +44,8 @@ void proto_register_p7(void); void proto_reg_handoff_p7(void); -static guint global_p7_tcp_port = 102; -static dissector_handle_t tpkt_handle; static int seqno = 0; -static void prefs_register_p7(void); /* forward declaration for use in preferences registration */ - - /* Initialize the protocol and registered fields */ static int proto_p7 = -1; @@ -105,13 +100,13 @@ void proto_register_p7(void) { /* Register our configuration options for P7, particularly our port */ - p7_module = prefs_register_protocol_subtree("OSI/X.400", proto_p7, prefs_register_p7); + p7_module = prefs_register_protocol_subtree("OSI/X.400", proto_p7, NULL); - prefs_register_uint_preference(p7_module, "tcp.port", "P7 TCP Port", - "Set the port for P7 operations (if other" - " than the default of 102)", - 10, &global_p7_tcp_port); + prefs_register_obsolete_preference(p7_module, "tcp.port"); + prefs_register_static_text_preference(p7_module, "tcp_port_info", + "The TCP ports used by the P7 protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "P7 TCP Port preference moved information"); } @@ -131,26 +126,4 @@ void proto_reg_handoff_p7(void) { register_ros_protocol_info("2.6.0.2.9", &p7_ros_info, 0, "id-as-ms", FALSE); register_ros_protocol_info("2.6.0.2.5", &p7_ros_info, 0, "id-as-mrse", FALSE); register_ros_protocol_info("2.6.0.2.1", &p7_ros_info, 0, "id-as-msse", FALSE); - - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); -} - - -static void -prefs_register_p7(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_p7_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", global_p7_tcp_port, tpkt_handle); - } diff --git a/epan/dissectors/packet-dap.c b/epan/dissectors/packet-dap.c index 579e8d9ce9..a095fabe16 100644 --- a/epan/dissectors/packet-dap.c +++ b/epan/dissectors/packet-dap.c @@ -61,11 +61,6 @@ void proto_register_dap(void); void proto_reg_handoff_dap(void); -static guint global_dap_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_dap(void); /* forward declaration for use in preferences registration */ - - /* Initialize the protocol and registered fields */ static int proto_dap = -1; @@ -480,7 +475,7 @@ static int hf_dap_SearchControlOptions_separateFamilyMembers = -1; static int hf_dap_SearchControlOptions_searchFamily = -1; /*--- End of included file: packet-dap-hf.c ---*/ -#line 66 "./asn1/dap/packet-dap-template.c" +#line 61 "./asn1/dap/packet-dap-template.c" /* Initialize the subtree pointers */ static gint ett_dap = -1; @@ -659,7 +654,7 @@ static gint ett_dap_UpdateError = -1; static gint ett_dap_T_signedUpdateError = -1; /*--- End of included file: packet-dap-ett.c ---*/ -#line 70 "./asn1/dap/packet-dap-template.c" +#line 65 "./asn1/dap/packet-dap-template.c" static expert_field ei_dap_anonymous = EI_INIT; @@ -686,7 +681,7 @@ static expert_field ei_dap_anonymous = EI_INIT; #define id_errcode_dsaReferral 9 /*--- End of included file: packet-dap-val.h ---*/ -#line 74 "./asn1/dap/packet-dap-template.c" +#line 69 "./asn1/dap/packet-dap-template.c" /*--- Included file: packet-dap-table.c ---*/ @@ -724,7 +719,7 @@ static const value_string dap_err_code_string_vals[] = { /*--- End of included file: packet-dap-table.c ---*/ -#line 76 "./asn1/dap/packet-dap-template.c" +#line 71 "./asn1/dap/packet-dap-template.c" /*--- Included file: packet-dap-fn.c ---*/ @@ -4774,7 +4769,7 @@ static int dissect_UpdateError_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pr /*--- End of included file: packet-dap-fn.c ---*/ -#line 78 "./asn1/dap/packet-dap-template.c" +#line 73 "./asn1/dap/packet-dap-template.c" /*--- Included file: packet-dap-table11.c ---*/ @@ -4806,7 +4801,7 @@ static const ros_opr_t dap_opr_tab[] = { /*--- End of included file: packet-dap-table11.c ---*/ -#line 80 "./asn1/dap/packet-dap-template.c" +#line 75 "./asn1/dap/packet-dap-template.c" /*--- Included file: packet-dap-table21.c ---*/ #line 1 "./asn1/dap/packet-dap-table21.c" @@ -4835,7 +4830,7 @@ static const ros_err_t dap_err_tab[] = { /*--- End of included file: packet-dap-table21.c ---*/ -#line 81 "./asn1/dap/packet-dap-template.c" +#line 76 "./asn1/dap/packet-dap-template.c" static const ros_info_t dap_ros_info = { "DAP", @@ -6475,7 +6470,7 @@ void proto_register_dap(void) { NULL, HFILL }}, /*--- End of included file: packet-dap-hfarr.c ---*/ -#line 100 "./asn1/dap/packet-dap-template.c" +#line 95 "./asn1/dap/packet-dap-template.c" }; /* List of subtrees */ @@ -6656,7 +6651,7 @@ void proto_register_dap(void) { &ett_dap_T_signedUpdateError, /*--- End of included file: packet-dap-ettarr.c ---*/ -#line 106 "./asn1/dap/packet-dap-template.c" +#line 101 "./asn1/dap/packet-dap-template.c" }; static ei_register_info ei[] = { @@ -6677,13 +6672,13 @@ void proto_register_dap(void) { /* Register our configuration options for DAP, particularly our port */ - dap_module = prefs_register_protocol_subtree("OSI/X.500", proto_dap, prefs_register_dap); + dap_module = prefs_register_protocol_subtree("OSI/X.500", proto_dap, NULL); - prefs_register_uint_preference(dap_module, "tcp.port", "DAP TCP Port", - "Set the port for DAP operations (if other" - " than the default of 102)", - 10, &global_dap_tcp_port); + prefs_register_obsolete_preference(dap_module, "tcp.port"); + prefs_register_static_text_preference(dap_module, "tcp_port_info", + "The TCP ports used by the DAP protocol should be added to the TPKT preference \"TPKT TCP ports\", or the IDMP preference \"IDMP TCP Port\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DAP TCP Port preference moved information"); } @@ -6703,9 +6698,6 @@ void proto_reg_handoff_dap(void) { register_idmp_protocol_info("2.5.33.0", &dap_ros_info, 0, "dap-ip"); - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - /* AttributeValueAssertions */ x509if_register_fmt(hf_dap_equality, "="); x509if_register_fmt(hf_dap_greaterOrEqual, ">="); @@ -6715,22 +6707,3 @@ void proto_reg_handoff_dap(void) { x509if_register_fmt(hf_dap_present, "= *"); } - - -static void -prefs_register_dap(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_dap_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", global_dap_tcp_port, tpkt_handle); - -} diff --git a/epan/dissectors/packet-disp.c b/epan/dissectors/packet-disp.c index b4ab8d631e..5422fe908d 100644 --- a/epan/dissectors/packet-disp.c +++ b/epan/dissectors/packet-disp.c @@ -62,11 +62,6 @@ void proto_register_disp(void); void proto_reg_handoff_disp(void); -static guint global_disp_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_disp(void); /* forward declaration for use in preferences registration */ - - /* Initialize the protocol and registered fields */ static int proto_disp = -1; @@ -182,7 +177,7 @@ static int hf_disp_signedShadowError = -1; /* T_signedShadowError */ static int hf_disp_shadowError = -1; /* ShadowErrorData */ /*--- End of included file: packet-disp-hf.c ---*/ -#line 66 "./asn1/disp/packet-disp-template.c" +#line 61 "./asn1/disp/packet-disp-template.c" /* Initialize the subtree pointers */ static gint ett_disp = -1; @@ -245,7 +240,7 @@ static gint ett_disp_ShadowError = -1; static gint ett_disp_T_signedShadowError = -1; /*--- End of included file: packet-disp-ett.c ---*/ -#line 70 "./asn1/disp/packet-disp-template.c" +#line 65 "./asn1/disp/packet-disp-template.c" static expert_field ei_disp_unsupported_opcode = EI_INIT; static expert_field ei_disp_unsupported_errcode = EI_INIT; @@ -1484,7 +1479,7 @@ static int dissect_ShadowingAgreementInfo_PDU(tvbuff_t *tvb _U_, packet_info *pi /*--- End of included file: packet-disp-fn.c ---*/ -#line 79 "./asn1/disp/packet-disp-template.c" +#line 74 "./asn1/disp/packet-disp-template.c" /* * Dissect DISP PDUs inside a ROS PDUs @@ -2042,7 +2037,7 @@ void proto_register_disp(void) { "ShadowErrorData", HFILL }}, /*--- End of included file: packet-disp-hfarr.c ---*/ -#line 204 "./asn1/disp/packet-disp-template.c" +#line 199 "./asn1/disp/packet-disp-template.c" }; /* List of subtrees */ @@ -2107,7 +2102,7 @@ void proto_register_disp(void) { &ett_disp_T_signedShadowError, /*--- End of included file: packet-disp-ettarr.c ---*/ -#line 210 "./asn1/disp/packet-disp-template.c" +#line 205 "./asn1/disp/packet-disp-template.c" }; static ei_register_info ei[] = { @@ -2132,12 +2127,13 @@ void proto_register_disp(void) { /* Register our configuration options for DISP, particularly our port */ - disp_module = prefs_register_protocol_subtree("OSI/X.500", proto_disp, prefs_register_disp); + disp_module = prefs_register_protocol_subtree("OSI/X.500", proto_disp, NULL); + + prefs_register_obsolete_preference(disp_module, "tcp.port"); - prefs_register_uint_preference(disp_module, "tcp.port", "DISP TCP Port", - "Set the port for DISP operations (if other" - " than the default of 102)", - 10, &global_disp_tcp_port); + prefs_register_static_text_preference(disp_module, "tcp_port_info", + "The TCP ports used by the DISP protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DISP TCP Port preference moved information"); } @@ -2155,7 +2151,7 @@ void proto_reg_handoff_disp(void) { /*--- End of included file: packet-disp-dis-tab.c ---*/ -#line 247 "./asn1/disp/packet-disp-template.c" +#line 243 "./asn1/disp/packet-disp-template.c" /* APPLICATION CONTEXT */ @@ -2172,28 +2168,7 @@ void proto_reg_handoff_disp(void) { /* OPERATIONAL BINDING */ oid_add_from_string("id-op-binding-shadow","2.5.1.0.5.1"); - tpkt_handle = find_dissector("tpkt"); - /* DNs */ x509if_register_fmt(hf_disp_contextPrefix, "cp="); } - - -static void -prefs_register_disp(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_disp_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", global_disp_tcp_port, tpkt_handle); - -} diff --git a/epan/dissectors/packet-dop.c b/epan/dissectors/packet-dop.c index 282ba5bb53..6c1695930d 100644 --- a/epan/dissectors/packet-dop.c +++ b/epan/dissectors/packet-dop.c @@ -58,10 +58,6 @@ void proto_register_dop(void); void proto_reg_handoff_dop(void); -static guint global_dop_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_dop(void); /* forward declaration for use in preferences registration */ - /* Initialize the protocol and registered fields */ static int proto_dop = -1; @@ -265,7 +261,7 @@ static int hf_dop_GrantsAndDenials_grantInvoke = -1; static int hf_dop_GrantsAndDenials_denyInvoke = -1; /*--- End of included file: packet-dop-hf.c ---*/ -#line 65 "./asn1/dop/packet-dop-template.c" +#line 61 "./asn1/dop/packet-dop-template.c" /* Initialize the subtree pointers */ static gint ett_dop = -1; @@ -342,7 +338,7 @@ static gint ett_dop_T_basicLevels = -1; static gint ett_dop_GrantsAndDenials = -1; /*--- End of included file: packet-dop-ett.c ---*/ -#line 70 "./asn1/dop/packet-dop-template.c" +#line 66 "./asn1/dop/packet-dop-template.c" static expert_field ei_dop_unknown_binding_parameter = EI_INIT; static expert_field ei_dop_unsupported_opcode = EI_INIT; @@ -2041,7 +2037,7 @@ static int dissect_ACIItem_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_ /*--- End of included file: packet-dop-fn.c ---*/ -#line 89 "./asn1/dop/packet-dop-template.c" +#line 85 "./asn1/dop/packet-dop-template.c" static int call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info, void* data) @@ -2958,7 +2954,7 @@ void proto_register_dop(void) { NULL, HFILL }}, /*--- End of included file: packet-dop-hfarr.c ---*/ -#line 241 "./asn1/dop/packet-dop-template.c" +#line 237 "./asn1/dop/packet-dop-template.c" }; /* List of subtrees */ @@ -3037,7 +3033,7 @@ void proto_register_dop(void) { &ett_dop_GrantsAndDenials, /*--- End of included file: packet-dop-ettarr.c ---*/ -#line 248 "./asn1/dop/packet-dop-template.c" +#line 244 "./asn1/dop/packet-dop-template.c" }; static ei_register_info ei[] = { @@ -3066,13 +3062,13 @@ void proto_register_dop(void) { /* Register our configuration options for DOP, particularly our port */ - dop_module = prefs_register_protocol_subtree("OSI/X.500", proto_dop, prefs_register_dop); + dop_module = prefs_register_protocol_subtree("OSI/X.500", proto_dop, NULL); - prefs_register_uint_preference(dop_module, "tcp.port", "DOP TCP Port", - "Set the port for DOP operations (if other" - " than the default of 102)", - 10, &global_dop_tcp_port); + prefs_register_obsolete_preference(dop_module, "tcp.port"); + prefs_register_static_text_preference(dop_module, "tcp_port_info", + "The TCP ports used by the DOP protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DOP TCP Port preference moved information"); } @@ -3104,7 +3100,7 @@ void proto_reg_handoff_dop(void) { /*--- End of included file: packet-dop-dis-tab.c ---*/ -#line 292 "./asn1/dop/packet-dop-template.c" +#line 288 "./asn1/dop/packet-dop-template.c" /* APPLICATION CONTEXT */ oid_add_from_string("id-ac-directory-operational-binding-management","2.5.3.3"); @@ -3137,26 +3133,4 @@ void proto_reg_handoff_dop(void) { oid_add_from_string("id-ar-collectiveAttributeInnerArea","2.5.23.6"); oid_add_from_string("id-ar-contextDefaultSpecificArea","2.5.23.7"); oid_add_from_string("id-ar-serviceSpecificArea","2.5.23.8"); - - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - -} - -static void -prefs_register_dop(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_dop_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", tcp_port, tpkt_handle); - } diff --git a/epan/dissectors/packet-dsp.c b/epan/dissectors/packet-dsp.c index df00bd2116..8be35db503 100644 --- a/epan/dissectors/packet-dsp.c +++ b/epan/dissectors/packet-dsp.c @@ -56,11 +56,6 @@ void proto_register_dsp(void); void proto_reg_handoff_dsp(void); -static guint global_dsp_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_dsp(void); /* forward declaration for use in preferences registration */ - - /* Initialize the protocol and registered fields */ static int proto_dsp = -1; @@ -206,7 +201,7 @@ static int hf_dsp_signed = -1; /* BOOLEAN */ static int hf_dsp_other = -1; /* EXTERNAL */ /*--- End of included file: packet-dsp-hf.c ---*/ -#line 60 "./asn1/dsp/packet-dsp-template.c" +#line 55 "./asn1/dsp/packet-dsp-template.c" /* Initialize the subtree pointers */ static gint ett_dsp = -1; @@ -286,7 +281,7 @@ static gint ett_dsp_AuthenticationLevel = -1; static gint ett_dsp_T_basicLevels = -1; /*--- End of included file: packet-dsp-ett.c ---*/ -#line 64 "./asn1/dsp/packet-dsp-template.c" +#line 59 "./asn1/dsp/packet-dsp-template.c" static expert_field ei_dsp_unsupported_opcode = EI_INIT; static expert_field ei_dsp_unsupported_errcode = EI_INIT; @@ -1693,7 +1688,7 @@ static int dissect_DitBridgeKnowledge_PDU(tvbuff_t *tvb _U_, packet_info *pinfo /*--- End of included file: packet-dsp-fn.c ---*/ -#line 71 "./asn1/dsp/packet-dsp-template.c" +#line 66 "./asn1/dsp/packet-dsp-template.c" static dissector_handle_t dsp_handle; @@ -2451,7 +2446,7 @@ void proto_register_dsp(void) { "EXTERNAL", HFILL }}, /*--- End of included file: packet-dsp-hfarr.c ---*/ -#line 276 "./asn1/dsp/packet-dsp-template.c" +#line 271 "./asn1/dsp/packet-dsp-template.c" }; /* List of subtrees */ @@ -2533,7 +2528,7 @@ void proto_register_dsp(void) { &ett_dsp_T_basicLevels, /*--- End of included file: packet-dsp-ettarr.c ---*/ -#line 282 "./asn1/dsp/packet-dsp-template.c" +#line 277 "./asn1/dsp/packet-dsp-template.c" }; static ei_register_info ei[] = { { &ei_dsp_unsupported_opcode, { "dsp.unsupported_opcode", PI_UNDECODED, PI_WARN, "Unsupported DSP opcode", EXPFILL }}, @@ -2558,13 +2553,13 @@ void proto_register_dsp(void) { /* Register our configuration options for DSP, particularly our port */ - dsp_module = prefs_register_protocol_subtree("OSI/X.500", proto_dsp, prefs_register_dsp); + dsp_module = prefs_register_protocol_subtree("OSI/X.500", proto_dsp, NULL); - prefs_register_uint_preference(dsp_module, "tcp.port", "DSP TCP Port", - "Set the port for DSP operations (if other" - " than the default of 102)", - 10, &global_dsp_tcp_port); + prefs_register_obsolete_preference(dsp_module, "tcp.port"); + prefs_register_static_text_preference(dsp_module, "tcp_port_info", + "The TCP ports used by the DSP protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "DSP TCP Port preference moved information"); } @@ -2582,7 +2577,7 @@ void proto_reg_handoff_dsp(void) { /*--- End of included file: packet-dsp-dis-tab.c ---*/ -#line 320 "./asn1/dsp/packet-dsp-template.c" +#line 315 "./asn1/dsp/packet-dsp-template.c" /* APPLICATION CONTEXT */ @@ -2590,28 +2585,7 @@ void proto_reg_handoff_dsp(void) { /* ABSTRACT SYNTAXES */ - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - /* Register DSP with ROS (with no use of RTSE) */ register_ros_oid_dissector_handle("2.5.9.2", dsp_handle, 0, "id-as-directory-system", FALSE); } - -static void -prefs_register_dsp(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_dsp_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", global_dsp_tcp_port, tpkt_handle); - -} diff --git a/epan/dissectors/packet-p1.c b/epan/dissectors/packet-p1.c index 4666b4e884..bbfa1fc728 100644 --- a/epan/dissectors/packet-p1.c +++ b/epan/dissectors/packet-p1.c @@ -54,10 +54,6 @@ #define PSNAME "P1" #define PFNAME "p1" -static guint global_p1_tcp_port = 102; -static dissector_handle_t tpkt_handle; -static void prefs_register_p1(void); /* forward declaration for use in preferences registration */ - /* Initialize the protocol and registered fields */ static int proto_p1 = -1; static int proto_p3 = -1; @@ -635,7 +631,7 @@ static int hf_p1_G3FacsimileNonBasicParameters_jpeg = -1; static int hf_p1_G3FacsimileNonBasicParameters_processable_mode_26 = -1; /*--- End of included file: packet-p1-hf.c ---*/ -#line 63 "./asn1/p1/packet-p1-template.c" +#line 59 "./asn1/p1/packet-p1-template.c" /* Initialize the subtree pointers */ static gint ett_p1 = -1; @@ -830,7 +826,7 @@ static gint ett_p1_SEQUENCE_SIZE_1_ub_recipients_OF_PerRecipientMessageSubmissio static gint ett_p1_SEQUENCE_SIZE_1_ub_recipients_OF_PerRecipientProbeSubmissionFields = -1; /*--- End of included file: packet-p1-ett.c ---*/ -#line 74 "./asn1/p1/packet-p1-template.c" +#line 70 "./asn1/p1/packet-p1-template.c" static expert_field ei_p1_unknown_extension_attribute_type = EI_INIT; static expert_field ei_p1_unknown_standard_extension = EI_INIT; @@ -890,7 +886,7 @@ static const value_string p3_err_code_string_vals[] = { /*--- End of included file: packet-p1-table.c ---*/ -#line 90 "./asn1/p1/packet-p1-template.c" +#line 86 "./asn1/p1/packet-p1-template.c" #define P1_ADDRESS_CTX "p1-address-ctx" typedef struct p1_address_ctx { @@ -8390,7 +8386,7 @@ static int dissect_SecurityClassification_PDU(tvbuff_t *tvb _U_, packet_info *pi /*--- End of included file: packet-p1-fn.c ---*/ -#line 167 "./asn1/p1/packet-p1-template.c" +#line 163 "./asn1/p1/packet-p1-template.c" /*--- Included file: packet-p1-table11.c ---*/ @@ -8422,7 +8418,7 @@ static const ros_opr_t p3_opr_tab[] = { /*--- End of included file: packet-p1-table11.c ---*/ -#line 169 "./asn1/p1/packet-p1-template.c" +#line 165 "./asn1/p1/packet-p1-template.c" /*--- Included file: packet-p1-table21.c ---*/ #line 1 "./asn1/p1/packet-p1-table21.c" @@ -8467,7 +8463,7 @@ static const ros_err_t p3_err_tab[] = { /*--- End of included file: packet-p1-table21.c ---*/ -#line 170 "./asn1/p1/packet-p1-template.c" +#line 166 "./asn1/p1/packet-p1-template.c" static const ros_info_t p3_ros_info = { "P3", @@ -10889,7 +10885,7 @@ void proto_register_p1(void) { NULL, HFILL }}, /*--- End of included file: packet-p1-hfarr.c ---*/ -#line 339 "./asn1/p1/packet-p1-template.c" +#line 335 "./asn1/p1/packet-p1-template.c" }; /* List of subtrees */ @@ -11086,7 +11082,7 @@ void proto_register_p1(void) { &ett_p1_SEQUENCE_SIZE_1_ub_recipients_OF_PerRecipientProbeSubmissionFields, /*--- End of included file: packet-p1-ettarr.c ---*/ -#line 352 "./asn1/p1/packet-p1-template.c" +#line 348 "./asn1/p1/packet-p1-template.c" }; static ei_register_info ei[] = { @@ -11119,12 +11115,13 @@ void proto_register_p1(void) { /* Register our configuration options for P1, particularly our port */ - p1_module = prefs_register_protocol_subtree("OSI/X.400", proto_p1, prefs_register_p1); + p1_module = prefs_register_protocol_subtree("OSI/X.400", proto_p1, NULL); + + prefs_register_obsolete_preference(p1_module, "tcp.port"); - prefs_register_uint_preference(p1_module, "tcp.port", "P1 TCP Port", - "Set the port for P1 operations (if other" - " than the default of 102)", - 10, &global_p1_tcp_port); + prefs_register_static_text_preference(p1_module, "tcp_port_info", + "The TCP ports used by the P1 protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "P1 TCP Port preference moved information"); register_ber_syntax_dissector("P1 Message", proto_p1, dissect_p1_mts_apdu); @@ -11135,7 +11132,7 @@ void proto_register_p1(void) { register_ber_syntax_dissector("ORName", proto_p1, dissect_ORName_PDU); /*--- End of included file: packet-p1-syn-reg.c ---*/ -#line 393 "./asn1/p1/packet-p1-template.c" +#line 390 "./asn1/p1/packet-p1-template.c" } @@ -11299,7 +11296,7 @@ void proto_reg_handoff_p1(void) { /*--- End of included file: packet-p1-dis-tab.c ---*/ -#line 399 "./asn1/p1/packet-p1-template.c" +#line 396 "./asn1/p1/packet-p1-template.c" /* APPLICATION CONTEXT */ @@ -11317,9 +11314,6 @@ void proto_reg_handoff_p1(void) { register_rtse_oid_dissector_handle(id_as_mts_rtse, NULL, 0, "id-as-mts-rtse", TRUE); register_rtse_oid_dissector_handle(id_as_msse, NULL, 0, "id-as-msse", TRUE); - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - /* APPLICATION CONTEXT */ oid_add_from_string("id-ac-mts-access-88", id_ac_mts_access_88); @@ -11343,24 +11337,6 @@ void proto_reg_handoff_p1(void) { } -static void -prefs_register_p1(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_p1_tcp_port; - - if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", tcp_port, tpkt_handle); - -} - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/epan/dissectors/packet-p7.c b/epan/dissectors/packet-p7.c index 09e1033d94..2cffff855c 100644 --- a/epan/dissectors/packet-p7.c +++ b/epan/dissectors/packet-p7.c @@ -52,13 +52,8 @@ void proto_register_p7(void); void proto_reg_handoff_p7(void); -static guint global_p7_tcp_port = 102; -static dissector_handle_t tpkt_handle; static int seqno = 0; -static void prefs_register_p7(void); /* forward declaration for use in preferences registration */ - - /* Initialize the protocol and registered fields */ static int proto_p7 = -1; @@ -121,7 +116,7 @@ static int proto_p7 = -1; #define ub_ua_restrictions 16 /*--- End of included file: packet-p7-val.h ---*/ -#line 58 "./asn1/p7/packet-p7-template.c" +#line 53 "./asn1/p7/packet-p7-template.c" /*--- Included file: packet-p7-hf.c ---*/ @@ -493,7 +488,7 @@ static int hf_p7_T_entry_class_problem_entry_class_not_subscribed = -1; static int hf_p7_T_entry_class_problem_inappropriate_entry_class = -1; /*--- End of included file: packet-p7-hf.c ---*/ -#line 60 "./asn1/p7/packet-p7-template.c" +#line 55 "./asn1/p7/packet-p7-template.c" /* Initialize the subtree pointers */ static gint ett_p7 = -1; @@ -635,7 +630,7 @@ static gint ett_p7_RTSE_apdus = -1; static gint ett_p7_RTABapdu = -1; /*--- End of included file: packet-p7-ett.c ---*/ -#line 64 "./asn1/p7/packet-p7-template.c" +#line 59 "./asn1/p7/packet-p7-template.c" /*--- Included file: packet-p7-table.c ---*/ @@ -678,7 +673,7 @@ static const value_string p7_err_code_string_vals[] = { /*--- End of included file: packet-p7-table.c ---*/ -#line 66 "./asn1/p7/packet-p7-template.c" +#line 61 "./asn1/p7/packet-p7-template.c" /*--- Included file: packet-p7-fn.c ---*/ @@ -4123,7 +4118,7 @@ static int dissect_RTSE_apdus_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro /*--- End of included file: packet-p7-fn.c ---*/ -#line 68 "./asn1/p7/packet-p7-template.c" +#line 63 "./asn1/p7/packet-p7-template.c" /*--- Included file: packet-p7-table11.c ---*/ @@ -4155,7 +4150,7 @@ static const ros_opr_t p7_opr_tab[] = { /*--- End of included file: packet-p7-table11.c ---*/ -#line 70 "./asn1/p7/packet-p7-template.c" +#line 65 "./asn1/p7/packet-p7-template.c" /*--- Included file: packet-p7-table21.c ---*/ #line 1 "./asn1/p7/packet-p7-table21.c" @@ -4194,7 +4189,7 @@ static const ros_err_t p7_err_tab[] = { /*--- End of included file: packet-p7-table21.c ---*/ -#line 71 "./asn1/p7/packet-p7-template.c" +#line 66 "./asn1/p7/packet-p7-template.c" static const ros_info_t p7_ros_info = { "P7", @@ -5674,7 +5669,7 @@ void proto_register_p7(void) { NULL, HFILL }}, /*--- End of included file: packet-p7-hfarr.c ---*/ -#line 90 "./asn1/p7/packet-p7-template.c" +#line 85 "./asn1/p7/packet-p7-template.c" }; /* List of subtrees */ @@ -5818,7 +5813,7 @@ void proto_register_p7(void) { &ett_p7_RTABapdu, /*--- End of included file: packet-p7-ettarr.c ---*/ -#line 96 "./asn1/p7/packet-p7-template.c" +#line 91 "./asn1/p7/packet-p7-template.c" }; module_t *p7_module; @@ -5831,13 +5826,13 @@ void proto_register_p7(void) { /* Register our configuration options for P7, particularly our port */ - p7_module = prefs_register_protocol_subtree("OSI/X.400", proto_p7, prefs_register_p7); + p7_module = prefs_register_protocol_subtree("OSI/X.400", proto_p7, NULL); - prefs_register_uint_preference(p7_module, "tcp.port", "P7 TCP Port", - "Set the port for P7 operations (if other" - " than the default of 102)", - 10, &global_p7_tcp_port); + prefs_register_obsolete_preference(p7_module, "tcp.port"); + prefs_register_static_text_preference(p7_module, "tcp_port_info", + "The TCP ports used by the P7 protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "P7 TCP Port preference moved information"); } @@ -5877,7 +5872,7 @@ void proto_reg_handoff_p7(void) { /*--- End of included file: packet-p7-dis-tab.c ---*/ -#line 122 "./asn1/p7/packet-p7-template.c" +#line 117 "./asn1/p7/packet-p7-template.c" /* APPLICATION CONTEXT */ @@ -5890,26 +5885,4 @@ void proto_reg_handoff_p7(void) { register_ros_protocol_info("2.6.0.2.9", &p7_ros_info, 0, "id-as-ms", FALSE); register_ros_protocol_info("2.6.0.2.5", &p7_ros_info, 0, "id-as-mrse", FALSE); register_ros_protocol_info("2.6.0.2.1", &p7_ros_info, 0, "id-as-msse", FALSE); - - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); -} - - -static void -prefs_register_p7(void) -{ - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_p7_tcp_port; - - if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", global_p7_tcp_port, tpkt_handle); - } diff --git a/epan/dissectors/packet-rdp.c b/epan/dissectors/packet-rdp.c index 52e0d8bf93..535b6f147b 100644 --- a/epan/dissectors/packet-rdp.c +++ b/epan/dissectors/packet-rdp.c @@ -40,13 +40,8 @@ #define PSNAME "RDP" #define PFNAME "rdp" - -static guint global_rdp_tcp_port = 3389; -static dissector_handle_t tpkt_handle; - void proto_register_rdp(void); void proto_reg_handoff_rdp(void); -static void prefs_register_rdp(void); static int proto_rdp = -1; @@ -3316,48 +3311,25 @@ proto_register_rdp(void) { /* Register our configuration options for RDP, particularly our port */ - rdp_module = prefs_register_protocol(proto_rdp, prefs_register_rdp); + rdp_module = prefs_register_protocol(proto_rdp, NULL); - prefs_register_uint_preference(rdp_module, "tcp.port", "RDP TCP Port", - "Set the port for RDP operations (if other" - " than the default of 3389)", - 10, &global_rdp_tcp_port); + prefs_register_obsolete_preference(rdp_module, "tcp.port"); + prefs_register_static_text_preference(rdp_module, "tcp_port_info", + "The TCP ports used by the RDP protocol should be added to the TPKT preference \"TPKT TCP ports\", or by selecting \"TPKT\" as the \"Transport\" protocol in the \"Decode As\" dialog.", + "RDP TCP Port preference moved information"); } void proto_reg_handoff_rdp(void) { - - /* remember the tpkt handler for change in preferences */ - tpkt_handle = find_dissector("tpkt"); - heur_dissector_add("cotp_cr", dissect_rdp_cr, "RDP", "rdp_cr", proto_rdp, HEURISTIC_ENABLE); heur_dissector_add("cotp_cc", dissect_rdp_cc, "RDP", "rdp_cc", proto_rdp, HEURISTIC_ENABLE); - prefs_register_rdp(); - register_t124_ns_dissector("Duca", dissect_rdp_ClientData, proto_rdp); register_t124_ns_dissector("McDn", dissect_rdp_ServerData, proto_rdp); } -static void -prefs_register_rdp(void) { - - static guint tcp_port = 0; - - /* de-register the old port */ - /* port 102 is registered by TPKT - don't undo this! */ - if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_delete_uint("tcp.port", tcp_port, tpkt_handle); - - /* Set our port number for future use */ - tcp_port = global_rdp_tcp_port; - - if ((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) - dissector_add_uint("tcp.port", tcp_port, tpkt_handle); -} - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/epan/dissectors/packet-tpkt.c b/epan/dissectors/packet-tpkt.c index 080340d9f1..964ed7263d 100644 --- a/epan/dissectors/packet-tpkt.c +++ b/epan/dissectors/packet-tpkt.c @@ -53,11 +53,12 @@ static gint ett_tpkt = -1; /* desegmentation of OSI over TPKT over TCP */ static gboolean tpkt_desegment = TRUE; -#define TCP_PORT_TPKT 102 - /* find the dissector for OSI TP (aka COTP) */ static dissector_handle_t osi_tp_handle; +#define DEFAULT_TPKT_PORT_RANGE "102" +static range_t *tpkt_tcp_port_range; + /* * Check whether this could be a TPKT-encapsulated PDU. * Returns -1 if it's not, and the PDU length from the TPKT header @@ -648,22 +649,42 @@ proto_register_tpkt(void) proto_register_subtree_array(ett, array_length(ett)); register_dissector("tpkt", dissect_tpkt, proto_tpkt); - tpkt_module = prefs_register_protocol(proto_tpkt, NULL); + tpkt_module = prefs_register_protocol(proto_tpkt, proto_reg_handoff_tpkt); prefs_register_bool_preference(tpkt_module, "desegment", "Reassemble TPKT messages spanning multiple TCP segments", "Whether the TPKT dissector should reassemble messages spanning multiple TCP segments. " "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &tpkt_desegment); + + range_convert_str(&tpkt_tcp_port_range, DEFAULT_TPKT_PORT_RANGE, MAX_TCP_PORT); + + prefs_register_range_preference(tpkt_module, "tcp.ports", "TPKT TCP ports", + "TCP ports to be decoded as TPKT (default: " + DEFAULT_TPKT_PORT_RANGE ")", + &tpkt_tcp_port_range, MAX_TCP_PORT); } void proto_reg_handoff_tpkt(void) { - dissector_handle_t tpkt_handle; + static dissector_handle_t tpkt_handle; + static range_t *port_range; + static gboolean initialized = FALSE; + + if (!initialized) + { + osi_tp_handle = find_dissector("ositp"); + tpkt_handle = find_dissector("tpkt"); + initialized = TRUE; + } + else + { + dissector_delete_uint_range("tcp.port", port_range, tpkt_handle); + g_free(port_range); + } - osi_tp_handle = find_dissector("ositp"); - tpkt_handle = find_dissector("tpkt"); - dissector_add_uint("tcp.port", TCP_PORT_TPKT, tpkt_handle); + port_range = range_copy(tpkt_tcp_port_range); + dissector_add_uint_range("tcp.port", port_range, tpkt_handle); /* tpkt_ascii_handle = create_dissector_handle(dissect_ascii_tpkt, proto_tpkt); diff --git a/epan/prefs.c b/epan/prefs.c index b7a46e3d71..008e59800c 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "print.h" #include #include /* ws_g_warning */ @@ -4018,6 +4019,61 @@ deprecated_heur_dissector_pref(gchar *pref_name, const gchar *value) return FALSE; } +static gboolean +deprecated_port_pref(gchar *pref_name, const gchar *value) +{ + struct port_pref_name + { + const char* pref_name; + const char* module_name; + const char* table_name; + guint base; + }; + + /* These are subdissectors of TPKT/OSITP that used to have a + TCP port preference even though they were never + directly on TCP. Convert them to use Decode As + with the TPKT dissector handle */ + struct port_pref_name tpkt_subdissector_port_prefs[] = { + {"dap.tcp.port", "DAP", "tcp.port", 10}, + {"disp.tcp.port", "DISP", "tcp.port", 10}, + {"dop.tcp.port", "DOP", "tcp.port", 10}, + {"dsp.tcp.port", "DSP", "tcp.port", 10}, + {"p1.tcp.port", "P1", "tcp.port", 10}, + {"p7.tcp.port", "P7", "tcp.port", 10}, + {"rdp.tcp.port", "RDP", "tcp.port", 10}, + }; + + unsigned int i; + char *p; + guint uval; + dissector_handle_t tpkt_handle; + + for (i = 0; i < sizeof(tpkt_subdissector_port_prefs)/sizeof(struct port_pref_name); i++) + { + if (strcmp(pref_name, tpkt_subdissector_port_prefs[i].pref_name) == 0) + { + /* XXX - give an error if it doesn't fit in a guint? */ + uval = (guint)strtoul(value, &p, tpkt_subdissector_port_prefs[i].base); + if (p == value || *p != '\0') + return FALSE; /* number was bad */ + + /* If the value is 0 or 102 (default TPKT port), don't add to the Decode As tables */ + if ((uval != 0) && (uval != 102)) + { + tpkt_handle = find_dissector("tpkt"); + if (tpkt_handle != NULL) { + dissector_change_uint(tpkt_subdissector_port_prefs[i].table_name, uval, tpkt_handle); + } + } + + return TRUE; + } + } + + return FALSE; +} + static prefs_set_pref_e set_pref(gchar *pref_name, const gchar *value, void *private_data _U_, gboolean return_range_errors) @@ -4077,6 +4133,8 @@ set_pref(gchar *pref_name, const gchar *value, void *private_data _U_, } } else if (deprecated_heur_dissector_pref(pref_name, value)) { /* Handled within deprecated_heur_dissector_pref() if found */ + } else if (deprecated_port_pref(pref_name, value)) { + /* Handled within deprecated_port_pref() if found */ } else { /* Handle deprecated "global" options that don't have a module * associated with them -- 2.34.1