diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2016-02-06 14:14:38 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-02-06 16:16:10 +0000 |
commit | bafdbb1882282e6ca3285510f2fd5add13936664 (patch) | |
tree | d33493fbffaaebabc3b5a8380f78f22cfb50a4dd /epan | |
parent | 4a2cd6c79ecbf2cb21f985f01ce1c1e3030285ec (diff) |
TCAP: fix indent and add modelines (use 2 spaces)
Change-Id: I3ac35f3dd6514469bdcabd0acd67970077d5c364
Reviewed-on: https://code.wireshark.org/review/13793
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-tcap.c | 251 |
1 files changed, 132 insertions, 119 deletions
diff --git a/epan/dissectors/packet-tcap.c b/epan/dissectors/packet-tcap.c index eba7d1d1ab..afebaefc9c 100644 --- a/epan/dissectors/packet-tcap.c +++ b/epan/dissectors/packet-tcap.c @@ -240,32 +240,32 @@ static GHashTable* ansi_sub_dissectors = NULL; static GHashTable* itu_sub_dissectors = NULL; extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) { - g_hash_table_insert(ansi_sub_dissectors,GUINT_TO_POINTER(ssn),dissector); - dissector_add_uint("sccp.ssn",ssn,tcap_handle); + g_hash_table_insert(ansi_sub_dissectors,GUINT_TO_POINTER(ssn),dissector); + dissector_add_uint("sccp.ssn",ssn,tcap_handle); } extern void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) { - g_hash_table_insert(itu_sub_dissectors,GUINT_TO_POINTER(ssn),dissector); - dissector_add_uint("sccp.ssn",ssn,tcap_handle); + g_hash_table_insert(itu_sub_dissectors,GUINT_TO_POINTER(ssn),dissector); + dissector_add_uint("sccp.ssn",ssn,tcap_handle); } extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) { - g_hash_table_remove(ansi_sub_dissectors,GUINT_TO_POINTER(ssn)); - if (!get_itu_tcap_subdissector(ssn)) + g_hash_table_remove(ansi_sub_dissectors,GUINT_TO_POINTER(ssn)); + if (!get_itu_tcap_subdissector(ssn)) dissector_delete_uint("sccp.ssn",ssn,tcap_handle); } extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) { - g_hash_table_remove(itu_sub_dissectors,GUINT_TO_POINTER(ssn)); - if (!get_ansi_tcap_subdissector(ssn)) - dissector_delete_uint("sccp.ssn", ssn,tcap_handle); + g_hash_table_remove(itu_sub_dissectors,GUINT_TO_POINTER(ssn)); + if (!get_ansi_tcap_subdissector(ssn)) + dissector_delete_uint("sccp.ssn", ssn,tcap_handle); } dissector_handle_t get_ansi_tcap_subdissector(guint32 ssn) { - return (dissector_handle_t)g_hash_table_lookup(ansi_sub_dissectors,GUINT_TO_POINTER(ssn)); + return (dissector_handle_t)g_hash_table_lookup(ansi_sub_dissectors,GUINT_TO_POINTER(ssn)); } dissector_handle_t get_itu_tcap_subdissector(guint32 ssn) { - return (dissector_handle_t)g_hash_table_lookup(itu_sub_dissectors,GUINT_TO_POINTER(ssn)); + return (dissector_handle_t)g_hash_table_lookup(itu_sub_dissectors,GUINT_TO_POINTER(ssn)); } @@ -665,33 +665,33 @@ static const ber_choice_t Component_choice[] = { static int dissect_tcap_Component(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 82 "../../asn1/tcap/tcap.cnf" -tvbuff_t *next_tvb; -gint8 ber_class; -gboolean pc; -gint tag; -guint32 len, comp_offset; -gint ind_field; - -comp_offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &ber_class, &pc, &tag); -comp_offset = dissect_ber_length(actx->pinfo, tree, tvb, comp_offset, &len, &ind_field); -/* we can believe the length now */ -next_tvb = tvb_new_subset_length(tvb, offset, len+comp_offset-offset); - -if (!next_tvb) - return comp_offset; - -TRY { - offset = dissect_ber_choice(actx, tree, tvb, offset, + tvbuff_t *next_tvb; + gint8 ber_class; + gboolean pc; + gint tag; + guint32 len, comp_offset; + gint ind_field; + + comp_offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &ber_class, &pc, &tag); + comp_offset = dissect_ber_length(actx->pinfo, tree, tvb, comp_offset, &len, &ind_field); + /* we can believe the length now */ + next_tvb = tvb_new_subset_length(tvb, offset, len+comp_offset-offset); + + if (!next_tvb) + return comp_offset; + + TRY { + offset = dissect_ber_choice(actx, tree, tvb, offset, Component_choice, hf_index, ett_tcap_Component, NULL); -} -CATCH_NONFATAL_ERRORS { - show_exception(tvb, actx->pinfo, tree, EXCEPT_CODE, GET_MESSAGE); -} -ENDTRY; + } + CATCH_NONFATAL_ERRORS { + show_exception(tvb, actx->pinfo, tree, EXCEPT_CODE, GET_MESSAGE); + } + ENDTRY; - dissect_tcap_ITU_ComponentPDU(implicit_tag, next_tvb, 0, actx, tcap_top_tree, hf_index); + dissect_tcap_ITU_ComponentPDU(implicit_tag, next_tvb, 0, actx, tcap_top_tree, hf_index); /* return comp_offset+len; or return offset (will be automatically added) */ @@ -753,41 +753,41 @@ dissect_tcap_OCTET_STRING_SIZE_1_4(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, static int dissect_tcap_OrigTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 126 "../../asn1/tcap/tcap.cnf" -tvbuff_t *parameter_tvb; -guint8 len, i; -proto_tree *subtree; -subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_otid, NULL, "Source Transaction ID"); - -dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_tid, NULL); -PROTO_ITEM_SET_HIDDEN(actx->created_item); -offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_otid, + tvbuff_t *parameter_tvb; + guint8 len, i; + proto_tree *subtree; + subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_otid, NULL, "Source Transaction ID"); + + dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_tid, NULL); + PROTO_ITEM_SET_HIDDEN(actx->created_item); + offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_otid, ¶meter_tvb); -if (parameter_tvb){ - len = tvb_reported_length_remaining(parameter_tvb, 0); - switch(len) { - case 1: - gp_tcapsrt_info->src_tid=tvb_get_guint8(parameter_tvb, 0); - break; - case 2: - gp_tcapsrt_info->src_tid=tvb_get_ntohs(parameter_tvb, 0); - break; - case 4: - gp_tcapsrt_info->src_tid=tvb_get_ntohl(parameter_tvb, 0); - break; - default: - gp_tcapsrt_info->src_tid=0; - break; - } + if (parameter_tvb) { + len = tvb_reported_length_remaining(parameter_tvb, 0); + switch(len) { + case 1: + gp_tcapsrt_info->src_tid=tvb_get_guint8(parameter_tvb, 0); + break; + case 2: + gp_tcapsrt_info->src_tid=tvb_get_ntohs(parameter_tvb, 0); + break; + case 4: + gp_tcapsrt_info->src_tid=tvb_get_ntohl(parameter_tvb, 0); + break; + default: + gp_tcapsrt_info->src_tid=0; + break; + } - if (len){ - col_append_str(actx->pinfo->cinfo, COL_INFO, "otid("); - for(i=0;i<len;i++) - col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i)); - col_append_str(actx->pinfo->cinfo, COL_INFO, ") "); - } + if (len) { + col_append_str(actx->pinfo->cinfo, COL_INFO, "otid("); + for(i=0;i<len;i++) + col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i)); + col_append_str(actx->pinfo->cinfo, COL_INFO, ") "); + } -} + } @@ -815,7 +815,7 @@ gp_tcapsrt_info->ope=TC_BEGIN; * If there's something there that should not be overwritten, whoever * put that info there should call col_set_fence() to protect it. */ - col_set_str(actx->pinfo->cinfo, COL_INFO, "Begin "); + col_set_str(actx->pinfo->cinfo, COL_INFO, "Begin "); offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, Begin_sequence, hf_index, ett_tcap_Begin); @@ -828,40 +828,40 @@ gp_tcapsrt_info->ope=TC_BEGIN; static int dissect_tcap_DestTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 165 "../../asn1/tcap/tcap.cnf" -tvbuff_t *parameter_tvb; -guint8 len , i; -proto_tree *subtree; -subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_dtid, NULL, "Destination Transaction ID"); - -dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_tid, NULL); -PROTO_ITEM_SET_HIDDEN(actx->created_item); -offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_dtid, - ¶meter_tvb); + tvbuff_t *parameter_tvb; + guint8 len , i; + proto_tree *subtree; + subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_dtid, NULL, "Destination Transaction ID"); -if (parameter_tvb){ - len = tvb_reported_length_remaining(parameter_tvb, 0); - switch(len) { - case 1: - gp_tcapsrt_info->dst_tid=tvb_get_guint8(parameter_tvb, 0); - break; - case 2: - gp_tcapsrt_info->dst_tid=tvb_get_ntohs(parameter_tvb, 0); - break; - case 4: - gp_tcapsrt_info->dst_tid=tvb_get_ntohl(parameter_tvb, 0); - break; - default: - gp_tcapsrt_info->dst_tid=0; - break; - } + dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_tid, NULL); + PROTO_ITEM_SET_HIDDEN(actx->created_item); + offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_dtid, + ¶meter_tvb); - if (len){ - col_append_str(actx->pinfo->cinfo, COL_INFO, "dtid("); - for(i=0;i<len;i++) - col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i)); - col_append_str(actx->pinfo->cinfo, COL_INFO, ") "); - } -} + if (parameter_tvb) { + len = tvb_reported_length_remaining(parameter_tvb, 0); + switch(len) { + case 1: + gp_tcapsrt_info->dst_tid=tvb_get_guint8(parameter_tvb, 0); + break; + case 2: + gp_tcapsrt_info->dst_tid=tvb_get_ntohs(parameter_tvb, 0); + break; + case 4: + gp_tcapsrt_info->dst_tid=tvb_get_ntohl(parameter_tvb, 0); + break; + default: + gp_tcapsrt_info->dst_tid=0; + break; + } + + if (len) { + col_append_str(actx->pinfo->cinfo, COL_INFO, "dtid("); + for(i=0;i<len;i++) + col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i)); + col_append_str(actx->pinfo->cinfo, COL_INFO, ") "); + } + } return offset; @@ -880,7 +880,7 @@ dissect_tcap_End(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a #line 214 "../../asn1/tcap/tcap.cnf" gp_tcapsrt_info->ope=TC_END; - col_set_str(actx->pinfo->cinfo, COL_INFO, "End "); + col_set_str(actx->pinfo->cinfo, COL_INFO, "End "); offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, End_sequence, hf_index, ett_tcap_End); @@ -902,7 +902,7 @@ dissect_tcap_Continue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ #line 221 "../../asn1/tcap/tcap.cnf" gp_tcapsrt_info->ope=TC_CONT; - col_set_str(actx->pinfo->cinfo, COL_INFO, "Continue "); + col_set_str(actx->pinfo->cinfo, COL_INFO, "Continue "); offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, Continue_sequence, hf_index, ett_tcap_Continue); @@ -973,7 +973,7 @@ dissect_tcap_Abort(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, #line 228 "../../asn1/tcap/tcap.cnf" gp_tcapsrt_info->ope=TC_ABORT; - col_set_str(actx->pinfo->cinfo, COL_INFO, "Abort "); + col_set_str(actx->pinfo->cinfo, COL_INFO, "Abort "); offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, Abort_sequence, hf_index, ett_tcap_Abort); @@ -1022,8 +1022,8 @@ dissect_tcap_AUDT_application_context_name(gboolean implicit_tag _U_, tvbuff_t * #line 111 "../../asn1/tcap/tcap.cnf" offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid); - tcap_private.oid= (const void*) cur_oid; - tcap_private.acv=TRUE; + tcap_private.oid= (const void*) cur_oid; + tcap_private.acv=TRUE; return offset; @@ -1119,8 +1119,8 @@ dissect_tcap_AARQ_application_context_name(gboolean implicit_tag _U_, tvbuff_t * #line 116 "../../asn1/tcap/tcap.cnf" offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid); - tcap_private.oid= (const void*) cur_oid; - tcap_private.acv=TRUE; + tcap_private.oid= (const void*) cur_oid; + tcap_private.acv=TRUE; return offset; @@ -1187,8 +1187,8 @@ dissect_tcap_AARE_application_context_name(gboolean implicit_tag _U_, tvbuff_t * #line 121 "../../asn1/tcap/tcap.cnf" offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid); - tcap_private.oid= (const void*) cur_oid; - tcap_private.acv=TRUE; + tcap_private.oid= (const void*) cur_oid; + tcap_private.acv=TRUE; return offset; @@ -3221,8 +3221,8 @@ const value_string tcap_component_type_str[] = { static int dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item=NULL; + proto_tree *tree=NULL; struct tcaphash_context_t * p_tcap_context; dissector_handle_t subdissector_handle; @@ -3232,14 +3232,14 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d gint tag; /* Check if ANSI TCAP and call the ANSI TCAP dissector if that's the case - * PackageType ::= CHOICE { unidirectional [PRIVATE 1] IMPLICIT UniTransactionPDU, - * queryWithPerm [PRIVATE 2] IMPLICIT TransactionPDU, - * queryWithoutPerm [PRIVATE 3] IMPLICIT TransactionPDU, - * response [PRIVATE 4] IMPLICIT TransactionPDU, - * conversationWithPerm [PRIVATE 5] IMPLICIT TransactionPDU, - * conversationWithoutPerm [PRIVATE 6] IMPLICIT TransactionPDU, - * abort [PRIVATE 22] IMPLICIT Abort - * } + * PackageType ::= CHOICE { unidirectional [PRIVATE 1] IMPLICIT UniTransactionPDU, + * queryWithPerm [PRIVATE 2] IMPLICIT TransactionPDU, + * queryWithoutPerm [PRIVATE 3] IMPLICIT TransactionPDU, + * response [PRIVATE 4] IMPLICIT TransactionPDU, + * conversationWithPerm [PRIVATE 5] IMPLICIT TransactionPDU, + * conversationWithoutPerm [PRIVATE 6] IMPLICIT TransactionPDU, + * abort [PRIVATE 22] IMPLICIT Abort + * } * * */ @@ -4005,11 +4005,11 @@ dissect_tcap_ITU_ComponentPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offs = get_itu_tcap_subdissector(actx->pinfo->match_uint))) { /* Found according to SSN */ is_subdissector=TRUE; - } else { + } else { /* Nothing found, take the Data handler */ subdissector_handle = data_handle; is_subdissector=TRUE; - } /* SSN */ + } /* SSN */ } /* ACN */ } else { /* There is no A.C.N for this transaction, so search in the SSN table */ @@ -4048,3 +4048,16 @@ call_tcap_dissector(dissector_handle_t handle, tvbuff_t* tvb, packet_info* pinfo requested_subdissector_handle = NULL; } + +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ |