summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/sv
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:33 +0000
commit9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9 (patch)
tree2784370cda9bbf2da9114d70f05399c0b229d28c /epan/dissectors/asn1/sv
parentAdding debian version 4.2.6-1. (diff)
downloadwireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.tar.xz
wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/asn1/sv')
-rw-r--r--epan/dissectors/asn1/sv/packet-sv-template.c87
-rw-r--r--epan/dissectors/asn1/sv/packet-sv-template.h12
-rw-r--r--epan/dissectors/asn1/sv/sv.cnf30
3 files changed, 65 insertions, 64 deletions
diff --git a/epan/dissectors/asn1/sv/packet-sv-template.c b/epan/dissectors/asn1/sv/packet-sv-template.c
index a2d8fc89..f8213f52 100644
--- a/epan/dissectors/asn1/sv/packet-sv-template.c
+++ b/epan/dissectors/asn1/sv/packet-sv-template.c
@@ -17,6 +17,7 @@
#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/addr_resolv.h>
+#include <wsutil/array.h>
#include "packet-ber.h"
#include "packet-acse.h"
@@ -63,51 +64,51 @@ void proto_register_sv(void);
void proto_reg_handoff_sv(void);
/* Data for SV tap */
-static int sv_tap = -1;
+static int sv_tap;
static sv_frame_data sv_data;
/* Initialize the protocol and registered fields */
-static int proto_sv = -1;
-static int hf_sv_appid = -1;
-static int hf_sv_length = -1;
-static int hf_sv_reserve1 = -1;
-static int hf_sv_reserve1_s_bit = -1;
-static int hf_sv_reserve2 = -1;
-static int hf_sv_phmeas_instmag_i = -1;
-static int hf_sv_phsmeas_q = -1;
-static int hf_sv_phsmeas_q_validity = -1;
-static int hf_sv_phsmeas_q_overflow = -1;
-static int hf_sv_phsmeas_q_outofrange = -1;
-static int hf_sv_phsmeas_q_badreference = -1;
-static int hf_sv_phsmeas_q_oscillatory = -1;
-static int hf_sv_phsmeas_q_failure = -1;
-static int hf_sv_phsmeas_q_olddata = -1;
-static int hf_sv_phsmeas_q_inconsistent = -1;
-static int hf_sv_phsmeas_q_inaccurate = -1;
-static int hf_sv_phsmeas_q_source = -1;
-static int hf_sv_phsmeas_q_test = -1;
-static int hf_sv_phsmeas_q_operatorblocked = -1;
-static int hf_sv_phsmeas_q_derived = -1;
-static int hf_sv_gmidentity = -1;
-static int hf_sv_gmidentity_manuf = -1;
+static int proto_sv;
+static int hf_sv_appid;
+static int hf_sv_length;
+static int hf_sv_reserve1;
+static int hf_sv_reserve1_s_bit;
+static int hf_sv_reserve2;
+static int hf_sv_phmeas_instmag_i;
+static int hf_sv_phsmeas_q;
+static int hf_sv_phsmeas_q_validity;
+static int hf_sv_phsmeas_q_overflow;
+static int hf_sv_phsmeas_q_outofrange;
+static int hf_sv_phsmeas_q_badreference;
+static int hf_sv_phsmeas_q_oscillatory;
+static int hf_sv_phsmeas_q_failure;
+static int hf_sv_phsmeas_q_olddata;
+static int hf_sv_phsmeas_q_inconsistent;
+static int hf_sv_phsmeas_q_inaccurate;
+static int hf_sv_phsmeas_q_source;
+static int hf_sv_phsmeas_q_test;
+static int hf_sv_phsmeas_q_operatorblocked;
+static int hf_sv_phsmeas_q_derived;
+static int hf_sv_gmidentity;
+static int hf_sv_gmidentity_manuf;
#include "packet-sv-hf.c"
/* Initialize the subtree pointers */
-static int ett_sv = -1;
-static int ett_phsmeas = -1;
-static int ett_phsmeas_q = -1;
-static int ett_gmidentity = -1;
-static int ett_reserve1 = -1;
+static int ett_sv;
+static int ett_phsmeas;
+static int ett_phsmeas_q;
+static int ett_gmidentity;
+static int ett_reserve1;
#include "packet-sv-ett.c"
-static expert_field ei_sv_mal_utctime = EI_INIT;
-static expert_field ei_sv_zero_pdu = EI_INIT;
-static expert_field ei_sv_mal_gmidentity = EI_INIT;
+static expert_field ei_sv_mal_utctime;
+static expert_field ei_sv_zero_pdu;
+static expert_field ei_sv_mal_gmidentity;
-static gboolean sv_decode_data_as_phsmeas = FALSE;
+static bool sv_decode_data_as_phsmeas;
static dissector_handle_t sv_handle;
@@ -138,14 +139,14 @@ static const value_string sv_q_source_vals[] = {
static int
dissect_PhsMeas1(bool implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, int hf_id _U_)
{
- gint8 ber_class;
+ int8_t ber_class;
bool pc;
- gint32 tag;
- guint32 len;
+ int32_t tag;
+ uint32_t len;
proto_tree *subtree;
- gint32 value;
- guint32 qual;
- guint32 i;
+ int32_t value;
+ uint32_t qual;
+ uint32_t i;
static int * const q_flags[] = {
&hf_sv_phsmeas_q_validity,
@@ -205,7 +206,7 @@ dissect_sv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* dat
{
int offset = 0;
int old_offset;
- guint sv_length = 0;
+ unsigned sv_length = 0;
proto_item *item;
proto_tree *tree;
@@ -216,7 +217,7 @@ dissect_sv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* dat
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);
item = proto_tree_add_item(parent_tree, proto_sv, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_sv);
@@ -242,7 +243,7 @@ dissect_sv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* dat
set_actual_length(tvb, sv_length);
while (tvb_reported_length_remaining(tvb, offset) > 0) {
old_offset = offset;
- offset = dissect_sv_SampledValues(FALSE, tvb, offset, &asn1_ctx , tree, -1);
+ offset = dissect_sv_SampledValues(false, tvb, offset, &asn1_ctx , tree, -1);
if (offset == old_offset) {
proto_tree_add_expert(tree, pinfo, &ei_sv_zero_pdu, tvb, offset, -1);
break;
@@ -331,7 +332,7 @@ void proto_register_sv(void) {
};
/* List of subtrees */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_sv,
&ett_phsmeas,
&ett_phsmeas_q,
diff --git a/epan/dissectors/asn1/sv/packet-sv-template.h b/epan/dissectors/asn1/sv/packet-sv-template.h
index 45ff60da..ea9aae9a 100644
--- a/epan/dissectors/asn1/sv/packet-sv-template.h
+++ b/epan/dissectors/asn1/sv/packet-sv-template.h
@@ -15,16 +15,16 @@
#define IEC61850_SV_MAX_PHSMEAS_ENTRIES 20
typedef struct _sv_phs_meas {
- gint32 value;
- guint32 qual;
+ int32_t value;
+ uint32_t qual;
} sv_phs_meas;
typedef struct _sv_frame_data {
- guint16 smpCnt;
- guint8 smpSynch;
- guint8 num_phsMeas;
+ uint16_t smpCnt;
+ uint8_t smpSynch;
+ uint8_t num_phsMeas;
sv_phs_meas phsMeas[IEC61850_SV_MAX_PHSMEAS_ENTRIES];
- guint16 smpMod;
+ uint16_t smpMod;
} sv_frame_data;
#endif /*__PACKET_SV_H__*/
diff --git a/epan/dissectors/asn1/sv/sv.cnf b/epan/dissectors/asn1/sv/sv.cnf
index 7da1f370..fd2634e0 100644
--- a/epan/dissectors/asn1/sv/sv.cnf
+++ b/epan/dissectors/asn1/sv/sv.cnf
@@ -15,18 +15,18 @@ SampledValues
#.FIELD_RENAME
#.FN_BODY ASDU/smpCnt VAL_PTR = &value
- guint32 value;
+ uint32_t value;
%(DEFAULT_BODY)s
sv_data.smpCnt = value;
#.END
#.FN_BODY UtcTime
- guint32 len;
- guint32 seconds;
- guint32 fraction;
- guint32 nanoseconds;
+ uint32_t len;
+ uint32_t seconds;
+ uint32_t fraction;
+ uint32_t nanoseconds;
nstime_t ts;
- gchar * ptime;
+ char * ptime;
len = tvb_reported_length_remaining(tvb, offset);
@@ -34,7 +34,7 @@ SampledValues
{
proto_tree_add_expert_format(tree, actx->pinfo, &ei_sv_mal_utctime, tvb, offset, len,
"BER Error: malformed UTCTime encoding, length must be 8 bytes");
- if(hf_index >= 0)
+ if(hf_index > 0)
{
proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
}
@@ -43,14 +43,14 @@ SampledValues
seconds = tvb_get_ntohl(tvb, offset);
fraction = tvb_get_ntoh24(tvb, offset+4) * 0x100; /* Only 3 bytes are recommended */
- nanoseconds = (guint32)( ((guint64)fraction * G_GUINT64_CONSTANT(1000000000)) / G_GUINT64_CONSTANT(0x100000000) ) ;
+ nanoseconds = (uint32_t)( ((uint64_t)fraction * UINT64_C(1000000000)) / UINT64_C(0x100000000) ) ;
ts.secs = seconds;
ts.nsecs = nanoseconds;
- ptime = abs_time_to_str(actx->pinfo->pool, &ts, ABSOLUTE_TIME_UTC, TRUE);
+ ptime = abs_time_to_str(actx->pinfo->pool, &ts, ABSOLUTE_TIME_UTC, true);
- if(hf_index >= 0)
+ if(hf_index > 0)
{
proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
}
@@ -61,13 +61,13 @@ SampledValues
UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE
#.FN_BODY ASDU/smpSynch VAL_PTR = &value
- guint32 value;
+ uint32_t value;
%(DEFAULT_BODY)s
sv_data.smpSynch = value;
#.END
#.FN_BODY ASDU/smpMod VAL_PTR = &value
- guint32 value;
+ uint32_t value;
%(DEFAULT_BODY)s
sv_data.smpMod = value;
#.END
@@ -81,10 +81,10 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE
#.END
#.FN_BODY GmidData
- guint32 len;
+ uint32_t len;
proto_item *gmidentity_ti;
proto_tree *gmidentity_tree;
- const gchar *manuf_name;
+ const char *manuf_name;
len = tvb_reported_length_remaining(tvb, offset);
@@ -92,7 +92,7 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE
{
proto_tree_add_expert_format(tree, actx->pinfo, &ei_sv_mal_gmidentity, tvb, offset, len,
"BER Error: malformed gmIdentity encoding, length must be 8 bytes");
- if(hf_index >= 0)
+ if(hf_index > 0)
{
proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
}