Introduce preferences to set the strictness of Invoke/response
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 4 Feb 2011 16:12:59 +0000 (16:12 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 4 Feb 2011 16:12:59 +0000 (16:12 +0000)
tracking.

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

asn1/ansi_map/packet-ansi_map-template.c
asn1/ansi_tcap/packet-ansi_tcap-template.c
epan/dissectors/packet-ansi_map.c
epan/dissectors/packet-ansi_tcap.c

index 5d2327c20900dd1c64993d2e8081aa922c8cb333..88e63ee56640aa87da63b3bc6e0291154e9bd60e 100644 (file)
 /* Preference settings default */
 #define MAX_SSN 254
 static range_t *global_ssn_range;
+gint ansi_map_response_matching_type = 1;
+
+#define ANSI_MAP_TID_ONLY 0
 
 static dissector_handle_t ansi_map_handle=NULL;
 
@@ -428,7 +431,17 @@ update_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb
         if ((!pinfo->fd->flags.visited)&&(p_private_tcap->TransactionID_str)){
             /* Only do this once XXX I hope its the right thing to do */
             /* The hash string needs to contain src and dest to distiguish differnt flows */
-            g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,src_str,dst_str);
+                       switch(ansi_map_response_matching_type){
+                               case ANSI_MAP_TID_ONLY:
+                                       g_snprintf(buf,1024,"%s",p_private_tcap->TransactionID_str);
+                                       break;
+                               case 1:
+                                       g_snprintf(buf,1024,"%s%s",p_private_tcap->TransactionID_str,src_str);
+                                       break;
+                               default:
+                                       g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,src_str,dst_str);
+                                       break;
+                       }
             /* If the entry allready exists don't owervrite it */
             ansi_map_saved_invokedata = g_hash_table_lookup(TransactionId_table,buf);
             if(ansi_map_saved_invokedata)
@@ -441,9 +454,7 @@ update_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb
             g_hash_table_insert(TransactionId_table,
                                 g_strdup(buf),
                                 ansi_map_saved_invokedata);
-            /*
-              g_warning("Invoke Hash string %s",buf);
-            */
+            g_warning("Invoke Hash string %s pkt: %u",buf,pinfo->fd->num);
         }
     }
 
@@ -4362,10 +4373,19 @@ find_saved_invokedata(asn1_ctx_t *actx){
         src_str = ep_address_to_str(src);
         dst_str = ep_address_to_str(dst);
         /* Reverse order to invoke */
-        g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,dst_str,src_str);
-        /*
-          g_warning("Find Hash string %s",buf);
-        */
+               switch(ansi_map_response_matching_type){
+                       case ANSI_MAP_TID_ONLY:
+                               g_snprintf(buf,1024,"%s",p_private_tcap->TransactionID_str);
+                               break;
+                       case 1:
+                               g_snprintf(buf,1024,"%s%s",p_private_tcap->TransactionID_str,dst_str);
+                               break;
+                       default:
+                               g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,dst_str,src_str);
+                               break;
+               }
+
+               g_warning("Find Hash string %s pkt: %u",buf,actx->pinfo->fd->num);
         ansi_map_saved_invokedata = g_hash_table_lookup(TransactionId_table, buf);
         if(ansi_map_saved_invokedata){
             OperationCode = ansi_map_saved_invokedata->opcode & 0xff;
@@ -4374,6 +4394,7 @@ find_saved_invokedata(asn1_ctx_t *actx){
             OperationCode = OperationCode & 0x00ff;
         }
     }else{
+               g_warning("No private data pkt: %u",actx->pinfo->fd->num);
         OperationCode = OperationCode & 0x00ff;
     }
     return OperationCode;
@@ -4426,22 +4447,22 @@ dissect_ansi_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     case 1:
         OperationCode = p_private_tcap->d.OperationCode_private & 0x00ff;
         ansi_map_is_invoke = TRUE;
-       col_add_fstr(pinfo->cinfo, COL_INFO,"%s Invoke ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
+        col_add_fstr(pinfo->cinfo, COL_INFO,"%s Invoke ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         proto_item_append_text(p_private_tcap->d.OperationCode_item," %s",val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         offset = dissect_invokeData(ansi_map_tree, tvb, 0, &asn1_ctx);
         update_saved_invokedata(pinfo, ansi_map_tree, tvb);
         break;
     case 2:
         OperationCode = find_saved_invokedata(&asn1_ctx);
-       col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnResult ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
+        col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnResult ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         proto_item_append_text(p_private_tcap->d.OperationCode_item," %s",val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         offset = dissect_returnData(ansi_map_tree, tvb, 0, &asn1_ctx);
         break;
     case 3:
-       col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnError ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
+        col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnError ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         break;
     case 4:
-       col_add_fstr(pinfo->cinfo, COL_INFO,"%s Reject ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
+        col_add_fstr(pinfo->cinfo, COL_INFO,"%s Reject ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         break;
     default:
         /* Must be Invoke ReturnResult ReturnError or Reject */
@@ -5327,6 +5348,12 @@ void proto_register_ansi_map(void) {
 #include "packet-ansi_map-ettarr.c"
     };
 
+       static enum_val_t ansi_map_response_matching_type_values[] = {
+               {"Only Transaction ID will be used in Invoke/response matching",                                        "Transaction ID only", 0},
+               {"Transaction ID and Source will be used in Invoke/response matching",                          "Transaction ID and Source", 1}, 
+               {"Transaction ID Source and Destination will be used in Invoke/response matching",      "Transaction ID Source and Destination", 2},
+               {NULL, NULL, -1}
+       };
 
     /* Register protocol */
     proto_ansi_map = proto_register_protocol(PNAME, PSNAME, PFNAME);
@@ -5360,6 +5387,11 @@ void proto_register_ansi_map(void) {
                                     "ANSI MAP SSNs to decode as ANSI MAP",
                                     &global_ssn_range, MAX_SSN);
 
+       prefs_register_enum_preference(ansi_map_module, "transaction.matchtype",
+                                      "Type of matching invoke/response",
+                                      "Type of matching invoke/response, risk of missmatch if loose matching choosen",
+                                      &ansi_map_response_matching_type, ansi_map_response_matching_type_values, FALSE);
+
     register_init_routine(&ansi_map_init_protocol);
 }
 
index d53a0c21a682c4baa0611cb7fa2aac6f923fe0f3..c7c35b8c7fcf584e99e665e109ed98711b79ab7e 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <glib.h>
 #include <epan/packet.h>
+#include <epan/prefs.h>
 #include <epan/oids.h>
 #include <epan/emem.h>
 #include <epan/asn1.h>
 #define PSNAME "ANSI_TCAP"
 #define PFNAME "ansi_tcap"
 
+
+/* Preferences defaults */
+gint ansi_tcap_response_matching_type = 0;
+
 /* Initialize the protocol and registered fields */
 static int proto_ansi_tcap = -1;
 
@@ -179,9 +184,17 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
           /* The hash string needs to contain src and dest to distiguish differnt flows */
           buf = ep_alloc(MAX_TID_STR_LEN);
           buf[0] = '\0';
-          g_snprintf(buf, MAX_TID_STR_LEN, "%s%s%s",
-                ansi_tcap_private.TransactionID_str, ep_address_to_str(src),
-                ep_address_to_str(dst));
+                 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(src));
+                                       break;
+                               default:
+                                       g_snprintf(buf,MAX_TID_STR_LEN,"%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src),ep_address_to_str(dst));
+                                       break;
+                       }
 
           /* If the entry allready exists don't owervrite it */
           ansi_tcap_saved_invokedata = g_hash_table_lookup(TransactionId_table,buf);
@@ -220,6 +233,17 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U
   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));
+                       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;
+       }
 
   ansi_tcap_saved_invokedata = g_hash_table_lookup(TransactionId_table, buf);
   if(ansi_tcap_saved_invokedata){
@@ -390,6 +414,8 @@ proto_reg_handoff_ansi_tcap(void)
 void
 proto_register_ansi_tcap(void)
 {
+    module_t    *ansi_tcap_module;
+
 
 /* Setup list of header fields  See Section 1.6.1 for details*/
     static hf_register_info hf[] = {
@@ -437,11 +463,12 @@ proto_register_ansi_tcap(void)
         #include "packet-ansi_tcap-ettarr.c"
     };
 
-    /*static enum_val_t tcap_options[] = {
-        { "itu", "ITU",  ITU_TCAP_STANDARD },
-        { "ansi", "ANSI", ANSI_TCAP_STANDARD },
-        { NULL, NULL, 0 }
-    };*/
+       static enum_val_t ansi_tcap_response_matching_type_values[] = {
+               {"Only Transaction ID will be used in Invoke/response matching",                                        "Transaction ID only", 0},
+               {"Transaction ID and Source will be used in Invoke/response matching",                          "Transaction ID and Source", 1}, 
+               {"Transaction ID Source and Destination will be used in Invoke/response matching",      "Transaction ID Source and Destination", 2},
+               {NULL, NULL, -1}
+       };
 
 
 /* Register the protocol name and description */
@@ -452,6 +479,12 @@ proto_register_ansi_tcap(void)
     proto_register_field_array(proto_ansi_tcap, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
 
+    ansi_tcap_module = prefs_register_protocol(proto_ansi_tcap, proto_reg_handoff_ansi_tcap);
+
+       prefs_register_enum_preference(ansi_tcap_module, "transaction.matchtype",
+                                      "Type of matching invoke/response",
+                                      "Type of matching invoke/response, risk of missmatch if loose matching choosen",
+                                      &ansi_tcap_response_matching_type, ansi_tcap_response_matching_type_values, FALSE);
 
     register_init_routine(&ansi_tcap_init_protocol);
 }
index 157afa177050fb80bccc3fd9f8e36d3f73d948d8..28761e4202759f5eb6d17a504c9971e8cfa9b2df 100644 (file)
 /* Preference settings default */
 #define MAX_SSN 254
 static range_t *global_ssn_range;
+gint ansi_map_response_matching_type = 1;
+
+#define ANSI_MAP_TID_ONLY 0
 
 static dissector_handle_t ansi_map_handle=NULL;
 
@@ -876,7 +879,7 @@ static int hf_ansi_map_interSystemSMSDeliveryPointToPointRes = -1;  /* InterSyst
 static int hf_ansi_map_qualificationRequest2Res = -1;  /* QualificationRequest2Res */
 
 /*--- End of included file: packet-ansi_map-hf.c ---*/
-#line 320 "packet-ansi_map-template.c"
+#line 323 "packet-ansi_map-template.c"
 
 /* Initialize the subtree pointers */
 static gint ett_ansi_map = -1;
@@ -1136,7 +1139,7 @@ static gint ett_ansi_map_InvokeData = -1;
 static gint ett_ansi_map_ReturnData = -1;
 
 /*--- End of included file: packet-ansi_map-ett.c ---*/
-#line 352 "packet-ansi_map-template.c"
+#line 355 "packet-ansi_map-template.c"
 
 /* Global variables */
 static dissector_table_t is637_tele_id_dissector_table; /* IS-637 Teleservice ID */
@@ -1216,7 +1219,17 @@ update_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb
         if ((!pinfo->fd->flags.visited)&&(p_private_tcap->TransactionID_str)){
             /* Only do this once XXX I hope its the right thing to do */
             /* The hash string needs to contain src and dest to distiguish differnt flows */
-            g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,src_str,dst_str);
+                       switch(ansi_map_response_matching_type){
+                               case ANSI_MAP_TID_ONLY:
+                                       g_snprintf(buf,1024,"%s",p_private_tcap->TransactionID_str);
+                                       break;
+                               case 1:
+                                       g_snprintf(buf,1024,"%s%s",p_private_tcap->TransactionID_str,src_str);
+                                       break;
+                               default:
+                                       g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,src_str,dst_str);
+                                       break;
+                       }
             /* If the entry allready exists don't owervrite it */
             ansi_map_saved_invokedata = g_hash_table_lookup(TransactionId_table,buf);
             if(ansi_map_saved_invokedata)
@@ -1229,9 +1242,7 @@ update_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb
             g_hash_table_insert(TransactionId_table,
                                 g_strdup(buf),
                                 ansi_map_saved_invokedata);
-            /*
-              g_warning("Invoke Hash string %s",buf);
-            */
+            g_warning("Invoke Hash string %s pkt: %u",buf,pinfo->fd->num);
         }
     }
 
@@ -15523,7 +15534,7 @@ dissect_ansi_map_ReturnData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
 
 
 /*--- End of included file: packet-ansi_map-fn.c ---*/
-#line 3646 "packet-ansi_map-template.c"
+#line 3657 "packet-ansi_map-template.c"
 
 /*
  * 6.5.2.dk N.S0013-0 v 1.0,X.S0004-550-E v1.0 2.301
@@ -16243,10 +16254,19 @@ find_saved_invokedata(asn1_ctx_t *actx){
         src_str = ep_address_to_str(src);
         dst_str = ep_address_to_str(dst);
         /* Reverse order to invoke */
-        g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,dst_str,src_str);
-        /*
-          g_warning("Find Hash string %s",buf);
-        */
+               switch(ansi_map_response_matching_type){
+                       case ANSI_MAP_TID_ONLY:
+                               g_snprintf(buf,1024,"%s",p_private_tcap->TransactionID_str);
+                               break;
+                       case 1:
+                               g_snprintf(buf,1024,"%s%s",p_private_tcap->TransactionID_str,dst_str);
+                               break;
+                       default:
+                               g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,dst_str,src_str);
+                               break;
+               }
+
+               g_warning("Find Hash string %s pkt: %u",buf,actx->pinfo->fd->num);
         ansi_map_saved_invokedata = g_hash_table_lookup(TransactionId_table, buf);
         if(ansi_map_saved_invokedata){
             OperationCode = ansi_map_saved_invokedata->opcode & 0xff;
@@ -16255,6 +16275,7 @@ find_saved_invokedata(asn1_ctx_t *actx){
             OperationCode = OperationCode & 0x00ff;
         }
     }else{
+               g_warning("No private data pkt: %u",actx->pinfo->fd->num);
         OperationCode = OperationCode & 0x00ff;
     }
     return OperationCode;
@@ -16307,22 +16328,22 @@ dissect_ansi_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     case 1:
         OperationCode = p_private_tcap->d.OperationCode_private & 0x00ff;
         ansi_map_is_invoke = TRUE;
-       col_add_fstr(pinfo->cinfo, COL_INFO,"%s Invoke ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
+        col_add_fstr(pinfo->cinfo, COL_INFO,"%s Invoke ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         proto_item_append_text(p_private_tcap->d.OperationCode_item," %s",val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         offset = dissect_invokeData(ansi_map_tree, tvb, 0, &asn1_ctx);
         update_saved_invokedata(pinfo, ansi_map_tree, tvb);
         break;
     case 2:
         OperationCode = find_saved_invokedata(&asn1_ctx);
-       col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnResult ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
+        col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnResult ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         proto_item_append_text(p_private_tcap->d.OperationCode_item," %s",val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         offset = dissect_returnData(ansi_map_tree, tvb, 0, &asn1_ctx);
         break;
     case 3:
-       col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnError ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
+        col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnError ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         break;
     case 4:
-       col_add_fstr(pinfo->cinfo, COL_INFO,"%s Reject ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
+        col_add_fstr(pinfo->cinfo, COL_INFO,"%s Reject ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)"));
         break;
     default:
         /* Must be Invoke ReturnResult ReturnError or Reject */
@@ -19365,7 +19386,7 @@ void proto_register_ansi_map(void) {
         NULL, HFILL }},
 
 /*--- End of included file: packet-ansi_map-hfarr.c ---*/
-#line 5295 "packet-ansi_map-template.c"
+#line 5316 "packet-ansi_map-template.c"
     };
 
     /* List of subtrees */
@@ -19626,9 +19647,15 @@ void proto_register_ansi_map(void) {
     &ett_ansi_map_ReturnData,
 
 /*--- End of included file: packet-ansi_map-ettarr.c ---*/
-#line 5328 "packet-ansi_map-template.c"
+#line 5349 "packet-ansi_map-template.c"
     };
 
+       static enum_val_t ansi_map_response_matching_type_values[] = {
+               {"Only Transaction ID will be used in Invoke/response matching",                                        "Transaction ID only", 0},
+               {"Transaction ID and Source will be used in Invoke/response matching",                          "Transaction ID and Source", 1}, 
+               {"Transaction ID Source and Destination will be used in Invoke/response matching",      "Transaction ID Source and Destination", 2},
+               {NULL, NULL, -1}
+       };
 
     /* Register protocol */
     proto_ansi_map = proto_register_protocol(PNAME, PSNAME, PFNAME);
@@ -19662,6 +19689,11 @@ void proto_register_ansi_map(void) {
                                     "ANSI MAP SSNs to decode as ANSI MAP",
                                     &global_ssn_range, MAX_SSN);
 
+       prefs_register_enum_preference(ansi_map_module, "transaction.matchtype",
+                                      "Type of matching invoke/response",
+                                      "Type of matching invoke/response, risk of missmatch if loose matching choosen",
+                                      &ansi_map_response_matching_type, ansi_map_response_matching_type_values, FALSE);
+
     register_init_routine(&ansi_map_init_protocol);
 }
 
index 2759b5f6b03bfae16b4e81e2ff5f9ebee4c8a377..232e231fabd65d2105e7927ce280b22aad8fbe28 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <glib.h>
 #include <epan/packet.h>
+#include <epan/prefs.h>
 #include <epan/oids.h>
 #include <epan/emem.h>
 #include <epan/asn1.h>
 #define PSNAME "ANSI_TCAP"
 #define PFNAME "ansi_tcap"
 
+
+/* Preferences defaults */
+gint ansi_tcap_response_matching_type = 0;
+
 /* Initialize the protocol and registered fields */
 static int proto_ansi_tcap = -1;
 
@@ -118,7 +123,7 @@ static int hf_ansi_tcap_paramSequence = -1;       /* T_paramSequence */
 static int hf_ansi_tcap_paramSet = -1;            /* T_paramSet */
 
 /*--- End of included file: packet-ansi_tcap-hf.c ---*/
-#line 58 "packet-ansi_tcap-template.c"
+#line 63 "packet-ansi_tcap-template.c"
 
 /* Initialize the subtree pointers */
 static gint ett_tcap = -1;
@@ -160,7 +165,7 @@ static gint ett_ansi_tcap_T_paramSequence = -1;
 static gint ett_ansi_tcap_T_paramSet = -1;
 
 /*--- End of included file: packet-ansi_tcap-ett.c ---*/
-#line 73 "packet-ansi_tcap-template.c"
+#line 78 "packet-ansi_tcap-template.c"
 
 #define MAX_SSN 254
 
@@ -270,9 +275,17 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
           /* The hash string needs to contain src and dest to distiguish differnt flows */
           buf = ep_alloc(MAX_TID_STR_LEN);
           buf[0] = '\0';
-          g_snprintf(buf, MAX_TID_STR_LEN, "%s%s%s",
-                ansi_tcap_private.TransactionID_str, ep_address_to_str(src),
-                ep_address_to_str(dst));
+                 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(src));
+                                       break;
+                               default:
+                                       g_snprintf(buf,MAX_TID_STR_LEN,"%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src),ep_address_to_str(dst));
+                                       break;
+                       }
 
           /* If the entry allready exists don't owervrite it */
           ansi_tcap_saved_invokedata = g_hash_table_lookup(TransactionId_table,buf);
@@ -311,6 +324,17 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U
   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));
+                       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;
+       }
 
   ansi_tcap_saved_invokedata = g_hash_table_lookup(TransactionId_table, buf);
   if(ansi_tcap_saved_invokedata){
@@ -1287,7 +1311,7 @@ dissect_ansi_tcap_PackageType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
 
 
 /*--- End of included file: packet-ansi_tcap-fn.c ---*/
-#line 310 "packet-ansi_tcap-template.c"
+#line 334 "packet-ansi_tcap-template.c"
 
 
 
@@ -1371,6 +1395,8 @@ proto_reg_handoff_ansi_tcap(void)
 void
 proto_register_ansi_tcap(void)
 {
+    module_t    *ansi_tcap_module;
+
 
 /* Setup list of header fields  See Section 1.6.1 for details*/
     static hf_register_info hf[] = {
@@ -1614,7 +1640,7 @@ proto_register_ansi_tcap(void)
         NULL, HFILL }},
 
 /*--- End of included file: packet-ansi_tcap-hfarr.c ---*/
-#line 428 "packet-ansi_tcap-template.c"
+#line 454 "packet-ansi_tcap-template.c"
     };
 
 /* Setup protocol subtree array */
@@ -1651,14 +1677,15 @@ proto_register_ansi_tcap(void)
     &ett_ansi_tcap_T_paramSet,
 
 /*--- End of included file: packet-ansi_tcap-ettarr.c ---*/
-#line 438 "packet-ansi_tcap-template.c"
+#line 464 "packet-ansi_tcap-template.c"
     };
 
-    /*static enum_val_t tcap_options[] = {
-        { "itu", "ITU",  ITU_TCAP_STANDARD },
-        { "ansi", "ANSI", ANSI_TCAP_STANDARD },
-        { NULL, NULL, 0 }
-    };*/
+       static enum_val_t ansi_tcap_response_matching_type_values[] = {
+               {"Only Transaction ID will be used in Invoke/response matching",                                        "Transaction ID only", 0},
+               {"Transaction ID and Source will be used in Invoke/response matching",                          "Transaction ID and Source", 1}, 
+               {"Transaction ID Source and Destination will be used in Invoke/response matching",      "Transaction ID Source and Destination", 2},
+               {NULL, NULL, -1}
+       };
 
 
 /* Register the protocol name and description */
@@ -1669,6 +1696,12 @@ proto_register_ansi_tcap(void)
     proto_register_field_array(proto_ansi_tcap, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
 
+    ansi_tcap_module = prefs_register_protocol(proto_ansi_tcap, proto_reg_handoff_ansi_tcap);
+
+       prefs_register_enum_preference(ansi_tcap_module, "transaction.matchtype",
+                                      "Type of matching invoke/response",
+                                      "Type of matching invoke/response, risk of missmatch if loose matching choosen",
+                                      &ansi_tcap_response_matching_type, ansi_tcap_response_matching_type_values, FALSE);
 
     register_init_routine(&ansi_tcap_init_protocol);
 }