From 488933518c86344204ad98f820fc15444fe36ef1 Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Tue, 11 Nov 2008 15:05:00 +0000 Subject: Small cleanups mostly related to proto_reg_handoff svn path=/trunk/; revision=26750 --- asn1/dap/packet-dap-template.c | 9 ++++----- asn1/disp/packet-disp-template.c | 20 +++++++++----------- asn1/dop/packet-dop-template.c | 15 +++++++-------- asn1/dsp/packet-dsp-template.c | 19 ++++++++++--------- asn1/p7/packet-p7-template.c | 6 +++--- asn1/x411/packet-x411-template.c | 23 +++++++++++------------ 6 files changed, 44 insertions(+), 48 deletions(-) diff --git a/asn1/dap/packet-dap-template.c b/asn1/dap/packet-dap-template.c index b77a6c02d4..fa5d009dce 100644 --- a/asn1/dap/packet-dap-template.c +++ b/asn1/dap/packet-dap-template.c @@ -58,9 +58,8 @@ #define PFNAME "dap" static guint global_dap_tcp_port = 102; -static guint tcp_port = 0; -static dissector_handle_t tpkt_handle = NULL; -void prefs_register_dap(void); /* forwad declaration for use in preferences registration */ +static dissector_handle_t tpkt_handle; +void prefs_register_dap(void); /* forward declaration for use in preferences registration */ /* Initialize the protocol and registered fields */ @@ -153,15 +152,15 @@ void proto_reg_handoff_dap(void) { /* AttributeTypes */ x509if_register_fmt(hf_dap_present, "= *"); - } 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 != 102) && tpkt_handle) + if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) dissector_delete("tcp.port", tcp_port, tpkt_handle); /* Set our port number for future use */ diff --git a/asn1/disp/packet-disp-template.c b/asn1/disp/packet-disp-template.c index 95e0f6ba75..1198f52142 100644 --- a/asn1/disp/packet-disp-template.c +++ b/asn1/disp/packet-disp-template.c @@ -60,9 +60,8 @@ #define PFNAME "disp" static guint global_disp_tcp_port = 102; -static guint tcp_port = 0; -static dissector_handle_t tpkt_handle = NULL; -void prefs_register_disp(void); /* forwad declaration for use in preferences registration */ +static dissector_handle_t tpkt_handle; +void prefs_register_disp(void); /* forward declaration for use in preferences registration */ /* Initialize the protocol and registered fields */ @@ -239,7 +238,7 @@ void proto_register_disp(void) { /*--- proto_reg_handoff_disp --- */ void proto_reg_handoff_disp(void) { - dissector_handle_t handle = NULL; + dissector_handle_t disp_handle; #include "packet-disp-dis-tab.c" @@ -252,13 +251,11 @@ void proto_reg_handoff_disp(void) { /* ABSTRACT SYNTAXES */ - if((handle = find_dissector("disp"))) { + disp_handle = find_dissector("disp"); - register_ros_oid_dissector_handle("2.5.9.3", handle, 0, "id-as-directory-shadow", FALSE); - - register_rtse_oid_dissector_handle("2.5.9.5", handle, 0, "id-as-directory-reliable-shadow", FALSE); - register_rtse_oid_dissector_handle("2.5.9.6", handle, 0, "id-as-directory-reliable-binding", FALSE); - } + register_ros_oid_dissector_handle("2.5.9.3", disp_handle, 0, "id-as-directory-shadow", FALSE); + register_rtse_oid_dissector_handle("2.5.9.5", disp_handle, 0, "id-as-directory-reliable-shadow", FALSE); + register_rtse_oid_dissector_handle("2.5.9.6", disp_handle, 0, "id-as-directory-reliable-binding", FALSE); /* OPERATIONAL BINDING */ oid_add_from_string("id-op-binding-shadow","2.5.1.0.5.1"); @@ -272,10 +269,11 @@ void proto_reg_handoff_disp(void) { 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 != 102) && tpkt_handle) + if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) dissector_delete("tcp.port", tcp_port, tpkt_handle); /* Set our port number for future use */ diff --git a/asn1/dop/packet-dop-template.c b/asn1/dop/packet-dop-template.c index fcd08e582e..78839bf604 100644 --- a/asn1/dop/packet-dop-template.c +++ b/asn1/dop/packet-dop-template.c @@ -57,9 +57,8 @@ #define PFNAME "dop" static guint global_dop_tcp_port = 102; -static guint tcp_port = 0; -static dissector_handle_t tpkt_handle = NULL; -void prefs_register_dop(void); /* forwad declaration for use in preferences registration */ +static dissector_handle_t tpkt_handle; +void prefs_register_dop(void); /* forward declaration for use in preferences registration */ /* Initialize the protocol and registered fields */ int proto_dop = -1; @@ -287,7 +286,7 @@ void proto_register_dop(void) { /*--- proto_reg_handoff_dop --- */ void proto_reg_handoff_dop(void) { - dissector_handle_t handle = NULL; + dissector_handle_t dop_handle; #include "packet-dop-dis-tab.c" /* APPLICATION CONTEXT */ @@ -297,9 +296,8 @@ void proto_reg_handoff_dop(void) { /* ABSTRACT SYNTAXES */ /* Register DOP with ROS (with no use of RTSE) */ - if((handle = find_dissector("dop"))) { - register_ros_oid_dissector_handle("2.5.9.4", handle, 0, "id-as-directory-operational-binding-management", FALSE); - } + dop_handle = find_dissector("dop"); + register_ros_oid_dissector_handle("2.5.9.4", dop_handle, 0, "id-as-directory-operational-binding-management", FALSE); /* BINDING TYPES */ @@ -330,10 +328,11 @@ void proto_reg_handoff_dop(void) { } 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 != 102) && tpkt_handle) + if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) dissector_delete("tcp.port", tcp_port, tpkt_handle); /* Set our port number for future use */ diff --git a/asn1/dsp/packet-dsp-template.c b/asn1/dsp/packet-dsp-template.c index e801443dc5..b8d716a582 100644 --- a/asn1/dsp/packet-dsp-template.c +++ b/asn1/dsp/packet-dsp-template.c @@ -54,9 +54,8 @@ #define PFNAME "dsp" static guint global_dsp_tcp_port = 102; -static guint tcp_port = 0; -static dissector_handle_t tpkt_handle = NULL; -void prefs_register_dsp(void); /* forwad declaration for use in preferences registration */ +static dissector_handle_t tpkt_handle; +void prefs_register_dsp(void); /* forward declaration for use in preferences registration */ /* Initialize the protocol and registered fields */ @@ -316,7 +315,7 @@ void proto_register_dsp(void) { /*--- proto_reg_handoff_dsp --- */ void proto_reg_handoff_dsp(void) { - dissector_handle_t handle = NULL; + dissector_handle_t dsp_handle; #include "packet-dsp-dis-tab.c" @@ -326,19 +325,21 @@ void proto_reg_handoff_dsp(void) { /* ABSTRACT SYNTAXES */ - /* Register DSP with ROS (with no use of RTSE) */ - if((handle = find_dissector("dsp"))) { - register_ros_oid_dissector_handle("2.5.9.2", handle, 0, "id-as-directory-system", FALSE); - } + /* remember the tpkt handler for change in preferences */ + tpkt_handle = find_dissector("tpkt"); + /* Register DSP with ROS (with no use of RTSE) */ + dsp_handle = find_dissector("dsp"); + register_ros_oid_dissector_handle("2.5.9.2", dsp_handle, 0, "id-as-directory-system", FALSE); } 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 != 102) && tpkt_handle) + if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) dissector_delete("tcp.port", tcp_port, tpkt_handle); /* Set our port number for future use */ diff --git a/asn1/p7/packet-p7-template.c b/asn1/p7/packet-p7-template.c index c8d65c1c29..7d358d91be 100644 --- a/asn1/p7/packet-p7-template.c +++ b/asn1/p7/packet-p7-template.c @@ -50,8 +50,7 @@ #define PFNAME "p7" static guint global_p7_tcp_port = 102; -static guint tcp_port = 0; -static dissector_handle_t tpkt_handle = NULL; +static dissector_handle_t tpkt_handle; static const char *object_identifier_id = NULL; /* attribute identifier */ static int seqno = 0; @@ -145,10 +144,11 @@ void proto_reg_handoff_p7(void) { 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 != 102) && tpkt_handle) + if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) dissector_delete("tcp.port", tcp_port, tpkt_handle); /* Set our port number for future use */ diff --git a/asn1/x411/packet-x411-template.c b/asn1/x411/packet-x411-template.c index 92fc034b98..f38d31e34f 100644 --- a/asn1/x411/packet-x411-template.c +++ b/asn1/x411/packet-x411-template.c @@ -57,9 +57,8 @@ #define PFNAME "x411" static guint global_x411_tcp_port = 102; -static guint tcp_port = 0; -static dissector_handle_t tpkt_handle = NULL; -void prefs_register_x411(void); /* forwad declaration for use in preferences registration */ +static dissector_handle_t tpkt_handle; +void prefs_register_x411(void); /* forward declaration for use in preferences registration */ /* Initialize the protocol and registered fields */ int proto_x411 = -1; @@ -278,7 +277,7 @@ void proto_register_x411(void) { /*--- proto_reg_handoff_x411 --- */ void proto_reg_handoff_x411(void) { - dissector_handle_t handle = NULL; + dissector_handle_t x411_handle; #include "packet-x411-dis-tab.c" @@ -288,14 +287,13 @@ void proto_reg_handoff_x411(void) { /* ABSTRACT SYNTAXES */ - if((handle = find_dissector("x411")) != NULL) { - register_rtse_oid_dissector_handle("2.6.0.2.12", handle, 0, "id-as-mta-rtse", TRUE); - register_rtse_oid_dissector_handle("2.6.0.2.7", handle, 0, "id-as-mtse", FALSE); + x411_handle = find_dissector("x411"); + register_rtse_oid_dissector_handle("2.6.0.2.12", x411_handle, 0, "id-as-mta-rtse", TRUE); + register_rtse_oid_dissector_handle("2.6.0.2.7", x411_handle, 0, "id-as-mtse", FALSE); - register_ber_syntax_dissector("X.411 Message", proto_x411, dissect_x411_mts_apdu); - register_rtse_oid_dissector_handle("applicationProtocol.1", handle, 0, "mts-transfer-protocol-1984", FALSE); - register_rtse_oid_dissector_handle("applicationProtocol.12", handle, 0, "mta-transfer-protocol", FALSE); - } + register_ber_syntax_dissector("X.411 Message", proto_x411, dissect_x411_mts_apdu); + register_rtse_oid_dissector_handle("applicationProtocol.1", x411_handle, 0, "mts-transfer-protocol-1984", FALSE); + register_rtse_oid_dissector_handle("applicationProtocol.12", x411_handle, 0, "mta-transfer-protocol", FALSE); /* remember the tpkt handler for change in preferences */ tpkt_handle = find_dissector("tpkt"); @@ -303,10 +301,11 @@ void proto_reg_handoff_x411(void) { } void prefs_register_x411(void) { + static guint tcp_port = 0; /* de-register the old port */ /* port 102 is registered by TPKT - don't undo this! */ - if((tcp_port != 102) && tpkt_handle) + if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) dissector_delete("tcp.port", tcp_port, tpkt_handle); /* Set our port number for future use */ -- cgit v1.2.3