summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dlt.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/packet-dlt.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/packet-dlt.c')
-rw-r--r--epan/dissectors/packet-dlt.c424
1 files changed, 212 insertions, 212 deletions
diff --git a/epan/dissectors/packet-dlt.c b/epan/dissectors/packet-dlt.c
index f94e663e..4cc2de12 100644
--- a/epan/dissectors/packet-dlt.c
+++ b/epan/dissectors/packet-dlt.c
@@ -161,94 +161,94 @@ void proto_reg_handoff_dlt_storage_header(void);
#define DLT_SERVICE_OPTIONS_WITH_LOG_TRACE 6
#define DLT_SERVICE_OPTIONS_WITH_LOG_TRACE_TEXT 7
-static int proto_dlt = -1;
-static int proto_dlt_storage_header = -1;
+static int proto_dlt;
+static int proto_dlt_storage_header;
-static dissector_handle_t dlt_handle_udp = NULL;
-static dissector_handle_t dlt_handle_tcp = NULL;
-static dissector_handle_t dlt_handle_storage = NULL;
+static dissector_handle_t dlt_handle_udp;
+static dissector_handle_t dlt_handle_tcp;
+static dissector_handle_t dlt_handle_storage;
/* Subdissectors */
static heur_dissector_list_t heur_subdissector_list;
static heur_dtbl_entry_t *heur_dtbl_entry;
/* header fields */
-static int hf_dlt_header_type = -1;
-static int hf_dlt_ht_ext_header = -1;
-static int hf_dlt_ht_msb_first = -1;
-static int hf_dlt_ht_with_ecuid = -1;
-static int hf_dlt_ht_with_sessionid = -1;
-static int hf_dlt_ht_with_timestamp = -1;
-static int hf_dlt_ht_version = -1;
-
-static int hf_dlt_msg_ctr = -1;
-static int hf_dlt_length = -1;
-
-static int hf_dlt_ecu_id = -1;
-static int hf_dlt_session_id = -1;
-static int hf_dlt_timestamp = -1;
-
-static int hf_dlt_ext_hdr = -1;
-static int hf_dlt_msg_info = -1;
-static int hf_dlt_mi_verbose = -1;
-static int hf_dlt_mi_msg_type = -1;
-static int hf_dlt_mi_msg_type_info = -1;
-static int hf_dlt_num_of_args = -1;
-static int hf_dlt_app_id = -1;
-static int hf_dlt_ctx_id = -1;
-
-static int hf_dlt_payload = -1;
-static int hf_dlt_message_id = -1;
-static int hf_dlt_payload_data = -1;
-
-static int hf_dlt_data_bool = -1;
-static int hf_dlt_uint8 = -1;
-static int hf_dlt_uint16 = -1;
-static int hf_dlt_uint32 = -1;
-static int hf_dlt_uint64 = -1;
-static int hf_dlt_int8 = -1;
-static int hf_dlt_int16 = -1;
-static int hf_dlt_int32 = -1;
-static int hf_dlt_int64 = -1;
-static int hf_dlt_float = -1;
-static int hf_dlt_double = -1;
-static int hf_dlt_rawd = -1;
-static int hf_dlt_string = -1;
-
-static int hf_dlt_service_options = -1;
-static int hf_dlt_service_application_id = -1;
-static int hf_dlt_service_context_id = -1;
-static int hf_dlt_service_log_level = -1;
-static int hf_dlt_service_new_log_level = -1;
-static int hf_dlt_service_trace_status = -1;
-static int hf_dlt_service_new_trace_status = -1;
-static int hf_dlt_service_new_status = -1;
-static int hf_dlt_service_reserved = -1;
-static int hf_dlt_service_status = -1;
-static int hf_dlt_service_length = -1;
-static int hf_dlt_service_swVersion = -1;
-static int hf_dlt_service_status_log_info = -1;
-static int hf_dlt_service_log_levels = -1;
-static int hf_dlt_service_count = -1;
-static int hf_dlt_service_app_desc = -1;
-static int hf_dlt_service_ctx_desc = -1;
-
-static int hf_dlt_storage_tstamp_s = -1;
-static int hf_dlt_storage_tstamp_us = -1;
-static int hf_dlt_storage_ecu_name = -1;
-static int hf_dlt_storage_reserved = -1;
+static int hf_dlt_header_type;
+static int hf_dlt_ht_ext_header;
+static int hf_dlt_ht_msb_first;
+static int hf_dlt_ht_with_ecuid;
+static int hf_dlt_ht_with_sessionid;
+static int hf_dlt_ht_with_timestamp;
+static int hf_dlt_ht_version;
+
+static int hf_dlt_msg_ctr;
+static int hf_dlt_length;
+
+static int hf_dlt_ecu_id;
+static int hf_dlt_session_id;
+static int hf_dlt_timestamp;
+
+static int hf_dlt_ext_hdr;
+static int hf_dlt_msg_info;
+static int hf_dlt_mi_verbose;
+static int hf_dlt_mi_msg_type;
+static int hf_dlt_mi_msg_type_info;
+static int hf_dlt_num_of_args;
+static int hf_dlt_app_id;
+static int hf_dlt_ctx_id;
+
+static int hf_dlt_payload;
+static int hf_dlt_message_id;
+static int hf_dlt_payload_data;
+
+static int hf_dlt_data_bool;
+static int hf_dlt_uint8;
+static int hf_dlt_uint16;
+static int hf_dlt_uint32;
+static int hf_dlt_uint64;
+static int hf_dlt_int8;
+static int hf_dlt_int16;
+static int hf_dlt_int32;
+static int hf_dlt_int64;
+static int hf_dlt_float;
+static int hf_dlt_double;
+static int hf_dlt_rawd;
+static int hf_dlt_string;
+
+static int hf_dlt_service_options;
+static int hf_dlt_service_application_id;
+static int hf_dlt_service_context_id;
+static int hf_dlt_service_log_level;
+static int hf_dlt_service_new_log_level;
+static int hf_dlt_service_trace_status;
+static int hf_dlt_service_new_trace_status;
+static int hf_dlt_service_new_status;
+static int hf_dlt_service_reserved;
+static int hf_dlt_service_status;
+static int hf_dlt_service_length;
+static int hf_dlt_service_swVersion;
+static int hf_dlt_service_status_log_info;
+static int hf_dlt_service_log_levels;
+static int hf_dlt_service_count;
+static int hf_dlt_service_app_desc;
+static int hf_dlt_service_ctx_desc;
+
+static int hf_dlt_storage_tstamp_s;
+static int hf_dlt_storage_tstamp_us;
+static int hf_dlt_storage_ecu_name;
+static int hf_dlt_storage_reserved;
/* subtrees */
-static gint ett_dlt = -1;
-static gint ett_dlt_hdr_type = -1;
-static gint ett_dlt_ext_hdr = -1;
-static gint ett_dlt_msg_info = -1;
-static gint ett_dlt_payload = -1;
-static gint ett_dlt_service_app_ids = -1;
-static gint ett_dlt_service_app_id = -1;
-static gint ett_dlt_service_ctx_id = -1;
+static int ett_dlt;
+static int ett_dlt_hdr_type;
+static int ett_dlt_ext_hdr;
+static int ett_dlt_msg_info;
+static int ett_dlt_payload;
+static int ett_dlt_service_app_ids;
+static int ett_dlt_service_app_id;
+static int ett_dlt_service_ctx_id;
-static gint ett_dlt_storage = -1;
+static int ett_dlt_storage;
/***************************
****** String Tables ******
@@ -380,57 +380,57 @@ static const value_string dlt_service_options[] = {
****** Expert Info ******
*************************/
-static expert_field ef_dlt_unsupported_datatype = EI_INIT;
-static expert_field ef_dlt_unsupported_length_datatype = EI_INIT;
-static expert_field ef_dlt_unsupported_string_coding = EI_INIT;
-static expert_field ef_dlt_unsupported_non_verbose_msg_type = EI_INIT;
-static expert_field ef_dlt_buffer_too_short = EI_INIT;
-static expert_field ef_dlt_parsing_error = EI_INIT;
+static expert_field ei_dlt_unsupported_datatype;
+static expert_field ei_dlt_unsupported_length_datatype;
+static expert_field ei_dlt_unsupported_string_coding;
+static expert_field ei_dlt_unsupported_non_verbose_msg_type;
+static expert_field ei_dlt_buffer_too_short;
+static expert_field ei_dlt_parsing_error;
static void
-expert_dlt_unsupported_parameter(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, gint length) {
+expert_dlt_unsupported_parameter(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, int length) {
if (tvb!=NULL) {
- proto_tree_add_expert(tree, pinfo, &ef_dlt_unsupported_datatype, tvb, offset, length);
+ proto_tree_add_expert(tree, pinfo, &ei_dlt_unsupported_datatype, tvb, offset, length);
}
col_append_str(pinfo->cinfo, COL_INFO, " [DLT: Unsupported Data Type!]");
}
static void
-expert_dlt_unsupported_length_datatype(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, gint length) {
+expert_dlt_unsupported_length_datatype(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, int length) {
if (tvb != NULL) {
- proto_tree_add_expert(tree, pinfo, &ef_dlt_unsupported_length_datatype, tvb, offset, length);
+ proto_tree_add_expert(tree, pinfo, &ei_dlt_unsupported_length_datatype, tvb, offset, length);
}
col_append_str(pinfo->cinfo, COL_INFO, " [DLT: Unsupported Length of Datatype!]");
}
static void
-expert_dlt_unsupported_string_coding(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, gint length) {
+expert_dlt_unsupported_string_coding(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, int length) {
if (tvb != NULL) {
- proto_tree_add_expert(tree, pinfo, &ef_dlt_unsupported_string_coding, tvb, offset, length);
+ proto_tree_add_expert(tree, pinfo, &ei_dlt_unsupported_string_coding, tvb, offset, length);
}
col_append_str(pinfo->cinfo, COL_INFO, " [DLT: Unsupported String Coding!]");
}
static void
-expert_dlt_unsupported_non_verbose_msg_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, gint length) {
+expert_dlt_unsupported_non_verbose_msg_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, int length) {
if (tvb != NULL) {
- proto_tree_add_expert(tree, pinfo, &ef_dlt_unsupported_non_verbose_msg_type, tvb, offset, length);
+ proto_tree_add_expert(tree, pinfo, &ei_dlt_unsupported_non_verbose_msg_type, tvb, offset, length);
}
col_append_str(pinfo->cinfo, COL_INFO, " [DLT: Unsupported Non-Verbose Message Type!]");
}
static void
-expert_dlt_buffer_too_short(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, gint length) {
+expert_dlt_buffer_too_short(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, int length) {
if (tvb != NULL) {
- proto_tree_add_expert(tree, pinfo, &ef_dlt_buffer_too_short, tvb, offset, length);
+ proto_tree_add_expert(tree, pinfo, &ei_dlt_buffer_too_short, tvb, offset, length);
}
col_append_str(pinfo->cinfo, COL_INFO, " [DLT: Buffer too short!]");
}
static void
-expert_dlt_parsing_error(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, gint length) {
+expert_dlt_parsing_error(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, int length) {
if (tvb != NULL) {
- proto_tree_add_expert(tree, pinfo, &ef_dlt_parsing_error, tvb, offset, length);
+ proto_tree_add_expert(tree, pinfo, &ei_dlt_parsing_error, tvb, offset, length);
}
col_append_str(pinfo->cinfo, COL_INFO, " [DLT: Parsing Error!]");
}
@@ -440,20 +440,20 @@ expert_dlt_parsing_error(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gi
****** Helper routines ******
*****************************/
-gint32
-dlt_ecu_id_to_gint32(const gchar *ecu_id) {
+int32_t
+dlt_ecu_id_to_int32(const char *ecu_id) {
if (ecu_id == NULL) {
return 0;
}
- gint32 ret = 0;
- gint i;
- guint shift = 32;
+ int32_t ret = 0;
+ int i;
+ unsigned shift = 32;
/* DLT allows only up to 4 ASCII chars! Unused is 0x00 */
- for (i = 0; i < (gint)strlen(ecu_id) && i < 4; i++) {
+ for (i = 0; i < (int)strlen(ecu_id) && i < 4; i++) {
shift -= 8;
- ret |= (gint32)ecu_id[i] << shift;
+ ret |= (int32_t)ecu_id[i] << shift;
}
return ret;
@@ -464,8 +464,8 @@ dlt_ecu_id_to_gint32(const gchar *ecu_id) {
**********************************/
static void
-sanitize_buffer(guint8 *buf, gint length, guint32 encoding) {
- gint i = 0;
+sanitize_buffer(uint8_t *buf, int length, uint32_t encoding) {
+ int i = 0;
for (i=0; i<length; i++) {
/* UTF-8 uses the ASCII chars. So between 0x00 and 0x7f, we can treat it as ASCII. :) */
@@ -476,32 +476,32 @@ sanitize_buffer(guint8 *buf, gint length, guint32 encoding) {
}
}
-static guint32
-dissect_dlt_verbose_parameter_bool(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, gboolean payload_le _U_, guint32 type_info _U_, gint length) {
- guint8 value = 0;
+static uint32_t
+dissect_dlt_verbose_parameter_bool(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool payload_le _U_, uint32_t type_info _U_, int length) {
+ uint8_t value = 0;
if (length != 1 || tvb_captured_length_remaining(tvb, offset) < length) {
expert_dlt_buffer_too_short(tree, pinfo, tvb, offset, 0);
return 0;
}
- value = tvb_get_guint8(tvb, offset);
+ value = tvb_get_uint8(tvb, offset);
proto_tree_add_item(tree, hf_dlt_data_bool, tvb, offset, 1, ENC_NA);
if (value==0x00) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " false");
+ col_append_str(pinfo->cinfo, COL_INFO, " false");
} else if (value==0x01) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " true");
+ col_append_str(pinfo->cinfo, COL_INFO, " true");
} else {
- col_append_fstr(pinfo->cinfo, COL_INFO, " undefined");
+ col_append_str(pinfo->cinfo, COL_INFO, " undefined");
}
return length;
}
-static guint32
-dissect_dlt_verbose_parameter_int(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, gboolean payload_le, guint32 type_info _U_, gint length) {
- gint64 value = 0;
+static uint32_t
+dissect_dlt_verbose_parameter_int(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool payload_le, uint32_t type_info _U_, int length) {
+ int64_t value = 0;
if (tvb_captured_length_remaining(tvb, offset) < length) {
return 0;
@@ -511,19 +511,19 @@ dissect_dlt_verbose_parameter_int(tvbuff_t *tvb, packet_info *pinfo, proto_tree
switch (length) {
case 1:
proto_tree_add_item(tree, hf_dlt_int8, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- value = (gint8)tvb_get_guint8(tvb, offset);
+ value = (int8_t)tvb_get_uint8(tvb, offset);
break;
case 2:
proto_tree_add_item(tree, hf_dlt_int16, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- value = (gint16)tvb_get_letohs(tvb, offset);
+ value = (int16_t)tvb_get_letohs(tvb, offset);
break;
case 4:
proto_tree_add_item(tree, hf_dlt_int32, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- value = (gint32)tvb_get_letohl(tvb, offset);
+ value = (int32_t)tvb_get_letohl(tvb, offset);
break;
case 8:
proto_tree_add_item(tree, hf_dlt_int64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
- value = (gint64)tvb_get_letoh64(tvb, offset);
+ value = (int64_t)tvb_get_letoh64(tvb, offset);
break;
case 16:
default:
@@ -533,19 +533,19 @@ dissect_dlt_verbose_parameter_int(tvbuff_t *tvb, packet_info *pinfo, proto_tree
switch (length) {
case 1:
proto_tree_add_item(tree, hf_dlt_int8, tvb, offset, 1, ENC_BIG_ENDIAN);
- value = (gint8)tvb_get_guint8(tvb, offset);
+ value = (int8_t)tvb_get_uint8(tvb, offset);
break;
case 2:
proto_tree_add_item(tree, hf_dlt_int16, tvb, offset, 2, ENC_BIG_ENDIAN);
- value = (gint16)tvb_get_ntohs(tvb, offset);
+ value = (int16_t)tvb_get_ntohs(tvb, offset);
break;
case 4:
proto_tree_add_item(tree, hf_dlt_int32, tvb, offset, 4, ENC_BIG_ENDIAN);
- value = (gint32)tvb_get_ntohl(tvb, offset);
+ value = (int32_t)tvb_get_ntohl(tvb, offset);
break;
case 8:
proto_tree_add_item(tree, hf_dlt_int64, tvb, offset, 8, ENC_BIG_ENDIAN);
- value = (gint64)tvb_get_ntoh64(tvb, offset);
+ value = (int64_t)tvb_get_ntoh64(tvb, offset);
break;
case 16:
default:
@@ -557,9 +557,9 @@ dissect_dlt_verbose_parameter_int(tvbuff_t *tvb, packet_info *pinfo, proto_tree
return length;
}
-static guint32
-dissect_dlt_verbose_parameter_uint(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, gboolean payload_le, guint32 type_info _U_, gint length) {
- guint64 value = 0;
+static uint32_t
+dissect_dlt_verbose_parameter_uint(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool payload_le, uint32_t type_info _U_, int length) {
+ uint64_t value = 0;
if (tvb_captured_length_remaining(tvb, offset) < length) {
expert_dlt_buffer_too_short(tree, pinfo, tvb, offset, 0);
@@ -570,7 +570,7 @@ dissect_dlt_verbose_parameter_uint(tvbuff_t *tvb, packet_info *pinfo, proto_tree
switch (length) {
case 1:
proto_tree_add_item(tree, hf_dlt_uint8, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- value = tvb_get_guint8(tvb, offset);
+ value = tvb_get_uint8(tvb, offset);
break;
case 2:
proto_tree_add_item(tree, hf_dlt_uint16, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -592,7 +592,7 @@ dissect_dlt_verbose_parameter_uint(tvbuff_t *tvb, packet_info *pinfo, proto_tree
switch (length) {
case 1:
proto_tree_add_item(tree, hf_dlt_uint8, tvb, offset, 1, ENC_BIG_ENDIAN);
- value = tvb_get_guint8(tvb, offset);
+ value = tvb_get_uint8(tvb, offset);
break;
case 2:
proto_tree_add_item(tree, hf_dlt_uint16, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -616,9 +616,9 @@ dissect_dlt_verbose_parameter_uint(tvbuff_t *tvb, packet_info *pinfo, proto_tree
return length;
}
-static guint32
-dissect_dlt_verbose_parameter_float(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, gboolean payload_le, guint32 type_info _U_, gint length) {
- gdouble value = 0.0;
+static uint32_t
+dissect_dlt_verbose_parameter_float(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool payload_le, uint32_t type_info _U_, int length) {
+ double value = 0.0;
if (tvb_captured_length_remaining(tvb, offset) < length) {
expert_dlt_buffer_too_short(tree, pinfo, tvb, offset, 0);
@@ -629,7 +629,7 @@ dissect_dlt_verbose_parameter_float(tvbuff_t *tvb, packet_info *pinfo, proto_tre
switch (length) {
case 4:
proto_tree_add_item(tree, hf_dlt_float, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- value = (gdouble)tvb_get_letohieee_float(tvb, offset);
+ value = (double)tvb_get_letohieee_float(tvb, offset);
break;
case 8:
proto_tree_add_item(tree, hf_dlt_double, tvb, offset, 8, ENC_LITTLE_ENDIAN);
@@ -644,7 +644,7 @@ dissect_dlt_verbose_parameter_float(tvbuff_t *tvb, packet_info *pinfo, proto_tre
switch (length) {
case 4:
proto_tree_add_item(tree, hf_dlt_float, tvb, offset, 4, ENC_BIG_ENDIAN);
- value = (gdouble)tvb_get_ntohieee_float(tvb, offset);
+ value = (double)tvb_get_ntohieee_float(tvb, offset);
break;
case 8:
proto_tree_add_item(tree, hf_dlt_double, tvb, offset, 8, ENC_BIG_ENDIAN);
@@ -661,12 +661,12 @@ dissect_dlt_verbose_parameter_float(tvbuff_t *tvb, packet_info *pinfo, proto_tre
return length;
}
-static guint32
-dissect_dlt_verbose_parameter_raw_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, gboolean payload_le, guint32 type_info _U_, gint length _U_) {
- guint16 len = 0;
- guint8 *buf = NULL;
- guint32 i = 0;
- guint32 offset_orig = offset;
+static uint32_t
+dissect_dlt_verbose_parameter_raw_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool payload_le, uint32_t type_info _U_, int length _U_) {
+ uint16_t len = 0;
+ uint8_t *buf = NULL;
+ uint32_t i = 0;
+ uint32_t offset_orig = offset;
if (tvb_captured_length_remaining(tvb, offset) < 2) {
expert_dlt_buffer_too_short(tree, pinfo, tvb, offset, 0);
@@ -687,7 +687,7 @@ dissect_dlt_verbose_parameter_raw_data(tvbuff_t *tvb, packet_info *pinfo, proto_
proto_tree_add_item(tree, hf_dlt_rawd, tvb, offset, len, ENC_NA);
- buf = (guint8 *) tvb_memdup(pinfo->pool, tvb, offset, len);
+ buf = (uint8_t *) tvb_memdup(pinfo->pool, tvb, offset, len);
offset += len;
for (i=0; i<len; i++) {
@@ -697,13 +697,13 @@ dissect_dlt_verbose_parameter_raw_data(tvbuff_t *tvb, packet_info *pinfo, proto_
return offset - offset_orig;
}
-static guint32
-dissect_dlt_verbose_parameter_string(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, gboolean payload_le, guint32 type_info _U_, gint length _U_) {
- guint16 str_len = 0;
- guint32 encoding = 0;
- guint8 *buf = NULL;
- guint32 offset_orig = offset;
- gint tmp_length = 0;
+static uint32_t
+dissect_dlt_verbose_parameter_string(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool payload_le, uint32_t type_info _U_, int length _U_) {
+ uint16_t str_len = 0;
+ uint32_t encoding = 0;
+ uint8_t *buf = NULL;
+ uint32_t offset_orig = offset;
+ int tmp_length = 0;
tvbuff_t *subtvb = NULL;
if (tvb_captured_length_remaining(tvb, offset) < 2) {
@@ -751,12 +751,12 @@ dissect_dlt_verbose_parameter_string(tvbuff_t *tvb, packet_info *pinfo, proto_tr
return offset - offset_orig;
}
-static guint32
-dissect_dlt_verbose_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, gboolean payload_le) {
- guint32 type_info = 0;
- guint8 length_field = 0;
- gint length = 0;
- guint32 offset_orig = offset;
+static uint32_t
+dissect_dlt_verbose_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool payload_le) {
+ uint32_t type_info = 0;
+ uint8_t length_field = 0;
+ int length = 0;
+ uint32_t offset_orig = offset;
/* we need at least the uint32 type info to decide on how much more bytes we need */
if (tvb_captured_length_remaining(tvb, offset) < 4) {
@@ -826,11 +826,11 @@ dissect_dlt_verbose_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
}
-static guint32
-dissect_dlt_verbose_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, gboolean payload_le, guint8 num_of_args) {
- guint32 i = 0;
- guint32 offset_orig = offset;
- guint32 len_parsed = 5;
+static uint32_t
+dissect_dlt_verbose_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset, bool payload_le, uint8_t num_of_args) {
+ uint32_t i = 0;
+ uint32_t offset_orig = offset;
+ uint32_t len_parsed = 5;
while (len_parsed>4 && i<num_of_args) {
len_parsed = dissect_dlt_verbose_parameter(tvb, pinfo, tree, offset, payload_le);
@@ -842,22 +842,22 @@ dissect_dlt_verbose_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
static int
-dissect_dlt_non_verbose_payload_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset, gboolean payload_le, guint8 msg_type _U_,
- guint8 msg_type_info_comb, guint32 message_id) {
+dissect_dlt_non_verbose_payload_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, uint32_t offset, bool payload_le, uint8_t msg_type _U_,
+ uint8_t msg_type_info_comb, uint32_t message_id) {
proto_item *ti = NULL;
proto_tree *subtree;
proto_tree *subtree2;
proto_tree *subtree3;
int ret = 0;
- gint len;
- guint32 offset_orig;
- guint tmp_length = 0;
- guint encoding = ENC_BIG_ENDIAN;
- guint status;
- guint appid_count;
- guint ctxid_count;
- guint i;
- guint j;
+ int len;
+ uint32_t offset_orig;
+ unsigned tmp_length = 0;
+ unsigned encoding = ENC_BIG_ENDIAN;
+ unsigned status;
+ unsigned appid_count;
+ unsigned ctxid_count;
+ unsigned i;
+ unsigned j;
offset_orig = offset;
@@ -975,7 +975,7 @@ dissect_dlt_non_verbose_payload_message(tvbuff_t *tvb, packet_info *pinfo _U_, p
case DLT_SERVICE_ID_GET_SOFTWARE_VERSION:
proto_tree_add_item(tree, hf_dlt_service_status, tvb, offset, 1, ENC_NA);
proto_tree_add_item_ret_uint(tree, hf_dlt_service_length, tvb, offset + 1, 4, encoding, &tmp_length);
- if ((guint)len >= 5 + tmp_length) {
+ if ((unsigned)len >= 5 + tmp_length) {
proto_tree_add_item(tree, hf_dlt_service_swVersion, tvb, offset + 5, tmp_length, ENC_ASCII | ENC_NA);
} else {
expert_dlt_buffer_too_short(tree, pinfo, tvb, offset, len);
@@ -991,9 +991,9 @@ dissect_dlt_non_verbose_payload_message(tvbuff_t *tvb, packet_info *pinfo _U_, p
return ret;
}
-static int
-dissect_dlt_non_verbose_payload_message_handoff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean payload_le,
- guint8 msg_type, guint8 msg_type_info_comb, guint32 message_id, const guint8 *ecu_id) {
+static bool
+dissect_dlt_non_verbose_payload_message_handoff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool payload_le,
+ uint8_t msg_type, uint8_t msg_type_info_comb, uint32_t message_id, const uint8_t *ecu_id) {
dlt_info_t dlt_info;
@@ -1001,18 +1001,18 @@ dissect_dlt_non_verbose_payload_message_handoff(tvbuff_t *tvb, packet_info *pinf
dlt_info.little_endian = payload_le;
dlt_info.message_type = msg_type;
dlt_info.message_type_info_comb = msg_type_info_comb;
- dlt_info.ecu_id = (const gchar *)ecu_id;
+ dlt_info.ecu_id = (const char *)ecu_id;
return dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree, &heur_dtbl_entry, &dlt_info);
}
static int
-dissect_dlt_non_verbose_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, proto_tree *tree, guint32 offset, gboolean payload_le,
- guint8 msg_type, guint8 msg_type_info_comb, const guint8 *ecu_id) {
- guint32 message_id = 0;
+dissect_dlt_non_verbose_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, proto_tree *tree, uint32_t offset, bool payload_le,
+ uint8_t msg_type, uint8_t msg_type_info_comb, const uint8_t *ecu_id) {
+ uint32_t message_id = 0;
tvbuff_t *subtvb = NULL;
- guint32 offset_orig = offset;
- const gchar *message_id_name = NULL;
+ uint32_t offset_orig = offset;
+ const char *message_id_name = NULL;
proto_item *ti;
if (payload_le) {
@@ -1042,7 +1042,7 @@ dissect_dlt_non_verbose_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *r
dissect_dlt_non_verbose_payload_message(subtvb, pinfo, tree, 0, payload_le, msg_type, msg_type_info_comb, message_id);
} else if(msg_type == DLT_MSG_TYPE_LOG_MSG) {
subtvb = tvb_new_subset_remaining(tvb, offset);
- if (dissect_dlt_non_verbose_payload_message_handoff(subtvb, pinfo, root_tree, payload_le, msg_type, msg_type_info_comb, message_id, ecu_id) <= 0) {
+ if (!dissect_dlt_non_verbose_payload_message_handoff(subtvb, pinfo, root_tree, payload_le, msg_type, msg_type_info_comb, message_id, ecu_id)) {
proto_tree_add_item(tree, hf_dlt_payload_data, tvb, offset, tvb_captured_length_remaining(tvb, offset), payload_le);
}
} else {
@@ -1053,30 +1053,30 @@ dissect_dlt_non_verbose_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *r
}
static int
-dissect_dlt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_, guint32 offset_orig) {
+dissect_dlt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_, uint32_t offset_orig) {
proto_item *ti;
proto_tree *dlt_tree = NULL;
proto_tree *ext_hdr_tree = NULL;
proto_tree *subtree = NULL;
- guint32 offset = offset_orig;
+ uint32_t offset = offset_orig;
- guint8 header_type = 0;
- gboolean ext_header = FALSE;
- gboolean payload_le = FALSE;
- guint16 length = 0;
+ uint8_t header_type = 0;
+ bool ext_header = false;
+ bool payload_le = false;
+ uint16_t length = 0;
- guint8 msg_info = 0;
- gboolean verbose = FALSE;
- guint8 msg_type = 0;
- guint8 msg_type_info = 0;
- guint8 msg_type_info_comb = 0;
+ uint8_t msg_info = 0;
+ bool verbose = false;
+ uint8_t msg_type = 0;
+ uint8_t msg_type_info = 0;
+ uint8_t msg_type_info_comb = 0;
- guint8 num_of_args = 0;
- gdouble timestamp = 0.0;
+ uint8_t num_of_args = 0;
+ double timestamp = 0.0;
- gint captured_length = tvb_captured_length_remaining(tvb, offset);
+ int captured_length = tvb_captured_length_remaining(tvb, offset);
- const guint8 *ecu_id = NULL;
+ const uint8_t *ecu_id = NULL;
col_set_str(pinfo->cinfo, COL_PROTOCOL, PNAME);
col_clear(pinfo->cinfo, COL_INFO);
@@ -1087,7 +1087,7 @@ dissect_dlt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_,
return captured_length;
}
- header_type = tvb_get_guint8(tvb, offset);
+ header_type = tvb_get_uint8(tvb, offset);
ext_header = ((header_type & DLT_HDR_TYPE_EXT_HEADER) == DLT_HDR_TYPE_EXT_HEADER);
payload_le = ((header_type & DLT_HDR_TYPE_MSB_FIRST) != DLT_HDR_TYPE_MSB_FIRST);
@@ -1137,7 +1137,7 @@ dissect_dlt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_,
proto_tree_add_item(subtree, hf_dlt_mi_verbose, tvb, offset, 1, ENC_NA);
- msg_info = tvb_get_guint8(tvb, offset);
+ msg_info = tvb_get_uint8(tvb, offset);
verbose = (msg_info & DLT_MSG_INFO_VERBOSE) == DLT_MSG_INFO_VERBOSE;
msg_type_info_comb = msg_info & DLT_MSG_INFO_MSG_TYPE_INFO_COMB;
msg_type = (msg_type_info_comb & DLT_MSG_INFO_MSG_TYPE) >> 1;
@@ -1148,7 +1148,7 @@ dissect_dlt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_,
val_to_str_const(msg_type_info_comb, dlt_msg_type_info, "Unknown Message Type Info"), msg_type_info);
offset += 1;
- num_of_args = tvb_get_guint8(tvb, offset);
+ num_of_args = tvb_get_uint8(tvb, offset);
proto_tree_add_item(ext_hdr_tree, hf_dlt_num_of_args, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -1162,7 +1162,7 @@ dissect_dlt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_,
ti = proto_tree_add_item(dlt_tree, hf_dlt_payload, tvb, offset, length - offset, ENC_NA);
subtree = proto_item_add_subtree(ti, ett_dlt_payload);
- col_append_fstr(pinfo->cinfo, COL_INFO, ":");
+ col_append_str(pinfo->cinfo, COL_INFO, ":");
if (!ext_header || !verbose) {
offset += dissect_dlt_non_verbose_payload(tvb, pinfo, tree, subtree, offset, payload_le, msg_type, msg_type_info_comb, ecu_id);
@@ -1179,14 +1179,14 @@ dissect_dlt_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
return dissect_dlt(tvb, pinfo, tree, data, 0);
}
-static guint
+static unsigned
get_dlt_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void* data _U_) {
return tvb_get_ntohs(tvb, offset + 2);
}
static int
dissect_dlt_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, DLT_MIN_SIZE_FOR_PARSING, get_dlt_message_len, dissect_dlt_msg, data);
+ tcp_dissect_pdus(tvb, pinfo, tree, true, DLT_MIN_SIZE_FOR_PARSING, get_dlt_message_len, dissect_dlt_msg, data);
return tvb_reported_length(tvb);
}
@@ -1200,7 +1200,7 @@ dissect_dlt_storage_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree *dlt_storage_tree;
proto_item *ti;
- guint32 offset = 0;
+ uint32_t offset = 0;
ti = proto_tree_add_item(tree, proto_dlt_storage_header, tvb, offset, 16, ENC_NA);
dlt_storage_tree = proto_item_add_subtree(ti, ett_dlt_storage);
@@ -1300,7 +1300,7 @@ void proto_register_dlt(void) {
{ &hf_dlt_data_bool, {
"(bool)", "dlt.data.bool",
- FT_BOOLEAN, 1, NULL, 0x0, NULL, HFILL } },
+ FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_dlt_uint8, {
"(uint8)", "dlt.data.uint8",
FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
@@ -1391,7 +1391,7 @@ void proto_register_dlt(void) {
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
};
- static gint *ett[] = {
+ static int *ett[] = {
&ett_dlt,
&ett_dlt_hdr_type,
&ett_dlt_ext_hdr,
@@ -1403,22 +1403,22 @@ void proto_register_dlt(void) {
};
static ei_register_info ei[] = {
- { &ef_dlt_unsupported_datatype, {
+ { &ei_dlt_unsupported_datatype, {
"dlt.unsupported_datatype", PI_MALFORMED, PI_ERROR,
"DLT: Unsupported Data Type!", EXPFILL } },
- { &ef_dlt_unsupported_length_datatype, {
+ { &ei_dlt_unsupported_length_datatype, {
"dlt.unsupported_length_datatype", PI_MALFORMED, PI_ERROR,
"DLT: Unsupported Length of Datatype!", EXPFILL } },
- { &ef_dlt_unsupported_string_coding, {
+ { &ei_dlt_unsupported_string_coding, {
"dlt.unsupported_string_coding", PI_MALFORMED, PI_ERROR,
"DLT: Unsupported String Coding!", EXPFILL } },
- { &ef_dlt_unsupported_non_verbose_msg_type, {
+ { &ei_dlt_unsupported_non_verbose_msg_type, {
"dlt.unsupported_non_verbose_message_type", PI_MALFORMED, PI_ERROR,
"DLT: Unsupported Non-Verbose Message Type!", EXPFILL } },
- { &ef_dlt_buffer_too_short, {
+ { &ei_dlt_buffer_too_short, {
"dlt.buffer_too_short", PI_MALFORMED, PI_ERROR,
"DLT: Buffer too short!", EXPFILL } },
- { &ef_dlt_parsing_error, {
+ { &ei_dlt_parsing_error, {
"dlt.parsing_error", PI_MALFORMED, PI_ERROR,
"DLT: Parsing Error!", EXPFILL } },
};
@@ -1435,7 +1435,7 @@ void proto_register_dlt(void) {
expert_module_DLT = expert_register_protocol(proto_dlt);
expert_register_field_array(expert_module_DLT, ei, array_length(ei));
- heur_subdissector_list = register_heur_dissector_list("dlt", proto_dlt);
+ heur_subdissector_list = register_heur_dissector_list_with_description("dlt", "DLT Log Message payload", proto_dlt);
}
void proto_reg_handoff_dlt(void) {
@@ -1460,7 +1460,7 @@ void proto_register_dlt_storage_header(void) {
};
- static gint *ett[] = {
+ static int *ett[] = {
&ett_dlt_storage,
};