aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/its
diff options
context:
space:
mode:
authorTomas Kukosa <kukosa@herman.cz>2021-05-07 12:53:13 +0200
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-05-08 06:57:44 +0000
commitf04c6d3b185d9ec3967bb7fee8aa6eb8102f6279 (patch)
tree40bc7d69b7ee31038f41f7751fa6f4f971893026 /epan/dissectors/asn1/its
parent9c6aef746abd1ea836c21e01d37838133bff4c88 (diff)
ITS: use custom formatters for better readability
Diffstat (limited to 'epan/dissectors/asn1/its')
-rw-r--r--epan/dissectors/asn1/its/its.cnf46
-rw-r--r--epan/dissectors/asn1/its/packet-its-template.c224
2 files changed, 261 insertions, 9 deletions
diff --git a/epan/dissectors/asn1/its/its.cnf b/epan/dissectors/asn1/its/its.cnf
index 1809bb9190..dc4c7b4392 100644
--- a/epan/dissectors/asn1/its/its.cnf
+++ b/epan/dissectors/asn1/its/its.cnf
@@ -287,11 +287,33 @@ Node-XY-28b/y n28bY
Node-XY-32b/y n32bY
#.TYPE_ATTR
-Longitude DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_longitude_fmt)
-Latitude DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_latitude_fmt)
-AltitudeValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_altitude_fmt)
-SemiAxisLength DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_sax_length_fmt)
-HeadingValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_heading_fmt)
+Longitude DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_longitude_fmt)
+Latitude DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_latitude_fmt)
+AltitudeValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_altitude_fmt)
+SemiAxisLength DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_sax_length_fmt)
+HeadingValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_heading_value_fmt)
+HeadingConfidence DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_heading_confidence_fmt)
+SpeedValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_speed_value_fmt)
+SpeedConfidence DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_speed_confidence_fmt)
+VehicleLengthValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_vehicle_length_value_fmt)
+VehicleWidth DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_vehicle_width_fmt)
+LongitudinalAccelerationValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_acceleration_value_fmt)
+LateralAccelerationValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_acceleration_value_fmt)
+VerticalAccelerationValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_acceleration_value_fmt)
+AccelerationConfidence DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_acceleration_confidence_fmt)
+CurvatureValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_curvature_value_fmt)
+YawRateValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_yaw_rate_value_fmt)
+SteeringWheelAngleValue DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_swa_value_fmt)
+SteeringWheelAngleConfidence DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(its_swa_confidence_fmt)
+
+GenerationDeltaTime STRINGS=NULL
+
+MinuteOfTheYear DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(dsrc_moi_fmt)
+DSecond DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(dsrc_dsecond_fmt)
+TimeMark DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(dsrc_time_mark_fmt)
+TimeIntervalConfidence STRINGS=VALS(dsrc_TimeIntervalConfidence_vals)
+Velocity DISPLAY=BASE_CUSTOM STRINGS=CF_FUNC(dsrc_velocity_fmt)
+#.END
#.FIELD_ATTR
IntersectionState/status ABBREV=intersectionState.status
@@ -743,6 +765,20 @@ Longitude
AltitudeValue
SemiAxisLength
$ITS-ContainerV1$HeadingValue
+HeadingConfidence
+SpeedValue
+SpeedConfidence
+VehicleLengthValue
+VehicleWidth
+LongitudinalAcceleration
+LateralAccelerationValue
+VerticalAccelerationValue
+AccelerationConfidence
+CurvatureValue
+YawRateValue
+SteeringWheelAngleValue
+SteeringWheelAngleConfidence
+GenerationDeltaTime
#.END
#.NO_EMIT WITHOUT_VALS
diff --git a/epan/dissectors/asn1/its/packet-its-template.c b/epan/dissectors/asn1/its/packet-its-template.c
index fe9fdf2144..ee5f5a56a4 100644
--- a/epan/dissectors/asn1/its/packet-its-template.c
+++ b/epan/dissectors/asn1/its/packet-its-template.c
@@ -33,6 +33,7 @@
*/
#include "config.h"
+#include <math.h>
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/decode_as.h>
@@ -396,7 +397,7 @@ its_altitude_fmt(gchar *s, guint32 v)
if (alt == 800001) {
g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", alt);
} else {
- g_snprintf(s, ITEM_LABEL_LENGTH, "%.2fm (%d)", alt / 100.0, alt);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2fm (%d)", alt * 0.01, alt);
}
}
@@ -408,21 +409,236 @@ its_sax_length_fmt(gchar *s, guint32 v)
} else if (v == 4094) {
g_snprintf(s, ITEM_LABEL_LENGTH, "outOfRange(%d)", v);
} else {
- g_snprintf(s, ITEM_LABEL_LENGTH, "%.2fm (%d)", v / 100.0, v);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2fm (%d)", v * 0.01, v);
}
}
static void
-its_heading_fmt(gchar *s, guint32 v)
+its_heading_value_fmt(gchar *s, guint32 v)
{
const gchar *p = try_val_to_str(v, VALS(its_HeadingValue_vals));
if (p) {
g_snprintf(s, ITEM_LABEL_LENGTH, "%s(%d)", p, v);
} else {
- g_snprintf(s, ITEM_LABEL_LENGTH, "%.1f° (%d)", v / 10.0, v);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.1f° (%d)", v * 0.1, v);
}
}
+static void
+its_heading_confidence_fmt(gchar *s, guint32 v)
+{
+ if (v == 127) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else if (v == 126) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "outOfRange(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.1f° (%d)", v * 0.1, v);
+ }
+}
+
+static void
+its_speed_value_fmt(gchar *s, guint32 v)
+{
+ if (v == 0) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "standstill(%d)", v);
+ } else if (v == 16383) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else {
+ double vms = v * 0.01;
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2fm/s = %.1fkm/h (%d)",
+ vms, vms * 3.6, v);
+ }
+}
+
+static void
+its_speed_confidence_fmt(gchar *s, guint32 v)
+{
+ if (v == 127) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else if (v == 126) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "outOfRange(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2fm/s (%d)", v * 0.01, v);
+ }
+}
+
+static void
+its_vehicle_length_value_fmt(gchar *s, guint32 v)
+{
+ if (v == 1023) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else if (v == 1022) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "outOfRange(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.1fm (%d)", v * 0.1, v);
+ }
+}
+
+static void
+its_vehicle_width_fmt(gchar *s, guint32 v)
+{
+ if (v == 62) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else if (v == 61) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "outOfRange(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.1fm (%d)", v * 0.1, v);
+ }
+}
+
+static void
+its_acceleration_value_fmt(gchar *s, guint32 v)
+{
+ gint32 acc = (gint32)v;
+ if (acc == 161) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.1fm/s² (%d)", acc * 0.1, acc);
+ }
+}
+
+static void
+its_acceleration_confidence_fmt(gchar *s, guint32 v)
+{
+ if (v == 102) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else if (v == 101) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "outOfRange(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.1fm/s² (%d)", v * 0.1, v);
+ }
+}
+
+static void
+its_curvature_value_fmt(gchar *s, guint32 v)
+{
+ gint32 curv = (gint32)v;
+ if (curv == 0) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "straight(%d)", v);
+ } else if (curv == 1023) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.3fm %s (%d)",
+ 30000.0 / curv,
+ (curv > 0) ? "left" : "right",
+ curv);
+ }
+}
+
+static void
+its_yaw_rate_value_fmt(gchar *s, guint32 v)
+{
+ gint32 yaw = (gint32)v;
+ if (yaw == 0) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "straight(%d)", v);
+ } else if (yaw == 32767) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f°/s %s (%d)",
+ yaw * 0.01,
+ (yaw > 0) ? "left" : "right",
+ yaw);
+ }
+}
+
+static void
+its_swa_value_fmt(gchar *s, guint32 v)
+{
+ gint32 swa = (gint32)v;
+ if (swa == 0) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "straight(%d)", v);
+ } else if (swa == 512) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.1f° %s (%d)",
+ swa * 1.5,
+ (swa > 0) ? "left" : "right",
+ swa);
+ }
+}
+
+static void
+its_swa_confidence_fmt(gchar *s, guint32 v)
+{
+ if (v == 127) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else if (v == 126) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "outOfRange(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.1f° (%d)", v * 1.5, v);
+ }
+}
+
+static void
+dsrc_moi_fmt(gchar *s, guint32 v)
+{
+ if (v == 527040) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "invalid(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%ud %02u:%02u (%d)",
+ v / 1440, v % 1440 / 60, v % 60, v);
+ }
+}
+
+static void
+dsrc_dsecond_fmt(gchar *s, guint32 v)
+{
+ if (v == 65535) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else if ((61000 <= v) && (v <= 65534)) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "reserved(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%02u.%03u (%d)",
+ v / 1000, v % 1000, v);
+ }
+}
+
+static void
+dsrc_time_mark_fmt(gchar *s, guint32 v)
+{
+ if (v == 36001) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unknown(%d)", v);
+ } else if (v == 36000) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "moreThanHour(%d)", v);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%02u:%02u.%u (%d)",
+ v / 600, v % 600 / 10, v % 10, v);
+ }
+}
+
+static const value_string dsrc_TimeIntervalConfidence_vals[] = {
+ { 0, "21% probability" },
+ { 1, "36% probability" },
+ { 2, "47% probability" },
+ { 3, "56% probability" },
+ { 4, "62% probability" },
+ { 5, "68% probability" },
+ { 6, "73% probability" },
+ { 7, "77% probability" },
+ { 8, "81% probability" },
+ { 9, "85% probability" },
+ { 10, "88% probability" },
+ { 11, "91% probability" },
+ { 12, "94% probability" },
+ { 13, "96% probability" },
+ { 14, "98% probability" },
+ { 15, "10% probability" },
+ { 0, NULL }
+};
+
+static void
+dsrc_velocity_fmt(gchar *s, guint32 v)
+{
+ if (v == 8191) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "unavailable(%d)", v);
+ } else {
+ double vms = v * 0.02;
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2fm/s = %ukm/h (%d)",
+ vms, (int)lround(vms * 3.6), v);
+ }
+}
+
+
static int
dissect_its_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{