diff options
author | Anders Broman <anders.broman@ericsson.com> | 2011-02-04 16:12:59 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2011-02-04 16:12:59 +0000 |
commit | b723ccb30c0bb8a8fc8c2abf5937940b8d74c7d6 (patch) | |
tree | 7d10c902ea9d8f688d71b8deb3880772ef579edc /epan/dissectors/packet-ansi_tcap.c | |
parent | 2195eb44bd523cd833b1008146ba9fb78152615c (diff) |
Introduce preferences to set the strictness of Invoke/response
tracking.
svn path=/trunk/; revision=35822
Diffstat (limited to 'epan/dissectors/packet-ansi_tcap.c')
-rw-r--r-- | epan/dissectors/packet-ansi_tcap.c | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/epan/dissectors/packet-ansi_tcap.c b/epan/dissectors/packet-ansi_tcap.c index 2759b5f6b0..232e231fab 100644 --- a/epan/dissectors/packet-ansi_tcap.c +++ b/epan/dissectors/packet-ansi_tcap.c @@ -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> @@ -53,6 +54,10 @@ #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); } |