Convert ASN1 dissectors from ep_address_to_str to address_to_str. Clean up a bit
authorEvan Huus <eapache@gmail.com>
Sat, 23 Nov 2013 22:37:33 +0000 (22:37 -0000)
committerEvan Huus <eapache@gmail.com>
Sat, 23 Nov 2013 22:37:33 +0000 (22:37 -0000)
of ansi_tcap code while in the neighbourhood.

svn path=/trunk/; revision=53530

asn1/ansi_map/packet-ansi_map-template.c
asn1/ansi_tcap/packet-ansi_tcap-template.c
asn1/h245/packet-h245-template.c
asn1/nbap/nbap.cnf
epan/dissectors/packet-ansi_map.c
epan/dissectors/packet-ansi_tcap.c
epan/dissectors/packet-h245.c
epan/dissectors/packet-nbap.c

index 7f048ba62c81e22130498e763cd07a5c8ed37652..e94a3f98926b5b2ef31b3609a75925aa62731a16 100644 (file)
@@ -409,8 +409,8 @@ update_saved_invokedata(packet_info *pinfo, struct ansi_tcap_private_t *p_privat
     guint8 *dst_str;
     const char *buf = NULL;
 
-    src_str = ep_address_to_str(src);
-    dst_str = ep_address_to_str(dst);
+    src_str = address_to_str(wmem_packet_scope(), src);
+    dst_str = address_to_str(wmem_packet_scope(), dst);
 
     /* Data from the TCAP dissector */
     if ((!pinfo->fd->flags.visited)&&(p_private_tcap->TransactionID_str)){
@@ -4337,8 +4337,8 @@ find_saved_invokedata(asn1_ctx_t *actx, struct ansi_tcap_private_t *p_private_tc
 
     /* Data from the TCAP dissector */
     /* The hash string needs to contain src and dest to distiguish differnt flows */
-    src_str = ep_address_to_str(src);
-    dst_str = ep_address_to_str(dst);
+    src_str = address_to_str(wmem_packet_scope(), src);
+    dst_str = address_to_str(wmem_packet_scope(), dst);
     /* Reverse order to invoke */
     switch(ansi_map_response_matching_type){
         case ANSI_MAP_TID_ONLY:
index ac4ff7b17e7b49fccefcb20eb48a236ce555847e..3153afffee0797b21344584f000cbbaa949333a1 100644 (file)
@@ -187,10 +187,12 @@ ansi_tcap_init_protocol(void)
 static void
 save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
   struct ansi_tcap_invokedata_t *ansi_tcap_saved_invokedata;
-  address* src = &(pinfo->src);
-  address* dst = &(pinfo->dst);
+  gchar *src, *dst;
   char *buf;
 
+  src = address_to_str(wmem_packet_scope(), &(pinfo->src));
+  dst = address_to_str(wmem_packet_scope(), &(pinfo->dst));
+
   if ((!pinfo->fd->flags.visited)&&(ansi_tcap_private.TransactionID_str)){
 
           /* Only do this once XXX I hope its the right thing to do */
@@ -200,10 +202,10 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
                                 buf = wmem_strdup(wmem_packet_scope(), ansi_tcap_private.TransactionID_str);
                                 break;
                         case 1:
-                                buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src));
+                                buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",ansi_tcap_private.TransactionID_str,src);
                                 break;
                         default:
-                                buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src),ep_address_to_str(dst));
+                                buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",ansi_tcap_private.TransactionID_str,src,dst);
                                 break;
                 }
 
@@ -229,32 +231,31 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
 static gboolean
 find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
   struct ansi_tcap_invokedata_t *ansi_tcap_saved_invokedata;
-  address* src = &(pinfo->src);
-  address* dst = &(pinfo->dst);
+  gchar *src, *dst;
   char *buf;
 
   if (!ansi_tcap_private.TransactionID_str) {
     return FALSE;
   }
 
+  src = address_to_str(wmem_packet_scope(), &(pinfo->src));
+  dst = address_to_str(wmem_packet_scope(), &(pinfo->dst));
+
   /* The hash string needs to contain src and dest to distiguish differnt flows */
   buf = (char *)wmem_alloc(wmem_packet_scope(), MAX_TID_STR_LEN);
   buf[0] = '\0';
   /* Reverse order to invoke */
-  g_snprintf(buf, MAX_TID_STR_LEN, "%s%s%s",
-        ansi_tcap_private.TransactionID_str, ep_address_to_str(dst),
-        ep_address_to_str(src));
   switch(ansi_tcap_response_matching_type){
         case 0:
                 g_snprintf(buf,MAX_TID_STR_LEN,"%s",ansi_tcap_private.TransactionID_str);
                 break;
         case 1:
-                g_snprintf(buf,MAX_TID_STR_LEN,"%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(dst));
+                g_snprintf(buf,MAX_TID_STR_LEN,"%s%s",ansi_tcap_private.TransactionID_str,dst);
                 break;
         default:
-                    g_snprintf(buf,MAX_TID_STR_LEN,"%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(dst),ep_address_to_str(src));
-                    break;
-    }
+                g_snprintf(buf,MAX_TID_STR_LEN,"%s%s%s",ansi_tcap_private.TransactionID_str,dst,src);
+                break;
+  }
 
   ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)g_hash_table_lookup(TransactionId_table, buf);
   if(ansi_tcap_saved_invokedata){
index e791a4f0075a4a0859af382424a0abae8082242f..d95292c683925fb664e896e5cdd1c0ac2b2ef2ec 100644 (file)
@@ -323,7 +323,10 @@ void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )
 
 static const gchar *gen_olc_key(guint16 lc_num, address *dst_addr, address *src_addr)
 {
-  return wmem_strdup_printf(wmem_packet_scope(), "%s/%s/%u", ep_address_to_str(dst_addr), ep_address_to_str(src_addr), lc_num);
+  return wmem_strdup_printf(wmem_packet_scope(), "%s/%s/%u",
+          address_to_str(wmem_packet_scope(), dst_addr),
+          address_to_str(wmem_packet_scope(), src_addr),
+          lc_num);
 }
 
 static void update_unicast_addr(unicast_addr_t *req_addr, unicast_addr_t *ack_addr)
index ee041e4407a93367a65e52be25cbccbf04570519..16e021c61131367425b310266f2eea6820ecb675 100644 (file)
@@ -1323,7 +1323,7 @@ BindingID_port = 0;
                     nbap_debug4("    g_tree_insert(edch_flow_port_map) com_context_id %%u e_dch_macdflow_id %%u IP %%s Port %%u",
                         umts_fp_conversation_info->com_context_id,
                         e_dch_macdflow_id,
-                        ep_address_to_str(&dst_addr),
+                        address_to_str(wmem_packet_scope(), &dst_addr),
                         BindingID_port);
 
                     /* Set address for collection of DDI entries */
@@ -1336,7 +1336,7 @@ BindingID_port = 0;
                     nbap_debug4("    Insert in existing edch_flow_port_map com_context_id %%u e_dch_macdflow_id %%u IP %%s Port %%u",
                         umts_fp_conversation_info->com_context_id,
                         e_dch_macdflow_id,
-                        ep_address_to_str(&dst_addr),
+                        address_to_str(wmem_packet_scope(), &dst_addr),
                         BindingID_port);
 
                     /* Must be same ADDRESS */
@@ -1434,12 +1434,12 @@ BindingID_port = 0;
         if(old_conversation){
             nbap_debug3("Frame %%u E-DCH-FDD-Information-to-Modify: found old conv on IP %%s Port %%u",
                 actx->pinfo->fd->num,
-                ep_address_to_str(&dst_addr),
+                address_to_str(wmem_packet_scope(), &dst_addr),
                 BindingID_port);
         }else{
             nbap_debug3("Frame %%u E-DCH-FDD-Information-to-Modify: Did not find old conv on IP %%s Port %%u",
                 actx->pinfo->fd->num,
-                ep_address_to_str(&dst_addr),
+                address_to_str(wmem_packet_scope(), &dst_addr),
                 BindingID_port);
         }
 
@@ -1778,7 +1778,7 @@ nbap_edch_channel_info[e_dch_macdflow_id].no_ddi_entries = num_items;
             nbap_debug4("Frame %%u HSDSCH-MACdFlows-Information:hsdsch_macdflow_id %%u Look for conv on IP %%s Port %%u",
                         actx->pinfo->fd->num,
                         i,
-                        ep_address_to_str (&(nbap_hsdsch_channel_info[i].crnc_address)),
+                        address_to_str (wmem_packet_scope(), &(nbap_hsdsch_channel_info[i].crnc_address)),
                         nbap_hsdsch_channel_info[i].crnc_port);
             conversation = find_conversation(actx->pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), &null_addr,
                                PT_UDP,
@@ -1894,7 +1894,7 @@ nbap_edch_channel_info[e_dch_macdflow_id].no_ddi_entries = num_items;
         if (nbap_hsdsch_channel_info[i].crnc_port != 0){
             nbap_debug3("    hsdsch_macdflow_id %%u Look for conv on IP %%s Port %%u",
                         i,
-                        ep_address_to_str (&(nbap_hsdsch_channel_info[i].crnc_address)),
+                        address_to_str (wmem_packet_scope(), &(nbap_hsdsch_channel_info[i].crnc_address)),
                         nbap_hsdsch_channel_info[i].crnc_port);
             conversation = find_conversation(actx->pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), &null_addr,
                                PT_UDP,
index ec6c4315e5bf119a180004bb2dcc8bddb9eca33d..8f90e001d16dc7f28dc68e9d1b2fe367091e3766 100644 (file)
@@ -1197,8 +1197,8 @@ update_saved_invokedata(packet_info *pinfo, struct ansi_tcap_private_t *p_privat
     guint8 *dst_str;
     const char *buf = NULL;
 
-    src_str = ep_address_to_str(src);
-    dst_str = ep_address_to_str(dst);
+    src_str = address_to_str(wmem_packet_scope(), src);
+    dst_str = address_to_str(wmem_packet_scope(), dst);
 
     /* Data from the TCAP dissector */
     if ((!pinfo->fd->flags.visited)&&(p_private_tcap->TransactionID_str)){
@@ -16215,8 +16215,8 @@ find_saved_invokedata(asn1_ctx_t *actx, struct ansi_tcap_private_t *p_private_tc
 
     /* Data from the TCAP dissector */
     /* The hash string needs to contain src and dest to distiguish differnt flows */
-    src_str = ep_address_to_str(src);
-    dst_str = ep_address_to_str(dst);
+    src_str = address_to_str(wmem_packet_scope(), src);
+    dst_str = address_to_str(wmem_packet_scope(), dst);
     /* Reverse order to invoke */
     switch(ansi_map_response_matching_type){
         case ANSI_MAP_TID_ONLY:
index 12ce6297a80316f49724237e0d6f21854fbb33f1..43de2a7b87de07f21e1f6ec46d659ff90995effd 100644 (file)
@@ -278,10 +278,12 @@ ansi_tcap_init_protocol(void)
 static void
 save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
   struct ansi_tcap_invokedata_t *ansi_tcap_saved_invokedata;
-  address* src = &(pinfo->src);
-  address* dst = &(pinfo->dst);
+  gchar *src, *dst;
   char *buf;
 
+  src = address_to_str(wmem_packet_scope(), &(pinfo->src));
+  dst = address_to_str(wmem_packet_scope(), &(pinfo->dst));
+
   if ((!pinfo->fd->flags.visited)&&(ansi_tcap_private.TransactionID_str)){
 
           /* Only do this once XXX I hope its the right thing to do */
@@ -291,10 +293,10 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
                                 buf = wmem_strdup(wmem_packet_scope(), ansi_tcap_private.TransactionID_str);
                                 break;
                         case 1:
-                                buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src));
+                                buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",ansi_tcap_private.TransactionID_str,src);
                                 break;
                         default:
-                                buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src),ep_address_to_str(dst));
+                                buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",ansi_tcap_private.TransactionID_str,src,dst);
                                 break;
                 }
 
@@ -320,32 +322,31 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
 static gboolean
 find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
   struct ansi_tcap_invokedata_t *ansi_tcap_saved_invokedata;
-  address* src = &(pinfo->src);
-  address* dst = &(pinfo->dst);
+  gchar *src, *dst;
   char *buf;
 
   if (!ansi_tcap_private.TransactionID_str) {
     return FALSE;
   }
 
+  src = address_to_str(wmem_packet_scope(), &(pinfo->src));
+  dst = address_to_str(wmem_packet_scope(), &(pinfo->dst));
+
   /* The hash string needs to contain src and dest to distiguish differnt flows */
   buf = (char *)wmem_alloc(wmem_packet_scope(), MAX_TID_STR_LEN);
   buf[0] = '\0';
   /* Reverse order to invoke */
-  g_snprintf(buf, MAX_TID_STR_LEN, "%s%s%s",
-        ansi_tcap_private.TransactionID_str, ep_address_to_str(dst),
-        ep_address_to_str(src));
   switch(ansi_tcap_response_matching_type){
         case 0:
                 g_snprintf(buf,MAX_TID_STR_LEN,"%s",ansi_tcap_private.TransactionID_str);
                 break;
         case 1:
-                g_snprintf(buf,MAX_TID_STR_LEN,"%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(dst));
+                g_snprintf(buf,MAX_TID_STR_LEN,"%s%s",ansi_tcap_private.TransactionID_str,dst);
                 break;
         default:
-                    g_snprintf(buf,MAX_TID_STR_LEN,"%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(dst),ep_address_to_str(src));
-                    break;
-    }
+                g_snprintf(buf,MAX_TID_STR_LEN,"%s%s%s",ansi_tcap_private.TransactionID_str,dst,src);
+                break;
+  }
 
   ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)g_hash_table_lookup(TransactionId_table, buf);
   if(ansi_tcap_saved_invokedata){
@@ -1394,7 +1395,7 @@ dissect_ansi_tcap_PackageType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
 
 
 /*--- End of included file: packet-ansi_tcap-fn.c ---*/
-#line 352 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 353 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
 
 
 
@@ -1739,7 +1740,7 @@ proto_register_ansi_tcap(void)
         NULL, HFILL }},
 
 /*--- End of included file: packet-ansi_tcap-hfarr.c ---*/
-#line 488 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 489 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
     };
 
 /* Setup protocol subtree array */
@@ -1777,7 +1778,7 @@ proto_register_ansi_tcap(void)
     &ett_ansi_tcap_T_paramSet,
 
 /*--- End of included file: packet-ansi_tcap-ettarr.c ---*/
-#line 499 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 500 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
     };
 
     static const enum_val_t ansi_tcap_response_matching_type_values[] = {
index ae98907a8b155f102e5a3210e22dfdb75c52cb2a..cb122b7f406967592669a61d6c0c8e91dd2a8538 100644 (file)
@@ -454,7 +454,10 @@ void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )
 
 static const gchar *gen_olc_key(guint16 lc_num, address *dst_addr, address *src_addr)
 {
-  return wmem_strdup_printf(wmem_packet_scope(), "%s/%s/%u", ep_address_to_str(dst_addr), ep_address_to_str(src_addr), lc_num);
+  return wmem_strdup_printf(wmem_packet_scope(), "%s/%s/%u",
+          address_to_str(wmem_packet_scope(), dst_addr),
+          address_to_str(wmem_packet_scope(), src_addr),
+          lc_num);
 }
 
 static void update_unicast_addr(unicast_addr_t *req_addr, unicast_addr_t *ack_addr)
@@ -1922,7 +1925,7 @@ static int hf_h245_encrypted = -1;                /* OCTET_STRING */
 static int hf_h245_encryptedAlphanumeric = -1;    /* EncryptedAlphanumeric */
 
 /*--- End of included file: packet-h245-hf.c ---*/
-#line 388 "../../asn1/h245/packet-h245-template.c"
+#line 391 "../../asn1/h245/packet-h245-template.c"
 
 /* Initialize the subtree pointers */
 static int ett_h245 = -1;
@@ -2423,7 +2426,7 @@ static gint ett_h245_FlowControlIndication = -1;
 static gint ett_h245_MobileMultilinkReconfigurationIndication = -1;
 
 /*--- End of included file: packet-h245-ett.c ---*/
-#line 393 "../../asn1/h245/packet-h245-template.c"
+#line 396 "../../asn1/h245/packet-h245-template.c"
 
 /* Forward declarations */
 static int dissect_h245_MultimediaSystemControlMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
@@ -14490,7 +14493,7 @@ static void dissect_OpenLogicalChannel_PDU(tvbuff_t *tvb _U_, packet_info *pinfo
 
 
 /*--- End of included file: packet-h245-fn.c ---*/
-#line 402 "../../asn1/h245/packet-h245-template.c"
+#line 405 "../../asn1/h245/packet-h245-template.c"
 
 static void
 dissect_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
@@ -20184,7 +20187,7 @@ void proto_register_h245(void) {
         NULL, HFILL }},
 
 /*--- End of included file: packet-h245-hfarr.c ---*/
-#line 483 "../../asn1/h245/packet-h245-template.c"
+#line 486 "../../asn1/h245/packet-h245-template.c"
   };
 
   /* List of subtrees */
@@ -20687,7 +20690,7 @@ void proto_register_h245(void) {
     &ett_h245_MobileMultilinkReconfigurationIndication,
 
 /*--- End of included file: packet-h245-ettarr.c ---*/
-#line 490 "../../asn1/h245/packet-h245-template.c"
+#line 493 "../../asn1/h245/packet-h245-template.c"
   };
   module_t *h245_module;
 
index e72d28faadfba87cffbdbb831b133a22e1c16e8f..3dd4f467371726321ff6bb6433b632028b75c95c 100644 (file)
@@ -18653,12 +18653,12 @@ BindingID_port = 0;
         if(old_conversation){
             nbap_debug3("Frame %u E-DCH-FDD-Information-to-Modify: found old conv on IP %s Port %u",
                 actx->pinfo->fd->num,
-                ep_address_to_str(&dst_addr),
+                address_to_str(wmem_packet_scope(), &dst_addr),
                 BindingID_port);
         }else{
             nbap_debug3("Frame %u E-DCH-FDD-Information-to-Modify: Did not find old conv on IP %s Port %u",
                 actx->pinfo->fd->num,
-                ep_address_to_str(&dst_addr),
+                address_to_str(wmem_packet_scope(), &dst_addr),
                 BindingID_port);
         }
 
@@ -23797,7 +23797,7 @@ dissect_nbap_HSDSCH_FDD_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_
             nbap_debug4("Frame %u HSDSCH-MACdFlows-Information:hsdsch_macdflow_id %u Look for conv on IP %s Port %u",
                         actx->pinfo->fd->num,
                         i,
-                        ep_address_to_str (&(nbap_hsdsch_channel_info[i].crnc_address)),
+                        address_to_str (wmem_packet_scope(), &(nbap_hsdsch_channel_info[i].crnc_address)),
                         nbap_hsdsch_channel_info[i].crnc_port);
             conversation = find_conversation(actx->pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), &null_addr,
                                PT_UDP,
@@ -24134,7 +24134,7 @@ dissect_nbap_HSDSCH_Information_to_Modify(tvbuff_t *tvb _U_, int offset _U_, asn
         if (nbap_hsdsch_channel_info[i].crnc_port != 0){
             nbap_debug3("    hsdsch_macdflow_id %u Look for conv on IP %s Port %u",
                         i,
-                        ep_address_to_str (&(nbap_hsdsch_channel_info[i].crnc_address)),
+                        address_to_str (wmem_packet_scope(), &(nbap_hsdsch_channel_info[i].crnc_address)),
                         nbap_hsdsch_channel_info[i].crnc_port);
             conversation = find_conversation(actx->pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), &null_addr,
                                PT_UDP,
@@ -28866,7 +28866,7 @@ BindingID_port = 0;
                     nbap_debug4("    g_tree_insert(edch_flow_port_map) com_context_id %u e_dch_macdflow_id %u IP %s Port %u",
                         umts_fp_conversation_info->com_context_id,
                         e_dch_macdflow_id,
-                        ep_address_to_str(&dst_addr),
+                        address_to_str(wmem_packet_scope(), &dst_addr),
                         BindingID_port);
 
                     /* Set address for collection of DDI entries */
@@ -28879,7 +28879,7 @@ BindingID_port = 0;
                     nbap_debug4("    Insert in existing edch_flow_port_map com_context_id %u e_dch_macdflow_id %u IP %s Port %u",
                         umts_fp_conversation_info->com_context_id,
                         e_dch_macdflow_id,
-                        ep_address_to_str(&dst_addr),
+                        address_to_str(wmem_packet_scope(), &dst_addr),
                         BindingID_port);
 
                     /* Must be same ADDRESS */