diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
commit | a86c5f7cae7ec9a3398300555a0b644689d946a1 (patch) | |
tree | 39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/asn1/ansi_tcap | |
parent | Releasing progress-linux version 4.2.6-1~progress7.99u1. (diff) | |
download | wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/asn1/ansi_tcap')
-rw-r--r-- | epan/dissectors/asn1/ansi_tcap/ansi_tcap.cnf | 12 | ||||
-rw-r--r-- | epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c | 105 | ||||
-rw-r--r-- | epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.h | 20 |
3 files changed, 67 insertions, 70 deletions
diff --git a/epan/dissectors/asn1/ansi_tcap/ansi_tcap.cnf b/epan/dissectors/asn1/ansi_tcap/ansi_tcap.cnf index b24c798e..9c8c8e06 100644 --- a/epan/dissectors/asn1/ansi_tcap/ansi_tcap.cnf +++ b/epan/dissectors/asn1/ansi_tcap/ansi_tcap.cnf @@ -31,8 +31,8 @@ OperationCode/private VAL_PTR = &ansi_tcap_private.d.OperationCode_private proto_tree *subtree; proto_item *spcifier_item; int start_offset = offset; - guint8 family; - guint8 specifier; + uint8_t family; + uint8_t specifier; %(DEFAULT_BODY)s /* mask off the H bit */ @@ -43,7 +43,7 @@ OperationCode/private VAL_PTR = &ansi_tcap_private.d.OperationCode_private * indicates that a reply is required; a value of 0 indicates that a reply is not required. */ family = (ansi_tcap_private.d.OperationCode_national & 0x7f00)>>8; - specifier = (guint8)(ansi_tcap_private.d.OperationCode_national & 0xff); + specifier = (uint8_t)(ansi_tcap_private.d.OperationCode_national & 0xff); proto_tree_add_item(subtree, hf_ansi_tcap_bit_h, tvb, start_offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_tcap_op_family, tvb, start_offset, 2, ENC_BIG_ENDIAN); spcifier_item = proto_tree_add_item(subtree, hf_ansi_tcap_op_specifier, tvb, start_offset, 2, ENC_BIG_ENDIAN); @@ -129,7 +129,7 @@ OperationCode/private VAL_PTR = &ansi_tcap_private.d.OperationCode_private %(DEFAULT_BODY)s ansi_tcap_private.objectApplicationId_oid= (const void*) oid_str; - ansi_tcap_private.oid_is_present=TRUE; + ansi_tcap_private.oid_is_present=true; #.FN_HDR PackageType/unidirectional gp_tcapsrt_info->ope=TC_ANSI_ALL; @@ -162,7 +162,7 @@ col_set_str(actx->pinfo->cinfo, COL_INFO, "Abort "); #.FN_BODY TransactionID/_untag VAL_PTR = &next_tvb tvbuff_t *next_tvb; -guint8 len; +uint8_t len; %(DEFAULT_BODY)s @@ -184,7 +184,7 @@ if(next_tvb) { } switch(len) { case 1: - gp_tcapsrt_info->src_tid=tvb_get_guint8(next_tvb, 0); + gp_tcapsrt_info->src_tid=tvb_get_uint8(next_tvb, 0); break; case 2: gp_tcapsrt_info->src_tid=tvb_get_ntohs(next_tvb, 0); diff --git a/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c b/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c index 10a5f4b7..789950b1 100644 --- a/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c +++ b/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c @@ -19,6 +19,7 @@ #include <epan/oids.h> #include <epan/asn1.h> #include <epan/strutil.h> +#include <wsutil/array.h> #include "packet-ber.h" #include "packet-tcap.h" @@ -35,39 +36,39 @@ void proto_reg_handoff_ansi_tcap(void); #define ANSI_TCAP_TID_ONLY 0 #define ANSI_TCAP_TID_AND_SOURCE 1 #define ANSI_TCAP_TID_SOURCE_AND_DEST 2 -static gint ansi_tcap_response_matching_type = ANSI_TCAP_TID_ONLY; +static int ansi_tcap_response_matching_type = ANSI_TCAP_TID_ONLY; /* Initialize the protocol and registered fields */ -static int proto_ansi_tcap = -1; +static int proto_ansi_tcap; #if 0 -static int hf_ansi_tcapsrt_SessionId = -1; -static int hf_ansi_tcapsrt_Duplicate = -1; -static int hf_ansi_tcapsrt_BeginSession = -1; -static int hf_ansi_tcapsrt_EndSession = -1; -static int hf_ansi_tcapsrt_SessionTime = -1; +static int hf_ansi_tcapsrt_SessionId; +static int hf_ansi_tcapsrt_Duplicate; +static int hf_ansi_tcapsrt_BeginSession; +static int hf_ansi_tcapsrt_EndSession; +static int hf_ansi_tcapsrt_SessionTime; #endif -static int hf_ansi_tcap_bit_h = -1; -static int hf_ansi_tcap_op_family = -1; -static int hf_ansi_tcap_op_specifier = -1; +static int hf_ansi_tcap_bit_h; +static int hf_ansi_tcap_op_family; +static int hf_ansi_tcap_op_specifier; #include "packet-ansi_tcap-hf.c" /* Initialize the subtree pointers */ -static gint ett_tcap = -1; -static gint ett_param = -1; -static gint ett_ansi_tcap_op_code_nat = -1; +static int ett_tcap; +static int ett_param; +static int ett_ansi_tcap_op_code_nat; -static gint ett_otid = -1; -static gint ett_dtid = -1; -static gint ett_ansi_tcap_stat = -1; +static int ett_otid; +static int ett_dtid; +static int ett_ansi_tcap_stat; -static expert_field ei_ansi_tcap_dissector_not_implemented = EI_INIT; +static expert_field ei_ansi_tcap_dissector_not_implemented; static struct tcapsrt_info_t * gp_tcapsrt_info; -static gboolean tcap_subdissector_used=FALSE; +static bool tcap_subdissector_used=false; -static struct tcaphash_context_t * gp_tcap_context=NULL; +static struct tcaphash_context_t * gp_tcap_context; /* Note the high bit should be masked off when registering in this table (0x7fff)*/ static dissector_table_t ansi_tcap_national_opcode_table; /* National Operation Codes */ @@ -76,10 +77,6 @@ static dissector_table_t ansi_tcap_national_opcode_table; /* National Operation #define MAX_SSN 254 -extern gboolean gtcap_PersistentSRT; -extern guint gtcap_RepetitionTimeout; -extern guint gtcap_LostTimeout; - /* When several Tcap components are received in a single TCAP message, we have to use several buffers for the stored parameters because else this data are erased during TAP dissector call */ @@ -87,7 +84,7 @@ extern guint gtcap_LostTimeout; int tcapsrt_global_current=0; struct tcapsrt_info_t tcapsrt_global_info[MAX_TCAP_INSTANCE]; -static dissector_table_t ber_oid_dissector_table=NULL; +static dissector_table_t ber_oid_dissector_table; static const char * cur_oid; static const char * tcapext_oid; @@ -100,7 +97,7 @@ struct ansi_tcap_private_t ansi_tcap_private; static void ansi_tcap_ctx_init(struct ansi_tcap_private_t *a_tcap_ctx) { memset(a_tcap_ctx, '\0', sizeof(*a_tcap_ctx)); a_tcap_ctx->signature = ANSI_TCAP_CTX_SIGNATURE; - a_tcap_ctx->oid_is_present = FALSE; + a_tcap_ctx->oid_is_present = false; a_tcap_ctx->TransactionID_str = NULL; } @@ -125,22 +122,22 @@ static const value_string ansi_tcap_national_op_code_family_vals[] = { /* Transaction tracking */ /* Transaction table */ struct ansi_tcap_invokedata_t { - gint OperationCode; + int OperationCode; /* 0 : national, 1 : private */ - gint32 OperationCode_private; - gint32 OperationCode_national; + int32_t OperationCode_private; + int32_t OperationCode_national; }; -static wmem_multimap_t *TransactionId_table=NULL; +static wmem_multimap_t *TransactionId_table; /* Store Invoke information needed for the corresponding reply */ static void save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){ struct ansi_tcap_invokedata_t *ansi_tcap_saved_invokedata; - gchar *src, *dst; + char *src, *dst; char *buf; src = address_to_str(pinfo->pool, &(pinfo->src)); @@ -149,7 +146,7 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){ if ((!pinfo->fd->visited)&&(ansi_tcap_private.TransactionID_str)){ /* Only do this once XXX I hope it's the right thing to do */ - /* The hash string needs to contain src and dest to distiguish differnt flows */ + /* The hash string needs to contain src and dest to distinguish different flows */ switch(ansi_tcap_response_matching_type){ case ANSI_TCAP_TID_ONLY: buf = wmem_strdup(pinfo->pool, ansi_tcap_private.TransactionID_str); @@ -178,20 +175,20 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){ } } -static gboolean +static bool find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){ struct ansi_tcap_invokedata_t *ansi_tcap_saved_invokedata; - gchar *src, *dst; + char *src, *dst; char *buf; if (!ansi_tcap_private.TransactionID_str) { - return FALSE; + return false; } src = address_to_str(pinfo->pool, &(pinfo->src)); dst = address_to_str(pinfo->pool, &(pinfo->dst)); - /* The hash string needs to contain src and dest to distiguish differnt flows */ + /* The hash string needs to contain src and dest to distinguish different flows */ buf = (char *)wmem_alloc(pinfo->pool, MAX_TID_STR_LEN); buf[0] = '\0'; /* Reverse order to invoke */ @@ -213,9 +210,9 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U ansi_tcap_private.d.OperationCode = ansi_tcap_saved_invokedata->OperationCode; ansi_tcap_private.d.OperationCode_national = ansi_tcap_saved_invokedata->OperationCode_national; ansi_tcap_private.d.OperationCode_private = ansi_tcap_saved_invokedata->OperationCode_private; - return TRUE; + return true; } - return FALSE; + return false; } /* As currently ANSI MAP is the only possible sub dissector this function @@ -234,7 +231,7 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U * Use SCCP SSN table as before? or a ansi.tcap.private dissector table? * */ -static gboolean +static bool find_tcap_subdissector(tvbuff_t *tvb, asn1_ctx_t *actx, proto_tree *tree){ proto_item *item; @@ -243,7 +240,7 @@ find_tcap_subdissector(tvbuff_t *tvb, asn1_ctx_t *actx, proto_tree *tree){ * if(ansi_tcap_private.d.oid_is_present){ call_ber_oid_callback(ansi_tcap_private.objectApplicationId_oid, tvb, 0, actx-pinfo, tree, NULL); - return TRUE; + return true; } */ if(ansi_tcap_private.d.pdu == 1){ @@ -264,16 +261,16 @@ find_tcap_subdissector(tvbuff_t *tvb, asn1_ctx_t *actx, proto_tree *tree){ } if(ansi_tcap_private.d.OperationCode == 0){ /* national */ - guint8 family = (ansi_tcap_private.d.OperationCode_national & 0x7f00)>>8; - guint8 specifier = (guint8)(ansi_tcap_private.d.OperationCode_national & 0xff); + uint8_t family = (ansi_tcap_private.d.OperationCode_national & 0x7f00)>>8; + uint8_t specifier = (uint8_t)(ansi_tcap_private.d.OperationCode_national & 0xff); if(!dissector_try_uint(ansi_tcap_national_opcode_table, ansi_tcap_private.d.OperationCode_national, tvb, actx->pinfo, actx->subtree.top_tree)){ proto_tree_add_expert_format(tree, actx->pinfo, &ei_ansi_tcap_dissector_not_implemented, tvb, 0, -1, "Dissector for ANSI TCAP NATIONAL code:0x%x(Family %u, Specifier %u) \n" "not implemented. Contact Wireshark developers if you want this supported(Spec required)", ansi_tcap_private.d.OperationCode_national, family, specifier); - return FALSE; + return false; } - return TRUE; + return true; }else if(ansi_tcap_private.d.OperationCode == 1){ /* private */ if((ansi_tcap_private.d.OperationCode_private & 0xff00) == 0x0900){ @@ -288,17 +285,17 @@ find_tcap_subdissector(tvbuff_t *tvb, asn1_ctx_t *actx, proto_tree *tree){ */ call_dissector_with_data(ansi_map_handle, tvb, actx->pinfo, actx->subtree.top_tree, &ansi_tcap_private); - return TRUE; + return true; } else if ((ansi_tcap_private.d.OperationCode_private & 0xf000) == 0x6000) { call_dissector_with_data(ain_handle, tvb, actx->pinfo, actx->subtree.top_tree, &ansi_tcap_private); - return TRUE; + return true; } } proto_tree_add_expert_format(tree, actx->pinfo, &ei_ansi_tcap_dissector_not_implemented, tvb, 0, -1, "Dissector for ANSI TCAP PRIVATE code:%u not implemented.\n" "Contact Wireshark developers if you want this supported(Spec required)", ansi_tcap_private.d.OperationCode_private); - return FALSE; + return false; } #include "packet-ansi_tcap-fn.c" @@ -314,13 +311,13 @@ dissect_ansi_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo #if 0 proto_item *stat_item=NULL; proto_tree *stat_tree=NULL; - gint offset = 0; + int offset = 0; struct tcaphash_context_t * p_tcap_context; dissector_handle_t subdissector_handle; #endif asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); ansi_tcap_ctx_init(&ansi_tcap_private); asn1_ctx.subtree.top_tree = parent_tree; @@ -335,9 +332,9 @@ dissect_ansi_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo tcapext_oid = NULL; gp_tcapsrt_info=tcapsrt_razinfo(); - tcap_subdissector_used=FALSE; + tcap_subdissector_used=false; gp_tcap_context=NULL; - dissect_ansi_tcap_PackageType(FALSE, tvb, 0, &asn1_ctx, tree, -1); + dissect_ansi_tcap_PackageType(false, tvb, 0, &asn1_ctx, tree, -1); #if 0 /* Skip this part for now it will be rewritten */ if (g_ansi_tcap_HandleSRT && !tcap_subdissector_used ) { @@ -356,11 +353,11 @@ dissect_ansi_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo (void) g_strlcpy(p_tcap_context->oid, cur_oid, sizeof(p_tcap_context->oid)); 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; + p_tcap_context->oid_present=true; } } if (g_ansi_tcap_HandleSRT && p_tcap_context && p_tcap_context->callback) { - /* Callback fonction for the upper layer */ + /* Callback function for the upper layer */ (p_tcap_context->callback)(tvb, pinfo, stat_tree, p_tcap_context); } } @@ -441,7 +438,7 @@ proto_register_ansi_tcap(void) }; /* Setup protocol subtree array */ - static gint *ett[] = { + static int *ett[] = { &ett_tcap, &ett_param, &ett_otid, @@ -481,7 +478,7 @@ proto_register_ansi_tcap(void) prefs_register_enum_preference(ansi_tcap_module, "transaction.matchtype", "Type of matching invoke/response", "Type of matching invoke/response, risk of mismatch if loose matching chosen", - &ansi_tcap_response_matching_type, ansi_tcap_response_matching_type_values, FALSE); + &ansi_tcap_response_matching_type, ansi_tcap_response_matching_type_values, false); TransactionId_table = wmem_multimap_new_autoreset(wmem_epan_scope(), wmem_file_scope(), wmem_str_hash, g_str_equal); } diff --git a/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.h b/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.h index 51f44771..b6a179ca 100644 --- a/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.h +++ b/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.h @@ -16,36 +16,36 @@ #define ANSI_TCAP_CTX_SIGNATURE 0x41544341 /* "ATCA" */ struct ansi_tcap_private_t { - guint32 signature; - gboolean oid_is_present; /* Is the Application Context Version present */ + uint32_t signature; + bool oid_is_present; /* Is the Application Context Version present */ const void * objectApplicationId_oid; - guint32 session_id; + uint32_t session_id; void * context; - gchar *TransactionID_str; + char *TransactionID_str; struct { /* "dynamic" data */ - gint pdu; + int pdu; /* 1 : invoke, 2 : returnResult, 3 : returnError, 4 : reject */ - gint OperationCode; + int OperationCode; /* 0 : national, 1 : private */ - gint32 OperationCode_national; - gint32 OperationCode_private; + int32_t OperationCode_national; + int32_t OperationCode_private; proto_item *OperationCode_item; } d; }; -/*extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);*/ +/*extern void add_ansi_tcap_subdissector(uint32_t ssn, dissector_handle_t dissector);*/ -/*extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);*/ +/*extern void delete_ansi_tcap_subdissector(uint32_t ssn, dissector_handle_t dissector);*/ #endif /* PACKET_ANSI_TCAP_H */ |