summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/pres/packet-pres-template.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
commita86c5f7cae7ec9a3398300555a0b644689d946a1 (patch)
tree39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/asn1/pres/packet-pres-template.c
parentReleasing progress-linux version 4.2.6-1~progress7.99u1. (diff)
downloadwireshark-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/pres/packet-pres-template.c')
-rw-r--r--epan/dissectors/asn1/pres/packet-pres-template.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/epan/dissectors/asn1/pres/packet-pres-template.c b/epan/dissectors/asn1/pres/packet-pres-template.c
index 1b3c3fc5..d7e7b5c0 100644
--- a/epan/dissectors/asn1/pres/packet-pres-template.c
+++ b/epan/dissectors/asn1/pres/packet-pres-template.c
@@ -18,6 +18,7 @@
#include <epan/conversation.h>
#include <epan/expert.h>
#include <epan/uat.h>
+#include <wsutil/array.h>
#include <epan/asn1.h>
#include <epan/oids.h>
@@ -39,63 +40,63 @@ void proto_register_pres(void);
void proto_reg_handoff_pres(void);
/* Initialize the protocol and registered fields */
-static int proto_pres = -1;
+static int proto_pres;
-/* Initialize the connectionles protocol */
-static int proto_clpres = -1;
+/* Initialize the connectionless protocol */
+static int proto_clpres;
/* pointers for acse dissector */
-proto_tree *global_tree = NULL;
-packet_info *global_pinfo = NULL;
+proto_tree *global_tree;
+packet_info *global_pinfo;
static const char *abstract_syntax_name_oid;
-static guint32 presentation_context_identifier;
+static uint32_t presentation_context_identifier;
/* to keep track of presentation context identifiers and protocol-oids */
typedef struct _pres_ctx_oid_t {
- guint32 ctx_id;
+ uint32_t ctx_id;
char *oid;
- guint32 idx;
+ uint32_t idx;
} pres_ctx_oid_t;
-static wmem_map_t *pres_ctx_oid_table = NULL;
+static wmem_map_t *pres_ctx_oid_table;
typedef struct _pres_user_t {
- guint ctx_id;
+ unsigned ctx_id;
char *oid;
} pres_user_t;
static pres_user_t *pres_users;
-static guint num_pres_users;
+static unsigned num_pres_users;
-static int hf_pres_CP_type = -1;
-static int hf_pres_CPA_PPDU = -1;
-static int hf_pres_Abort_type = -1;
-static int hf_pres_CPR_PPDU = -1;
-static int hf_pres_Typed_data_type = -1;
+static int hf_pres_CP_type;
+static int hf_pres_CPA_PPDU;
+static int hf_pres_Abort_type;
+static int hf_pres_CPR_PPDU;
+static int hf_pres_Typed_data_type;
#include "packet-pres-hf.c"
/* Initialize the subtree pointers */
-static gint ett_pres = -1;
+static int ett_pres;
#include "packet-pres-ett.c"
-static expert_field ei_pres_dissector_not_available = EI_INIT;
-static expert_field ei_pres_wrong_spdu_type = EI_INIT;
-static expert_field ei_pres_invalid_offset = EI_INIT;
+static expert_field ei_pres_dissector_not_available;
+static expert_field ei_pres_wrong_spdu_type;
+static expert_field ei_pres_invalid_offset;
UAT_DEC_CB_DEF(pres_users, ctx_id, pres_user_t)
UAT_CSTRING_CB_DEF(pres_users, oid, pres_user_t)
-static guint
-pres_ctx_oid_hash(gconstpointer k)
+static unsigned
+pres_ctx_oid_hash(const void *k)
{
const pres_ctx_oid_t *pco=(const pres_ctx_oid_t *)k;
return pco->ctx_id;
}
-static gint
-pres_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
+static int
+pres_ctx_oid_equal(const void *k1, const void *k2)
{
const pres_ctx_oid_t *pco1=(const pres_ctx_oid_t *)k1;
const pres_ctx_oid_t *pco2=(const pres_ctx_oid_t *)k2;
@@ -103,7 +104,7 @@ pres_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
}
static void
-register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
+register_ctx_id_and_oid(packet_info *pinfo _U_, uint32_t idx, const char *oid)
{
pres_ctx_oid_t *pco, *tmppco;
conversation_t *conversation;
@@ -132,9 +133,9 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
}
static char *
-find_oid_in_users_table(packet_info *pinfo, guint32 ctx_id)
+find_oid_in_users_table(packet_info *pinfo, uint32_t ctx_id)
{
- guint i;
+ unsigned i;
for (i = 0; i < num_pres_users; i++) {
pres_user_t *u = &(pres_users[i]);
@@ -150,7 +151,7 @@ find_oid_in_users_table(packet_info *pinfo, guint32 ctx_id)
}
char *
-find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
+find_oid_by_pres_ctx_id(packet_info *pinfo, uint32_t idx)
{
pres_ctx_oid_t pco, *tmppco;
conversation_t *conversation;
@@ -205,7 +206,7 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, st
proto_tree *pres_tree;
struct SESSION_DATA_STRUCTURE* session;
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);
/* do we have spdu type from the session dissector? */
if (local_session == NULL) {
@@ -231,32 +232,32 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, st
switch (session->spdu_type) {
case SES_CONNECTION_REQUEST:
- offset = dissect_pres_CP_type(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CP_type);
+ offset = dissect_pres_CP_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CP_type);
break;
case SES_CONNECTION_ACCEPT:
- offset = dissect_pres_CPA_PPDU(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CPA_PPDU);
+ offset = dissect_pres_CPA_PPDU(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CPA_PPDU);
break;
case SES_ABORT:
case SES_ABORT_ACCEPT:
- offset = dissect_pres_Abort_type(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_Abort_type);
+ offset = dissect_pres_Abort_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_Abort_type);
break;
case SES_DATA_TRANSFER:
- offset = dissect_pres_CPC_type(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_user_data);
+ offset = dissect_pres_CPC_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_user_data);
break;
case SES_TYPED_DATA:
- offset = dissect_pres_Typed_data_type(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_Typed_data_type);
+ offset = dissect_pres_Typed_data_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_Typed_data_type);
break;
case SES_RESYNCHRONIZE:
- offset = dissect_pres_RS_PPDU(FALSE, tvb, offset, &asn1_ctx, pres_tree, -1);
+ offset = dissect_pres_RS_PPDU(false, tvb, offset, &asn1_ctx, pres_tree, -1);
break;
case SES_RESYNCHRONIZE_ACK:
- offset = dissect_pres_RSA_PPDU(FALSE, tvb, offset, &asn1_ctx, pres_tree, -1);
+ offset = dissect_pres_RSA_PPDU(false, tvb, offset, &asn1_ctx, pres_tree, -1);
break;
case SES_REFUSE:
- offset = dissect_pres_CPR_PPDU(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CPR_PPDU);
+ offset = dissect_pres_CPR_PPDU(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CPR_PPDU);
break;
default:
- offset = dissect_pres_CPC_type(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_user_data);
+ offset = dissect_pres_CPC_type(false, tvb, offset, &asn1_ctx, pres_tree, hf_pres_user_data);
break;
}
@@ -365,7 +366,7 @@ void proto_register_pres(void) {
};
/* List of subtrees */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_pres,
#include "packet-pres-ettarr.c"
};
@@ -385,7 +386,7 @@ void proto_register_pres(void) {
uat_t* users_uat = uat_new("PRES Users Context List",
sizeof(pres_user_t),
"pres_context_list",
- TRUE,
+ true,
&pres_users,
&num_pres_users,
UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */