Minor cleanup mostly related to proto_reg_handoff
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 4 Nov 2008 21:42:02 +0000 (21:42 +0000)
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 4 Nov 2008 21:42:02 +0000 (21:42 +0000)
 Remove code for unused handles;
 Localize handles (in proto_reg_handoff) which need not be global;
 Localize (in proto_reg_handoff) "saved prefs";
 Use find_dissector instead of create_dissector_handle as appropriate;
 Use gboolean for "initialized" flag in proto_reg_handoff.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@26693 f5534014-38df-0310-8fa8-9805f1628bb7

17 files changed:
asn1/h235/packet-h235-template.c
asn1/h245/packet-h245-template.c
asn1/h283/packet-h283-template.c
asn1/h323/packet-h323-template.c
asn1/h450/packet-h450-template.c
asn1/h501/packet-h501-template.c
asn1/mpeg-pes/packet-mpeg-pes-template.c
asn1/nbap/packet-nbap-template.c
asn1/pres/packet-pres-template.c
asn1/q932/packet-q932-template.c
asn1/qsig/packet-qsig-template.c
asn1/rnsap/packet-rnsap-template.c
asn1/rrc/packet-rrc-template.c
asn1/rrlp/packet-rrlp-template.c
asn1/spnego/packet-spnego-template.c
asn1/t38/packet-t38-template.c
asn1/x2ap/packet-x2ap-template.c

index ef6bb09115b78169e880cc07f30accf793a4df08..ad4b2d5385645debd22d40a3d85d30be80515976 100644 (file)
@@ -59,7 +59,6 @@ int proto_h235 = -1;
 /* Initialize the subtree pointers */
 #include "packet-h235-ett.c"
 
-static dissector_handle_t mikey_handle=NULL;
 
 static int
 dissect_xxx_ToBeSigned(tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
@@ -102,8 +101,8 @@ void proto_register_h235(void) {
     oid_add_from_string("HMAC-SHA1-96","0.0.8.235.0.1.6");
     oid_add_from_string("HMAC-SHA1-96","0.0.8.235.0.2.6");
   /* H.235.7, Chapter 5, Table 1 */
-    oid_add_from_string("MIKEY",                       OID_MIKEY);
-    oid_add_from_string("MIKEY-PS",                    OID_MIKEY_PS);
+    oid_add_from_string("MIKEY",               OID_MIKEY);
+    oid_add_from_string("MIKEY-PS",            OID_MIKEY_PS);
     oid_add_from_string("MIKEY-DHHMAC",                OID_MIKEY_DHHMAC);
     oid_add_from_string("MIKEY-PK-SIGN",       OID_MIKEY_PK_SIGN);
     oid_add_from_string("MIKEY-DH-SIGN",       OID_MIKEY_DH_SIGN);
@@ -120,6 +119,7 @@ void proto_register_h235(void) {
 
 /*--- proto_reg_handoff_h235 -------------------------------------------*/
 void proto_reg_handoff_h235(void) {
+  dissector_handle_t mikey_handle;
 
   mikey_handle = find_dissector("mikey");
 
index 4f366c90dba4fcb4a47181f828ee147335e05d1e..f10aee757cbf5a671224d7ddf3aefdb869d7e7c2 100644 (file)
@@ -71,7 +71,6 @@ static dissector_table_t gef_name_dissector_table;
 static dissector_table_t gef_content_dissector_table;
 static dissector_handle_t nsp_handle;
 static dissector_handle_t data_handle;
-static dissector_handle_t h245_handle;
 static dissector_handle_t MultimediaSystemControlMessage_handle;
 static dissector_handle_t h263_handle = NULL;
 static dissector_handle_t amr_handle = NULL;
@@ -554,6 +553,8 @@ void proto_register_h245(void) {
 
 /*--- proto_reg_handoff_h245 ---------------------------------------*/
 void proto_reg_handoff_h245(void) {
+       dissector_handle_t h245_handle;
+
        rtp_handle = find_dissector("rtp");
        rtcp_handle = find_dissector("rtcp");
        t38_handle = find_dissector("t38");
@@ -562,9 +563,9 @@ void proto_reg_handoff_h245(void) {
        amr_handle = find_dissector("amr_if2_nb");
 
 
-       h245_handle=create_dissector_handle(dissect_h245, proto_h245);
+       h245_handle = find_dissector("h245");
        dissector_add_handle("tcp.port", h245_handle);
-       MultimediaSystemControlMessage_handle=create_dissector_handle(dissect_h245_h245, proto_h245);
+       MultimediaSystemControlMessage_handle = find_dissector("h245dg");
        dissector_add_handle("udp.port", MultimediaSystemControlMessage_handle);
 }
 
index 62fddfd4435d5567448c56b94233c980bfb0cf9b..b10453b2834894353383d734cca153e0b5d5e095 100644 (file)
@@ -51,13 +51,10 @@ int proto_h283 = -1;
 static int ett_h283 = -1;
 #include "packet-h283-ett.c"
 
-/* Dissectors */
-static dissector_handle_t h283_udp_handle = NULL; 
-
 /* Subdissectors */
-static dissector_handle_t rdc_pdu_handle = NULL
-static dissector_handle_t rdc_device_list_handle = NULL
-static dissector_handle_t data_handle = NULL
+static dissector_handle_t rdc_pdu_handle; 
+static dissector_handle_t rdc_device_list_handle; 
+static dissector_handle_t data_handle; 
 
 static gboolean info_is_set;
 
@@ -102,14 +99,15 @@ void proto_register_h283(void) {
   proto_register_subtree_array(ett, array_length(ett));
 
   new_register_dissector(PFNAME, dissect_h283_udp, proto_h283);
-  h283_udp_handle = find_dissector(PFNAME);
 
 }
 
 /*--- proto_reg_handoff_h283 -------------------------------------------*/
 void proto_reg_handoff_h283(void) 
 {
+  dissector_handle_t h283_udp_handle; 
 
+  h283_udp_handle = find_dissector(PFNAME);
   dissector_add_handle("udp.port", h283_udp_handle); 
 
   rdc_pdu_handle = find_dissector("rdc");
index 44f2b816ad3c6208708dfc9a98f0c7b12e8af53d..f5fbe75ae3861ea9c1640cf98f82c05399c9a61f 100644 (file)
@@ -91,9 +91,6 @@ void gef_ctx_update_key(gef_ctx_t *gefx) {
   );
 }
 
-/* Subdissectors */
-static dissector_handle_t q931_handle = NULL; 
-
 /* Initialize the protocol and registered fields */
 int proto_h323 = -1;
 #include "packet-h323-hf.c"
@@ -129,6 +126,8 @@ void proto_register_h323(void) {
 /*--- proto_reg_handoff_h323 -------------------------------------------*/
 void proto_reg_handoff_h323(void) 
 {
+  dissector_handle_t q931_handle; 
+
   q931_handle = find_dissector("q931");
 
   /* H.323, Annex M1, Tunnelling of signalling protocols (QSIG) in H.323 */
index 2c8420dd95ea304d1f5fb20f290799381ad34393..5905bc1079bbc5086555fb7e0698953d3f5ad157 100644 (file)
@@ -71,9 +71,6 @@ static const value_string h450_str_error[] = {
 /* ROSE context */
 static rose_ctx_t h450_rose_ctx;
 
-/* Subdissectors */
-static dissector_handle_t data_handle = NULL; 
-
 /* Global variables */
 
 #include "packet-h450-fn.c"
@@ -292,8 +289,6 @@ proto_reg_handoff_h450(void)
   dissector_handle_t h450_res_handle;
   dissector_handle_t h450_err_handle;
 
-  data_handle = find_dissector("data");
-
   h450_arg_handle = new_create_dissector_handle(dissect_h450_arg, proto_h450);
   h450_res_handle = new_create_dissector_handle(dissect_h450_res, proto_h450);
   for (i=0; i<(int)array_length(h450_op_tab); i++) {
index 4c40ecf86879cf0281b07e413a1f759df5c9913c..9c237d892c718fd85cc0ec55d6e0304220918486 100644 (file)
@@ -55,19 +55,13 @@ static int ett_h501 = -1;
 #include "packet-h501-ett.c"
 
 /* Dissectors */
-static dissector_handle_t h501_pdu_handle = NULL;
-static dissector_handle_t h501_udp_handle = NULL;
-static dissector_handle_t h501_tcp_handle = NULL;
+static dissector_handle_t h501_pdu_handle;
 
 /* Preferences */
 static guint h501_udp_port = 2099;
 static guint h501_tcp_port = 2099;
 static gboolean h501_desegment_tcp = TRUE;
 
-/* Gloabl variables */
-static guint saved_h501_udp_port;
-static guint saved_h501_tcp_port;
-
 void proto_reg_handoff_h501(void);
 
 #include "packet-h501-fn.c"
@@ -124,10 +118,6 @@ void proto_register_h501(void) {
   proto_register_subtree_array(ett, array_length(ett));
 
   new_register_dissector(PFNAME, dissect_h501_pdu, proto_h501);
-  h501_pdu_handle = find_dissector(PFNAME);
-
-  h501_udp_handle = new_create_dissector_handle(dissect_h501_udp, proto_h501);
-  h501_tcp_handle = new_create_dissector_handle(dissect_h501_tcp, proto_h501);
 
   h501_module = prefs_register_protocol(proto_h501, proto_reg_handoff_h501);
   prefs_register_uint_preference(h501_module, "udp.port",
@@ -149,12 +139,19 @@ void proto_register_h501(void) {
 void proto_reg_handoff_h501(void) 
 {
   static gboolean h501_prefs_initialized = FALSE;
-
-  if (h501_prefs_initialized) {
+  static dissector_handle_t h501_udp_handle;
+  static dissector_handle_t h501_tcp_handle;
+  static guint saved_h501_udp_port;
+  static guint saved_h501_tcp_port;
+
+  if (!h501_prefs_initialized) {
+    h501_pdu_handle = find_dissector(PFNAME);
+    h501_udp_handle = new_create_dissector_handle(dissect_h501_udp, proto_h501);
+    h501_tcp_handle = new_create_dissector_handle(dissect_h501_tcp, proto_h501);
+    h501_prefs_initialized = TRUE;
+  } else {
     dissector_delete("udp.port", saved_h501_udp_port, h501_udp_handle);
     dissector_delete("tcp.port", saved_h501_tcp_port, h501_tcp_handle);
-  } else {
-    h501_prefs_initialized = TRUE;
   }
 
   /* Set our port number for future use */
index 513b37e168d78c5e2502fbc5ceefaf5dd8d5adc6..42374168a4518c4556f36224d80819d6b1631bc7 100644 (file)
@@ -568,9 +568,8 @@ proto_register_mpeg_pes(void)
 void
 proto_reg_handoff_mpeg_pes(void)
 {
-       dissector_handle_t mpeg_handle = create_dissector_handle(
-                       dissect_mpeg, proto_mpeg);
-       dissector_add("wtap_encap", WTAP_ENCAP_MPEG, mpeg_handle);
+       dissector_handle_t mpeg_handle = find_dissector("mpeg");
 
+       dissector_add("wtap_encap", WTAP_ENCAP_MPEG, mpeg_handle);
        heur_dissector_add("mpeg", dissect_mpeg_pes, proto_mpeg_pes);
 }
index dbf13961ee4a3da315f8c8e59d25311921f446e6..1151c10b0f4fa15f2d21772509a6fc9b1452613f 100644 (file)
@@ -51,8 +51,6 @@
 
 #include "packet-nbap-val.h"
 
-static dissector_handle_t nbap_handle = NULL;
-
 /* Initialize the protocol and registered fields */
 static int proto_nbap = -1;
 
@@ -153,7 +151,6 @@ void proto_register_nbap(void) {
  
   /* Register dissector */
   register_dissector("nbap", dissect_nbap, proto_nbap);
-  nbap_handle = find_dissector("nbap");
 
   /* Register dissector tables */
   nbap_ies_dissector_table = register_dissector_table("nbap.ies", "NBAP-PROTOCOL-IES", FT_UINT32, BASE_DEC);
@@ -169,7 +166,9 @@ void proto_register_nbap(void) {
 void
 proto_reg_handoff_nbap(void)
 {
+       dissector_handle_t nbap_handle;
 
+       nbap_handle = find_dissector("nbap");
        /*dissector_add("sctp.ppi",  Add ppid here, nbap_handle); */
        dissector_add("sctp.port", 0, nbap_handle);
 
index 5cc95221deeca833a3d01cbc3ee29c1e7d121cda..ebed644121e641af2a2f9afcb479b2da999c17bb 100644 (file)
@@ -57,9 +57,6 @@ static struct SESSION_DATA_STRUCTURE* session = NULL;
 proto_tree *global_tree  = NULL;
 packet_info *global_pinfo = NULL;
 
-/* dissector for data */
-static dissector_handle_t data_handle;
-
 static const char *abstract_syntax_name_oid;
 static guint32 presentation_context_identifier;
 
@@ -345,6 +342,4 @@ void proto_reg_handoff_pres(void) {
 /*     register_ber_oid_dissector("0.4.0.0.1.1.1.1", dissect_pres, proto_pres, 
          "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) abstractSyntax(1) pres(1) version1(1)"); */
 
-       data_handle = find_dissector("data");
-
 }
index 4f68a74909e6198343f5528da9dacaaacb7d6ad1..88d469f274834165755c96bd69551ea2526a382b 100644 (file)
@@ -60,11 +60,7 @@ static gint ett_q932_ie = -1;
 static rose_ctx_t q932_rose_ctx;
 
 /* Subdissectors */
-static dissector_handle_t data_handle = NULL; 
-static dissector_handle_t q932_ros_handle = NULL; 
-
-/* Gloabl variables */
-
+static dissector_handle_t q932_ros_handle; 
 
 #define        Q932_IE_EXTENDED_FACILITY   0x0D
 #define        Q932_IE_FACILITY            0x1C
@@ -335,7 +331,6 @@ void proto_reg_handoff_q932(void) {
   dissector_add("q931.ie", (0x00 << 8) | Q932_IE_NOTIFICATION_INDICATOR, q932_ie_handle); 
 
   q932_ros_handle = find_dissector("q932.ros");
-  data_handle = find_dissector("data");
 }
 
 /*---------------------------------------------------------------------------*/
index f65aa3a7ede8b5cadb16dddbd7a5904c5d493170..0cb0a96937be5007154c67157d0b91c3b5ff1e3f 100644 (file)
@@ -312,11 +312,7 @@ static gint ett_qsig_unknown_extension = -1;
 
 /* Preferences */
 
-/* Subdissectors */
-static dissector_handle_t q931_handle = NULL; 
-static dissector_handle_t data_handle = NULL; 
-
-/* Gloabl variables */
+/* Global variables */
 static const char *extension_oid = NULL;
 
 /* Dissector tables */
@@ -643,13 +639,13 @@ void proto_register_qsig(void) {
 /*--- proto_reg_handoff_qsig ------------------------------------------------*/
 void proto_reg_handoff_qsig(void) {
   int i;
+  dissector_handle_t q931_handle; 
   dissector_handle_t qsig_arg_handle;
   dissector_handle_t qsig_res_handle;
   dissector_handle_t qsig_err_handle;
   dissector_handle_t qsig_ie_handle;
 
   q931_handle = find_dissector("q931");
-  data_handle = find_dissector("data");
 
   qsig_arg_handle = new_create_dissector_handle(dissect_qsig_arg, proto_qsig);
   qsig_res_handle = new_create_dissector_handle(dissect_qsig_res, proto_qsig);
index 6aa6f77f8c4f5c567c408440e832e81c51b37963..9cbe2d2e23730b3b3de7fc4212cc43a6850f82b2 100644 (file)
@@ -56,8 +56,6 @@
 
 #include "packet-rnsap-val.h"
 
-static dissector_handle_t rnsap_handle = NULL;
-
 static dissector_handle_t rrc_dl_dcch_handle = NULL;
 
 /* Initialize the protocol and registered fields */
@@ -160,7 +158,6 @@ void proto_register_rnsap(void) {
  
   /* Register dissector */
   register_dissector("rnsap", dissect_rnsap, proto_rnsap);
-  rnsap_handle = find_dissector("rnsap");
 
   /* Register dissector tables */
   rnsap_ies_dissector_table = register_dissector_table("rnsap.ies", "RNSAP-PROTOCOL-IES", FT_UINT32, BASE_DEC);
@@ -176,7 +173,9 @@ void proto_register_rnsap(void) {
 void
 proto_reg_handoff_rnsap(void)
 {
+       dissector_handle_t rnsap_handle;
 
+       rnsap_handle = find_dissector("rnsap");
        rrc_dl_dcch_handle = find_dissector("rrc.dl.dcch");
 
        dissector_add("sccp.ssn", SCCP_SSN_RNSAP, rnsap_handle);
index 40cdc9b32e739a94adaedd3d3d248428834c8d2e..95bc0db05ab4177429a07997930390ce51f6d588 100644 (file)
@@ -53,8 +53,7 @@
 #define PSNAME "RRC"
 #define PFNAME "rrc"
 
-static dissector_handle_t rrc_handle=NULL;
-static dissector_handle_t gsm_a_dtap_handle=NULL;
+static dissector_handle_t gsm_a_dtap_handle;
 
 /* Include constants */
 #include "packet-rrc-val.h"
@@ -141,7 +140,6 @@ void proto_register_rrc(void) {
   proto_register_field_array(proto_rrc, hf, array_length(hf));
   proto_register_subtree_array(ett, array_length(ett));
 
-
   register_dissector("rrc", dissect_rrc, proto_rrc);
 
 #include "packet-rrc-dis-reg.c"
@@ -154,7 +152,6 @@ void
 proto_reg_handoff_rrc(void)
 {
 
-       rrc_handle = find_dissector("rrc");
        gsm_a_dtap_handle = find_dissector("gsm_a_dtap");
 
 }
index 8781e5d9d576f64f0203c7ebce0491eb5e65158b..415954d28aed67e63fa8cc589d4025fffe35e489 100644 (file)
@@ -53,8 +53,6 @@
 #pragma warning(disable:4146)
 #endif
 
-static dissector_handle_t rrlp_handle=NULL;
-
 
 /* Initialize the protocol and registered fields */
 static int proto_rrlp = -1;
@@ -106,9 +104,6 @@ void
 proto_reg_handoff_rrlp(void)
 {
 
-       rrlp_handle = create_dissector_handle(dissect_PDU_PDU, proto_rrlp);
-
-
 }
 
 
index fba8e99a3c3a3b98aafe29ceadd8ec3780c7b2d1..0357465f8cd34970a54b9f29eba6a65fd073d9ab 100644 (file)
@@ -96,8 +96,6 @@ static gint ett_spnego_krb5_cfx_flags = -1;
 
 #include "packet-spnego-ett.c"
 
-static dissector_handle_t data_handle;
-
 /*
  * Unfortunately, we have to have a forward declaration of this,
  * as the code generated by asn2wrs includes a call before the
@@ -1414,9 +1412,8 @@ void proto_reg_handoff_spnego(void) {
 
        /* Register protocol with GSS-API module */
 
-       spnego_handle = create_dissector_handle(dissect_spnego, proto_spnego);
-       spnego_wrap_handle = new_create_dissector_handle(dissect_spnego_wrap,
-                                                        proto_spnego);
+        spnego_handle = find_dissector("spnego");
+       spnego_wrap_handle = new_create_dissector_handle(dissect_spnego_wrap,  proto_spnego);
        gssapi_init_oid("1.3.6.1.5.5.2", proto_spnego, ett_spnego,
            spnego_handle, spnego_wrap_handle,
            "SPNEGO - Simple Protected Negotiation");
@@ -1430,10 +1427,8 @@ void proto_reg_handoff_spnego(void) {
         * See the archive of <ietf-krb-wg@anl.gov> for the thread topic
         * SPNEGO implementation issues. 3-Dec-2002.
         */
-       spnego_krb5_handle = create_dissector_handle(dissect_spnego_krb5,
-                                                    proto_spnego_krb5);
-       spnego_krb5_wrap_handle = new_create_dissector_handle(dissect_spnego_krb5_wrap,
-                                                             proto_spnego_krb5);
+        spnego_krb5_handle = find_dissector("spnego-krb5");
+       spnego_krb5_wrap_handle = find_dissector("spnego-krb5-wrap");
        gssapi_init_oid("1.2.840.48018.1.2.2", proto_spnego_krb5, ett_spnego_krb5,
                        spnego_krb5_handle, spnego_krb5_wrap_handle,
                        "MS KRB5 - Microsoft Kerberos 5");
@@ -1444,8 +1439,4 @@ void proto_reg_handoff_spnego(void) {
                        spnego_krb5_handle, spnego_krb5_wrap_handle,
                        "KRB5 - Kerberos 5 - User to User");
 
-       /*
-        * Find the data handle for some calls
-        */
-       data_handle = find_dissector("data");
 }
index 5461b2b04eda0514ed847569237fe5744e352593..319818b9adeeee6214ed853dcf9adce448e5506d 100644 (file)
@@ -73,13 +73,6 @@ static guint global_t38_udp_port = PORT_T38;
 
 static int t38_tap = -1;
 
-/*
-* Variables to allow for proper deletion of dissector registration when
-* the user changes port from the gui.
-*/
-static guint tcp_port = 0;
-static guint udp_port = 0;
-
 /* dissect using the Pre Corrigendum T.38 ASN.1 specification (1998) */
 static gboolean use_pre_corrigendum_asn1_specification = TRUE;
 
@@ -745,7 +738,7 @@ proto_register_t38(void)
        register_dissector("t38", dissect_t38, proto_t38);
 
        /* Init reassemble tables for HDLC */
-    register_init_routine(t38_defragment_init);
+       register_init_routine(t38_defragment_init);
 
        t38_tap = register_tap("t38");
 
@@ -773,7 +766,8 @@ proto_register_t38(void)
                "Reassemble T.38 PDUs over TPKT over TCP",
                "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments "
                "when TPKT is used over TCP. "
-        "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
+               "To use this option, you must also enable \"Allow subdissectors to reassemble "
+               "TCP streams\" in the TCP protocol settings.",
                &t38_tpkt_reassembly);
        prefs_register_enum_preference(t38_module, "tpkt_usage",
                "TPKT used over TCP",
@@ -791,12 +785,17 @@ proto_register_t38(void)
 void
 proto_reg_handoff_t38(void)
 {
-       static int t38_prefs_initialized = FALSE;
+       static gboolean t38_prefs_initialized = FALSE;
+       static guint tcp_port;
+       static guint udp_port;
 
        if (!t38_prefs_initialized) {
                t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
                t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
                t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
+               rtp_handle = find_dissector("rtp");
+               t30_hdlc_handle = find_dissector("t30.hdlc");
+               data_handle = find_dissector("data");
                t38_prefs_initialized = TRUE;
        }
        else {
@@ -809,11 +808,5 @@ proto_reg_handoff_t38(void)
        dissector_add("tcp.port", tcp_port, t38_tcp_handle);
        dissector_add("udp.port", udp_port, t38_udp_handle);
 
-       rtp_handle = find_dissector("rtp");
-       t30_hdlc_handle = find_dissector("t30.hdlc");
-       data_handle = find_dissector("data");
 }
 
-
-
-
index 2aa236fc02a7dcf79d8ef8e3c897cbfb50518068..32e9b31c4cfbcd8d9c0f262bc3051a2a0403463c 100644 (file)
@@ -56,8 +56,6 @@
 
 #include "packet-x2ap-val.h"
 
-static dissector_handle_t x2ap_handle = NULL;
-
 /* Initialize the protocol and registered fields */
 static int proto_x2ap = -1;
 
@@ -157,7 +155,6 @@ void proto_register_x2ap(void) {
  
   /* Register dissector */
   register_dissector("x2ap", dissect_x2ap, proto_x2ap);
-  x2ap_handle = find_dissector("x2ap");
 
   /* Register dissector tables */
   x2ap_ies_dissector_table = register_dissector_table("x2ap.ies", "X2AP-PROTOCOL-IES", FT_UINT32, BASE_DEC);
@@ -173,7 +170,9 @@ void proto_register_x2ap(void) {
 void
 proto_reg_handoff_x2ap(void)
 {
+       dissector_handle_t x2ap_handle;
 
+       x2ap_handle = find_dissector("x2ap");
        dissector_add("sctp.port", 0, x2ap_handle);
 
 #include "packet-x2ap-dis-tab.c"