aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/ansi_map
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2011-02-04 16:12:59 +0000
committerAnders Broman <anders.broman@ericsson.com>2011-02-04 16:12:59 +0000
commitb723ccb30c0bb8a8fc8c2abf5937940b8d74c7d6 (patch)
tree7d10c902ea9d8f688d71b8deb3880772ef579edc /asn1/ansi_map
parent2195eb44bd523cd833b1008146ba9fb78152615c (diff)
Introduce preferences to set the strictness of Invoke/response
tracking. svn path=/trunk/; revision=35822
Diffstat (limited to 'asn1/ansi_map')
-rw-r--r--asn1/ansi_map/packet-ansi_map-template.c56
1 files changed, 44 insertions, 12 deletions
diff --git a/asn1/ansi_map/packet-ansi_map-template.c b/asn1/ansi_map/packet-ansi_map-template.c
index 5d2327c209..88e63ee566 100644
--- a/asn1/ansi_map/packet-ansi_map-template.c
+++ b/asn1/ansi_map/packet-ansi_map-template.c
@@ -108,6 +108,9 @@
/* 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);
}