summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/ranap/packet-ranap-template.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/asn1/ranap/packet-ranap-template.c')
-rw-r--r--epan/dissectors/asn1/ranap/packet-ranap-template.c105
1 files changed, 53 insertions, 52 deletions
diff --git a/epan/dissectors/asn1/ranap/packet-ranap-template.c b/epan/dissectors/asn1/ranap/packet-ranap-template.c
index ce8f0e14..f576345b 100644
--- a/epan/dissectors/asn1/ranap/packet-ranap-template.c
+++ b/epan/dissectors/asn1/ranap/packet-ranap-template.c
@@ -19,6 +19,7 @@
#include <epan/asn1.h>
#include <epan/prefs.h>
#include <epan/proto_data.h>
+#include <wsutil/array.h>
#include "packet-ber.h"
#include "packet-per.h"
@@ -51,24 +52,24 @@ void proto_register_ranap(void);
void proto_reg_handoff_ranap(void);
/* Initialize the protocol and registered fields */
-static int proto_ranap = -1;
+static int proto_ranap;
/* initialise sub-dissector handles */
-static dissector_handle_t rrc_s_to_trnc_handle = NULL;
-static dissector_handle_t rrc_t_to_srnc_handle = NULL;
-static dissector_handle_t rrc_ho_to_utran_cmd = NULL;
-static dissector_handle_t bssgp_handle = NULL;
+static dissector_handle_t rrc_s_to_trnc_handle;
+static dissector_handle_t rrc_t_to_srnc_handle;
+static dissector_handle_t rrc_ho_to_utran_cmd;
+static dissector_handle_t bssgp_handle;
-static int hf_ranap_transportLayerAddress_ipv4 = -1;
-static int hf_ranap_transportLayerAddress_ipv6 = -1;
-static int hf_ranap_transportLayerAddress_nsap = -1;
+static int hf_ranap_transportLayerAddress_ipv4;
+static int hf_ranap_transportLayerAddress_ipv6;
+static int hf_ranap_transportLayerAddress_nsap;
#include "packet-ranap-hf.c"
/* Initialize the subtree pointers */
-static int ett_ranap = -1;
-static int ett_ranap_transportLayerAddress = -1;
-static int ett_ranap_transportLayerAddress_nsap = -1;
+static int ett_ranap;
+static int ett_ranap_transportLayerAddress;
+static int ett_ranap_transportLayerAddress_nsap;
#include "packet-ranap-ett.c"
@@ -81,8 +82,8 @@ static int ett_ranap_transportLayerAddress_nsap = -1;
typedef struct ranap_private_data_t
{
- guint32 transportLayerAddress_ipv4;
- guint16 binding_id_port;
+ uint32_t transportLayerAddress_ipv4;
+ uint16_t binding_id_port;
e212_number_type_t number_type;
} ranap_private_data_t;
@@ -105,25 +106,25 @@ static void ranap_reset_private_data(packet_info *pinfo)
p_remove_proto_data(pinfo->pool, pinfo, proto_ranap, 0);
}
-static guint32 private_data_get_transportLayerAddress_ipv4(asn1_ctx_t *actx)
+static uint32_t private_data_get_transportLayerAddress_ipv4(asn1_ctx_t *actx)
{
ranap_private_data_t *private_data = (ranap_private_data_t*)ranap_get_private_data(actx);
return private_data->transportLayerAddress_ipv4;
}
-static void private_data_set_transportLayerAddress_ipv4(asn1_ctx_t *actx, guint32 transportLayerAddress_ipv4)
+static void private_data_set_transportLayerAddress_ipv4(asn1_ctx_t *actx, uint32_t transportLayerAddress_ipv4)
{
ranap_private_data_t *private_data = (ranap_private_data_t*)ranap_get_private_data(actx);
private_data->transportLayerAddress_ipv4 = transportLayerAddress_ipv4;
}
-static guint16 private_data_get_binding_id_port(asn1_ctx_t *actx)
+static uint16_t private_data_get_binding_id_port(asn1_ctx_t *actx)
{
ranap_private_data_t *private_data = (ranap_private_data_t*)ranap_get_private_data(actx);
return private_data->binding_id_port;
}
-static void private_data_set_binding_id_port(asn1_ctx_t *actx, guint16 binding_id_port)
+static void private_data_set_binding_id_port(asn1_ctx_t *actx, uint16_t binding_id_port)
{
ranap_private_data_t *private_data = (ranap_private_data_t*)ranap_get_private_data(actx);
private_data->binding_id_port = binding_id_port;
@@ -133,10 +134,10 @@ static void private_data_set_binding_id_port(asn1_ctx_t *actx, guint16 binding_i
/* Global variables */
-static guint32 ProcedureCode;
-static guint32 ProtocolIE_ID;
-static guint32 ProtocolExtensionID;
-static gboolean glbl_dissect_container = FALSE;
+static uint32_t ProcedureCode;
+static uint32_t ProtocolIE_ID;
+static uint32_t ProtocolExtensionID;
+static bool glbl_dissect_container;
static dissector_handle_t ranap_handle;
@@ -163,7 +164,7 @@ static dissector_handle_t ranap_handle;
#define SOUT (2U<<16)
#define SPECIAL (4U<<16)
-int pdu_type = 0; /* 0 means wildcard */
+int pdu_type; /* 0 means wildcard */
/* Dissector tables */
static dissector_table_t ranap_ies_dissector_table;
@@ -203,16 +204,16 @@ dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
case id_RelocationPreparation:
if((ProtocolIE_ID == id_Source_ToTarget_TransparentContainer)||(ProtocolIE_ID == id_Target_ToSource_TransparentContainer)){
key = SPECIAL | ProtocolIE_ID;
- ret = (dissector_try_uint_new(ranap_ies_dissector_table, key, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0;
+ ret = (dissector_try_uint_new(ranap_ies_dissector_table, key, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0;
break;
}
/* Fall through */
default:
/* no special handling */
- ret = (dissector_try_uint_new(ranap_ies_dissector_table, ProtocolIE_ID, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0;
+ ret = (dissector_try_uint_new(ranap_ies_dissector_table, ProtocolIE_ID, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0;
if (ret == 0) {
key = pdu_type | ProtocolIE_ID;
- ret = (dissector_try_uint_new(ranap_ies_dissector_table, key, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0;
+ ret = (dissector_try_uint_new(ranap_ies_dissector_table, key, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0;
}
break;
}
@@ -222,28 +223,28 @@ dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
static int
dissect_ProtocolIEFieldPairFirstValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- return (dissector_try_uint_new(ranap_ies_p1_dissector_table, ProtocolIE_ID, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0;
+ return (dissector_try_uint_new(ranap_ies_p1_dissector_table, ProtocolIE_ID, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0;
}
static int
dissect_ProtocolIEFieldPairSecondValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- return (dissector_try_uint_new(ranap_ies_p2_dissector_table, ProtocolIE_ID, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0;
+ return (dissector_try_uint_new(ranap_ies_p2_dissector_table, ProtocolIE_ID, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0;
}
static int
dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- return (dissector_try_uint_new(ranap_extension_dissector_table, ProtocolExtensionID, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0;
+ return (dissector_try_uint_new(ranap_extension_dissector_table, ProtocolExtensionID, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0;
}
static int
dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- gboolean ret;
+ bool ret;
pdu_type = IMSG;
- ret = dissector_try_uint_new(ranap_proc_imsg_dissector_table, ProcedureCode, tvb, pinfo, tree, FALSE, NULL);
+ ret = dissector_try_uint_new(ranap_proc_imsg_dissector_table, ProcedureCode, tvb, pinfo, tree, false, NULL);
pdu_type = 0;
return ret ? tvb_captured_length(tvb) : 0;
}
@@ -251,10 +252,10 @@ dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
static int
dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- gboolean ret;
+ bool ret;
pdu_type = SOUT;
- ret = dissector_try_uint_new(ranap_proc_sout_dissector_table, ProcedureCode, tvb, pinfo, tree, FALSE, NULL);
+ ret = dissector_try_uint_new(ranap_proc_sout_dissector_table, ProcedureCode, tvb, pinfo, tree, false, NULL);
pdu_type = 0;
return ret ? tvb_captured_length(tvb) : 0;
}
@@ -262,13 +263,13 @@ dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
static int
dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- return (dissector_try_uint_new(ranap_proc_uout_dissector_table, ProcedureCode, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0;
+ return (dissector_try_uint_new(ranap_proc_uout_dissector_table, ProcedureCode, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0;
}
static int
dissect_OutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- return (dissector_try_uint_new(ranap_proc_out_dissector_table, ProcedureCode, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0;
+ return (dissector_try_uint_new(ranap_proc_out_dissector_table, ProcedureCode, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0;
}
static int
@@ -302,7 +303,7 @@ dissect_ranap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
sccp_msg_lcl->data.co.assoc->payload = SCCP_PLOAD_RANAP;
if (! sccp_msg_lcl->data.co.label && ProcedureCode != 0xFFFFFFFF) {
- const gchar* str = val_to_str_const(ProcedureCode, ranap_ProcedureCode_vals, "Unknown RANAP");
+ const char* str = val_to_str_const(ProcedureCode, ranap_ProcedureCode_vals, "Unknown RANAP");
sccp_msg_lcl->data.co.label = wmem_strdup(wmem_file_scope(), str);
}
}
@@ -311,12 +312,12 @@ dissect_ranap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
}
#define RANAP_MSG_MIN_LENGTH 7
-static gboolean
+static bool
dissect_sccp_ranap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- guint8 temp;
- guint16 word;
- guint length;
+ uint8_t temp;
+ uint16_t word;
+ unsigned length;
int offset;
/* Is it a ranap packet?
@@ -334,53 +335,53 @@ dissect_sccp_ranap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
#define CRIT_OFFSET 2
#define MSG_TYPE_OFFSET 1
#define PDU_TYPE_OFFSET 0
- if (tvb_captured_length(tvb) < RANAP_MSG_MIN_LENGTH) { return FALSE; }
+ if (tvb_captured_length(tvb) < RANAP_MSG_MIN_LENGTH) { return false; }
- temp = tvb_get_guint8(tvb, PDU_TYPE_OFFSET);
+ temp = tvb_get_uint8(tvb, PDU_TYPE_OFFSET);
if (temp & 0x1F) {
/* PDU Type byte is not 0x00 (initiatingMessage), 0x20 (succesfulOutcome),
0x40 (unsuccesfulOutcome) or 0x60 (outcome), ignore extension bit (0x80) */
- return FALSE;
+ return false;
}
- temp = tvb_get_guint8(tvb, CRIT_OFFSET);
+ temp = tvb_get_uint8(tvb, CRIT_OFFSET);
if (temp == 0xC0 || temp & 0x3F) {
/* Criticality byte is not 0x00 (reject), 0x40 (ignore) or 0x80 (notify) */
- return FALSE;
+ return false;
}
/* compute aligned PER length determinant without calling dissect_per_length_determinant()
to avoid exceptions and info added to tree, info column and expert info */
offset = LENGTH_OFFSET;
- length = tvb_get_guint8(tvb, offset);
+ length = tvb_get_uint8(tvb, offset);
offset += 1;
if ((length & 0x80) == 0x80) {
if ((length & 0xc0) == 0x80) {
length &= 0x3f;
length <<= 8;
- length += tvb_get_guint8(tvb, offset);
+ length += tvb_get_uint8(tvb, offset);
offset += 1;
} else {
length = 0;
}
}
if (length!= (tvb_reported_length(tvb) - offset)){
- return FALSE;
+ return false;
}
- temp = tvb_get_guint8(tvb, MSG_TYPE_OFFSET);
- if (temp > RANAP_MAX_PC) { return FALSE; }
+ temp = tvb_get_uint8(tvb, MSG_TYPE_OFFSET);
+ if (temp > RANAP_MAX_PC) { return false; }
/* Try to strengthen the heuristic further, by checking the byte following the length and the bitfield indicating extensions etc
* which usually is a sequence-of length
*/
word = tvb_get_ntohs(tvb, offset + 1);
if (word > 0x1ff){
- return FALSE;
+ return false;
}
dissect_ranap(tvb, pinfo, tree, data);
- return TRUE;
+ return true;
}
/*--- proto_register_ranap -------------------------------------------*/
@@ -408,7 +409,7 @@ void proto_register_ranap(void) {
};
/* List of subtrees */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_ranap,
&ett_ranap_transportLayerAddress,
&ett_ranap_transportLayerAddress_nsap,