diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2007-04-23 10:45:00 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2007-04-23 10:45:00 +0000 |
commit | 20a3a52951ef6f5029f7ab9ae5475e41ae027fe4 (patch) | |
tree | a8804f6d8c5ef50c16a3efc91be69382e33046b3 | |
parent | c84eda3a80250e06b2b777d45231ce42c992f0cf (diff) |
Mark all the items for TCAP statistics as generated
svn path=/trunk/; revision=21524
-rw-r--r-- | asn1/tcap/packet-tcap-template.c | 76 | ||||
-rw-r--r-- | epan/dissectors/packet-tcap.c | 80 | ||||
-rw-r--r-- | epan/tcap-persistentdata.c | 266 |
3 files changed, 218 insertions, 204 deletions
diff --git a/asn1/tcap/packet-tcap-template.c b/asn1/tcap/packet-tcap-template.c index d858bd0611..e6e72b3bb2 100644 --- a/asn1/tcap/packet-tcap-template.c +++ b/asn1/tcap/packet-tcap-template.c @@ -47,8 +47,8 @@ /* Initialize the protocol and registered fields */ int proto_tcap = -1; -static int hf_tcap_tag = -1; -static int hf_tcap_length = -1; +static int hf_tcap_tag = -1; +static int hf_tcap_length = -1; static int hf_tcap_data = -1; static int hf_tcap_tid = -1; @@ -183,18 +183,19 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) gp_tcapsrt_info=tcapsrt_razinfo(); tcap_subdissector_used=FALSE; gp_tcap_context=NULL; - dissect_tcap_TCMessage(FALSE, tvb, 0, pinfo, tree, -1); + dissect_tcap_TCMessage(FALSE, tvb, 0, pinfo, tree, -1); if (gtcap_HandleSRT && !tcap_subdissector_used ) { if (gtcap_DisplaySRT && tree) { stat_item = proto_tree_add_text(tree, tvb, 0, 0, "Stat"); + PROTO_ITEM_SET_GENERATED(stat_item); stat_tree = proto_item_add_subtree(stat_item, ett_tcap_stat); } p_tcap_context=tcapsrt_call_matching(tvb, pinfo, stat_tree, gp_tcapsrt_info); tcap_private.context=p_tcap_context; - /* If the current message is TCAP only, + /* If the current message is TCAP only, save the Application contexte name for the next messages */ if ( p_tcap_context && cur_oid && @@ -202,13 +203,13 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* Save the application context and the sub dissector */ ber_oid_dissector_table = find_dissector_table("ber.oid"); strncpy(p_tcap_context->oid,cur_oid, LENGTH_OID); - if ( (subdissector_handle + if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) { p_tcap_context->subdissector_handle=subdissector_handle; p_tcap_context->oid_present=TRUE; } - } - + } + if (gtcap_HandleSRT && p_tcap_context && p_tcap_context->callback) { @@ -222,14 +223,14 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) void proto_reg_handoff_tcap(void) { - + static gboolean prefs_initialized = FALSE; - + if (! prefs_initialized) { sccp_ssn_table = find_dissector_table("sccp.ssn"); prefs_initialized = TRUE; } - + data_handle = find_dissector("data"); #include "packet-tcap-dis-tab.c" } @@ -261,7 +262,7 @@ proto_register_tcap(void) { "Transaction Id", "tcap.tid", FT_BYTES, BASE_HEX, NULL, 0, "", HFILL } - }, + }, /* Tcap Service Response Time */ { &hf_tcapsrt_SessionId, { "Session Id", @@ -293,7 +294,7 @@ proto_register_tcap(void) FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } }, -#include "packet-tcap-hfarr.c" +#include "packet-tcap-hfarr.c" }; /* Setup protocol subtree array */ @@ -356,7 +357,7 @@ proto_register_tcap(void) "Persistent stats for SRT", "Statistics for Response Time", >cap_PersistentSRT); - + prefs_register_uint_preference(tcap_module, "repetitiontimeout", "Repetition timeout", "Maximal delay for message repetion", @@ -366,7 +367,7 @@ proto_register_tcap(void) "lost timeout", "Maximal delay for message lost", 10, >cap_LostTimeout); - + ansi_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal); itu_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal); @@ -399,7 +400,7 @@ static void init_tcap(void) { range_foreach(ssn_range, range_delete_callback); g_free(ssn_range); } - + ssn_range = range_copy(global_ssn_range); range_foreach(ssn_range, range_add_callback); tcapsrt_init_routine(); @@ -417,11 +418,11 @@ dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs gint32 tag; guint32 len; gboolean ind_field; - + while (tvb_reported_length_remaining(tvb, offset) > 0) { saved_offset = offset; - + offset = get_ber_identifier(tvb, offset, &class, &pc, &tag); tag_offset = offset; offset = get_ber_length(tree, tvb, offset, &len, &ind_field); @@ -441,9 +442,9 @@ dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs tag_offset, len_offset-tag_offset, len); if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */ { - next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), len-(2*ind_field)); + next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), len-(2*ind_field)); dissect_tcap_param(pinfo, subtree,next_tvb,0); - } + } if (ind_field) proto_tree_add_text(subtree, tvb, offset+len-2, 2, "CONSTRUCTOR EOC"); offset += len; @@ -462,7 +463,7 @@ dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs saved_offset+1, 1, len); if (len) /* check for NULLS */ { - next_tvb = tvb_new_subset(tvb, offset, len, len); + next_tvb = tvb_new_subset(tvb, offset, len, len); dissect_ber_octet_string(TRUE, pinfo, tree, next_tvb, 0, hf_tcap_data, NULL); } @@ -473,7 +474,7 @@ dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs } static void raz_tcap_private(struct tcap_private_t * p_tcap_private) -{ +{ memset(p_tcap_private,0,sizeof(struct tcap_private_t) ); } @@ -493,7 +494,7 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, gint ind_field; proto_tree * stat_tree=NULL; proto_item * stat_item=NULL; - /* + /* * ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it. */ ber_oid_dissector_table = find_dissector_table("ber.oid"); @@ -504,10 +505,10 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, next_tvb = tvb_new_subset(tvb, s_offset, len+(offset-s_offset), len+(offset-s_offset)); if (!next_tvb) return offset+len; - + dissect_ber_choice(pinfo, tree, next_tvb, 0, Component_choice, hf_index, ett_tcap_Component,NULL); - + /* * Handle The TCAP Service Response Time @@ -517,6 +518,7 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, /* Create TCAP context and tree for display */ if (gtcap_DisplaySRT && tree) { stat_item = proto_tree_add_text(tcap_stat_tree, tvb, offset, -1, "Stat"); + PROTO_ITEM_SET_GENERATED(stat_item); stat_tree = proto_item_add_subtree(stat_item, ett_tcap_stat); } p_tcap_context=tcapsrt_call_matching(tvb, pinfo, stat_tree, gp_tcapsrt_info); @@ -539,7 +541,7 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, /* ACN, changed, Fallback to lower version */ /* and update the subdissector (purely formal) */ strncpy(p_tcap_context->oid,cur_oid, LENGTH_OID); - if ( (subdissector_handle + if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) { p_tcap_context->subdissector_handle=subdissector_handle; } @@ -547,7 +549,7 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, } else { /* We do not have the OID in the TCAP context, so store it */ strncpy(p_tcap_context->oid,cur_oid, LENGTH_OID); - if ( (subdissector_handle + if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) { p_tcap_context->subdissector_handle=subdissector_handle; p_tcap_context->oid_present=TRUE; @@ -561,8 +563,8 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, } } /* no OID */ } /* no TCAP context */ - - if ( p_tcap_context + + if ( p_tcap_context && p_tcap_context->oid_present) { /* Take the subdissector from the context */ subdissector_handle=p_tcap_context->subdissector_handle; @@ -580,17 +582,17 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, * If we do not currently know the subdissector, we have to find it * - first, according to the OID * - then according to the SSN - * - and at least, take the default Data handler + * - and at least, take the default Data handler */ if (ber_oid_dissector_table && cur_oid) { /* Search if we can find the sub protocol according to the A.C.N */ - if ( (subdissector_handle + if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) { /* found */ is_subdissector=TRUE; } else { /* Search if we can found the sub protocol according to the SSN table */ - if ( (subdissector_handle + if ( (subdissector_handle = get_itu_tcap_subdissector(pinfo->match_port))) { /* Found according to SSN */ is_subdissector=TRUE; @@ -613,11 +615,11 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, } else { /* We have it already */ } - + /* Call the sub dissector if present, and not already called */ if (is_subdissector) call_dissector(subdissector_handle, next_tvb, pinfo, tcap_top_tree); - + return offset+len; } @@ -632,7 +634,7 @@ dissect_tcap_TheExternUserInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int off guint32 len, start_offset; gint ind_field; - /* + /* * ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it. */ ber_oid_dissector_table = find_dissector_table("ber.oid"); @@ -640,12 +642,12 @@ dissect_tcap_TheExternUserInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int off offset = get_ber_identifier(tvb, offset, &class, &pc, &tag); offset = get_ber_length(tree, tvb, offset, &len, &ind_field); - next_tvb = tvb_new_subset(tvb, start_offset, len +(offset - start_offset), len+(offset - start_offset)); + next_tvb = tvb_new_subset(tvb, start_offset, len +(offset - start_offset), len+(offset - start_offset)); if (!next_tvb) return offset+len; if (ber_oid_dissector_table && tcapext_oid){ - if(!dissector_try_string(ber_oid_dissector_table, tcapext_oid, next_tvb, pinfo, tcap_top_tree)) + if(!dissector_try_string(ber_oid_dissector_table, tcapext_oid, next_tvb, pinfo, tcap_top_tree)) { } } @@ -666,7 +668,7 @@ void call_tcap_dissector(dissector_handle_t handle, tvbuff_t* tvb, packet_info* requested_subdissector_handle = NULL; RETHROW; } ENDTRY; - + requested_subdissector_handle = NULL; } diff --git a/epan/dissectors/packet-tcap.c b/epan/dissectors/packet-tcap.c index efe55ed983..5bb58d505d 100644 --- a/epan/dissectors/packet-tcap.c +++ b/epan/dissectors/packet-tcap.c @@ -55,8 +55,8 @@ /* Initialize the protocol and registered fields */ int proto_tcap = -1; -static int hf_tcap_tag = -1; -static int hf_tcap_length = -1; +static int hf_tcap_tag = -1; +static int hf_tcap_length = -1; static int hf_tcap_data = -1; static int hf_tcap_tid = -1; @@ -2405,18 +2405,19 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) gp_tcapsrt_info=tcapsrt_razinfo(); tcap_subdissector_used=FALSE; gp_tcap_context=NULL; - dissect_tcap_TCMessage(FALSE, tvb, 0, pinfo, tree, -1); + dissect_tcap_TCMessage(FALSE, tvb, 0, pinfo, tree, -1); if (gtcap_HandleSRT && !tcap_subdissector_used ) { if (gtcap_DisplaySRT && tree) { stat_item = proto_tree_add_text(tree, tvb, 0, 0, "Stat"); + PROTO_ITEM_SET_GENERATED(stat_item); stat_tree = proto_item_add_subtree(stat_item, ett_tcap_stat); } p_tcap_context=tcapsrt_call_matching(tvb, pinfo, stat_tree, gp_tcapsrt_info); tcap_private.context=p_tcap_context; - /* If the current message is TCAP only, + /* If the current message is TCAP only, save the Application contexte name for the next messages */ if ( p_tcap_context && cur_oid && @@ -2424,13 +2425,13 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* Save the application context and the sub dissector */ ber_oid_dissector_table = find_dissector_table("ber.oid"); strncpy(p_tcap_context->oid,cur_oid, LENGTH_OID); - if ( (subdissector_handle + if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) { p_tcap_context->subdissector_handle=subdissector_handle; p_tcap_context->oid_present=TRUE; } - } - + } + if (gtcap_HandleSRT && p_tcap_context && p_tcap_context->callback) { @@ -2444,14 +2445,14 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) void proto_reg_handoff_tcap(void) { - + static gboolean prefs_initialized = FALSE; - + if (! prefs_initialized) { sccp_ssn_table = find_dissector_table("sccp.ssn"); prefs_initialized = TRUE; } - + data_handle = find_dissector("data"); /*--- Included file: packet-tcap-dis-tab.c ---*/ @@ -2461,7 +2462,7 @@ proto_reg_handoff_tcap(void) /*--- End of included file: packet-tcap-dis-tab.c ---*/ -#line 235 "packet-tcap-template.c" +#line 236 "packet-tcap-template.c" } static void init_tcap(void); @@ -2491,7 +2492,7 @@ proto_register_tcap(void) { "Transaction Id", "tcap.tid", FT_BYTES, BASE_HEX, NULL, 0, "", HFILL } - }, + }, /* Tcap Service Response Time */ { &hf_tcapsrt_SessionId, { "Session Id", @@ -3024,7 +3025,7 @@ proto_register_tcap(void) "", HFILL }}, /*--- End of included file: packet-tcap-hfarr.c ---*/ -#line 297 "packet-tcap-template.c" +#line 298 "packet-tcap-template.c" }; /* Setup protocol subtree array */ @@ -3089,7 +3090,7 @@ proto_register_tcap(void) &ett_tcap_ErrorCode, /*--- End of included file: packet-tcap-ettarr.c ---*/ -#line 307 "packet-tcap-template.c" +#line 308 "packet-tcap-template.c" }; /*static enum_val_t tcap_options[] = { @@ -3142,7 +3143,7 @@ proto_register_tcap(void) "Persistent stats for SRT", "Statistics for Response Time", >cap_PersistentSRT); - + prefs_register_uint_preference(tcap_module, "repetitiontimeout", "Repetition timeout", "Maximal delay for message repetion", @@ -3152,7 +3153,7 @@ proto_register_tcap(void) "lost timeout", "Maximal delay for message lost", 10, >cap_LostTimeout); - + ansi_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal); itu_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal); @@ -3185,7 +3186,7 @@ static void init_tcap(void) { range_foreach(ssn_range, range_delete_callback); g_free(ssn_range); } - + ssn_range = range_copy(global_ssn_range); range_foreach(ssn_range, range_add_callback); tcapsrt_init_routine(); @@ -3203,11 +3204,11 @@ dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs gint32 tag; guint32 len; gboolean ind_field; - + while (tvb_reported_length_remaining(tvb, offset) > 0) { saved_offset = offset; - + offset = get_ber_identifier(tvb, offset, &class, &pc, &tag); tag_offset = offset; offset = get_ber_length(tree, tvb, offset, &len, &ind_field); @@ -3227,9 +3228,9 @@ dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs tag_offset, len_offset-tag_offset, len); if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */ { - next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), len-(2*ind_field)); + next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), len-(2*ind_field)); dissect_tcap_param(pinfo, subtree,next_tvb,0); - } + } if (ind_field) proto_tree_add_text(subtree, tvb, offset+len-2, 2, "CONSTRUCTOR EOC"); offset += len; @@ -3248,7 +3249,7 @@ dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs saved_offset+1, 1, len); if (len) /* check for NULLS */ { - next_tvb = tvb_new_subset(tvb, offset, len, len); + next_tvb = tvb_new_subset(tvb, offset, len, len); dissect_ber_octet_string(TRUE, pinfo, tree, next_tvb, 0, hf_tcap_data, NULL); } @@ -3259,7 +3260,7 @@ dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs } static void raz_tcap_private(struct tcap_private_t * p_tcap_private) -{ +{ memset(p_tcap_private,0,sizeof(struct tcap_private_t) ); } @@ -3279,7 +3280,7 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, gint ind_field; proto_tree * stat_tree=NULL; proto_item * stat_item=NULL; - /* + /* * ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it. */ ber_oid_dissector_table = find_dissector_table("ber.oid"); @@ -3290,10 +3291,10 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, next_tvb = tvb_new_subset(tvb, s_offset, len+(offset-s_offset), len+(offset-s_offset)); if (!next_tvb) return offset+len; - + dissect_ber_choice(pinfo, tree, next_tvb, 0, Component_choice, hf_index, ett_tcap_Component,NULL); - + /* * Handle The TCAP Service Response Time @@ -3303,6 +3304,7 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, /* Create TCAP context and tree for display */ if (gtcap_DisplaySRT && tree) { stat_item = proto_tree_add_text(tcap_stat_tree, tvb, offset, -1, "Stat"); + PROTO_ITEM_SET_GENERATED(stat_item); stat_tree = proto_item_add_subtree(stat_item, ett_tcap_stat); } p_tcap_context=tcapsrt_call_matching(tvb, pinfo, stat_tree, gp_tcapsrt_info); @@ -3325,7 +3327,7 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, /* ACN, changed, Fallback to lower version */ /* and update the subdissector (purely formal) */ strncpy(p_tcap_context->oid,cur_oid, LENGTH_OID); - if ( (subdissector_handle + if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) { p_tcap_context->subdissector_handle=subdissector_handle; } @@ -3333,7 +3335,7 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, } else { /* We do not have the OID in the TCAP context, so store it */ strncpy(p_tcap_context->oid,cur_oid, LENGTH_OID); - if ( (subdissector_handle + if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) { p_tcap_context->subdissector_handle=subdissector_handle; p_tcap_context->oid_present=TRUE; @@ -3347,8 +3349,8 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, } } /* no OID */ } /* no TCAP context */ - - if ( p_tcap_context + + if ( p_tcap_context && p_tcap_context->oid_present) { /* Take the subdissector from the context */ subdissector_handle=p_tcap_context->subdissector_handle; @@ -3366,17 +3368,17 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, * If we do not currently know the subdissector, we have to find it * - first, according to the OID * - then according to the SSN - * - and at least, take the default Data handler + * - and at least, take the default Data handler */ if (ber_oid_dissector_table && cur_oid) { /* Search if we can find the sub protocol according to the A.C.N */ - if ( (subdissector_handle + if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) { /* found */ is_subdissector=TRUE; } else { /* Search if we can found the sub protocol according to the SSN table */ - if ( (subdissector_handle + if ( (subdissector_handle = get_itu_tcap_subdissector(pinfo->match_port))) { /* Found according to SSN */ is_subdissector=TRUE; @@ -3399,11 +3401,11 @@ dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, } else { /* We have it already */ } - + /* Call the sub dissector if present, and not already called */ if (is_subdissector) call_dissector(subdissector_handle, next_tvb, pinfo, tcap_top_tree); - + return offset+len; } @@ -3418,7 +3420,7 @@ dissect_tcap_TheExternUserInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int off guint32 len, start_offset; gint ind_field; - /* + /* * ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it. */ ber_oid_dissector_table = find_dissector_table("ber.oid"); @@ -3426,12 +3428,12 @@ dissect_tcap_TheExternUserInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int off offset = get_ber_identifier(tvb, offset, &class, &pc, &tag); offset = get_ber_length(tree, tvb, offset, &len, &ind_field); - next_tvb = tvb_new_subset(tvb, start_offset, len +(offset - start_offset), len+(offset - start_offset)); + next_tvb = tvb_new_subset(tvb, start_offset, len +(offset - start_offset), len+(offset - start_offset)); if (!next_tvb) return offset+len; if (ber_oid_dissector_table && tcapext_oid){ - if(!dissector_try_string(ber_oid_dissector_table, tcapext_oid, next_tvb, pinfo, tcap_top_tree)) + if(!dissector_try_string(ber_oid_dissector_table, tcapext_oid, next_tvb, pinfo, tcap_top_tree)) { } } @@ -3452,7 +3454,7 @@ void call_tcap_dissector(dissector_handle_t handle, tvbuff_t* tvb, packet_info* requested_subdissector_handle = NULL; RETHROW; } ENDTRY; - + requested_subdissector_handle = NULL; } diff --git a/epan/tcap-persistentdata.c b/epan/tcap-persistentdata.c index 36109a3f35..d41cd5d56c 100644 --- a/epan/tcap-persistentdata.c +++ b/epan/tcap-persistentdata.c @@ -136,7 +136,7 @@ static void dbg(unsigned level, char* fmt, ...) { va_list ap; - + if (level > debug_level) return; va_start(ap,fmt); vfprintf(stderr, fmt, ap); @@ -149,7 +149,7 @@ tcaphash_context_equal(gconstpointer k1, gconstpointer k2) { const struct tcaphash_context_key_t *key1 = (const struct tcaphash_context_key_t *) k1; const struct tcaphash_context_key_t *key2 = (const struct tcaphash_context_key_t *) k2; - + return (key1->session_id == key2->session_id); } @@ -169,14 +169,14 @@ tcaphash_begin_equal(gconstpointer k1, gconstpointer k2) const struct tcaphash_begin_info_key_t *key2 = (const struct tcaphash_begin_info_key_t *) k2; if (key1->hashKey == key2->hashKey) { - + if ( ( (key1->opc_hash == key2->opc_hash) && (key1->dpc_hash == key2->dpc_hash) && - (key1->tid == key2->tid) ) + (key1->tid == key2->tid) ) || ( (key1->opc_hash == key2->dpc_hash) && (key1->dpc_hash == key2->opc_hash) && - (key1->tid == key2->tid) ) + (key1->tid == key2->tid) ) ) return TRUE; } @@ -207,7 +207,7 @@ tcaphash_cont_equal(gconstpointer k1, gconstpointer k2) (key1->src_tid == key2->src_tid) && (key1->dst_tid == key2->dst_tid) ) { return TRUE; - } + } else if ( (key1->opc_hash == key2->dpc_hash) && (key1->dpc_hash == key2->opc_hash) && (key1->src_tid == key2->dst_tid) && @@ -238,11 +238,11 @@ tcaphash_end_equal(gconstpointer k1, gconstpointer k2) if (key1->hashKey == key2->hashKey) { if ( ( (key1->opc_hash == key2->opc_hash) && (key1->dpc_hash == key2->dpc_hash) && - (key1->tid == key2->tid) ) + (key1->tid == key2->tid) ) || ( (key1->opc_hash == key2->dpc_hash) && (key1->dpc_hash == key2->opc_hash) && - (key1->tid == key2->tid) ) ) + (key1->tid == key2->tid) ) ) return TRUE; } return FALSE; @@ -258,8 +258,8 @@ tcaphash_end_calchash(gconstpointer k) return hashkey; } -/* - * Update a record with the data of the Request +/* + * Update a record with the data of the Request */ static void update_tcaphash_begincall(struct tcaphash_begincall_t *p_tcaphash_begincall, @@ -271,9 +271,9 @@ update_tcaphash_begincall(struct tcaphash_begincall_t *p_tcaphash_begincall, p_tcaphash_begincall->context->begin_time = pinfo->fd->abs_ts; } -/* +/* * Append a new dialogue, using the same Key, to the chained list - * The time is stored too + * The time is stored too */ static struct tcaphash_begincall_t * append_tcaphash_begincall(struct tcaphash_begincall_t *prev_begincall, @@ -281,7 +281,7 @@ append_tcaphash_begincall(struct tcaphash_begincall_t *prev_begincall, packet_info *pinfo) { struct tcaphash_begincall_t *p_new_tcaphash_begincall = NULL; - + /* Append the transaction to the list, when the same key is found This should append when the tcap-transaction Id is reused */ @@ -290,7 +290,7 @@ append_tcaphash_begincall(struct tcaphash_begincall_t *prev_begincall, p_tcaphash_context->begincall=p_new_tcaphash_begincall; p_new_tcaphash_begincall->beginkey=prev_begincall->beginkey; p_new_tcaphash_begincall->context->first_frame = pinfo->fd->num; - p_new_tcaphash_begincall->next_begincall=NULL; + p_new_tcaphash_begincall->next_begincall=NULL; p_new_tcaphash_begincall->previous_begincall=prev_begincall; p_new_tcaphash_begincall->father=FALSE; @@ -313,15 +313,15 @@ append_tcaphash_contcall(struct tcaphash_contcall_t *prev_contcall, struct tcaphash_context_t *p_tcaphash_context) { struct tcaphash_contcall_t *p_new_tcaphash_contcall = NULL; - + /* Append the transaction to the list, when the same key is found This should append when the tcap-transaction Id is reused */ - + p_new_tcaphash_contcall = se_alloc0(sizeof(struct tcaphash_contcall_t)); p_new_tcaphash_contcall->context=p_tcaphash_context; p_tcaphash_context->contcall=p_new_tcaphash_contcall; p_new_tcaphash_contcall->contkey=prev_contcall->contkey; - p_new_tcaphash_contcall->next_contcall=NULL; + p_new_tcaphash_contcall->next_contcall=NULL; p_new_tcaphash_contcall->previous_contcall=prev_contcall; p_new_tcaphash_contcall->father=FALSE; @@ -339,7 +339,7 @@ append_tcaphash_endcall(struct tcaphash_endcall_t *prev_endcall, struct tcaphash_context_t *p_tcaphash_context) { struct tcaphash_endcall_t *p_new_tcaphash_endcall = NULL; - + /* Append the transaction to the list, when the same key is found This should append when the tcap-transaction Id is reused */ @@ -347,7 +347,7 @@ append_tcaphash_endcall(struct tcaphash_endcall_t *prev_endcall, p_new_tcaphash_endcall->context=p_tcaphash_context; p_tcaphash_context->endcall=p_new_tcaphash_endcall; p_new_tcaphash_endcall->endkey=prev_endcall->endkey; - p_new_tcaphash_endcall->next_endcall=NULL; + p_new_tcaphash_endcall->next_endcall=NULL; p_new_tcaphash_endcall->previous_endcall=prev_endcall; p_new_tcaphash_endcall->father=FALSE; @@ -360,8 +360,8 @@ append_tcaphash_endcall(struct tcaphash_endcall_t *prev_endcall, } -/* - * Find the dialog by Key and Time +/* + * Find the dialog by Key and Time */ static struct tcaphash_begincall_t * find_tcaphash_begin(struct tcaphash_begin_info_key_t *p_tcaphash_begin_key, @@ -369,7 +369,7 @@ find_tcaphash_begin(struct tcaphash_begin_info_key_t *p_tcaphash_begin_key, { struct tcaphash_begincall_t *p_tcaphash_begincall = NULL; p_tcaphash_begincall = (struct tcaphash_begincall_t *)g_hash_table_lookup(tcaphash_begin, p_tcaphash_begin_key); - + if(p_tcaphash_begincall) { do { if ( p_tcaphash_begincall->context ) { @@ -379,7 +379,7 @@ find_tcaphash_begin(struct tcaphash_begin_info_key_t *p_tcaphash_begin_key, ( !isBegin && pinfo->fd->num >= p_tcaphash_begincall->context->first_frame && ( p_tcaphash_begincall->context->last_frame?pinfo->fd->num <= p_tcaphash_begincall->context->last_frame:1 ) - ) + ) ) { /* We have a dialogue, with this key, opened before this request */ #ifdef DEBUG_TCAPSRT @@ -401,7 +401,7 @@ find_tcaphash_begin(struct tcaphash_begin_info_key_t *p_tcaphash_begin_key, } else { #ifdef DEBUG_TCAPSRT dbg(23,"Not in Bhash "); -#endif +#endif } return NULL; } @@ -414,7 +414,7 @@ find_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, { struct tcaphash_contcall_t *p_tcaphash_contcall = NULL; p_tcaphash_contcall = (struct tcaphash_contcall_t *)g_hash_table_lookup(tcaphash_cont, p_tcaphash_cont_key); - + if(p_tcaphash_contcall) { do { if ( p_tcaphash_contcall->context && @@ -423,7 +423,7 @@ find_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, /* We have a dialogue, with this key, opened before this request */ #ifdef DEBUG_TCAPSRT dbg(10,"C%d ", p_tcaphash_contcall->context->session_id); -#endif +#endif return p_tcaphash_contcall; break; } else { @@ -444,7 +444,7 @@ find_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, #ifdef DEBUG_TCAPSRT dbg(23,"Not in Chash "); #endif - } + } return NULL; } @@ -454,23 +454,23 @@ find_tcaphash_end(struct tcaphash_end_info_key_t *p_tcaphash_end_key, { struct tcaphash_endcall_t *p_tcaphash_endcall = NULL; p_tcaphash_endcall = (struct tcaphash_endcall_t *)g_hash_table_lookup(tcaphash_end, p_tcaphash_end_key); - + if(p_tcaphash_endcall) { do { if ( p_tcaphash_endcall->context ) { if ( ( isEnd && - (p_tcaphash_endcall->context->last_frame?pinfo->fd->num == p_tcaphash_endcall->context->last_frame:1) + (p_tcaphash_endcall->context->last_frame?pinfo->fd->num == p_tcaphash_endcall->context->last_frame:1) ) || ( !isEnd && pinfo->fd->num >= p_tcaphash_endcall->context->first_frame && - (p_tcaphash_endcall->context->last_frame?pinfo->fd->num <= p_tcaphash_endcall->context->last_frame:1) + (p_tcaphash_endcall->context->last_frame?pinfo->fd->num <= p_tcaphash_endcall->context->last_frame:1) ) ) { /* We have a dialogue, with this key, opened before this request */ #ifdef DEBUG_TCAPSRT dbg(10,"E%d ", p_tcaphash_endcall->context->session_id); -#endif +#endif return p_tcaphash_endcall; break; } else { @@ -492,12 +492,12 @@ find_tcaphash_end(struct tcaphash_end_info_key_t *p_tcaphash_end_key, #ifdef DEBUG_TCAPSRT dbg(23,"Not in Ehash "); #endif - } + } return NULL; } /* - * New record to create, to identify a new transaction + * New record to create, to identify a new transaction */ static struct tcaphash_context_t * new_tcaphash_context(struct tcaphash_context_key_t *p_tcaphash_context_key, @@ -505,8 +505,8 @@ new_tcaphash_context(struct tcaphash_context_key_t *p_tcaphash_context_key, { struct tcaphash_context_key_t *p_new_tcaphash_context_key; struct tcaphash_context_t *p_new_tcaphash_context = NULL; - - /* Register the transaction in the hash table + + /* Register the transaction in the hash table with the tcap transaction Id as Main Key Once created, this entry will be updated later */ @@ -526,7 +526,7 @@ new_tcaphash_context(struct tcaphash_context_key_t *p_tcaphash_context_key, } /* - * New record to create, to identify a new transaction + * New record to create, to identify a new transaction */ static struct tcaphash_begincall_t * new_tcaphash_begin(struct tcaphash_begin_info_key_t *p_tcaphash_begin_key, @@ -534,8 +534,8 @@ new_tcaphash_begin(struct tcaphash_begin_info_key_t *p_tcaphash_begin_key, { struct tcaphash_begin_info_key_t *p_new_tcaphash_begin_key; struct tcaphash_begincall_t *p_new_tcaphash_begincall = NULL; - - /* Register the transaction in the hash table + + /* Register the transaction in the hash table with the tcap transaction Id as Main Key Once created, this entry will be updated later */ @@ -564,7 +564,7 @@ new_tcaphash_begin(struct tcaphash_begin_info_key_t *p_tcaphash_begin_key, /* - * New record to create, to identify a new transaction + * New record to create, to identify a new transaction */ static struct tcaphash_contcall_t * new_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, @@ -572,8 +572,8 @@ new_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, { struct tcaphash_cont_info_key_t *p_new_tcaphash_cont_key; struct tcaphash_contcall_t *p_new_tcaphash_contcall = NULL; - - /* Register the transaction in the hash table + + /* Register the transaction in the hash table with the tcap transaction Id as Main Key Once created, this entry will be updated later */ @@ -583,9 +583,9 @@ new_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, p_new_tcaphash_cont_key->dst_tid = p_tcaphash_cont_key->dst_tid; p_new_tcaphash_cont_key->opc_hash = p_tcaphash_cont_key->opc_hash; p_new_tcaphash_cont_key->dpc_hash = p_tcaphash_cont_key->dpc_hash; - + p_new_tcaphash_contcall = se_alloc0(sizeof(struct tcaphash_contcall_t)); - p_new_tcaphash_contcall->contkey=p_new_tcaphash_cont_key; + p_new_tcaphash_contcall->contkey=p_new_tcaphash_cont_key; p_new_tcaphash_contcall->context=p_tcaphash_context; p_tcaphash_context->contcall=p_new_tcaphash_contcall; p_new_tcaphash_contcall->father=TRUE; @@ -602,7 +602,7 @@ new_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, /* - * New record to create, to identify a new transaction + * New record to create, to identify a new transaction */ static struct tcaphash_endcall_t * new_tcaphash_end(struct tcaphash_end_info_key_t *p_tcaphash_end_key, @@ -610,8 +610,8 @@ new_tcaphash_end(struct tcaphash_end_info_key_t *p_tcaphash_end_key, { struct tcaphash_end_info_key_t *p_new_tcaphash_end_key; struct tcaphash_endcall_t *p_new_tcaphash_endcall = NULL; - - /* Register the transaction in the hash table + + /* Register the transaction in the hash table with the tcap transaction Id as Main Key Once created, this entry will be updated later */ @@ -624,11 +624,11 @@ new_tcaphash_end(struct tcaphash_end_info_key_t *p_tcaphash_end_key, p_new_tcaphash_endcall = se_alloc0(sizeof(struct tcaphash_endcall_t)); p_new_tcaphash_endcall->endkey=p_new_tcaphash_end_key; p_new_tcaphash_endcall->context=p_tcaphash_context; - p_tcaphash_context->endcall=p_new_tcaphash_endcall; + p_tcaphash_context->endcall=p_new_tcaphash_endcall; p_new_tcaphash_endcall->father=TRUE; p_new_tcaphash_endcall->next_endcall=NULL; p_new_tcaphash_endcall->previous_endcall=NULL; - + #ifdef DEBUG_TCAPSRT dbg(10,"E%d ", p_new_tcaphash_endcall->context->session_id); #endif @@ -639,7 +639,7 @@ new_tcaphash_end(struct tcaphash_end_info_key_t *p_tcaphash_end_key, -static struct tcaphash_contcall_t * +static struct tcaphash_contcall_t * create_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, struct tcaphash_context_t *p_tcaphash_context) { @@ -648,7 +648,7 @@ create_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, p_tcaphash_contcall1 = (struct tcaphash_contcall_t *) g_hash_table_lookup(tcaphash_cont, p_tcaphash_cont_key); - + if (p_tcaphash_contcall1) { /* Walk through list of transaction with identical keys */ /* go the the end to insert new record */ @@ -668,16 +668,16 @@ create_tcaphash_cont(struct tcaphash_cont_info_key_t *p_tcaphash_cont_key, } -static struct tcaphash_endcall_t * +static struct tcaphash_endcall_t * create_tcaphash_end(struct tcaphash_end_info_key_t *p_tcaphash_end_key, struct tcaphash_context_t *p_tcaphash_context) { struct tcaphash_endcall_t *p_tcaphash_endcall1 = NULL; struct tcaphash_endcall_t *p_tcaphash_endcall = NULL; - + p_tcaphash_endcall1 = (struct tcaphash_endcall_t *) g_hash_table_lookup(tcaphash_end, p_tcaphash_end_key); - + if (p_tcaphash_endcall1) { /* Walk through list of transaction with identical keys */ /* go the the end to insert new record */ @@ -718,7 +718,7 @@ tcapsrt_init_routine(void) dbg(16,"Destroy hash_begin "); #endif g_hash_table_destroy(tcaphash_begin); - } + } if (tcaphash_cont != NULL) { #ifdef DEBUG_TCAPSRT @@ -752,7 +752,7 @@ tcapsrt_init_routine(void) /* * Service Responsee Time analyze - * Called just after dissector call + * Called just after dissector call */ struct tcaphash_context_t * tcapsrt_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, @@ -761,7 +761,7 @@ tcapsrt_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, struct tcaphash_context_t *tcap_context=NULL; switch (p_tcapsrt_info->ope) { - + case TC_BEGIN: /*InitialDP*/ #ifdef DEBUG_TCAPSRT dbg(1,"TC_BEGIN "); @@ -772,24 +772,24 @@ tcapsrt_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case TC_CONT: #ifdef DEBUG_TCAPSRT dbg(1,"TC_CONT "); -#endif +#endif tcap_context=tcaphash_cont_matching(tvb, pinfo, tree, p_tcapsrt_info); break; case TC_ABORT: #ifdef DEBUG_TCAPSRT dbg(1,"TC_ABORT "); -#endif +#endif tcap_context=tcaphash_end_matching(tvb, pinfo, tree, p_tcapsrt_info); break; - + case TC_END: #ifdef DEBUG_TCAPSRT dbg(1,"TC_END "); #endif tcap_context=tcaphash_end_matching(tvb, pinfo, tree, p_tcapsrt_info); break; - + default: #ifdef DEBUG_TCAPSRT dbg(1,"Unknow %d ", p_tcapsrt_info->ope); @@ -804,12 +804,12 @@ tcapsrt_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } -/* +/* * Create the record identifiying the TCAP transaction - * When the identifier for the transaction is reused, check + * When the identifier for the transaction is reused, check * the following criteria before to append a new record: - * - a timeout corresponding to a message retransmission is detected, - * - a message hast been lost + * - a timeout corresponding to a message retransmission is detected, + * - a message hast been lost * - or the previous transaction has been be closed */ static struct tcaphash_context_t * @@ -817,11 +817,11 @@ tcaphash_begin_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, struct tcapsrt_info_t *p_tcapsrt_info) { struct tcaphash_context_t *p_tcaphash_context=NULL; - struct tcaphash_context_key_t tcaphash_context_key; + struct tcaphash_context_key_t tcaphash_context_key; struct tcaphash_begincall_t *p_tcaphash_begincall, *p_new_tcaphash_begincall; struct tcaphash_begin_info_key_t tcaphash_begin_key; - proto_item *ti; - + proto_item *pi; + /* prepare the key data */ tcaphash_begin_key.tid = p_tcapsrt_info->src_tid; tcaphash_begin_key.opc_hash = mtp3_pc_hash( ((address *)(&pinfo->src))->data); @@ -840,7 +840,7 @@ tcaphash_begin_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (p_tcaphash_begincall) { /* Walk through list of transaction with identical keys */ - do { + do { /* Check if the request with this reqSeqNum has been seen, with the same Message Type */ if (pinfo->fd->num == p_tcaphash_begincall->context->first_frame) { /* We have seen this request before -> do nothing */ @@ -856,18 +856,18 @@ tcaphash_begin_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* if last request has been responded (response number in known) and this request appears after last response (has bigger frame number) and last request occured after the timeout for repetition, - or + or if last request hasn't been responded (so number unknown) and this request appears after last request (has bigger frame number) and this request occured after the timeout for message lost */ if ( ( p_tcaphash_begincall->context->last_frame != 0 - && pinfo->fd->num > p_tcaphash_begincall->context->first_frame + && pinfo->fd->num > p_tcaphash_begincall->context->first_frame && (guint) pinfo->fd->abs_ts.secs > (guint)(p_tcaphash_begincall->context->begin_time.secs + gtcap_RepetitionTimeout) ) || ( p_tcaphash_begincall->context->last_frame == 0 && pinfo->fd->num > p_tcaphash_begincall->context->first_frame - && (guint)pinfo->fd->abs_ts.secs > (guint)(p_tcaphash_begincall->context->begin_time.secs + gtcap_LostTimeout) - ) + && (guint)pinfo->fd->abs_ts.secs > (guint)(p_tcaphash_begincall->context->begin_time.secs + gtcap_LostTimeout) + ) ) { /* we decide that we have a new request */ @@ -875,46 +875,48 @@ tcaphash_begin_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #ifdef DEBUG_TCAPSRT dbg(12,"(timeout) Append key %lx ",tcaphash_begin_key.hashKey); dbg(12,"Frame %u rsp %u ",pinfo->fd->num,p_tcaphash_begincall->context->last_frame ); -#endif +#endif tcaphash_context_key.session_id = tcapsrt_global_SessionId++; - p_tcaphash_context = new_tcaphash_context(&tcaphash_context_key, pinfo); + p_tcaphash_context = new_tcaphash_context(&tcaphash_context_key, pinfo); p_new_tcaphash_begincall = append_tcaphash_begincall(p_tcaphash_begincall, p_tcaphash_context, pinfo); - + #ifdef DEBUG_TCAPSRT dbg(12,"Update key %lx ",tcaphash_begin_key.hashKey); #endif update_tcaphash_begincall(p_new_tcaphash_begincall, pinfo); p_tcaphash_begincall=p_new_tcaphash_begincall; } else { - + /* If the Tid is reused for a closed Transaction */ /* Or if we received an InitialDP for a non closed Transaction */ if ( p_tcaphash_begincall->context->closed) { #ifdef DEBUG_TCAPSRT dbg(12,"(closed) Append key %lu ",tcaphash_begin_key.hashKey); dbg(12,"Frame %u rsp %u ",pinfo->fd->num,p_tcaphash_begincall->context->last_frame ); -#endif +#endif tcaphash_context_key.session_id = tcapsrt_global_SessionId++; - p_tcaphash_context = new_tcaphash_context(&tcaphash_context_key, pinfo); + p_tcaphash_context = new_tcaphash_context(&tcaphash_context_key, pinfo); p_new_tcaphash_begincall = append_tcaphash_begincall(p_tcaphash_begincall, p_tcaphash_context, pinfo); - + #ifdef DEBUG_TCAPSRT dbg(12,"Update key %lu ",tcaphash_begin_key.hashKey); #endif update_tcaphash_begincall(p_new_tcaphash_begincall, pinfo); p_tcaphash_begincall=p_new_tcaphash_begincall; - + } else { /* No, so it's a duplicate request.Mark it as such. */ #ifdef DEBUG_TCAPSRT dbg(21,"Display_duplicate "); #endif - if (gtcap_DisplaySRT) - proto_tree_add_uint_hidden(tree, hf_tcapsrt_Duplicate, tvb, 0,0, p_tcapsrt_info->src_tid); + if (gtcap_DisplaySRT) { + pi = proto_tree_add_uint_hidden(tree, hf_tcapsrt_Duplicate, tvb, 0,0, p_tcapsrt_info->src_tid); + PROTO_ITEM_SET_GENERATED(pi); + } p_tcaphash_context=p_tcaphash_begincall->context; } /* test with Timeout */ } /* closed */ @@ -928,37 +930,40 @@ tcaphash_begin_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { /* p_tcaphash_begincall has not been found */ #ifdef DEBUG_TCAPSRT dbg(10,"New key %lx ",tcaphash_begin_key.hashKey); -#endif +#endif tcaphash_context_key.session_id = tcapsrt_global_SessionId++; - p_tcaphash_context = new_tcaphash_context(&tcaphash_context_key, pinfo); + p_tcaphash_context = new_tcaphash_context(&tcaphash_context_key, pinfo); p_tcaphash_begincall = new_tcaphash_begin(&tcaphash_begin_key, p_tcaphash_context); - + #ifdef DEBUG_TCAPSRT dbg(11,"Update key %lx ",tcaphash_begin_key.hashKey); dbg(11,"Frame reqlink #%u ", pinfo->fd->num); #endif update_tcaphash_begincall(p_tcaphash_begincall, pinfo); } - + /* display tcap session, if available */ if ( gtcap_DisplaySRT && p_tcaphash_context && - p_tcaphash_context->session_id) - proto_tree_add_uint(tree, hf_tcapsrt_SessionId, tvb, 0,0, p_tcaphash_context->session_id); - + p_tcaphash_context->session_id) { + pi = proto_tree_add_uint(tree, hf_tcapsrt_SessionId, tvb, 0,0, p_tcaphash_context->session_id); + PROTO_ITEM_SET_GENERATED(pi); + } + + /* add link to response frame, if available */ if( gtcap_DisplaySRT && p_tcaphash_begincall->context->last_frame != 0){ #ifdef DEBUG_TCAPSRT dbg(20,"Display_frameRsplink %d ",p_tcaphash_begincall->context->last_frame); #endif - ti = proto_tree_add_uint_format(tree, hf_tcapsrt_BeginSession, tvb, 0, 0, + pi = proto_tree_add_uint_format(tree, hf_tcapsrt_BeginSession, tvb, 0, 0, p_tcaphash_begincall->context->last_frame, "End of session in frame %u", p_tcaphash_begincall->context->last_frame); - PROTO_ITEM_SET_GENERATED(ti); - } + PROTO_ITEM_SET_GENERATED(pi); + } return p_tcaphash_context; } @@ -974,10 +979,11 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, struct tcaphash_context_t *p_tcaphash_context=NULL; struct tcaphash_contcall_t *p_tcaphash_contcall; struct tcaphash_cont_info_key_t tcaphash_cont_key; + proto_item *pi; #ifdef DEBUG_TCAPSRT dbg(10,"\n Hcont #%u ", pinfo->fd->num); -#endif +#endif /* look only for matching request, if matching conversation is available. */ tcaphash_cont_key.src_tid = p_tcapsrt_info->src_tid; @@ -988,7 +994,7 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #ifdef DEBUG_TCAPSRT dbg(11,"Ckey %lx ", tcaphash_cont_key.hashKey); - dbg(51,"PC %s %s ",address_to_str(&pinfo->src), address_to_str(&pinfo->dst)); + dbg(51,"PC %s %s ",address_to_str(&pinfo->src), address_to_str(&pinfo->dst)); dbg(51,"Tid %lx %lx ",tcaphash_cont_key.src_tid, tcaphash_cont_key.dst_tid); #endif p_tcaphash_contcall = find_tcaphash_cont(&tcaphash_cont_key, pinfo); @@ -1014,7 +1020,7 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #ifdef DEBUG_TCAPSRT dbg(11,"Bkey %lx ", tcaphash_begin_key.hashKey); - dbg(51,"PC %s %s ",address_to_str(&pinfo->src), address_to_str(&pinfo->dst)); + dbg(51,"PC %s %s ",address_to_str(&pinfo->src), address_to_str(&pinfo->dst)); dbg(51,"Tid %lx ",tcaphash_begin_key.tid); #endif p_tcaphash_begincall = find_tcaphash_begin(&tcaphash_begin_key, pinfo,FALSE); @@ -1022,7 +1028,7 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, !p_tcaphash_begincall->context->contcall ) { #ifdef DEBUG_TCAPSRT dbg(12,"BFound "); -#endif +#endif p_tcaphash_context=p_tcaphash_begincall->context; p_tcaphash_context->responded=TRUE; @@ -1031,7 +1037,7 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #endif p_tcaphash_contcall = create_tcaphash_cont(&tcaphash_cont_key, p_tcaphash_begincall->context); - + #ifdef DEBUG_TCAPSRT dbg(11,"Update Ckey %lx ",tcaphash_begin_key.hashKey); dbg(11,"Frame reqlink #%u ", pinfo->fd->num); @@ -1046,7 +1052,7 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #endif p_tcaphash_endcall = create_tcaphash_end(&tcaphash_end_key, p_tcaphash_begincall->context); - + #ifdef DEBUG_TCAPSRT dbg(11,"Update Ekey %lx ",tcaphash_end_key.hashKey); dbg(11,"Frame reqlink #%u ", pinfo->fd->num); @@ -1054,15 +1060,17 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { /* Begin not found */ #ifdef DEBUG_TCAPSRT dbg(12,"BnotFound "); -#endif +#endif } /* begin found */ } /* cont found */ /* display tcap session, if available */ if (gtcap_DisplaySRT && p_tcaphash_context && - p_tcaphash_context->session_id) - proto_tree_add_uint(tree, hf_tcapsrt_SessionId, tvb, 0,0, p_tcaphash_context->session_id); - + p_tcaphash_context->session_id) { + pi = proto_tree_add_uint(tree, hf_tcapsrt_SessionId, tvb, 0,0, p_tcaphash_context->session_id); + PROTO_ITEM_SET_GENERATED(pi); + } + return p_tcaphash_context; } @@ -1075,15 +1083,15 @@ tcaphash_cont_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static struct tcaphash_context_t * tcaphash_end_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, struct tcapsrt_info_t *p_tcapsrt_info) -{ +{ struct tcaphash_context_t *p_tcaphash_context=NULL; struct tcaphash_end_info_key_t tcaphash_end_key; struct tcaphash_endcall_t *p_tcaphash_endcall=NULL; struct tcaphash_begin_info_key_t tcaphash_begin_key; - struct tcaphash_begincall_t *p_tcaphash_begincall=NULL; - proto_item *ti; + struct tcaphash_begincall_t *p_tcaphash_begincall=NULL; + proto_item *pi; nstime_t delta; @@ -1098,71 +1106,73 @@ tcaphash_end_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #ifdef DEBUG_TCAPSRT dbg(11,"Ekey %lx ",tcaphash_end_key.hashKey); - dbg(11,"PC %s %s ",address_to_str(&pinfo->src), address_to_str(&pinfo->dst)); + dbg(11,"PC %s %s ",address_to_str(&pinfo->src), address_to_str(&pinfo->dst)); dbg(51,"Tid %lx ",tcaphash_end_key.tid); #endif p_tcaphash_endcall = find_tcaphash_end(&tcaphash_end_key, pinfo,TRUE); - + if(!p_tcaphash_endcall) { #ifdef DEBUG_TCAPSRT - dbg(12,"EnotFound "); -#endif + dbg(12,"EnotFound "); +#endif tcaphash_begin_key.tid = p_tcapsrt_info->dst_tid; tcaphash_begin_key.opc_hash=mtp3_pc_hash( ((address*)(&pinfo->src))->data); tcaphash_begin_key.dpc_hash=mtp3_pc_hash( ((address*)(&pinfo->dst))->data); tcaphash_begin_key.hashKey=tcaphash_begin_calchash(&tcaphash_begin_key); - + #ifdef DEBUG_TCAPSRT dbg(11,"Bkey %lx ", tcaphash_begin_key.hashKey); - dbg(51,"PC %s %s ",address_to_str(&pinfo->src), address_to_str(&pinfo->dst)); + dbg(51,"PC %s %s ",address_to_str(&pinfo->src), address_to_str(&pinfo->dst)); dbg(51,"Tid %lx ",tcaphash_begin_key.tid); #endif p_tcaphash_begincall = find_tcaphash_begin(&tcaphash_begin_key, pinfo,FALSE); } - + if (p_tcaphash_endcall) { /* Use the TC_BEGIN Destination reference */ p_tcaphash_context=p_tcaphash_endcall->context; } else if (p_tcaphash_begincall) { - /* Use the TC_BEGIN Source reference */ + /* Use the TC_BEGIN Source reference */ p_tcaphash_context=p_tcaphash_begincall->context; } if (p_tcaphash_context) { - + #ifdef DEBUG_TCAPSRT dbg(12,"Found, req=%d ",p_tcaphash_context->first_frame); #endif - if (gtcap_DisplaySRT) - proto_tree_add_uint(tree, hf_tcapsrt_SessionId, tvb, 0,0, p_tcaphash_context->session_id); + if (gtcap_DisplaySRT) { + pi = proto_tree_add_uint(tree, hf_tcapsrt_SessionId, tvb, 0,0, p_tcaphash_context->session_id); + PROTO_ITEM_SET_GENERATED(pi); + } #ifdef DEBUG_TCAPSRT dbg(20,"Display framereqlink %d ",p_tcaphash_context->first_frame); #endif /* Indicate the frame to which this is a reply. */ if (gtcap_DisplaySRT) { - ti = proto_tree_add_uint_format(tree, hf_tcapsrt_EndSession, tvb, 0, 0, + pi = proto_tree_add_uint_format(tree, hf_tcapsrt_EndSession, tvb, 0, 0, p_tcaphash_context->first_frame, "Begin of session in frame %u", p_tcaphash_context->first_frame); - PROTO_ITEM_SET_GENERATED(ti); + PROTO_ITEM_SET_GENERATED(pi); /* Calculate Service Response Time */ nstime_delta(&delta, &pinfo->fd->abs_ts, &p_tcaphash_context->begin_time); - + /* display Service Response Time and make it filterable */ - ti = proto_tree_add_time(tree, hf_tcapsrt_SessionTime, tvb, 0, 0, &delta); - PROTO_ITEM_SET_GENERATED(ti); + pi = proto_tree_add_time(tree, hf_tcapsrt_SessionTime, tvb, 0, 0, &delta); + PROTO_ITEM_SET_GENERATED(pi); } /* Close the context and remove it */ tcapsrt_close(p_tcaphash_context,pinfo); - } /* context present */ + } /* context present */ return p_tcaphash_context; } /* * Initialize the Message Info used by the main dissector - * Data are linked to a TCAP transaction + * Data are linked to a TCAP transaction */ struct tcapsrt_info_t * tcapsrt_razinfo(void) @@ -1174,9 +1184,9 @@ tcapsrt_razinfo(void) if(tcapsrt_global_current==MAX_TCAP_INSTANCE){ tcapsrt_global_current=0; } - + p_tcapsrt_info=&tcapsrt_global_info[tcapsrt_global_current]; - memset(p_tcapsrt_info,0,sizeof(struct tcapsrt_info_t)); + memset(p_tcapsrt_info,0,sizeof(struct tcapsrt_info_t)); return p_tcapsrt_info; } @@ -1202,7 +1212,7 @@ tcapsrt_close(struct tcaphash_context_t *p_tcaphash_context, #endif g_hash_table_remove(tcaphash_end, p_tcaphash_context->endcall->endkey); } - + /* If the contkey is present */ if ( p_tcaphash_context->contcall && !gtcap_PersistentSRT) { @@ -1211,7 +1221,7 @@ tcapsrt_close(struct tcaphash_context_t *p_tcaphash_context, #endif g_hash_table_remove(tcaphash_cont, p_tcaphash_context->contcall->contkey); } - + /* If the beginkey is present */ if (p_tcaphash_context->begincall->next_begincall) { if (p_tcaphash_context->begincall->previous_begincall ) { @@ -1237,7 +1247,7 @@ tcapsrt_close(struct tcaphash_context_t *p_tcaphash_context, dbg(20,"remove context "); #endif g_hash_table_remove(tcaphash_context, p_tcaphash_context->key); - + } /* begincall without chained string */ } else { /* no context */ #ifdef DEBUG_TCAPSRT |