summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/rnsap/packet-rnsap-template.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/asn1/rnsap/packet-rnsap-template.c')
-rw-r--r--epan/dissectors/asn1/rnsap/packet-rnsap-template.c74
1 files changed, 39 insertions, 35 deletions
diff --git a/epan/dissectors/asn1/rnsap/packet-rnsap-template.c b/epan/dissectors/asn1/rnsap/packet-rnsap-template.c
index fc08e17b..1d24d7c7 100644
--- a/epan/dissectors/asn1/rnsap/packet-rnsap-template.c
+++ b/epan/dissectors/asn1/rnsap/packet-rnsap-template.c
@@ -19,10 +19,12 @@
#include <epan/packet.h>
#include <epan/asn1.h>
#include <epan/proto_data.h>
+#include <wsutil/array.h>
#include "packet-isup.h"
#include "packet-per.h"
#include "packet-ber.h"
+#include "packet-e212.h"
#ifdef _MSC_VER
/* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */
@@ -41,29 +43,30 @@ void proto_register_rnsap(void);
void proto_reg_handoff_rnsap(void);
typedef struct {
- guint32 ProcedureCode;
- guint32 ProtocolIE_ID;
- guint32 ddMode;
+ uint32_t ProcedureCode;
+ uint32_t ProtocolIE_ID;
+ uint32_t ddMode;
const char *ProcedureID;
const char *obj_id;
} rnsap_private_data_t;
-static dissector_handle_t ranap_handle = NULL;
-static dissector_handle_t rrc_dl_ccch_handle = NULL;
-static dissector_handle_t rrc_ul_ccch_handle = NULL;
+static dissector_handle_t ranap_handle;
+static dissector_handle_t rrc_dl_ccch_handle;
+static dissector_handle_t rrc_ul_ccch_handle;
/* Initialize the protocol and registered fields */
-static int proto_rnsap = -1;
+static int proto_rnsap;
-static int hf_rnsap_transportLayerAddress_ipv4 = -1;
-static int hf_rnsap_transportLayerAddress_ipv6 = -1;
-static int hf_rnsap_transportLayerAddress_nsap = -1;
+static int hf_rnsap_transportLayerAddress_ipv4;
+static int hf_rnsap_transportLayerAddress_ipv6;
+static int hf_rnsap_transportLayerAddress_nsap;
#include "packet-rnsap-hf.c"
/* Initialize the subtree pointers */
-static int ett_rnsap = -1;
-static int ett_rnsap_transportLayerAddress = -1;
-static int ett_rnsap_transportLayerAddress_nsap = -1;
+static int ett_rnsap;
+static int ett_rnsap_transportLayerAddress;
+static int ett_rnsap_transportLayerAddress_nsap;
+static int ett_rnsap_IMSI;
#include "packet-rnsap-ett.c"
@@ -161,50 +164,50 @@ dissect_rnsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* Highest ProcedureCode value, used in heuristics */
#define RNSAP_MAX_PC 61 /* id-enhancedRelocationResourceRelease = 61*/
#define RNSAP_MSG_MIN_LENGTH 7
-static gboolean
+static bool
dissect_sccp_rnsap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- guint8 pdu_type;
- guint8 procedure_id;
- guint8 dd_mode;
- guint8 criticality;
- guint8 transaction_id_type;
- guint length;
+ uint8_t pdu_type;
+ uint8_t procedure_id;
+ uint8_t dd_mode;
+ uint8_t criticality;
+ uint8_t transaction_id_type;
+ unsigned length;
int length_field_offset;
#define PDU_TYPE_OFFSET 0
#define PROC_CODE_OFFSET 1
#define DD_CRIT_OFFSET 2
if (tvb_captured_length(tvb) < RNSAP_MSG_MIN_LENGTH) {
- return FALSE;
+ return false;
}
- pdu_type = tvb_get_guint8(tvb, PDU_TYPE_OFFSET);
+ pdu_type = tvb_get_uint8(tvb, PDU_TYPE_OFFSET);
if (pdu_type & 0x1F) {
/* pdu_type is not 0x00 (initiatingMessage), 0x20 (succesfulOutcome),
0x40 (unsuccesfulOutcome) or 0x60 (outcome), ignore extension bit (0x80) */
- return FALSE;
+ return false;
}
- procedure_id = tvb_get_guint8(tvb, PROC_CODE_OFFSET);
+ procedure_id = tvb_get_uint8(tvb, PROC_CODE_OFFSET);
if (procedure_id > RNSAP_MAX_PC) {
- return FALSE;
+ return false;
}
- dd_mode = tvb_get_guint8(tvb, DD_CRIT_OFFSET) >> 5;
+ dd_mode = tvb_get_uint8(tvb, DD_CRIT_OFFSET) >> 5;
if (dd_mode >= 0x03) {
/* dd_mode is not 0x00 (tdd), 0x01 (fdd) or 0x02 (common) */
- return FALSE;
+ return false;
}
- criticality = (tvb_get_guint8(tvb, DD_CRIT_OFFSET) & 0x18) >> 3;
+ criticality = (tvb_get_uint8(tvb, DD_CRIT_OFFSET) & 0x18) >> 3;
if (criticality == 0x03) {
/* criticality is not 0x00 (reject), 0x01 (ignore) or 0x02 (notify) */
- return FALSE;
+ return false;
}
/* Finding the offset for the length field - depends on wether the transaction id is long or short */
- transaction_id_type = (tvb_get_guint8(tvb, DD_CRIT_OFFSET) & 0x04) >> 2;
+ transaction_id_type = (tvb_get_uint8(tvb, DD_CRIT_OFFSET) & 0x04) >> 2;
if(transaction_id_type == 0x00) { /* Short transaction id - 1 byte*/
length_field_offset = 4;
}
@@ -214,25 +217,25 @@ dissect_sccp_rnsap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
/* compute aligned PER length determinant without calling dissect_per_length_determinant()
to avoid exceptions and info added to tree, info column and expert info */
- length = tvb_get_guint8(tvb, length_field_offset);
+ length = tvb_get_uint8(tvb, length_field_offset);
length_field_offset += 1;
if (length & 0x80) {
if ((length & 0xc0) == 0x80) {
length &= 0x3f;
length <<= 8;
- length += tvb_get_guint8(tvb, length_field_offset);
+ length += tvb_get_uint8(tvb, length_field_offset);
length_field_offset += 1;
} else {
length = 0;
}
}
if (length!= (tvb_reported_length(tvb) - length_field_offset)){
- return FALSE;
+ return false;
}
dissect_rnsap(tvb, pinfo, tree, data);
- return TRUE;
+ return true;
}
@@ -257,10 +260,11 @@ void proto_register_rnsap(void) {
};
/* List of subtrees */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_rnsap,
&ett_rnsap_transportLayerAddress,
&ett_rnsap_transportLayerAddress_nsap,
+ &ett_rnsap_IMSI,
#include "packet-rnsap-ettarr.c"
};