summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-locamation-im.c
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/packet-locamation-im.c
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/packet-locamation-im.c')
-rw-r--r--epan/dissectors/packet-locamation-im.c406
1 files changed, 203 insertions, 203 deletions
diff --git a/epan/dissectors/packet-locamation-im.c b/epan/dissectors/packet-locamation-im.c
index 037d0007..b287f919 100644
--- a/epan/dissectors/packet-locamation-im.c
+++ b/epan/dissectors/packet-locamation-im.c
@@ -122,33 +122,33 @@ static const value_string company_pid_vals[] = {
/*
* struct _sample_set_t {
- * guint16 ranges;
- * gint32 sample_1;
- * gint32 sample_2;
- * gint32 sample_3;
- * gint32 sample_4;
- * gint32 sample_5;
- * gint32 sample_6;
- * gint32 sample_7;
- * gint32 sample_8;
+ * uint16_t ranges;
+ * int32_t sample_1;
+ * int32_t sample_2;
+ * int32_t sample_3;
+ * int32_t sample_4;
+ * int32_t sample_5;
+ * int32_t sample_6;
+ * int32_t sample_7;
+ * int32_t sample_8;
* };
*/
#define SAMPLE_SET_SIZE 34
/*
* struct _timestamp_t {
- * guint8 sync_status;
- * guint8 additional_status;
- * guint32 sec;
- * guint32 nsec;
+ * uint8_t sync_status;
+ * uint8_t additional_status;
+ * uint32_t sec;
+ * uint32_t nsec;
* };
*/
#define TIMESTAMP_SIZE 10
/*
* struct _timestamps_t {
- * guint8 version;
- * guint24 reserved;
+ * uint8_t version;
+ * uint24_t reserved;
* struct _timestamp_t timestamps[8];
* };
*/
@@ -166,7 +166,7 @@ static void add_split_lines(packet_info *pinfo, tvbuff_t *tvb, int tvb_offset, p
int offset = tvb_offset;
int next_offset;
while (tvb_offset_exists(tvb, offset)) {
- int len = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
+ int len = tvb_find_line_end(tvb, offset, -1, &next_offset, false);
if (len == -1) {
break;
}
@@ -212,13 +212,13 @@ static void add_split_lines(packet_info *pinfo, tvbuff_t *tvb, int tvb_offset, p
* Calibration Chunk: string
*/
-static int hf_calibration_sequence_number = -1;
-static int hf_calibration_first_sequence_number = -1;
-static int hf_calibration_last_sequence_number = -1;
-static int hf_calibration_name = -1;
-static int hf_calibration_name_line = -1;
-static int hf_calibration_chunk = -1;
-static int hf_calibration_chunk_line = -1;
+static int hf_calibration_sequence_number;
+static int hf_calibration_first_sequence_number;
+static int hf_calibration_last_sequence_number;
+static int hf_calibration_name;
+static int hf_calibration_name_line;
+static int hf_calibration_chunk;
+static int hf_calibration_chunk_line;
static hf_register_info protocol_registration_calibration[] = {
{&hf_calibration_sequence_number, {"Sequence Number", "locamation-im.calibration.sequence_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
@@ -229,29 +229,29 @@ static hf_register_info protocol_registration_calibration[] = {
{&hf_calibration_chunk, {"Chunk", "locamation-im.calibration.chunk", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
{&hf_calibration_chunk_line, {"Chunk Line", "locamation-im.calibration.chunk.line", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}};
-static expert_field ei_calibration_header = EI_INIT;
+static expert_field ei_calibration_header;
static ei_register_info ei_calibration[] = {
{&ei_calibration_header, {"locamation-im.calibration.header", PI_SEQUENCE, PI_NOTE, "Header Packet", EXPFILL}}};
static int h_protocol_calibration = -1;
-static gint hst_protocol_calibration = -1;
-static gint hst_calibration_lines = -1;
+static int ett_protocol_calibration;
+static int ett_calibration_lines;
static int dissect_calibration(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTOCOL_SHORTNAME_CALIBRATION);
col_set_str(pinfo->cinfo, COL_INFO, PROTOCOL_NAME_CALIBRATION);
proto_item *calibration_item = proto_tree_add_item(tree, h_protocol_calibration, tvb, 0, -1, ENC_NA);
- proto_tree *calibration_item_subtree = proto_item_add_subtree(calibration_item, hst_protocol_calibration);
+ proto_tree *calibration_item_subtree = proto_item_add_subtree(calibration_item, ett_protocol_calibration);
- gint tvb_offset = 0;
+ int tvb_offset = 0;
/* Sequence Number */
- gint item_size = 2;
+ int item_size = 2;
tvb_ensure_bytes_exist(tvb, tvb_offset, item_size);
- guint16 sequence_number = tvb_get_guint16(tvb, 0, ENC_BIG_ENDIAN);
+ uint16_t sequence_number = tvb_get_uint16(tvb, 0, ENC_BIG_ENDIAN);
if (sequence_number == 0) {
expert_add_info(pinfo, calibration_item, &ei_calibration_header);
}
@@ -278,7 +278,7 @@ static int dissect_calibration(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
proto_item *name_item = proto_tree_add_item(calibration_item_subtree, hf_calibration_name, tvb, tvb_offset, name_length, ENC_UTF_8);
/* Name - Lines */
- proto_tree *name_item_subtree = proto_item_add_subtree(name_item, hst_calibration_lines);
+ proto_tree *name_item_subtree = proto_item_add_subtree(name_item, ett_calibration_lines);
add_split_lines(pinfo, tvb, tvb_offset, name_item_subtree, hf_calibration_name_line);
} else {
/* Chunk Packet */
@@ -288,7 +288,7 @@ static int dissect_calibration(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
proto_item *chunk_item = proto_tree_add_item(calibration_item_subtree, hf_calibration_chunk, tvb, tvb_offset, chunk_length, ENC_UTF_8);
/* Chunk - Lines */
- proto_tree *chunk_item_subtree = proto_item_add_subtree(chunk_item, hst_calibration_lines);
+ proto_tree *chunk_item_subtree = proto_item_add_subtree(chunk_item, ett_calibration_lines);
add_split_lines(pinfo, tvb, tvb_offset, chunk_item_subtree, hf_calibration_chunk_line);
}
@@ -311,8 +311,8 @@ static int dissect_calibration(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
* Content: string
*/
-static int hf_ident_contents = -1;
-static int hf_ident_contents_line = -1;
+static int hf_ident_contents;
+static int hf_ident_contents_line;
static hf_register_info protocol_registration_ident[] = {
{&hf_ident_contents, {"Contents", "locamation-im.ident.contents", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
@@ -320,22 +320,22 @@ static hf_register_info protocol_registration_ident[] = {
static int h_protocol_ident = -1;
-static gint hst_protocol_ident = -1;
-static gint hst_ident_lines = -1;
+static int ett_protocol_ident;
+static int ett_ident_lines;
static int dissect_ident(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTOCOL_SHORTNAME_IDENT);
col_set_str(pinfo->cinfo, COL_INFO, PROTOCOL_NAME_IDENT);
proto_item *ident_item = proto_tree_add_item(tree, h_protocol_ident, tvb, 0, -1, ENC_NA);
- proto_tree *ident_item_subtree = proto_item_add_subtree(ident_item, hst_protocol_ident);
+ proto_tree *ident_item_subtree = proto_item_add_subtree(ident_item, ett_protocol_ident);
/* Contents */
int contents_length = tvb_reported_length_remaining(tvb, 0);
proto_item *contents_item = proto_tree_add_item(ident_item_subtree, hf_ident_contents, tvb, 0, contents_length, ENC_UTF_8);
/* Contents - Lines */
- proto_tree *contents_item_subtree = proto_item_add_subtree(contents_item, hst_ident_lines);
+ proto_tree *contents_item_subtree = proto_item_add_subtree(contents_item, ett_ident_lines);
add_split_lines(pinfo, tvb, 0, contents_item_subtree, hf_ident_contents_line);
return tvb_captured_length(tvb);
@@ -349,17 +349,17 @@ static int dissect_ident(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
* ########################################################################
*/
-static expert_field ei_samples_ranges_sample_1_invalid = EI_INIT;
-static expert_field ei_samples_ranges_sample_2_invalid = EI_INIT;
-static expert_field ei_samples_ranges_sample_3_invalid = EI_INIT;
-static expert_field ei_samples_ranges_sample_4_invalid = EI_INIT;
-static expert_field ei_samples_ranges_sample_5_invalid = EI_INIT;
-static expert_field ei_samples_ranges_sample_6_invalid = EI_INIT;
-static expert_field ei_samples_ranges_sample_7_invalid = EI_INIT;
-static expert_field ei_samples_ranges_sample_8_invalid = EI_INIT;
+static expert_field ei_samples_ranges_sample_1_invalid;
+static expert_field ei_samples_ranges_sample_2_invalid;
+static expert_field ei_samples_ranges_sample_3_invalid;
+static expert_field ei_samples_ranges_sample_4_invalid;
+static expert_field ei_samples_ranges_sample_5_invalid;
+static expert_field ei_samples_ranges_sample_6_invalid;
+static expert_field ei_samples_ranges_sample_7_invalid;
+static expert_field ei_samples_ranges_sample_8_invalid;
-static void check_ranges(tvbuff_t *tvb, packet_info *pinfo, gint tvb_offset, proto_item *item) {
- guint16 ranges = tvb_get_guint16(tvb, tvb_offset, ENC_BIG_ENDIAN);
+static void check_ranges(tvbuff_t *tvb, packet_info *pinfo, int tvb_offset, proto_item *item) {
+ uint16_t ranges = tvb_get_uint16(tvb, tvb_offset, ENC_BIG_ENDIAN);
if ((ranges & MASK_RANGES_SAMPLE_8) == MASK_RANGES_SAMPLE_8) {
expert_add_info(pinfo, item, &ei_samples_ranges_sample_8_invalid);
@@ -387,18 +387,18 @@ static void check_ranges(tvbuff_t *tvb, packet_info *pinfo, gint tvb_offset, pro
}
}
-static gint hst_samples_sample_set_ranges = -1;
+static int ett_samples_sample_set_ranges;
-static int hf_samples_sample_set_ranges = -1;
+static int hf_samples_sample_set_ranges;
-static int hf_samples_sample_set_ranges_sample_1 = -1;
-static int hf_samples_sample_set_ranges_sample_2 = -1;
-static int hf_samples_sample_set_ranges_sample_3 = -1;
-static int hf_samples_sample_set_ranges_sample_4 = -1;
-static int hf_samples_sample_set_ranges_sample_5 = -1;
-static int hf_samples_sample_set_ranges_sample_6 = -1;
-static int hf_samples_sample_set_ranges_sample_7 = -1;
-static int hf_samples_sample_set_ranges_sample_8 = -1;
+static int hf_samples_sample_set_ranges_sample_1;
+static int hf_samples_sample_set_ranges_sample_2;
+static int hf_samples_sample_set_ranges_sample_3;
+static int hf_samples_sample_set_ranges_sample_4;
+static int hf_samples_sample_set_ranges_sample_5;
+static int hf_samples_sample_set_ranges_sample_6;
+static int hf_samples_sample_set_ranges_sample_7;
+static int hf_samples_sample_set_ranges_sample_8;
static int *const rangesBits[] = {
&hf_samples_sample_set_ranges_sample_8,
@@ -411,26 +411,26 @@ static int *const rangesBits[] = {
&hf_samples_sample_set_ranges_sample_1,
NULL};
-static int hf_samples_sample_set_sample_1 = -1;
-static int hf_samples_sample_set_sample_2 = -1;
-static int hf_samples_sample_set_sample_3 = -1;
-static int hf_samples_sample_set_sample_4 = -1;
-static int hf_samples_sample_set_sample_5 = -1;
-static int hf_samples_sample_set_sample_6 = -1;
-static int hf_samples_sample_set_sample_7 = -1;
-static int hf_samples_sample_set_sample_8 = -1;
-
-static void add_sample_set(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_offset, int hf, proto_tree *tree) {
- gint item_size = SAMPLE_SET_SIZE;
+static int hf_samples_sample_set_sample_1;
+static int hf_samples_sample_set_sample_2;
+static int hf_samples_sample_set_sample_3;
+static int hf_samples_sample_set_sample_4;
+static int hf_samples_sample_set_sample_5;
+static int hf_samples_sample_set_sample_6;
+static int hf_samples_sample_set_sample_7;
+static int hf_samples_sample_set_sample_8;
+
+static void add_sample_set(tvbuff_t *tvb, packet_info *pinfo, int *tvb_offset, int hf, proto_tree *tree) {
+ int item_size = SAMPLE_SET_SIZE;
tvb_ensure_bytes_exist(tvb, *tvb_offset, item_size);
proto_item *sample_set_item = proto_tree_add_item(tree, hf, tvb, *tvb_offset, item_size, ENC_BIG_ENDIAN);
- proto_tree *sample_set_item_subtree = proto_item_add_subtree(sample_set_item, hst_samples_sample_set_ranges);
+ proto_tree *sample_set_item_subtree = proto_item_add_subtree(sample_set_item, ett_samples_sample_set_ranges);
/* Ranges */
item_size = 2;
tvb_ensure_bytes_exist(tvb, *tvb_offset, item_size);
- proto_item *ranges_item = proto_tree_add_bitmask(sample_set_item_subtree, tvb, *tvb_offset, hf_samples_sample_set_ranges, hst_samples_sample_set_ranges, rangesBits, ENC_BIG_ENDIAN);
+ proto_item *ranges_item = proto_tree_add_bitmask(sample_set_item_subtree, tvb, *tvb_offset, hf_samples_sample_set_ranges, ett_samples_sample_set_ranges, rangesBits, ENC_BIG_ENDIAN);
check_ranges(tvb, pinfo, *tvb_offset, ranges_item);
*tvb_offset += item_size;
@@ -446,39 +446,39 @@ static void add_sample_set(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_offset,
hf_samples_sample_set_sample_8};
item_size = 4;
- for (guint index_sample = 0; index_sample < array_length(hfs); index_sample++) {
+ for (unsigned index_sample = 0; index_sample < array_length(hfs); index_sample++) {
tvb_ensure_bytes_exist(tvb, *tvb_offset, item_size);
proto_tree_add_item(sample_set_item_subtree, hfs[index_sample], tvb, *tvb_offset, item_size, ENC_BIG_ENDIAN);
*tvb_offset += item_size;
}
}
-static void add_sample_sets(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_offset, int *hfs, guint hfs_size, proto_tree *tree) {
- for (guint index_sample_set = 0; index_sample_set < hfs_size; index_sample_set++) {
+static void add_sample_sets(tvbuff_t *tvb, packet_info *pinfo, int *tvb_offset, int *hfs, unsigned hfs_size, proto_tree *tree) {
+ for (unsigned index_sample_set = 0; index_sample_set < hfs_size; index_sample_set++) {
add_sample_set(tvb, pinfo, tvb_offset, hfs[index_sample_set], tree);
}
}
-static void add_rms_values(tvbuff_t *tvb, gint *tvb_offset, int *hfs, guint hfs_size, proto_tree *tree) {
- gint item_size = 4;
- for (guint index_rms_value = 0; index_rms_value < hfs_size; index_rms_value++) {
+static void add_rms_values(tvbuff_t *tvb, int *tvb_offset, int *hfs, unsigned hfs_size, proto_tree *tree) {
+ int item_size = 4;
+ for (unsigned index_rms_value = 0; index_rms_value < hfs_size; index_rms_value++) {
tvb_ensure_bytes_exist(tvb, *tvb_offset, item_size);
proto_tree_add_item(tree, hfs[index_rms_value], tvb, *tvb_offset, item_size, ENC_BIG_ENDIAN);
*tvb_offset += item_size;
}
}
-static gint hst_samples_timestamps_sample = -1;
-static gint hst_samples_timestamps_sample_reserved = -1;
-static gint hst_samples_timestamps_sample_timestamp = -1;
+static int ett_samples_timestamps_sample;
+static int ett_samples_timestamps_sample_reserved;
+static int ett_samples_timestamps_sample_timestamp;
-static int hf_samples_timestamps_sample_sync_status = -1;
-static int hf_samples_timestamps_sample_additional_status = -1;
-static int hf_samples_timestamps_sample_additional_status_holdover_state = -1;
-static int hf_samples_timestamps_sample_additional_status_master_clock_switch = -1;
-static int hf_samples_timestamps_sample_timestamp = -1;
-static int hf_samples_timestamps_sample_timestamp_seconds = -1;
-static int hf_samples_timestamps_sample_timestamp_nanoseconds = -1;
+static int hf_samples_timestamps_sample_sync_status;
+static int hf_samples_timestamps_sample_additional_status;
+static int hf_samples_timestamps_sample_additional_status_holdover_state;
+static int hf_samples_timestamps_sample_additional_status_master_clock_switch;
+static int hf_samples_timestamps_sample_timestamp;
+static int hf_samples_timestamps_sample_timestamp_seconds;
+static int hf_samples_timestamps_sample_timestamp_nanoseconds;
static const value_string samples_timestamps_sample_sync_status[] = {
{0, "None"},
@@ -491,26 +491,26 @@ static int *const timestamp_additional_status_bits[] = {
&hf_samples_timestamps_sample_additional_status_master_clock_switch,
NULL};
-static expert_field ei_samples_timestamp_sync_status_invalid = EI_INIT;
+static expert_field ei_samples_timestamp_sync_status_invalid;
-static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_offset_previous, gint *tvb_offset, int hf, proto_tree *tree) {
- gint item_size = TIMESTAMP_SIZE;
+static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, int *tvb_offset_previous, int *tvb_offset, int hf, proto_tree *tree) {
+ int item_size = TIMESTAMP_SIZE;
tvb_ensure_bytes_exist(tvb, *tvb_offset, item_size);
/* Get the timestamp components */
- guint8 sync_status = tvb_get_guint8(tvb, *tvb_offset);
- guint32 seconds = tvb_get_guint32(tvb, *tvb_offset + 2, ENC_BIG_ENDIAN);
- guint32 nanoseconds = tvb_get_guint32(tvb, *tvb_offset + 6, ENC_BIG_ENDIAN);
+ uint8_t sync_status = tvb_get_uint8(tvb, *tvb_offset);
+ uint32_t seconds = tvb_get_uint32(tvb, *tvb_offset + 2, ENC_BIG_ENDIAN);
+ uint32_t nanoseconds = tvb_get_uint32(tvb, *tvb_offset + 6, ENC_BIG_ENDIAN);
/* Convert the timestamp seconds to a split time type */
time_t sample_time = (time_t)seconds;
struct tm *sample_time_split = gmtime(&sample_time);
/* Construct the readable sync status */
- const gchar *sync_status_buf = val_to_str(sync_status, samples_timestamps_sample_sync_status, "Unknown (%u)");
+ const char *sync_status_buf = val_to_str(sync_status, samples_timestamps_sample_sync_status, "Unknown (%u)");
/* Construct the readable timestamp */
- gchar timestamp_buf[ITEM_LABEL_LENGTH];
+ char timestamp_buf[ITEM_LABEL_LENGTH];
size_t timestamp_length = 0;
if (sample_time_split != NULL) {
timestamp_length += strftime(&timestamp_buf[timestamp_length], ITEM_LABEL_LENGTH - timestamp_length, "%Y-%m-%d %H:%M:%S.", sample_time_split);
@@ -525,12 +525,12 @@ static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_of
title_length += snprintf(&title_buf[title_length], ITEM_LABEL_LENGTH - title_length, "%s (Sync: %s", timestamp_buf, sync_status_buf);
if (tvb_offset_previous != NULL) {
/* Get the previous timestamp components and calculate the time difference */
- guint32 seconds_previous = tvb_get_guint32(tvb, *tvb_offset_previous + 2, ENC_BIG_ENDIAN);
- guint32 nanoseconds_previous = tvb_get_guint32(tvb, *tvb_offset_previous + 6, ENC_BIG_ENDIAN);
- guint64 time_previous = ((guint64)seconds_previous * 1000000000) + nanoseconds_previous;
- guint64 time_now = ((guint64)seconds * 1000000000) + nanoseconds;
- guint64 time_diff = 0;
- gchar time_difference_sign[2] = {'\0', '\0'};
+ uint32_t seconds_previous = tvb_get_uint32(tvb, *tvb_offset_previous + 2, ENC_BIG_ENDIAN);
+ uint32_t nanoseconds_previous = tvb_get_uint32(tvb, *tvb_offset_previous + 6, ENC_BIG_ENDIAN);
+ uint64_t time_previous = ((uint64_t)seconds_previous * 1000000000) + nanoseconds_previous;
+ uint64_t time_now = ((uint64_t)seconds * 1000000000) + nanoseconds;
+ uint64_t time_diff = 0;
+ char time_difference_sign[2] = {'\0', '\0'};
if (time_now > time_previous) {
time_diff = time_now - time_previous;
time_difference_sign[0] = '\0';
@@ -542,7 +542,7 @@ static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_of
if (time_diff != 0) {
frequency = 1.0 / ((double)time_diff * 1.0E-09);
}
- title_length += snprintf(&title_buf[title_length], ITEM_LABEL_LENGTH - title_length, ", Time Difference: %s%" G_GINT64_MODIFIER "u nsec", time_difference_sign, time_diff);
+ title_length += snprintf(&title_buf[title_length], ITEM_LABEL_LENGTH - title_length, ", Time Difference: %s%" PRIu64 " nsec", time_difference_sign, time_diff);
if (frequency != 0.0) {
title_length += snprintf(&title_buf[title_length], ITEM_LABEL_LENGTH - title_length, " = %f Hz", frequency);
}
@@ -551,7 +551,7 @@ static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_of
proto_item *sample_timestamp_item = proto_tree_add_string(tree, hf, tvb, *tvb_offset, item_size, title_buf);
- proto_tree *sample_timestamp_item_subtree = proto_item_add_subtree(sample_timestamp_item, hst_samples_timestamps_sample);
+ proto_tree *sample_timestamp_item_subtree = proto_item_add_subtree(sample_timestamp_item, ett_samples_timestamps_sample);
/* Sync Status */
item_size = 1;
@@ -566,7 +566,7 @@ static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_of
/* Additional Status */
item_size = 1;
tvb_ensure_bytes_exist(tvb, *tvb_offset, item_size);
- proto_tree_add_bitmask(sample_timestamp_item_subtree, tvb, *tvb_offset, hf_samples_timestamps_sample_additional_status, hst_samples_timestamps_sample_reserved, timestamp_additional_status_bits, ENC_BIG_ENDIAN);
+ proto_tree_add_bitmask(sample_timestamp_item_subtree, tvb, *tvb_offset, hf_samples_timestamps_sample_additional_status, ett_samples_timestamps_sample_reserved, timestamp_additional_status_bits, ENC_BIG_ENDIAN);
*tvb_offset += item_size;
/* Timestamp */
@@ -574,7 +574,7 @@ static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_of
tvb_ensure_bytes_exist(tvb, *tvb_offset, item_size);
proto_item *sample_timestamp_timestamp_item = proto_tree_add_string(sample_timestamp_item_subtree, hf_samples_timestamps_sample_timestamp, tvb, *tvb_offset, item_size, timestamp_buf);
- proto_tree *sample_timestamp_timestamp_item_subtree = proto_item_add_subtree(sample_timestamp_timestamp_item, hst_samples_timestamps_sample_timestamp);
+ proto_tree *sample_timestamp_timestamp_item_subtree = proto_item_add_subtree(sample_timestamp_timestamp_item, ett_samples_timestamps_sample_timestamp);
/* Seconds */
item_size = 4;
@@ -589,10 +589,10 @@ static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_of
*tvb_offset += item_size;
}
-static void add_timestamps_set(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_offset, int *hfs, guint hfs_size, proto_tree *tree) {
- gint tvb_offset_previous = 0;
- for (guint index_timestamp = 0; index_timestamp < hfs_size; index_timestamp++) {
- gint tvb_offset_saved = *tvb_offset;
+static void add_timestamps_set(tvbuff_t *tvb, packet_info *pinfo, int *tvb_offset, int *hfs, unsigned hfs_size, proto_tree *tree) {
+ int tvb_offset_previous = 0;
+ for (unsigned index_timestamp = 0; index_timestamp < hfs_size; index_timestamp++) {
+ int tvb_offset_saved = *tvb_offset;
add_timestamp_sample(tvb, pinfo, (index_timestamp == 0) ? NULL : &tvb_offset_previous, tvb_offset, hfs[index_timestamp], tree);
tvb_offset_previous = tvb_offset_saved;
}
@@ -748,30 +748,30 @@ static void add_timestamps_set(tvbuff_t *tvb, packet_info *pinfo, gint *tvb_offs
* Nanoseconds 4 bytes, unsigned
*/
-static gint hst_protocol_samples = -1;
-static gint hst_samples_control = -1;
-static gint hst_samples_sets = -1;
-static gint hst_samples_sets_set = -1;
-static gint hst_samples_rms = -1;
-static gint hst_samples_rms_values = -1;
-static gint hst_samples_timestamps = -1;
-static gint hst_samples_timestamps_set = -1;
-
-static expert_field ei_samples_im_version_invalid = EI_INIT;
-
-static int hf_samples_transport_delay = -1;
-static int hf_samples_hop_count = -1;
-static int hf_samples_control = -1;
-static int hf_samples_control_type = -1;
-static int hf_samples_control_simulated = -1;
-static int hf_samples_control_version = -1;
-static int hf_samples_control_sequence_number = -1;
-static int hf_samples_temperature = -1;
-static int hf_samples_padding = -1;
-static int hf_samples_adc_status = -1;
-static int hf_samples_sample_set = -1;
-static int hf_samples_rms_values = -1;
-static int hf_samples_timestamps = -1;
+static int ett_protocol_samples;
+static int ett_samples_control;
+static int ett_samples_sets;
+static int ett_samples_sets_set;
+static int ett_samples_rms;
+static int ett_samples_rms_values;
+static int ett_samples_timestamps;
+static int ett_samples_timestamps_set;
+
+static expert_field ei_samples_im_version_invalid;
+
+static int hf_samples_transport_delay;
+static int hf_samples_hop_count;
+static int hf_samples_control;
+static int hf_samples_control_type;
+static int hf_samples_control_simulated;
+static int hf_samples_control_version;
+static int hf_samples_control_sequence_number;
+static int hf_samples_temperature;
+static int hf_samples_padding;
+static int hf_samples_adc_status;
+static int hf_samples_sample_set;
+static int hf_samples_rms_values;
+static int hf_samples_timestamps;
static int *const controlBits[] = {
&hf_samples_control_type,
@@ -780,46 +780,46 @@ static int *const controlBits[] = {
&hf_samples_control_sequence_number,
NULL};
-static int hf_samples_sample_set_measurement_channel_1 = -1;
-static int hf_samples_sample_set_measurement_channel_2 = -1;
-static int hf_samples_sample_set_measurement_channel_3 = -1;
-static int hf_samples_sample_set_measurement_channel_n = -1;
-static int hf_samples_sample_set_protection_channel_1 = -1;
-static int hf_samples_sample_set_protection_channel_2 = -1;
-static int hf_samples_sample_set_protection_channel_3 = -1;
-static int hf_samples_sample_set_protection_channel_n = -1;
-static int hf_samples_sample_set_channel_unused = -1;
-
-static int hf_samples_rms_values_measurement_channel_1 = -1;
-static int hf_samples_rms_values_measurement_channel_2 = -1;
-static int hf_samples_rms_values_measurement_channel_3 = -1;
-static int hf_samples_rms_values_protection_channel_1 = -1;
-static int hf_samples_rms_values_protection_channel_2 = -1;
-static int hf_samples_rms_values_protection_channel_3 = -1;
-static int hf_samples_rms_values_channel_unused = -1;
-
-static int hf_samples_timestamps_version = -1;
-static int hf_samples_timestamps_reserved = -1;
-static int hf_samples_timestamps_sample_1 = -1;
-static int hf_samples_timestamps_sample_2 = -1;
-static int hf_samples_timestamps_sample_3 = -1;
-static int hf_samples_timestamps_sample_4 = -1;
-static int hf_samples_timestamps_sample_5 = -1;
-static int hf_samples_timestamps_sample_6 = -1;
-static int hf_samples_timestamps_sample_7 = -1;
-static int hf_samples_timestamps_sample_8 = -1;
-
-static int dissect_samples_im(gboolean im1, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_, int h_protocol_samples) {
+static int hf_samples_sample_set_measurement_channel_1;
+static int hf_samples_sample_set_measurement_channel_2;
+static int hf_samples_sample_set_measurement_channel_3;
+static int hf_samples_sample_set_measurement_channel_n;
+static int hf_samples_sample_set_protection_channel_1;
+static int hf_samples_sample_set_protection_channel_2;
+static int hf_samples_sample_set_protection_channel_3;
+static int hf_samples_sample_set_protection_channel_n;
+static int hf_samples_sample_set_channel_unused;
+
+static int hf_samples_rms_values_measurement_channel_1;
+static int hf_samples_rms_values_measurement_channel_2;
+static int hf_samples_rms_values_measurement_channel_3;
+static int hf_samples_rms_values_protection_channel_1;
+static int hf_samples_rms_values_protection_channel_2;
+static int hf_samples_rms_values_protection_channel_3;
+static int hf_samples_rms_values_channel_unused;
+
+static int hf_samples_timestamps_version;
+static int hf_samples_timestamps_reserved;
+static int hf_samples_timestamps_sample_1;
+static int hf_samples_timestamps_sample_2;
+static int hf_samples_timestamps_sample_3;
+static int hf_samples_timestamps_sample_4;
+static int hf_samples_timestamps_sample_5;
+static int hf_samples_timestamps_sample_6;
+static int hf_samples_timestamps_sample_7;
+static int hf_samples_timestamps_sample_8;
+
+static int dissect_samples_im(bool im1, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_, int h_protocol_samples) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, im1 ? PROTOCOL_SHORTNAME_SAMPLES_IM1 : PROTOCOL_SHORTNAME_SAMPLES_IM2R0);
col_set_str(pinfo->cinfo, COL_INFO, im1 ? PROTOCOL_NAME_SAMPLES_IM1 : PROTOCOL_NAME_SAMPLES_IM2R0);
proto_item *samples_item = proto_tree_add_item(tree, h_protocol_samples, tvb, 0, -1, ENC_NA);
- proto_tree *samples_item_subtree = proto_item_add_subtree(samples_item, hst_protocol_samples);
+ proto_tree *samples_item_subtree = proto_item_add_subtree(samples_item, ett_protocol_samples);
- gint tvb_offset = 0;
+ int tvb_offset = 0;
/* Transport Delay */
- gint item_size = 2;
+ int item_size = 2;
tvb_ensure_bytes_exist(tvb, tvb_offset, item_size);
proto_tree_add_item(samples_item_subtree, hf_samples_transport_delay, tvb, tvb_offset, item_size, ENC_BIG_ENDIAN);
tvb_offset += item_size;
@@ -831,15 +831,15 @@ static int dissect_samples_im(gboolean im1, tvbuff_t *tvb, packet_info *pinfo, p
tvb_offset += item_size;
/* Get Control */
- guint8 control = tvb_get_guint8(tvb, tvb_offset);
- gboolean isIM1 = ((control & MASK_SAMPLES_CONTROL_VERSION) == 0);
- gboolean isIM2R0 = ((control & MASK_SAMPLES_CONTROL_VERSION) == MASK_SAMPLES_CONTROL_VERSION);
- gboolean isCIM = ((control & MASK_SAMPLES_CONTROL_TYPE) == 0);
+ uint8_t control = tvb_get_uint8(tvb, tvb_offset);
+ bool isIM1 = ((control & MASK_SAMPLES_CONTROL_VERSION) == 0);
+ bool isIM2R0 = ((control & MASK_SAMPLES_CONTROL_VERSION) == MASK_SAMPLES_CONTROL_VERSION);
+ bool isCIM = ((control & MASK_SAMPLES_CONTROL_TYPE) == 0);
/* Control */
item_size = 1;
tvb_ensure_bytes_exist(tvb, tvb_offset, item_size);
- proto_item *control_item = proto_tree_add_bitmask(samples_item_subtree, tvb, tvb_offset, hf_samples_control, hst_samples_control, controlBits, ENC_BIG_ENDIAN);
+ proto_item *control_item = proto_tree_add_bitmask(samples_item_subtree, tvb, tvb_offset, hf_samples_control, ett_samples_control, controlBits, ENC_BIG_ENDIAN);
tvb_offset += item_size;
if (!isIM1 && !isIM2R0) {
expert_add_info(pinfo, control_item, &ei_samples_im_version_invalid);
@@ -865,7 +865,7 @@ static int dissect_samples_im(gboolean im1, tvbuff_t *tvb, packet_info *pinfo, p
/* Sample Sets */
{
- proto_tree *sample_sets_subtree = proto_item_add_subtree(samples_item, hst_samples_sets);
+ proto_tree *sample_sets_subtree = proto_item_add_subtree(samples_item, ett_samples_sets);
if (im1) {
item_size = SAMPLE_SET_SIZE * 6;
@@ -875,7 +875,7 @@ static int dissect_samples_im(gboolean im1, tvbuff_t *tvb, packet_info *pinfo, p
tvb_ensure_bytes_exist(tvb, tvb_offset, item_size);
proto_item *sample_sets_subtree_item = proto_tree_add_item(sample_sets_subtree, hf_samples_sample_set, tvb, tvb_offset, item_size, ENC_NA);
- proto_tree *sample_sets_subtree_item_subtree = proto_item_add_subtree(sample_sets_subtree_item, hst_samples_sets_set);
+ proto_tree *sample_sets_subtree_item_subtree = proto_item_add_subtree(sample_sets_subtree_item, ett_samples_sets_set);
if (isIM1) {
if (isCIM) {
@@ -938,7 +938,7 @@ static int dissect_samples_im(gboolean im1, tvbuff_t *tvb, packet_info *pinfo, p
/* RMS Values */
{
- proto_tree *rms_values_subtree = proto_item_add_subtree(samples_item, hst_samples_rms);
+ proto_tree *rms_values_subtree = proto_item_add_subtree(samples_item, ett_samples_rms);
if (im1) {
item_size = 4 * 6;
@@ -948,7 +948,7 @@ static int dissect_samples_im(gboolean im1, tvbuff_t *tvb, packet_info *pinfo, p
tvb_ensure_bytes_exist(tvb, tvb_offset, item_size);
proto_item *rms_values_item = proto_tree_add_item(rms_values_subtree, hf_samples_rms_values, tvb, tvb_offset, item_size, ENC_NA);
- proto_tree *rms_values_item_subtree = proto_item_add_subtree(rms_values_item, hst_samples_rms_values);
+ proto_tree *rms_values_item_subtree = proto_item_add_subtree(rms_values_item, ett_samples_rms_values);
if (isIM1) {
if (isCIM) {
@@ -993,13 +993,13 @@ static int dissect_samples_im(gboolean im1, tvbuff_t *tvb, packet_info *pinfo, p
/* Timestamps */
if (isIM2R0 && tvb_bytes_exist(tvb, tvb_offset, TIMESTAMPS_SIZE)) {
- proto_tree *samples_timestamps_subtree = proto_item_add_subtree(samples_item, hst_samples_timestamps);
+ proto_tree *samples_timestamps_subtree = proto_item_add_subtree(samples_item, ett_samples_timestamps);
item_size = TIMESTAMPS_SIZE;
tvb_ensure_bytes_exist(tvb, tvb_offset, item_size);
proto_item *samples_timestamps_subtree_item = proto_tree_add_item(samples_timestamps_subtree, hf_samples_timestamps, tvb, tvb_offset, item_size, ENC_NA);
- proto_tree *samples_timestamps_subtree_item_subtree = proto_item_add_subtree(samples_timestamps_subtree_item, hst_samples_timestamps_set);
+ proto_tree *samples_timestamps_subtree_item_subtree = proto_item_add_subtree(samples_timestamps_subtree_item, ett_samples_timestamps_set);
/* Version */
item_size = 1;
@@ -1039,7 +1039,7 @@ static int dissect_samples_im(gboolean im1, tvbuff_t *tvb, packet_info *pinfo, p
* ########################################################################
*/
-static void samples_transport_delay(gchar *result, guint16 transport_delay) {
+static void samples_transport_delay(char *result, uint16_t transport_delay) {
snprintf(result, ITEM_LABEL_LENGTH, "%u ns", transport_delay * 10);
}
@@ -1060,11 +1060,11 @@ static const value_string samples_control_version_vals[] = {
{3, "IM2R0"},
{0, NULL}};
-static void samples_sequence_number(gchar *result, guint8 sequence_number) {
+static void samples_sequence_number(char *result, uint8_t sequence_number) {
snprintf(result, ITEM_LABEL_LENGTH, "%u", sequence_number);
}
-static void samples_temperature(gchar *result, gint16 temperature) {
+static void samples_temperature(char *result, int16_t temperature) {
snprintf(result, ITEM_LABEL_LENGTH, "%.2f C", (0.25f * temperature));
}
@@ -1080,7 +1080,7 @@ static hf_register_info protocol_registration_samples[] = {
{&hf_samples_hop_count, {"Hop Count", "locamation-im.samples.hop_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
{&hf_samples_control, {"Control", "locamation-im.samples.control", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
{&hf_samples_control_type, {"Type", "locamation-im.samples.control.type", FT_UINT8, BASE_DEC, VALS(samples_control_type_vals), MASK_SAMPLES_CONTROL_TYPE, NULL, HFILL}},
- {&hf_samples_control_simulated, {"Status", "locamation-im.samples.control.simulated", FT_UINT8, BASE_DEC, VALS(samples_control_simulated_vals), MASK_SAMPLES_CONTROL_SIMULATED, NULL, HFILL}},
+ {&hf_samples_control_simulated, {"Simulated", "locamation-im.samples.control.simulated", FT_UINT8, BASE_DEC, VALS(samples_control_simulated_vals), MASK_SAMPLES_CONTROL_SIMULATED, NULL, HFILL}},
{&hf_samples_control_version, {"Version", "locamation-im.samples.control.version", FT_UINT8, BASE_DEC, VALS(samples_control_version_vals), MASK_SAMPLES_CONTROL_VERSION, NULL, HFILL}},
{&hf_samples_control_sequence_number, {"Sequence Number", "locamation-im.samples.control.sequence_number", FT_UINT8, BASE_CUSTOM, CF_FUNC(samples_sequence_number), MASK_SAMPLES_CONTROL_SEQUENCE_NUMBER, NULL, HFILL}},
{&hf_samples_temperature, {"Temperature", "locamation-im.samples.temperature", FT_INT16, BASE_CUSTOM, CF_FUNC(samples_temperature), 0x0, NULL, HFILL}},
@@ -1135,7 +1135,7 @@ static ei_register_info ei_samples_im1[] = {
static int h_protocol_samples_im1 = -1;
static int dissect_samples_im1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
- return dissect_samples_im(TRUE, tvb, pinfo, tree, data, h_protocol_samples_im1);
+ return dissect_samples_im(true, tvb, pinfo, tree, data, h_protocol_samples_im1);
}
/*
@@ -1173,7 +1173,7 @@ static ei_register_info ei_samples_im2r0[] = {
static int h_protocol_samples_im2r0 = -1;
static int dissect_samples_im2r0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
- return dissect_samples_im(FALSE, tvb, pinfo, tree, data, h_protocol_samples_im2r0);
+ return dissect_samples_im(false, tvb, pinfo, tree, data, h_protocol_samples_im2r0);
}
/*
@@ -1184,7 +1184,7 @@ static int dissect_samples_im2r0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
* ########################################################################
*/
-static int hf_llc_company_pid = -1;
+static int hf_llc_company_pid;
static hf_register_info llc_registration[] = {
{&hf_llc_company_pid, {"PID", "locamation-im.llc.pid", FT_UINT16, BASE_HEX, VALS(company_pid_vals), 0x0, "Protocol ID", HFILL}}};
@@ -1197,25 +1197,25 @@ static hf_register_info llc_registration[] = {
* ########################################################################
*/
-static gint *protocol_subtree[] = {
- &hst_protocol_calibration,
- &hst_calibration_lines,
-
- &hst_protocol_ident,
- &hst_ident_lines,
-
- &hst_samples_sample_set_ranges,
- &hst_protocol_samples,
- &hst_samples_control,
- &hst_samples_sets,
- &hst_samples_sets_set,
- &hst_samples_rms,
- &hst_samples_rms_values,
- &hst_samples_timestamps,
- &hst_samples_timestamps_set,
- &hst_samples_timestamps_sample,
- &hst_samples_timestamps_sample_timestamp,
- &hst_samples_timestamps_sample_reserved};
+static int *protocol_subtree[] = {
+ &ett_protocol_calibration,
+ &ett_calibration_lines,
+
+ &ett_protocol_ident,
+ &ett_ident_lines,
+
+ &ett_samples_sample_set_ranges,
+ &ett_protocol_samples,
+ &ett_samples_control,
+ &ett_samples_sets,
+ &ett_samples_sets_set,
+ &ett_samples_rms,
+ &ett_samples_rms_values,
+ &ett_samples_timestamps,
+ &ett_samples_timestamps_set,
+ &ett_samples_timestamps_sample,
+ &ett_samples_timestamps_sample_timestamp,
+ &ett_samples_timestamps_sample_reserved};
static dissector_handle_t h_calibration;
static dissector_handle_t h_ident;