Coverage Report

Created: 2026-09-28 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-c2p.c
Line
Count
Source
1
/* packet-c2p.c
2
 * Commsignia Capture Protocol dissector
3
 * Copyright 2025, (C) Commsignia Ltd.
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include "config.h"
13
14
#include <epan/packet.h>
15
#include <epan/unit_strings.h>
16
#include <inttypes.h>
17
18
19
/**
20
Possible values for Transmission State StationInfo parameter
21
@note Data element is used to provide the current state of the vehicle transmission
22
*/
23
typedef enum sti_transmission_state_t {
24
    STI_TRANSMISSION_STATE_NEUTRAL = 0,                     /**< Neutral state */
25
    STI_TRANSMISSION_PARK,                                  /**< Parking state */
26
    STI_TRANSMISSION_FWD_GEARS,                             /**< Forward gears */
27
    STI_TRANSMISSION_REVERSE_GEARS                          /**< Reverse gears */
28
} sti_transmission_state_t;
29
30
/**
31
Possible values for Auxiliary Brake StationInfo parameter
32
@note The status of the auxiliary brakes (sometimes referred to as the
33
      parking brake) of the vehicle. The auxiliary brakes are in a fully
34
      released (Off) state or in an engaged or in the process of
35
      being engaged (On) state
36
37
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
38
     SAE J2735_201603 Chapter 7.14 DE_AuxiliaryBrakeStatus
39
*/
40
typedef enum sti_aux_brakes_t {
41
    STI_AUX_BRAKES_OFF = 0,                                 /**< Vehicle's Aux Brakes are off */
42
    STI_AUX_BRAKES_ON                                       /**< Vehicle's Aux Brakes are on (engaged) */
43
} sti_aux_brakes_t;
44
45
/**
46
Possible values for Vehicle Length Confidence StationInfo parameter
47
@note To indicate whether the presence of a trailer is detectable or
48
      whether its length is included in a reported vehicle length value.
49
50
@see Intelligent Transport Systemst (ITS); User and application requirements
51
     ETSI TS 102 894-2 V1.3.1; Part2; Annex 91 - DE_VehicleLengthConfidenceIndication
52
*/
53
typedef enum sti_vehicle_length_conf_t {
54
    STI_VEHICLE_LENGTH_CONF_NO_TRAILER = 0,                 /**< No trailer is present */
55
    STI_VEHICLE_LENGTH_CONF_TRAILER_WITH_LENGTH,            /**< Trailer present with known length */
56
    STI_VEHICLE_LENGTH_CONF_TRAILER_WITH_NA_LENGTH,         /**< Trailer present with unknown length */
57
    STI_VEHICLE_LENGTH_CONF_TRAILER_PRESENCE_IS_UNK         /**< Trailer presence is unknown */
58
} sti_vehicle_length_conf_t;
59
60
/**
61
Possible values for Dangerous Goods StationInfo parameter
62
@note Indicates the type of the dangerous goods being carried by a heavy vehicle.
63
64
@see European Agreement (Applicable as from 1 January 2011): "Concerning the International Carriage
65
     of Dangerous Goods by Road" part II, chapter 2.1.1.1
66
@see Available at http://www.unece.org/trans/danger/publi/adr/adr2011/11ContentsE.html
67
*/
68
typedef enum sti_dangerous_good_t {
69
    STI_DANGEROUS_GOODS_EXPLOSIVES1 = 0,                    /**< Explosive substance type 1 */
70
    STI_DANGEROUS_GOODS_EXPLOSIVES2,                        /**< Explosive substance type 2 */
71
    STI_DANGEROUS_GOODS_EXPLOSIVES3,                        /**< Explosive substance type 3 */
72
    STI_DANGEROUS_GOODS_EXPLOSIVES4,                        /**< Explosive substance type 4 */
73
    STI_DANGEROUS_GOODS_EXPLOSIVES5,                        /**< Explosive substance type 5 */
74
    STI_DANGEROUS_GOODS_EXPLOSIVES6,                        /**< Explosive substance type 6 */
75
    STI_DANGEROUS_GOODS_FLAMMABLE_GASES,                    /**< Flammable gases */
76
    STI_DANGEROUS_GOODS_NON_FLAMMABLE_GASES,                /**< Non flammable gases */
77
    STI_DANGEROUS_GOODS_TOXIC_GASES,                        /**< Toxic gases */
78
    STI_DANGEROUS_GOODS_FLAMMABLE_LIQUIDS,                  /**< Flammable liquids */
79
    STI_DANGEROUS_GOODS_FLAMMABLE_SOLIDS,                   /**< Flammable solids */
80
    STI_DANGEROUS_GOODS_SUBSTANCES_SPONTAIN_COMBUSTION,     /**< Substances liable to spontaneous combustion */
81
    STI_DANGEROUS_GOODS_SUBSTANCES_FLAMBLE_CONTACT_WATER,   /**< Substances emitting flammable gases upon contact with water */
82
    STI_DANGEROUS_GOODS_OXIDIZING_SUBSTANCES,               /**< Oxidizing substances */
83
    STI_DANGEROUS_GOODS_ORGANIC_PEROXIDES,                  /**< Organic peroxides */
84
    STI_DANGEROUS_GOODS_TOXIC_SUBSTANCES,                   /**< Toxic substances */
85
    STI_DANGEROUS_GOODS_INFECTIOUS_SUBSTANCES,              /**< Infectious substances */
86
    STI_DANGEROUS_GOODS_RADIOACTIVE_MATERIAL,               /**< Radioactive material */
87
    STI_DANGEROUS_GOODS_CORROSIVE_SUBSTANCES,               /**< Corrosive substances */
88
    STI_DANGEROUS_GOODS_MISC_DANGEROUS_SUBSTANCES           /**< Miscellaneous dangerous substances */
89
} sti_dangerous_good_t;
90
91
/**
92
Possible values for Station type parameter
93
@note Not to be confused with vehicle role. It may seem redundant,
94
      but while class doesn't change for the lifetime of the vehicle,
95
      role may change based on what it's doing currently.
96
@note It is used to provide a common classification system to categorize DSRC
97
      equipped devices for various cross-cutting uses. Several other
98
      classification systems in this data dictionary can be used to provide
99
      more domain specific detail when required.
100
101
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
102
     SAE J2735_201603 Chapter 7.15 DE_BasicVehicleClass
103
*/
104
typedef enum sti_station_type_t {
105
    STI_STATION_TYPE_UNK = 0,                              /**< Not equipped, not known or unavailable */
106
    STI_STATION_TYPE_SPECIAL,                              /**< Special use */
107
    STI_STATION_TYPE_PASSENGER_UNK,                        /**< Unknown type passenger vehicle */
108
    STI_STATION_TYPE_PASSENGER_OTHER,                      /**< Other type passenger vehicle */
109
    STI_STATION_TYPE_LIGHT_TRUCK_UNK,                      /**< Unknown type light truck */
110
    STI_STATION_TYPE_LIGHT_TRUCK_OTHER,                    /**< Other type light truck */
111
    STI_STATION_TYPE_TRUCK_UNK,                            /**< Unknown type truck */
112
    STI_STATION_TYPE_TRUCK_OTHER,                          /**< Other type truck */
113
    STI_STATION_TYPE_TRUCK_AXLE_CNT_2,                     /**< Two axle, six tire single units */
114
    STI_STATION_TYPE_TRUCK_AXLE_CNT_3,                     /**< Three axle single units */
115
    STI_STATION_TYPE_TRUCK_AXLE_CNT_4,                     /**< Four or more axle single unit */
116
    STI_STATION_TYPE_TRUCK_AXLE_CNT_4_TRAILER,             /**< Four or less axle single trailer */
117
    STI_STATION_TYPE_TRUCK_AXLE_CNT_5_TRAILER,             /**< Five or less axle single trailer */
118
    STI_STATION_TYPE_TRUCK_AXLE_CNT_6_TRAILER,             /**< Six or more axle single trailer */
119
    STI_STATION_TYPE_TRUCK_AXLE_CNT_5_MULTI_TRAILER,       /**< Five or less axle multi-trailer */
120
    STI_STATION_TYPE_TRUCK_AXLE_CNT_6_MULTI_TRAILER,       /**< Six axle multi-trailer */
121
    STI_STATION_TYPE_TRUCK_AXLE_CNT_7_MULTI_TRAILER,       /**< Seven or more axle multi-trailer */
122
    STI_STATION_TYPE_MOTORCYCLE_UNK,                       /**< Unknown type motorcycle */
123
    STI_STATION_TYPE_MOTORCYCLE_OTHER,                     /**< Other type motorcycle */
124
    STI_STATION_TYPE_MOTORCYCLE_CRUISER_STANDARD,          /**< Cruiser standard motorcycle */
125
    STI_STATION_TYPE_MOTORCYCLE_SPORT_UNCLAD,              /**< Unclad sport motorcycle */
126
    STI_STATION_TYPE_MOTORCYCLE_SPORT_TOURING,             /**< Sport touring motorcycle */
127
    STI_STATION_TYPE_MOTORCYCLE_SUPER_SPORT,               /**< Super sport motorcycle */
128
    STI_STATION_TYPE_MOTORCYCLE_TOURING,                   /**< Touring motorcycle */
129
    STI_STATION_TYPE_MOTORCYCLE_TRIKE,                     /**< Trike motorcycle */
130
    STI_STATION_TYPE_MOTORCYCLE_WITH_PASSENGERS,           /**< Motorcycle with passengers */
131
    STI_STATION_TYPE_TRANSIT_UNK,                          /**< Unknown type transit */
132
    STI_STATION_TYPE_TRANSIT_OTHER,                        /**< Other type transit */
133
    STI_STATION_TYPE_TRANSIT_BRT,                          /**< Bus rapid transit */
134
    STI_STATION_TYPE_TRANSIT_EXPRESS_BUS,                  /**< Express bus */
135
    STI_STATION_TYPE_TRANSIT_LOCAL_BUS,                    /**< Local bus */
136
    STI_STATION_TYPE_TRANSIT_SCHOOL_BUS,                   /**< School bus */
137
    STI_STATION_TYPE_TRANSIT_FIXED_GUIDE_WAY,              /**< Fixed guideway transit, like tram */
138
    STI_STATION_TYPE_TRANSIT_PARATRANSIT,                  /**< Paratransit */
139
    STI_STATION_TYPE_TRANSIT_PARATRANSIT_AMBULANCE,        /**< Paratransit ambulance */
140
    STI_STATION_TYPE_EMERGENCY_UNK,                        /**< Unknown type emergency vehicle */
141
    STI_STATION_TYPE_EMERGENCY_OTHER,                      /**< Other type emergency vehicle */
142
    STI_STATION_TYPE_EMERGENCY_FIRE_LIGHT,                 /**< Light fire emergency vehicle */
143
    STI_STATION_TYPE_EMERGENCY_FIRE_HEAVY,                 /**< Heavy fire emergency vehicle */
144
    STI_STATION_TYPE_EMERGENCY_FIRE_PARAMEDIC,             /**< Fire paramedic emergency vehicle */
145
    STI_STATION_TYPE_EMERGENCY_FIRE_AMBULANCE,             /**< Fire ambulance emergency vehicle */
146
    STI_STATION_TYPE_EMERGENCY_POLICE_LIGHT,               /**< Light police emergency vehicle */
147
    STI_STATION_TYPE_EMERGENCY_POLICE_HEAVY,               /**< Heavy police emergency vehicle */
148
    STI_STATION_TYPE_EMERGENCY_OTHER_RESPONDER,            /**< Other type responder emergency vehicle */
149
    STI_STATION_TYPE_EMERGENCY_OTHER_AMBULANCE,            /**< Other type ambulance emergency vehicle */
150
    STI_STATION_TYPE_OTHER_UNK,                            /**< DSRC equipped unknown type other traveler */
151
    STI_STATION_TYPE_OTHER_OTHER,                          /**< DSRC equipped other type other traveler */
152
    STI_STATION_TYPE_OTHER_PEDESTRIAN,                     /**< DSRC equipped other type pedestrian */
153
    STI_STATION_TYPE_OTHER_VISUALLY_DISABLED,              /**< DSRC equipped visually disabled other traveler */
154
    STI_STATION_TYPE_OTHER_PHYSICALLY_DISABLED,            /**< DSRC equipped physically disabled other traveler */
155
    STI_STATION_TYPE_OTHER_BICYCLE,                        /**< DSRC equipped bicycle */
156
    STI_STATION_TYPE_OTHER_VULNERABLE_ROADWORKER,          /**< DSRC equipped vulnerable road worker */
157
    STI_STATION_TYPE_INFRASTRUCTURE_UNK,                   /**< DSRC equipped unknown type device */
158
    STI_STATION_TYPE_INFRASTRUCTURE_FIXED,                 /**< DSRC equipped fixed device, typically Road Side Units (RSU) */
159
    STI_STATION_TYPE_INFRASTRUCTURE_MOVABLE,               /**< DSRC equipped movable device */
160
    STI_STATION_TYPE_EQUIPPED_CARGO_TRAILER,               /**< DSRC equipped cargo trailer */
161
    STI_STATION_TYPE_LIGHT_VRU_VEHICLE,                    /**< Micrmomobility users (EU CDD release 2) */
162
    STI_STATION_TYPE_ANIMAL                                /**< DSRC equipped animals (EU CDD release 2) */
163
} sti_station_type_t;
164
165
/**
166
Possible values for Basic Vehicle Role StationInfo parameter
167
@note Not to be confused with vehicle class. It may seem redundant,
168
      but while class doesn't change for the lifetime of the vehicle,
169
      role may change based on what it's doing currently,
170
      e.g. simple passenger vehicle can be a safety car while it's in service,
171
      but a basic vehicle when it's not.
172
173
@see Intelligent Transport Systemst (ITS); User and application requirements
174
     ETSI TS 102 894-2 V1.3.1; Part2; Annex 94 - DE_VehicleRole
175
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
176
     SAE J2735_201603 Chapter 7.16 DE_BasicVehicleRole
177
*/
178
typedef enum sti_vehicle_role_t {
179
    STI_VEHICLE_ROLE_BASIC_VEHICLE = 0,                     /**< Default vehicle role as indicated by the vehicle type */
180
    STI_VEHICLE_ROLE_PUBLIC_TRANSPORT,                      /**< Vehicle is used to operate public transport service */
181
    STI_VEHICLE_ROLE_SPECIAL_TRANSPORT,                     /**< Vehicle is used for special transport purpose, like oversized trucks */
182
    STI_VEHICLE_ROLE_DANGEROUS_GOODS,                       /**< Vehicle is used for dangerous goods transportation */
183
    STI_VEHICLE_ROLE_ROAD_WORK,                             /**< Vehicle is used to realize roadwork or road maintenance mission */
184
    STI_VEHICLE_ROLE_RESCUE,                                /**< Vehicle is used for rescue purpose in case of an accident, like as a towing service */
185
    STI_VEHICLE_ROLE_EMERGENCY,                             /**< Vehicle is used for emergency mission, like ambulance, fire brigade */
186
    STI_VEHICLE_ROLE_SAFETY_CAR,                            /**< Vehicle is used for public safety, like patrol */
187
    STI_VEHICLE_ROLE_TRUCK,                                 /**< Heavy trucks with additional BSM rights and obligations */
188
    STI_VEHICLE_ROLE_MOTORCYCLE,                            /**< Motorcycle role */
189
    STI_VEHICLE_ROLE_ROAD_SIDE_SOURCE,                      /**< For infrastructure generated calls such as fire house, rail infrastructure, roadwork site, etc. */
190
    STI_VEHICLE_ROLE_POLICE,                                /**< Police role */
191
    STI_VEHICLE_ROLE_FIRE,                                  /**< Fire role */
192
    STI_VEHICLE_ROLE_AMBULANCE,                             /**< (does not include private para-transit etc.) */
193
    STI_VEHICLE_ROLE_DOT,                                   /**< All roadwork vehicles */
194
    STI_VEHICLE_ROLE_TRANSIT,                               /**< All transit vehicles */
195
    STI_VEHICLE_ROLE_SLOW_MOVING,                           /**< Also include oversize etc. */
196
    STI_VEHICLE_ROLE_STOP_N_GO,                             /**< To include trash trucks, school buses and others that routinely disturb the free flow of traffic */
197
    STI_VEHICLE_ROLE_CYCLIST,                               /**< Cyclist role */
198
    STI_VEHICLE_ROLE_PEDESTRIAN,                            /**< Also includes those with mobility limitations */
199
    STI_VEHICLE_ROLE_NON_MOTORIZED,                         /**< other, such as horse drawn */
200
    STI_VEHICLE_ROLE_MILITARY,                              /**< Military role */
201
    STI_VEHICLE_ROLE_AGRICULTURE,                           /**< Vehicle is used for agriculture, like farm tractor */
202
    STI_VEHICLE_ROLE_COMMERCIAL,                            /**< Vehicle is used for transportation of commercial goods */
203
    STI_VEHICLE_ROLE_ROAD_OPERATOR,                         /**< Vehicle is used in road operator missions */
204
    STI_VEHICLE_ROLE_TAXI                                   /**< Vehicle is used to provide an authorized taxi service */
205
} sti_vehicle_role_t;
206
207
/**
208
Possible values for Weather Precipitation Situation StationInfo parameter
209
@note Describes the weather situation in terms of precipitation.
210
*/
211
typedef enum sti_weather_precip_situation_t {
212
    STI_WEATHER_PRECIP_SITUATON_OTHER = 0,                  /**< Other type precipitation */
213
    STI_WEATHER_PRECIP_SITUATON_UNK,                        /**< Unknown type precipitation */
214
    STI_WEATHER_PRECIP_SITUATON_NO_PRECIP,                  /**< No precipitation */
215
    STI_WEATHER_PRECIP_SITUATON_UNK_SLIGHT,                 /**< Unknown type slight precipitation */
216
    STI_WEATHER_PRECIP_SITUATON_UNK_MODERATE,               /**< Unknown type moderate precipitation */
217
    STI_WEATHER_PRECIP_SITUATON_UNK_HEAVY,                  /**< Unknown type heavy precipitation */
218
    STI_WEATHER_PRECIP_SITUATON_SNOW_SLIGHT,                /**< Slight snow precipitation */
219
    STI_WEATHER_PRECIP_SITUATON_SNOW_MODERATE,              /**< Moderate snow precipitation */
220
    STI_WEATHER_PRECIP_SITUATON_SNOW_HEAVY,                 /**< Heavy snow precipitation */
221
    STI_WEATHER_PRECIP_SITUATON_RAIN_SLIGHT,                /**< Slight rain precipitation */
222
    STI_WEATHER_PRECIP_SITUATON_RAIN_MODERATE,              /**< Moderate rain precipitation */
223
    STI_WEATHER_PRECIP_SITUATON_RAIN_HEAVY,                 /**< Heavy rain precipitation */
224
    STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_SLIGHT,       /**< Slight frozen precipitation */
225
    STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_MODERATE,     /**< Moderate frozen precipitation */
226
    STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_HEAVY         /**< Heavy frozen precipitation */
227
} sti_weather_precip_situation_t;
228
229
/**
230
Possible values for Wiper State StationInfo parameter
231
@note It is intended to inform other users whether or not it was
232
      raining/snowing at the vehicle's location at the time it was taken.
233
      The element also includes whether the wipers were turned on manually
234
      (driver activated) or automatically (rain sensor activated) to provide
235
      additional information as to driving conditions in the area of the vehicle.
236
237
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
238
     SAE J2735_201603 Chapter 7.227 DE_WiperStatus
239
*/
240
typedef enum sti_wiper_state_t {
241
    STI_WIPER_STATE_OFF = 0,                                /**< Off state */
242
    STI_WIPER_STATE_INTERMITTENT,                           /**< Intermittent state */
243
    STI_WIPER_STATE_LOW,                                    /**< Low state */
244
    STI_WIPER_STATE_HIGH,                                   /**< High state */
245
    STI_WIPER_STATE_WASHER_IN_USE,                          /**< Washer in use */
246
    STI_WIPER_STATE_AUTO                                    /**< Auto wiper state */
247
} sti_wiper_state_t;
248
249
/**
250
Possible values for Lightbar StationInfo parameter
251
@note It is intended to inform if any sort of additional visible
252
      lighting-alerting system is currently in use by a vehicle.
253
      This includes light bars and the various symbols they can indicate
254
      as well as arrow boards, flashing lights (including back up alerts),
255
      and any other form of lighting not found on normal vehicles of this type
256
      or related to safety systems. Used to reflect any type or style of visual
257
      alerting when a vehicle is progressing and transmitting DSRC messages
258
      to other nearby vehicles about its path.
259
*/
260
typedef enum sti_lightbar_t {
261
    STI_LIGHTBAR_NOT_IN_USE = 0,                            /**< There is a lightbar, but it is currently not in use */
262
    STI_LIGHTBAR_IN_USE,                                    /**< Lightbar in use */
263
    STI_LIGHTBAR_YELLOW_CAUTION_LIGHTS,                     /**< Yellow caution lights */
264
    STI_LIGHTBAR_SCHOOL_BUS_LIGHTS,                         /**< School bus lights */
265
    STI_LIGHTBAR_ARROW_SIGNS_ACTIVE,                        /**< Arrow signs active */
266
    STI_LIGHTBAR_SLOW_MOVING_VEHICLE,                       /**< Slow moving vehicle lights */
267
    STI_LIGHTBAR_FREQ_STOPS                                 /**< Freq stops */
268
} sti_lightbar_t;
269
270
/**
271
Possible values for Siren StationInfo parameter
272
@note A data element which is set if any sort of audible alarm is being
273
      emitted from the vehicle. This includes various common sirens as well
274
      as backup beepers and other slow speed maneuvering alerts.
275
276
@see Dedicated Short Range Communications (DSRC) Message Set Dictionary
277
     SAE J2735_201603 Chapter 7.174 DE_SirenInUse
278
*/
279
typedef enum sti_siren_t {
280
    STI_SIREN_NOT_IN_USE = 0,                               /**< Siren not in use */
281
    STI_SIREN_IN_USE                                        /**< Siren in use */
282
} sti_siren_t;
283
284
/**
285
Possible values for Lane Position StationInfo parameter
286
@note Data frame is used to provide information regarding
287
      what lane a subject vehicle (or other object) is in.
288
      ETSI TS 102 894-2 V1.3.1 supports only 13 lanes.
289
*/
290
typedef enum sti_lane_pos_t {
291
    STI_LANE_POSITION_INNER_HARD_SHOULDER = 0,              /**< Inner hard shoulder position */
292
    STI_LANE_POSITION_INNERMOST_DRIVING_LANE,               /**< Innermost driving lane */
293
    STI_LANE_POSITION_SECOND_LANE_FROM_INSIDE,              /**< Second lane from inside */
294
    STI_LANE_POSITION_THIRD_LANE_FROM_INSIDE,               /**< Third lane from inside */
295
    STI_LANE_POSITION_FOURTH_LANE_FROM_INSIDE,              /**< Fourth lane from inside */
296
    STI_LANE_POSITION_FIFTH_LANE_FROM_INSIDE,               /**< Fifth lane from inside */
297
    STI_LANE_POSITION_SIXTH_LANE_FROM_INSIDE,               /**< Sixth lane from inside */
298
    STI_LANE_POSITION_SEVENTH_LANE_FROM_INSIDE,             /**< Seventh lane from inside */
299
    STI_LANE_POSITION_EIGHTH_LANE_FROM_INSIDE,              /**< Eighth lane from inside */
300
    STI_LANE_POSITION_NINTH_LANE_FROM_INSIDE,               /**< Ninth lane from inside */
301
    STI_LANE_POSITION_TENTH_LANE_FROM_INSIDE,               /**< Tenth lane from inside */
302
    STI_LANE_POSITION_ELEVENTH_LANE_FROM_INSIDE,            /**< Eleventh lane from inside */
303
    STI_LANE_POSITION_TWELFTH_LANE_FROM_INSIDE,             /**< Twelfth lane from inside */
304
    STI_LANE_POSITION_THIRTEENTH_LANE_FROM_INSIDE,          /**< Thirteenth lane from inside */
305
    STI_LANE_POSITION_FOURTEENTH_LANE_FROM_INSIDE,          /**< Fourteenth lane from inside */
306
    STI_LANE_POSITION_FIFTEENTH_LANE_FROM_INSIDE,           /**< Fifteenth lane from inside */
307
    STI_LANE_POSITION_SIXTEENTH_LANE_FROM_INSIDE,           /**< Sixteenth lane from inside */
308
    STI_LANE_POSITION_SEVENTEENTH_LANE_FROM_INSIDE,         /**< Seventeenth lane from inside */
309
    STI_LANE_POSITION_EIGHTEENTH_LANE_FROM_INSIDE,          /**< Eighteenth lane from inside */
310
    STI_LANE_POSITION_NINETEENTH_LANE_FROM_INSIDE,          /**< Nineteenth lane from inside */
311
    STI_LANE_POSITION_TWENTIETH_LANE_FROM_INSIDE,           /**< Twentieth lane from inside */
312
    STI_LANE_POSITION_TWENTY_FIRST_LANE_FROM_INSIDE,        /**< Twenty-first lane from inside */
313
    STI_LANE_POSITION_TWENTY_SECOND_LANE_FROM_INSIDE,       /**< Twenty-second lane from inside */
314
    STI_LANE_POSITION_TWENTY_THIRD_LANE_FROM_INSIDE,        /**< Twenty-third lane from inside */
315
    STI_LANE_POSITION_TWENTY_FOURTH_LANE_FROM_INSIDE,       /**< Twenty-fourth lane from inside */
316
    STI_LANE_POSITION_TWENTY_FIFTH_LANE_FROM_INSIDE,        /**< Twenty-fifth lane from inside */
317
    STI_LANE_POSITION_TWENTY_SIXTH_LANE_FROM_INSIDE,        /**< Twenty-sixth lane from inside */
318
    STI_LANE_POSITION_TWENTY_SEVENTH_LANE_FROM_INSIDE,      /**< Twenty-seventh lane from inside */
319
    STI_LANE_POSITION_TWENTY_EIGHTH_LANE_FROM_INSIDE,       /**< Twenty-eighth lane from inside */
320
    STI_LANE_POSITION_TWENTY_NINTH_LANE_FROM_INSIDE,        /**< Twenty-ninth lane from inside */
321
    STI_LANE_POSITION_THIRTIETH_LANE_FROM_INSIDE,           /**< Thirtieth lane from inside */
322
    STI_LANE_POSITION_THIRTY_FIRST_LANE_FROM_INSIDE,        /**< Thirty-first lane from inside */
323
    STI_LANE_POSITION_THIRTY_SECOND_LANE_FROM_INSIDE,       /**< Thirty-second lane from inside */
324
    STI_LANE_POSITION_OUTER_HARD_SHOULDER,                  /**< Outer hard shoulder position */
325
    STI_LANE_POSITION_OFF_THE_ROAD                          /**< Off the road position */
326
} sti_lane_pos_t;
327
328
/**
329
Possible values for fuel type
330
*/
331
typedef enum sti_fuel_type_t {
332
    STI_FUEL_TYPE_GASOLINE = 0,                             /**< Gasoline fuel type */
333
    STI_FUEL_TYPE_ETHANOL,                                  /**< Ethanol fuel type */
334
    STI_FUEL_TYPE_DIESEL,                                   /**< Diesel fuel type */
335
    STI_FUEL_TYPE_ELECTRIC,                                 /**< Electric fuel type */
336
    STI_FUEL_TYPE_HYBRID,                                   /**< Hybrid fuel type */
337
    STI_FUEL_TYPE_HYDROGEN,                                 /**< Hydrogen fuel type */
338
    STI_FUEL_TYPE_NAT_GAS_LIQUID,                           /**< NAT gas liquefied fuel type */
339
    STI_FUEL_TYPE_NAT_GAS_COMP,                             /**< NAT gas compressed fuel type */
340
    STI_FUEL_TYPE_PROPANE,                                  /**< Propane fuel type */
341
} sti_fuel_type_t;
342
343
/**
344
Possible values for environment area type
345
*/
346
typedef enum sti_area_type_t {
347
    STI_AREA_TYPE_RURAL = 0,                                /**< Rural area */
348
    STI_AREA_TYPE_URBAN,                                    /**< Urban area */
349
} sti_area_type_t;
350
351
/**
352
Possible values for door state related StationInfo parameters
353
*/
354
typedef enum sti_door_state_t {
355
    STI_DOOR_STATE_NA = 0,                                  /**< N/A state */
356
    STI_DOOR_STATE_CLOSED,                                  /**< Closed state */
357
    STI_DOOR_STATE_OPEN,                                    /**< Open state */
358
} sti_door_state_t;
359
360
/**
361
Possible values for belt buckle state related StationInfo parameters
362
*/
363
typedef enum sti_belt_buckle_status_t {
364
    STI_BELT_BUCKLE_DISCONNECTED = 0,                       /**< Belt buckle is disconnected */
365
    STI_BELT_BUCKLE_CONNECTED,                              /**< Belt buckle is connected */
366
} sti_belt_buckle_status_t;
367
368
/**
369
Possible values for Transmission type
370
*/
371
typedef enum sti_transmission_type_t {
372
    STI_TRANSMISSION_TYPE_AUTOMATIC = 0,                    /**< Transmission type is automatic */
373
    STI_TRANSMISSION_TYPE_MANUAL,                           /**< Transmission type is manual */
374
} sti_transmission_type_t;
375
376
/**
377
Possible values for presence of physical separation between own and oncoming lanes of the road/highway
378
*/
379
typedef enum sti_physical_road_separation_t {
380
    STI_PHYSICAL_ROAD_SEPARATION_NOT_PRESENT = 0,           /**< Physical separation is not present */
381
    STI_PHYSICAL_ROAD_SEPARATION_PRESENT                    /**< Physical separation is present */
382
} sti_physical_road_separation_t;
383
384
/**
385
Possible values for RoadClass parameter
386
*/
387
typedef enum sti_road_class_t {
388
    STI_ROAD_CLASS_UNKNOWN = 0,                             /**< Unknown road class */
389
    STI_ROAD_CLASS_MOTORWAY,                                /**< Motorway road class */
390
    STI_ROAD_CLASS_COUNTRY_ROAD,                            /**< Country road road class */
391
    STI_ROAD_CLASS_LOCAL_ROAD,                              /**< Local road road class */
392
} sti_road_class_t;
393
394
/**
395
Possible values for rule of the road
396
*/
397
typedef enum sti_road_rule_t {
398
    STI_ROAD_RULE_RIGHT_HAND_TRAFFIC = 0,                   /**< Right-hand traffic */
399
    STI_ROAD_RULE_LEFT_HAND_TRAFFIC,                        /**< Left-hand traffic */
400
} sti_road_rule_t;
401
402
/**
403
Possible values for StationInfo parameters which have two states
404
*/
405
typedef enum sti_state_t {
406
    STI_STATE_OFF = 0,                                      /**< Off state */
407
    STI_STATE_ON                                            /**< On state */
408
} sti_state_t;
409
410
/**
411
Possible values for StationInfo parameters which have three states
412
*/
413
typedef enum sti_tristate_t {
414
    STI_TRISTATE_OFF = 0,                                   /**< Off state */
415
    STI_TRISTATE_ON,                                        /**< On or active (but not engaged) state */
416
    STI_TRISTATE_ENGAGED                                    /**< Engaged state */
417
} sti_tristate_t;
418
419
420
typedef enum sti_type_t {
421
422
    /**
423
    Transmission state
424
    @type [enum]
425
    @see sti_transmission_state_t
426
    */
427
    STI_TRANSMISSION_STATE = 0,
428
429
    /**
430
    Steering wheel angle.
431
    @note Do not confuse with driving wheel angle.
432
          The steering wheel is what the driver holds in their hands,
433
          the driving wheel is what touches the ground.
434
    @type [angle]
435
    @unit [0.001 degree] CCW positive
436
    */
437
    STI_STEERING_WHEEL_ANGLE,
438
439
    /**
440
    Steering wheel angle confidence
441
    @type [angle]
442
    @unit [0.001 degree]
443
    */
444
    STI_STEERING_WHEEL_ANGLE_CONF,
445
446
    /**
447
    Steering wheel angle rate
448
    @type [angular velocity]
449
    @unit [0.001 degree/second]
450
    */
451
    STI_STEERING_WHEEL_ANGLE_RATE,
452
453
    /**
454
    Driving wheel angle
455
    @note Do not confuse with steering wheel angle.
456
          The steering wheel is what the driver holds in their hands,
457
          the driving wheel is what touches the ground.
458
    @type [angle]
459
    @unit [0.001 degree]
460
    */
461
    STI_DRIVING_WHEEL_ANGLE,
462
463
    /**
464
    Longitudinal acceleration
465
    @type [acceleration]
466
    @unit [mm/s^2]
467
    */
468
    STI_LONG_ACC,
469
470
    /**
471
    Longitudinal acceleration confidence
472
    @type [acceleration]
473
    @unit [mm/s^2]
474
    */
475
    STI_LONG_ACC_CONF,
476
477
    /**
478
    Lateral acceleration
479
    @type [acceleration]
480
    @unit [mm/s^2]
481
    */
482
    STI_LAT_ACC,
483
484
    /**
485
    Lateral acceleration confidence
486
    @type [acceleration]
487
    @unit [mm/s^2]
488
    */
489
    STI_LAT_ACC_CONF,
490
491
    /**
492
    Vertical acceleration
493
    @note If the car is standing still, this should be 0, i.e.
494
          gravity is not included in this value.
495
    @type [acceleration]
496
    @unit [mm/s^2]
497
    */
498
    STI_VERT_ACC,
499
500
    /**
501
    Vertical acceleration confidence
502
    @type [acceleration]
503
    @unit [mm/s^2]
504
    */
505
    STI_VERT_ACC_CONF,
506
507
    /**
508
    Yaw rate
509
    @type [angular velocity]
510
    @unit [0.001 degree/second] CCW positive
511
    */
512
    STI_YAW_RATE,
513
514
    /**
515
    Yaw rate confidence
516
    @type [angular velocity]
517
    @unit [0.001 degree/second]
518
    */
519
    STI_YAW_RATE_CONF,
520
521
    /**
522
    Front left brake applied pressure
523
    @type [thousandths]
524
    @unit [parts-per-thousand]
525
    */
526
    STI_BRAKE_STATUS_LEFT_FRONT,
527
528
    /**
529
    Rear left brake applied pressure
530
    @type [thousandths]
531
    @unit [parts-per-thousand]
532
    */
533
    STI_BRAKE_STATUS_LEFT_REAR,
534
535
    /**
536
    Front right brake applied pressure
537
    @type [thousandths]
538
    @unit [parts-per-thousand]
539
    */
540
    STI_BRAKE_STATUS_RIGHT_FRONT,
541
542
    /**
543
    Rear right brake applied pressure
544
    @type [thousandths]
545
    @unit [parts-per-thousand]
546
    */
547
    STI_BRAKE_STATUS_RIGHT_REAR,
548
549
    /**
550
    Traction control status
551
    @type [enum]
552
    @see sti_tristate_t
553
    */
554
    STI_TRACTION_CONTROL_STATUS,
555
556
    /**
557
    Anti-lock braking system status
558
    @type [enum]
559
    @see sti_tristate_t
560
    */
561
    STI_ABS,
562
563
    /**
564
    Stability control status
565
    @type [enum]
566
    @see sti_tristate_t
567
    */
568
    STI_STABILITY_CONTROL_STATUS,
569
570
    /**
571
    Emergency brake status, also known as 'Brake boost'
572
    @type [enum]
573
    @see sti_state_t
574
    */
575
    STI_EMERGENCY_BRAKE,
576
577
    /**
578
    Auxiliary brake status
579
    @type [enum]
580
    @see sti_aux_brakes_t
581
    */
582
    STI_AUX_BRAKES,
583
584
    /**
585
    Vehicle width
586
    @note The width shall be the widest point of the vehicle with all
587
          factory installed equipment.
588
    @type [length]
589
    @unit [mm]
590
    */
591
    STI_VEHICLE_WIDTH,
592
593
    /**
594
    Vehicle length
595
    @note The length of the vehicle measured from the edge of the front
596
          bumper to the edge of the rear bumper.
597
    @type [length]
598
    @unit [mm]
599
    */
600
    STI_VEHICLE_LENGTH,
601
602
    /**
603
    Vehicle length confidence
604
    @type [enum]
605
    @see sti_vehicle_length_conf_t
606
    */
607
    STI_VEHICLE_LENGTH_CONF,
608
609
    /**
610
    Vehicle height
611
    @type [length]
612
    @unit [mm]
613
    */
614
    STI_VEHICLE_HEIGHT,
615
616
    /**
617
    Vehicle mass
618
    @type [mass]
619
    @unit [gram]
620
    */
621
    STI_VEHICLE_MASS,
622
623
    /**
624
    Stop line violated
625
    @type [enum]
626
    @see sti_state_t
627
    */
628
    STI_EV_STOP_LINE_VIOLATED,
629
630
    /**
631
    Dangerous goods present
632
    @note Indicates the type of the dangerous goods being carried by a heavy vehicle.
633
    @type [enum]
634
    @see sti_dangerous_good_t
635
    */
636
    STI_DANGEROUS_GOODS,
637
638
    /**
639
    Flat tire
640
    @type [enum]
641
    @see sti_state_t
642
    */
643
    STI_EV_FLAT_TIRE,
644
645
    /**
646
    Disabled vehicle
647
    @note An equipped vehicle that has self-declared that it is not
648
          performing all designed/intended functions and/or operations.
649
          Such a vehicle may be moving or may be stationary.
650
    @type [enum]
651
    @see sti_state_t
652
    */
653
    STI_EV_DISABLED_VEHICLE,
654
655
    /**
656
    Airbag deployed
657
    @type [enum]
658
    @see sti_state_t
659
    */
660
    STI_EV_AIRBAG_DEPLOYED,
661
662
    /**
663
    Low beam headlight status
664
    @type [enum]
665
    @see sti_state_t
666
    */
667
    STI_EXT_LIGHT_LOWBEAM_HEAD,
668
669
    /**
670
    High beam headlight status
671
    @type [enum]
672
    @see sti_state_t
673
    */
674
    STI_EXT_LIGHT_HIGHBEAM_HEAD,
675
676
    /**
677
    Left turn signal status
678
    @note Keep in mind that this signal should be
679
          a stable 'on', and should not be blinking
680
    @type [enum]
681
    @see sti_state_t
682
    */
683
    STI_EXT_LIGHT_LEFT_TURN_SIGNAL,
684
685
    /**
686
    Right turn signal status
687
    @note Keep in mind that this signal should be
688
          a stable 'on', and should not be blinking
689
    @type [enum]
690
    @see sti_state_t
691
    */
692
    STI_EXT_LIGHT_RIGHT_TURN_SIGNAL,
693
694
    /**
695
    Hazard light status status
696
    @note Keep in mind that this signal should be
697
          a stable 'on', and should not be blinking.
698
          This value is independent from the turn signal and signifies
699
          the button itself on the dashboard. If this value cannot be
700
          obtained independently, it should be manually set to 'on' if
701
          both turn signals are 'on'.
702
    @type [enum]
703
    @see sti_state_t
704
    */
705
    STI_EXT_LIGHT_HAZARD_LIGHT,
706
707
    /**
708
    Auto light control status status
709
    @type [enum]
710
    @see sti_state_t
711
    */
712
    STI_EXT_LIGHT_AUTO_LIGHT_CONTROL,
713
714
    /**
715
    Daytime running light status
716
    @type [enum]
717
    @see sti_state_t
718
    */
719
    STI_EXT_LIGHT_DAYTIME_RUNNING,
720
721
    /**
722
    Fog light status
723
    @type [enum]
724
    @see sti_state_t
725
    */
726
    STI_EXT_LIGHT_FOG,
727
728
    /**
729
    Parking light status
730
    @type [enum]
731
    @see sti_state_t
732
    */
733
    STI_EXT_LIGHT_PARKING,
734
735
    /**
736
    Reverse light status
737
    @type [enum]
738
    @see sti_state_t
739
    */
740
    STI_EXT_LIGHT_REVERSE,
741
742
    /**
743
    Station type
744
    @note Not to be confused with vehicle role. It may seem redundant,
745
          but while class doesn't change for the lifetime of the vehicle,
746
          role may change based on what it's doing currently.
747
    @type [enum]
748
    @see sti_station_type_t
749
    */
750
    STI_STATION_TYPE,
751
752
    /**
753
    Vehicle role
754
    @note Not to be confused with vehicle class. It may seem redundant,
755
          but while class doesn't change for the lifetime of the vehicle,
756
          role may change based on what it's doing currently,
757
          e.g. simple passenger vehicle can be a safety car while it's in service,
758
          but a basic vehicle when it's not.
759
    @type [enum]
760
    @see sti_vehicle_role_t
761
    */
762
    STI_VEHICLE_ROLE,
763
764
    /**
765
    Height of the front bumper
766
    @type [length]
767
    @unit [mm]
768
    */
769
    STI_BUMPER_HEIGHT_FRONT,
770
771
    /**
772
    Height of the rear bumper
773
    @type [length]
774
    @unit [mm]
775
    */
776
    STI_BUMPER_HEIGHT_REAR,
777
778
    /**
779
    Rain rate
780
    @type [rate]
781
    @unit [0.1 g/s/m^2]
782
    */
783
    STI_WEATHER_RAIN_RATE,
784
785
    /**
786
    Rain sensor
787
    @note Describes the current sensor reading normalized to a 0-1000 range,
788
          where 0 is completely dry, and 1000 is the highest rain value the
789
          sensor is capable of detecting.
790
          Note that this is independent from STI_WEATHER_PRECIP_SITUATON,
791
          which is more of a semantic value. If both are needed, they need to
792
          be set individually.
793
    @type [thousandths]
794
    @unit [parts-per-thousand]
795
    */
796
    STI_RAIN_SENSOR,
797
798
    /**
799
    Precipitation situation
800
    @note Describes the weather situation in terms of precipitation.
801
    @type [enum]
802
    @see sti_weather_precip_situation_t
803
    */
804
    STI_WEATHER_PRECIP_SITUATON,
805
806
    /**
807
    Solar radiation
808
    @type [solar irradiance]
809
    @unit [J/m^2]
810
    */
811
    STI_WEATHER_SOLAR_RADIATION,
812
813
    /**
814
    Coefficient of friction
815
    @type [thousandths]
816
    @unit [parts-per-thousand]
817
    */
818
    STI_WEATHER_COEF_FRICTION,
819
820
    /**
821
    Ambient air temperature
822
    @type [temperature]
823
    @unit [0.1C°]
824
    */
825
    STI_WEATHER_AIR_TEMP,
826
827
    /**
828
    Ambient air pressure
829
    @type [pressure]
830
    @unit [Pascal]
831
    */
832
    STI_WEATHER_AIR_PRESSURE,
833
834
    /**
835
    Front wiper state
836
    @type [enum]
837
    @see sti_wiper_state_t
838
    */
839
    STI_WIPER_STATE_FRONT,
840
841
    /**
842
    Rear wiper state
843
    @type [enum]
844
    @see sti_wiper_state_t
845
    */
846
    STI_WIPER_STATE_REAR,
847
848
    /**
849
    Front wiper rate
850
    @note Usually only makes sense if the wiper state is also set to a
851
          correct value. This has to be done manually.
852
    @type [rate]
853
    @unit [sweeps/minute]
854
    */
855
    STI_WIPER_RATE_FRONT,
856
857
    /**
858
    Rear wiper rate
859
    @note Usually only makes sense if the wiper state is also set to a
860
          correct value. This has to be done manually.
861
    @type [rate]
862
    @unit [sweeps/minute]
863
    */
864
    STI_WIPER_RATE_REAR,
865
866
    /**
867
    Embarkation status
868
    @type [enum]
869
    @see sti_state_t
870
    */
871
    STI_EMBARKATION_STATUS,
872
873
    /**
874
    Lightbar status
875
    @note It is intended to inform if any sort of additional visible
876
          lighting-alerting system is currently in use by a vehicle.
877
    @type [enum]
878
    @see sti_lightbar_t
879
    */
880
    STI_LIGHTBAR,
881
882
    /**
883
    Siren status
884
    @note A data element which is set if any sort of audible alarm is being
885
          emitted from the vehicle.
886
    @type [enum]
887
    @see sti_siren_t
888
    */
889
    STI_SIREN,
890
891
    /**
892
    Accelerator pedal position
893
    @type [thousandths]
894
    @unit [parts-per-thousand]
895
    */
896
    STI_ACCELERATOR_PEDAL,
897
898
    /**
899
    Brake pedal position
900
    @type [thousandths]
901
    @unit [parts-per-thousand]
902
    */
903
    STI_BRAKE_PEDAL,
904
905
    /**
906
    Collision warning
907
    @type [enum]
908
    @see sti_state_t
909
    */
910
    STI_COLLISION_WARNING,
911
912
    /**
913
    Adaptive cruise control status
914
    @type [enum]
915
    @see sti_state_t
916
    */
917
    STI_ADAPTIVE_CRUISE_CONTROL,
918
919
    /**
920
    Cruise control status
921
    @type [enum]
922
    @see sti_state_t
923
    */
924
    STI_CRUISE_CONTROL,
925
926
    /**
927
    Speed limiter status
928
    @type [enum]
929
    @see sti_state_t
930
    */
931
    STI_SPEED_LIMITER,
932
933
    /**
934
    Lane position
935
    @type [enum]
936
    @see sti_lane_pos_t
937
    */
938
    STI_LANE_POSITION,
939
940
    /**
941
    Trailer weight
942
    @type [weight]
943
    @unit [g]
944
    */
945
    STI_TRAILER_WEIGHT,
946
947
    /**
948
    Front left door state
949
    @type [enum]
950
    @see sti_door_state_t
951
    */
952
    STI_DOOR_STATE_FRONT_LEFT,
953
954
    /**
955
    Front right door state
956
    @type [enum]
957
    @see sti_door_state_t
958
    */
959
    STI_DOOR_STATE_FRONT_RIGHT,
960
961
    /**
962
    Rear left door state
963
    @type [enum]
964
    @see sti_door_state_t
965
    */
966
    STI_DOOR_STATE_REAR_LEFT,
967
968
    /**
969
    Rear right door state
970
    @type [enum]
971
    @see sti_door_state_t
972
    */
973
    STI_DOOR_STATE_REAR_RIGHT,
974
975
    /**
976
    Bonnet state
977
    @type [enum]
978
    @see sti_door_state_t
979
    */
980
    STI_DOOR_STATE_BONNET,
981
982
    /**
983
    Trunk state
984
    @type [enum]
985
    @see sti_door_state_t
986
    */
987
    STI_DOOR_STATE_TRUNK,
988
989
    /**
990
    Fuel type
991
    @type [enum]
992
    @see sti_fuel_type_t
993
    */
994
    STI_FUEL_TYPE,
995
996
    /**
997
    Road class
998
    @type [enum]
999
    @see sti_road_class_t
1000
    */
1001
    STI_ROAD_CLASS,
1002
1003
    /**
1004
    Area type
1005
    @type [enum]
1006
    @see sti_area_type_t
1007
    */
1008
    STI_AREA_TYPE,
1009
1010
    /**
1011
    Automatic emergency brake status
1012
    @type [enum]
1013
    @see sti_state_t
1014
    */
1015
    STI_AUTOMATIC_EMERGENCY_BRAKE,
1016
1017
    /**
1018
    Reversible Occupant Restraint System status (e.g. reversible belt-tightener)
1019
    @note Activate when any of the applicable system is active.
1020
    @type [enum]
1021
    @see sti_state_t
1022
    */
1023
    STI_REVERSIBLE_OCCUPANT_RESTRAINT_SYSTEM,
1024
1025
    /**
1026
    A red warning light is active in the vehicle. (See ECE 121)
1027
    @type [enum]
1028
    @see sti_state_t
1029
    */
1030
    STI_RED_WARNING_ACTIVE,
1031
1032
    /**
1033
    First row belt buckle status on the driver side.
1034
    @type [enum]
1035
    @see sti_belt_buckle_status_t
1036
    */
1037
    STI_BELT_BUCKLE_ROW1_DRIVER,
1038
1039
    /**
1040
    First row belt buckle status on the middle.
1041
    @type [enum]
1042
    @see sti_belt_buckle_status_t
1043
    */
1044
    STI_BELT_BUCKLE_ROW1_MIDDLE,
1045
1046
    /**
1047
    First row belt buckle status on the passenger side.
1048
    @type [enum]
1049
    @see sti_belt_buckle_status_t
1050
    */
1051
    STI_BELT_BUCKLE_ROW1_PASSENGER,
1052
1053
    /**
1054
    Second row belt buckle status on the driver side.
1055
    @type [enum]
1056
    @see sti_belt_buckle_status_t
1057
    */
1058
    STI_BELT_BUCKLE_ROW2_DRIVER,
1059
1060
    /**
1061
    Second row belt buckle status on the middle.
1062
    @type [enum]
1063
    @see sti_belt_buckle_status_t
1064
    */
1065
    STI_BELT_BUCKLE_ROW2_MIDDLE,
1066
1067
    /**
1068
    Second row belt buckle status on the passenger side.
1069
    @type [enum]
1070
    @see sti_belt_buckle_status_t
1071
    */
1072
    STI_BELT_BUCKLE_ROW2_PASSENGER,
1073
1074
    /**
1075
    Third row belt buckle status on the driver side.
1076
    @type [enum]
1077
    @see sti_belt_buckle_status_t
1078
    */
1079
    STI_BELT_BUCKLE_ROW3_DRIVER,
1080
1081
    /**
1082
    Third row belt buckle status on the middle.
1083
    @type [enum]
1084
    @see sti_belt_buckle_status_t
1085
    */
1086
    STI_BELT_BUCKLE_ROW3_MIDDLE,
1087
1088
    /**
1089
    Third row belt buckle status on the passenger side.
1090
    @type [enum]
1091
    @see sti_belt_buckle_status_t
1092
    */
1093
    STI_BELT_BUCKLE_ROW3_PASSENGER,
1094
1095
    /**
1096
    Ignition status of the vehicle. (terminal 15)
1097
    @type [enum]
1098
    @see sti_state_t
1099
    */
1100
    STI_IGNITION,
1101
1102
    /**
1103
    Type of the transmission. (automatic or manual)
1104
    @type [enum]
1105
    @see sti_transmission_type_t
1106
    */
1107
    STI_TRANSMISSION_TYPE,
1108
1109
    /**
1110
    Presence of physical separation between own and oncoming lanes of the road/highway
1111
    @type [enum]
1112
    @see sti_physical_road_separation_t
1113
    */
1114
    STI_PHYSICAL_ROAD_SEPARATION,
1115
1116
    /**
1117
    An eCall has been triggered manually by an occupant of the vehicle by the eCall
1118
    button.
1119
    @type [enum]
1120
    @see sti_state_t
1121
    */
1122
    STI_MANUAL_ECALL,
1123
1124
    /**
1125
    Low severity crash crash is detected without the activation of an irreversible occupant
1126
    restraint system. (e.g. high-voltage battery cut-off, door unlock)
1127
    @type [enum]
1128
    @see sti_state_t
1129
    */
1130
    STI_LOW_SEVERITY_CRASH,
1131
1132
    /**
1133
    Pedestrian collision is detected with the activation of at least one irreversible
1134
    pedestrian-protection system. (e.g. pop-up bonnet, outside airbag)
1135
    @type [enum]
1136
    @see sti_state_t
1137
    */
1138
    STI_PEDESTRIAN_COLLISION,
1139
1140
    /**
1141
    High severity crash is detected with the activation of at least one irreversible
1142
    occupant-restraint system. (e.g. pyrotechnic belt-tightener, airbag)
1143
    @type [enum]
1144
    @see sti_state_t
1145
    */
1146
    STI_HIGH_SEVERITY_CRASH,
1147
1148
    /**
1149
    Rule of the road. (e.g. right-hand traffic, left-hand traffic)
1150
    @type [enum]
1151
    @see sti_state_t
1152
    */
1153
    STI_ROAD_RULE,
1154
1155
    /**
1156
    Jackknife.
1157
    @type [enum]
1158
    @see sti_state_t
1159
    */
1160
    STI_EV_JACKKNIFE,
1161
1162
    /**
1163
    ISO-3166-1 numeric country code.
1164
    @type [integer]
1165
    */
1166
    STI_COUNTRY_CODE,
1167
1168
    /**
1169
    Project specific STI values.
1170
    @type [integer]
1171
    @unit [varying]
1172
    */
1173
    STI_PROJECT_00 = 128,
1174
    STI_PROJECT_01,
1175
    STI_PROJECT_02,
1176
    STI_PROJECT_03,
1177
    STI_PROJECT_04,
1178
    STI_PROJECT_05,
1179
    STI_PROJECT_06,
1180
    STI_PROJECT_07,
1181
    STI_PROJECT_08,
1182
    STI_PROJECT_09,
1183
    STI_PROJECT_10,
1184
    STI_PROJECT_11,
1185
    STI_PROJECT_12,
1186
    STI_PROJECT_13,
1187
    STI_PROJECT_14,
1188
    STI_PROJECT_15,
1189
    STI_PROJECT_16,
1190
    STI_PROJECT_17,
1191
    STI_PROJECT_18,
1192
    STI_PROJECT_19,
1193
    STI_PROJECT_20,
1194
    STI_PROJECT_21,
1195
    STI_PROJECT_22,
1196
    STI_PROJECT_23,
1197
    STI_PROJECT_24,
1198
    STI_PROJECT_25,
1199
    STI_PROJECT_26,
1200
    STI_PROJECT_27,
1201
    STI_PROJECT_28,
1202
    STI_PROJECT_29,
1203
    STI_PROJECT_30,
1204
    STI_PROJECT_31,
1205
1206
    /** Number of STI types, do not use as a parameter */
1207
    STI_TYPE_LAST
1208
} sti_type_t;
1209
1210
1211
static int proto_desc;
1212
static int ett_c2p;
1213
static dissector_handle_t ieee80211_handle;
1214
static dissector_handle_t its_handle;
1215
static dissector_handle_t j2735_handle;
1216
static dissector_handle_t wsa_handle;
1217
static dissector_handle_t cn_msg_frame_handle;
1218
static dissector_handle_t commsigniaapi_handle;
1219
1220
static int hf_c2p_version_desc;
1221
static int hf_c2p_type_desc;
1222
static int hf_c2p_tst_sec_desc;
1223
static int hf_c2p_tst_msec_desc;
1224
static int hf_c2p_primary_channel_desc;
1225
static int hf_c2p_secondary_channel_desc;
1226
static int hf_c2p_used_interface_desc;
1227
static int hf_c2p_datarate_desc;
1228
static int hf_c2p_antenna_desc;
1229
static int hf_c2p_latitude_desc;
1230
static int hf_c2p_longitude_desc;
1231
static int hf_c2p_altitude_desc;
1232
static int hf_c2p_speed_desc;
1233
static int hf_c2p_heading_desc;
1234
static int hf_c2p_semi_major_conf_desc;
1235
static int hf_c2p_semi_minor_conf_desc;
1236
static int hf_c2p_semi_major_ori_desc;
1237
static int hf_c2p_alttitude_acc_desc;
1238
static int hf_c2p_heading_acc_desc;
1239
static int hf_c2p_speed_acc_desc;
1240
static int hf_c2p_rssi_ant_1_desc;
1241
static int hf_c2p_rssi_ant_2_desc;
1242
static int hf_c2p_noise_ant_1_desc;
1243
static int hf_c2p_noise_ant_2_desc;
1244
static int hf_c2p_cbr_ant_1_desc;
1245
static int hf_c2p_cbr_ant_2_desc;
1246
static int hf_c2p_tx_power_desc;
1247
static int hf_c2p_cv2x_tx_power_desc;
1248
static int hf_c2p_tssi_ant_1_desc;
1249
static int hf_c2p_tssi_ant_2_desc;
1250
static int hf_c2p_sps_desc;
1251
static int hf_c2p_sps_port_desc;
1252
static int hf_c2p_event_port_desc;
1253
static int hf_c2p_bw_res_v2xid_desc;
1254
static int hf_c2p_bw_res_period_interval_ms_desc;
1255
static int hf_c2p_bw_res_tx_reservation_size_bytes_desc;
1256
static int hf_c2p_bw_res_tx_priority_desc;
1257
static int hf_c2p_socket_index_desc;
1258
static int hf_c2p_ethertype_desc;
1259
static int hf_c2p_rssi_desc;
1260
static int hf_c2p_nav_fix_is_valid_desc;
1261
static int hf_c2p_gps_timestamp_desc;
1262
static int hf_c2p_sti_length_desc;
1263
static int hf_c2p_sti_type_desc;
1264
static int hf_c2p_sti_value_angle_desc;
1265
static int hf_c2p_sti_value_acceleration_desc;
1266
static int hf_c2p_sti_value_angular_velocity_desc;
1267
static int hf_c2p_sti_value_thousandths_desc;
1268
static int hf_c2p_sti_value_length_desc;
1269
static int hf_c2p_sti_value_mass_desc;
1270
static int hf_c2p_sti_value_rain_rate_desc;
1271
static int hf_c2p_sti_value_solar_irradiance_desc;
1272
static int hf_c2p_sti_value_temperature_desc;
1273
static int hf_c2p_sti_value_pressure_desc;
1274
static int hf_c2p_sti_value_sweep_rate_desc;
1275
static int hf_c2p_sti_value_integer_desc;
1276
static int hf_c2p_sti_value_transmission_state_desc;
1277
static int hf_c2p_sti_value_aux_breaks_desc;
1278
static int hf_c2p_sti_value_vehicle_length_conf_desc;
1279
static int hf_c2p_sti_value_dangerous_goods_desc;
1280
static int hf_c2p_sti_value_station_type_desc;
1281
static int hf_c2p_sti_value_vehicle_role_desc;
1282
static int hf_c2p_sti_value_weather_precip_situation_desc;
1283
static int hf_c2p_sti_value_wiper_state_desc;
1284
static int hf_c2p_sti_value_door_state_desc;
1285
static int hf_c2p_sti_value_fuel_type_desc;
1286
static int hf_c2p_sti_value_road_class_desc;
1287
static int hf_c2p_sti_value_road_rule_desc;
1288
static int hf_c2p_sti_value_area_type_desc;
1289
static int hf_c2p_sti_value_belt_buckle_status_desc;
1290
static int hf_c2p_sti_value_transmission_type_desc;
1291
static int hf_c2p_sti_value_physical_road_separation_desc;
1292
static int hf_c2p_sti_value_siren_desc;
1293
static int hf_c2p_sti_value_lightbar_desc;
1294
static int hf_c2p_sti_value_lane_position_desc;
1295
static int hf_c2p_sti_value_state_desc;
1296
static int hf_c2p_sti_value_tristate_desc;
1297
static int hf_c2p_fac_msg_type_desc;
1298
static int hf_c2p_fac_timestamp_desc;
1299
static int hf_c2p_fac_interface_id_desc;
1300
static int hf_c2p_fac_source_address_desc;
1301
static int hf_c2p_fac_dest_address_desc;
1302
static int hf_c2p_fac_datarate_desc;
1303
static int hf_c2p_fac_user_prio_desc;
1304
static int hf_c2p_fac_rssi_desc;
1305
static int hf_c2p_fac_fingerprint_desc;
1306
static int hf_c2p_fac_verify_result_desc;
1307
static int hf_c2p_fac_psid_desc;
1308
static int hf_c2p_fac_ssp_type_desc;
1309
static int hf_c2p_fac_ssp_field_desc;
1310
static int hf_c2p_fac_ssp_length_desc;
1311
static int hf_c2p_fac_signer_id_desc;
1312
static int hf_c2p_fac_generation_time_desc;
1313
static int hf_c2p_fac_payload_length_desc;
1314
1315
static int hf_c2p_api_direction_desc;
1316
static int hf_c2p_api_client_ip_desc;
1317
static int hf_c2p_api_client_port_desc;
1318
static int hf_c2p_api_length_desc;
1319
1320
1321
0
#define C2P_TYPE_DSRC_RX        1UL
1322
0
#define C2P_TYPE_DSRC_TX        2UL
1323
1
#define C2P_TYPE_NAV            3UL
1324
#define C2P_TYPE_CAN            4UL
1325
15
#define C2P_TYPE_STI            5UL
1326
#define C2P_TYPE_POTI           6UL
1327
0
#define C2P_TYPE_CV2X_RX        7UL
1328
1
#define C2P_TYPE_CV2X_TX        8UL
1329
0
#define C2P_TYPE_API            11UL
1330
0
#define C2P_TYPE_FAC_INJECT     12UL
1331
1332
enum { C2P_TYPES_NUM = 11UL };
1333
1334
static const value_string c2p_types[C2P_TYPES_NUM] = {
1335
    { C2P_TYPE_DSRC_RX, "Received DSRC Packet" },
1336
    { C2P_TYPE_DSRC_TX, "Transmitted DSRC Packet" },
1337
    { C2P_TYPE_NAV, "Navigation" },
1338
    { C2P_TYPE_CAN, "CAN" },
1339
    { C2P_TYPE_STI, "StationInfo" },
1340
    { C2P_TYPE_POTI, "Position & Timing" },
1341
    { C2P_TYPE_CV2X_RX, "Received CV2X Packet" },
1342
    { C2P_TYPE_CV2X_TX, "Transmitted CV2X Packet" },
1343
    { C2P_TYPE_API, "Remote API Message" },
1344
    { C2P_TYPE_FAC_INJECT, "Injected Facility Packet" },
1345
    { 0, NULL }
1346
};
1347
1348
/**
1349
Direction of a captured remote API message
1350
*/
1351
static const value_string api_directions[] = {
1352
    { 0, "Received from the API client" },
1353
    { 1, "Sent to the API client" },
1354
    { 0, NULL }
1355
};
1356
1357
/**
1358
Facility message types of an injected facility packet
1359
*/
1360
static const value_string fac_msg_types[] = {
1361
    { 1, "EU CAM (Cooperative Awareness Message)" },
1362
    { 2, "EU DENM (Decentralized Environmental Notification Message)" },
1363
    { 3, "EU MAP" },
1364
    { 4, "EU SPAT (Signal Phase & Timing)" },
1365
    { 5, "EU IVI (In-Vehicle Information)" },
1366
    { 6, "EU RTCM (Real Time Correction Message)" },
1367
    { 7, "EU SRM (Signal Request Message)" },
1368
    { 8, "EU SSM (Signal Status Message)" },
1369
    { 9, "EU CPM (Collective Perception Message)" },
1370
    { 10, "EU VAM (Vulnerable Road User Awareness Message)" },
1371
    { 100, "US BSM (Basic Safety Message)" },
1372
    { 101, "US TIM (Traveler Information Message)" },
1373
    { 102, "US RSA (Road Side Alert)" },
1374
    { 103, "US MAP" },
1375
    { 104, "US SPAT (Signal Phase & Timing)" },
1376
    { 105, "US SRM (Signal Request Message)" },
1377
    { 106, "US SSM (Signal Status Message)" },
1378
    { 107, "US PSM (Personal Safety Message)" },
1379
    { 108, "US PVD (Probe Vehicle Data)" },
1380
    { 109, "US PDM (Probe Data Management)" },
1381
    { 110, "US RTCM (Real Time Correction Message)" },
1382
    { 111, "US WSA (WAVE Service Advertisement)" },
1383
    { 112, "US SDSM (Sensor Data Sharing Message)" },
1384
    { 113, "US CSR (Common Safety Request)" },
1385
    { 114, "US ICA (Intersection Collision Avoidance)" },
1386
    { 115, "US NMEA (NMEA Corrections)" },
1387
    { 116, "US RSM (Road Safety Message)" },
1388
    { 117, "US RWM (Road Weather Message)" },
1389
    { 118, "US PDC (Probe Data Config Message)" },
1390
    { 119, "US PDR (Probe Data Report Message)" },
1391
    { 120, "US TAM (Toll Advertisement Message)" },
1392
    { 121, "US TUM (Toll Usage Message)" },
1393
    { 122, "US TUM_ACK (Toll Usage Ack Message)" },
1394
    { 123, "US CCM (Cooperative Control Message)" },
1395
    { 124, "US MSCM (Maneuver Sharing and Coordinating Message)" },
1396
    { 125, "US RGA (Road Geometry and Attributes)" },
1397
    { 126, "US PSM2 (Personal Safety Message 2)" },
1398
    { 127, "US TSPAT (Traffic Signal Phase and Timing)" },
1399
    { 128, "US SCPR (Signal Control and Prioritization Request)" },
1400
    { 129, "US SCPS (Signal Control and Prioritization Status)" },
1401
    { 130, "US RUCCM (Road User Charging Config Message)" },
1402
    { 131, "US RUCRM (Road User Charging Report Message)" },
1403
    { 132, "US TLSM (Traffic Light Status Message)" },
1404
    { 200, "China BSM (Basic Safety Message)" },
1405
    { 201, "China MAP" },
1406
    { 202, "China SPAT (Signal Phase & Timing)" },
1407
    { 203, "China RSI (Road Side Information)" },
1408
    { 204, "China RSM (Road Side Message)" },
1409
    { 0, NULL }
1410
};
1411
1412
/**
1413
Security verification result of a facility packet
1414
*/
1415
static const value_string fac_verify_results[] = {
1416
    { 0, "Unsecured" },
1417
    { 1, "Success" },
1418
    { 2, "Signed (Disabled security)" },
1419
    { 3, "Timeout" },
1420
    { 4, "Invalid signature" },
1421
    { 5, "Invalid signer ID" },
1422
    { 6, "Invalid certificate" },
1423
    { 7, "Invalid PSID" },
1424
    { 8, "Invalid generation time" },
1425
    { 9, "Invalid generation location" },
1426
    { 10, "Internal error" },
1427
    { 11, "Invalid hash algorithm" },
1428
    { 12, "Malformed message" },
1429
    { 13, "Invalid protocol version" },
1430
    { 14, "Invalid security profile" },
1431
    { 15, "Replayed message" },
1432
    { 16, "Generation time is not consistent with certificate" },
1433
    { 17, "Generation time is missing" },
1434
    { 18, "Invalid critical information fields" },
1435
    { 19, "Missing expiry time" },
1436
    { 20, "Expiry time is in the past" },
1437
    { 21, "Expiry time is not consistent with certificate" },
1438
    { 22, "Expiry time is before generation time" },
1439
    { 23, "Security header's PSID is inconsistent with certificate" },
1440
    { 24, "Generation location is missing" },
1441
    { 25, "Generation location is inconsistent with certificate" },
1442
    { 26, "Network layer location is inconsistent with certificate" },
1443
    { 0, NULL }
1444
};
1445
1446
/**
1447
Service Specific Permissions (SSP) field types
1448
*/
1449
static const value_string fac_ssp_types[] = {
1450
    { 0, "Opaque" },
1451
    { 1, "Bitmap" },
1452
    { 2, "Invalid" },
1453
    { 0, NULL }
1454
};
1455
1456
enum { HEADING_PREDEFINED_VALUES_NUM = 7UL };
1457
1458
static const value_string heading_predefined_values[HEADING_PREDEFINED_VALUES_NUM] = {
1459
    { 0, "wgs84North" },
1460
    { 900, "wgs84East" },
1461
    { 1800, "wgs84South" },
1462
    { 2700, "wgs84West" },
1463
    { 3600, "Unavailable" },
1464
    { 3601, "Unavailable" },
1465
    { 0, NULL }
1466
};
1467
1468
static const val64_string sti_transmission_state_types[5] = {
1469
    { STI_TRANSMISSION_STATE_NEUTRAL, "Neutral" },
1470
    { STI_TRANSMISSION_PARK, "Parking" },
1471
    { STI_TRANSMISSION_FWD_GEARS, "Forward gears" },
1472
    { STI_TRANSMISSION_REVERSE_GEARS, "Reverse gears" },
1473
    { 0, NULL }
1474
};
1475
1476
static const val64_string sti_aux_breaks_types[3] = {
1477
    { STI_AUX_BRAKES_OFF, "Off" },
1478
    { STI_AUX_BRAKES_ON, "On" },
1479
    { 0, NULL }
1480
};
1481
1482
static const val64_string sti_vehicle_length_conf_types[5] = {
1483
    { STI_VEHICLE_LENGTH_CONF_NO_TRAILER, "No trailer" },
1484
    { STI_VEHICLE_LENGTH_CONF_TRAILER_WITH_LENGTH, "Trailer with known length" },
1485
    { STI_VEHICLE_LENGTH_CONF_TRAILER_WITH_NA_LENGTH, "Trailer with unknown length" },
1486
    { STI_VEHICLE_LENGTH_CONF_TRAILER_PRESENCE_IS_UNK, "Trailer presence unknown" },
1487
    { 0, NULL }
1488
};
1489
1490
static const val64_string sti_dangerous_goods_types[21] = {
1491
    { STI_DANGEROUS_GOODS_EXPLOSIVES1, "Explosive substance type 1" },
1492
    { STI_DANGEROUS_GOODS_EXPLOSIVES2, "Explosive substance type 2" },
1493
    { STI_DANGEROUS_GOODS_EXPLOSIVES3, "Explosive substance type 3" },
1494
    { STI_DANGEROUS_GOODS_EXPLOSIVES4, "Explosive substance type 4" },
1495
    { STI_DANGEROUS_GOODS_EXPLOSIVES5, "Explosive substance type 5" },
1496
    { STI_DANGEROUS_GOODS_EXPLOSIVES6, "Explosive substance type 6" },
1497
    { STI_DANGEROUS_GOODS_FLAMMABLE_GASES, "Flammable gases" },
1498
    { STI_DANGEROUS_GOODS_NON_FLAMMABLE_GASES, "Non flammable gases" },
1499
    { STI_DANGEROUS_GOODS_TOXIC_GASES, "Toxic gases" },
1500
    { STI_DANGEROUS_GOODS_FLAMMABLE_LIQUIDS, "Flammable liquids" },
1501
    { STI_DANGEROUS_GOODS_FLAMMABLE_SOLIDS, "Flammable solids" },
1502
    { STI_DANGEROUS_GOODS_SUBSTANCES_SPONTAIN_COMBUSTION, "Substances liable to spontaneous combustion" },
1503
    { STI_DANGEROUS_GOODS_SUBSTANCES_FLAMBLE_CONTACT_WATER, "Substances emitting flammable gases upon contact with water" },
1504
    { STI_DANGEROUS_GOODS_OXIDIZING_SUBSTANCES, "Oxidizing substances" },
1505
    { STI_DANGEROUS_GOODS_ORGANIC_PEROXIDES, "Organic peroxides" },
1506
    { STI_DANGEROUS_GOODS_TOXIC_SUBSTANCES, "Toxic substances" },
1507
    { STI_DANGEROUS_GOODS_INFECTIOUS_SUBSTANCES, "Infectious substances" },
1508
    { STI_DANGEROUS_GOODS_RADIOACTIVE_MATERIAL, "Radioactive material" },
1509
    { STI_DANGEROUS_GOODS_CORROSIVE_SUBSTANCES, "Corrosive substances" },
1510
    { STI_DANGEROUS_GOODS_MISC_DANGEROUS_SUBSTANCES, "Miscellaneous dangerous substances" },
1511
    { 0, NULL }
1512
};
1513
1514
static const val64_string sti_station_type_types[59] = {
1515
    { STI_STATION_TYPE_UNK, "Unknown" },
1516
    { STI_STATION_TYPE_SPECIAL, "Special" },
1517
    { STI_STATION_TYPE_PASSENGER_UNK, "Unknown type passenger vehicle" },
1518
    { STI_STATION_TYPE_PASSENGER_OTHER, "Other type passenger vehicle" },
1519
    { STI_STATION_TYPE_LIGHT_TRUCK_UNK, "Unknown type light truck" },
1520
    { STI_STATION_TYPE_LIGHT_TRUCK_OTHER, "Other type light truck" },
1521
    { STI_STATION_TYPE_TRUCK_UNK, "Unknown type truck" },
1522
    { STI_STATION_TYPE_TRUCK_OTHER, "Other type truck" },
1523
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_2, "Two axle, six tire single units" },
1524
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_3, "Three axle single units" },
1525
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_4, "Four or more axle single unit" },
1526
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_4_TRAILER, "Four or less axle single trailer" },
1527
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_5_TRAILER, "Five or less axle single trailer" },
1528
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_6_TRAILER, "Six or more axle single trailer" },
1529
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_5_MULTI_TRAILER, "Five or less axle multi-trailer" },
1530
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_6_MULTI_TRAILER, "Six axle multi-trailer" },
1531
    { STI_STATION_TYPE_TRUCK_AXLE_CNT_7_MULTI_TRAILER, "Seven or more axle multi-trailer" },
1532
    { STI_STATION_TYPE_MOTORCYCLE_UNK, "Unknown type motorcycle" },
1533
    { STI_STATION_TYPE_MOTORCYCLE_OTHER, "Other type motorcycle" },
1534
    { STI_STATION_TYPE_MOTORCYCLE_CRUISER_STANDARD, "Cruiser standard motorcycle" },
1535
    { STI_STATION_TYPE_MOTORCYCLE_SPORT_UNCLAD, "Unclad sport motorcycle" },
1536
    { STI_STATION_TYPE_MOTORCYCLE_SPORT_TOURING, "Sport touring motorcycle" },
1537
    { STI_STATION_TYPE_MOTORCYCLE_SUPER_SPORT, "Super sport motorcycle" },
1538
    { STI_STATION_TYPE_MOTORCYCLE_TOURING, "Touring motorcycle" },
1539
    { STI_STATION_TYPE_MOTORCYCLE_TRIKE, "Trike motorcycle" },
1540
    { STI_STATION_TYPE_MOTORCYCLE_WITH_PASSENGERS, "Motorcycle with passengers" },
1541
    { STI_STATION_TYPE_TRANSIT_UNK, "Unknown type transit" },
1542
    { STI_STATION_TYPE_TRANSIT_OTHER, "Other type transit" },
1543
    { STI_STATION_TYPE_TRANSIT_BRT, "Bus rapid transit" },
1544
    { STI_STATION_TYPE_TRANSIT_EXPRESS_BUS, "Express bus" },
1545
    { STI_STATION_TYPE_TRANSIT_LOCAL_BUS, "Local bus" },
1546
    { STI_STATION_TYPE_TRANSIT_SCHOOL_BUS, "School bus" },
1547
    { STI_STATION_TYPE_TRANSIT_FIXED_GUIDE_WAY, "Fixed guideway transit, like tram" },
1548
    { STI_STATION_TYPE_TRANSIT_PARATRANSIT, "Paratransit" },
1549
    { STI_STATION_TYPE_TRANSIT_PARATRANSIT_AMBULANCE, "Paratransit ambulance" },
1550
    { STI_STATION_TYPE_EMERGENCY_UNK, "Unknown type emergency vehicle" },
1551
    { STI_STATION_TYPE_EMERGENCY_OTHER, "Other type emergency vehicle" },
1552
    { STI_STATION_TYPE_EMERGENCY_FIRE_LIGHT, "Light fire emergency vehicle" },
1553
    { STI_STATION_TYPE_EMERGENCY_FIRE_HEAVY, "Heavy fire emergency vehicle" },
1554
    { STI_STATION_TYPE_EMERGENCY_FIRE_PARAMEDIC, "Fire paramedic emergency vehicle" },
1555
    { STI_STATION_TYPE_EMERGENCY_FIRE_AMBULANCE, "Fire ambulance emergency vehicle" },
1556
    { STI_STATION_TYPE_EMERGENCY_POLICE_LIGHT, "Light police emergency vehicle" },
1557
    { STI_STATION_TYPE_EMERGENCY_POLICE_HEAVY, "Heavy police emergency vehicle" },
1558
    { STI_STATION_TYPE_EMERGENCY_OTHER_RESPONDER, "Other type responder emergency vehicle" },
1559
    { STI_STATION_TYPE_EMERGENCY_OTHER_AMBULANCE, "Other type ambulance emergency vehicle" },
1560
    { STI_STATION_TYPE_OTHER_UNK, "Unknown type other traveler" },
1561
    { STI_STATION_TYPE_OTHER_OTHER, "Other type other traveler" },
1562
    { STI_STATION_TYPE_OTHER_PEDESTRIAN, "Other type pedestrian" },
1563
    { STI_STATION_TYPE_OTHER_VISUALLY_DISABLED, "Visually disabled other traveler" },
1564
    { STI_STATION_TYPE_OTHER_PHYSICALLY_DISABLED, "Physically disabled other traveler" },
1565
    { STI_STATION_TYPE_OTHER_BICYCLE, "Bicycle" },
1566
    { STI_STATION_TYPE_OTHER_VULNERABLE_ROADWORKER, "Vulnerable road worker" },
1567
    { STI_STATION_TYPE_INFRASTRUCTURE_UNK, "Unknown type infrastructure" },
1568
    { STI_STATION_TYPE_INFRASTRUCTURE_FIXED, "Fixed infrastructure" },
1569
    { STI_STATION_TYPE_INFRASTRUCTURE_MOVABLE, "Movable device" },
1570
    { STI_STATION_TYPE_EQUIPPED_CARGO_TRAILER, "Cargo trailer" },
1571
    { STI_STATION_TYPE_LIGHT_VRU_VEHICLE, "Vulnerable road worker" },
1572
    { STI_STATION_TYPE_ANIMAL, "Animal" },
1573
    { 0, NULL }
1574
};
1575
1576
1577
static const val64_string sti_vehicle_role_types[27] = {
1578
    { STI_VEHICLE_ROLE_BASIC_VEHICLE, "Basic vehicle" },
1579
    { STI_VEHICLE_ROLE_PUBLIC_TRANSPORT, "Public transport" },
1580
    { STI_VEHICLE_ROLE_SPECIAL_TRANSPORT, "Special transport" },
1581
    { STI_VEHICLE_ROLE_DANGEROUS_GOODS, "Dangerous goods" },
1582
    { STI_VEHICLE_ROLE_ROAD_WORK, "Roadwork" },
1583
    { STI_VEHICLE_ROLE_RESCUE, "Rescue" },
1584
    { STI_VEHICLE_ROLE_EMERGENCY, "Emergency" },
1585
    { STI_VEHICLE_ROLE_SAFETY_CAR, "Safety car" },
1586
    { STI_VEHICLE_ROLE_TRUCK, "Truck" },
1587
    { STI_VEHICLE_ROLE_MOTORCYCLE, "Motorcycle" },
1588
    { STI_VEHICLE_ROLE_ROAD_SIDE_SOURCE, "RSU" },
1589
    { STI_VEHICLE_ROLE_POLICE, "Police" },
1590
    { STI_VEHICLE_ROLE_FIRE, "Fire" },
1591
    { STI_VEHICLE_ROLE_AMBULANCE, "Ambulance" },
1592
    { STI_VEHICLE_ROLE_DOT, "DoT" },
1593
    { STI_VEHICLE_ROLE_TRANSIT, "Transit" },
1594
    { STI_VEHICLE_ROLE_SLOW_MOVING, "Slow moving" },
1595
    { STI_VEHICLE_ROLE_STOP_N_GO, "Stop 'n' Go" },
1596
    { STI_VEHICLE_ROLE_CYCLIST, "Cyclist" },
1597
    { STI_VEHICLE_ROLE_PEDESTRIAN, "Pedestrian" },
1598
    { STI_VEHICLE_ROLE_NON_MOTORIZED, "Non motorized" },
1599
    { STI_VEHICLE_ROLE_MILITARY, "Military" },
1600
    { STI_VEHICLE_ROLE_AGRICULTURE, "Agriculture" },
1601
    { STI_VEHICLE_ROLE_COMMERCIAL, "Commercial" },
1602
    { STI_VEHICLE_ROLE_ROAD_OPERATOR, "Road operator" },
1603
    { STI_VEHICLE_ROLE_TAXI, "Taxi" },
1604
    { 0, NULL }
1605
};
1606
1607
static const val64_string sti_weather_precip_situation_types[16] = {
1608
    { STI_WEATHER_PRECIP_SITUATON_OTHER, "Other type precipitation" },
1609
    { STI_WEATHER_PRECIP_SITUATON_UNK, "Unknown type precipitation" },
1610
    { STI_WEATHER_PRECIP_SITUATON_NO_PRECIP, "No precipitation" },
1611
    { STI_WEATHER_PRECIP_SITUATON_UNK_SLIGHT, "Unknown type slight precipitation" },
1612
    { STI_WEATHER_PRECIP_SITUATON_UNK_MODERATE, "Unknown type moderate precipitation" },
1613
    { STI_WEATHER_PRECIP_SITUATON_UNK_HEAVY, "Unknown type heavy precipitation" },
1614
    { STI_WEATHER_PRECIP_SITUATON_SNOW_SLIGHT, "Slight snow precipitation" },
1615
    { STI_WEATHER_PRECIP_SITUATON_SNOW_MODERATE, "Moderate snow precipitation" },
1616
    { STI_WEATHER_PRECIP_SITUATON_SNOW_HEAVY, "Heavy snow precipitation" },
1617
    { STI_WEATHER_PRECIP_SITUATON_RAIN_SLIGHT, "Slight rain precipitation" },
1618
    { STI_WEATHER_PRECIP_SITUATON_RAIN_MODERATE, "Moderate rain precipitation" },
1619
    { STI_WEATHER_PRECIP_SITUATON_RAIN_HEAVY, "Heavy rain precipitation" },
1620
    { STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_SLIGHT, "Slight frozen precipitation" },
1621
    { STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_MODERATE, "Moderate frozen precipitation" },
1622
    { STI_WEATHER_PRECIP_SITUATON_FROZEN_PRECIP_HEAVY, "Heavy frozen precipitation" },
1623
    { 0, NULL }
1624
};
1625
1626
static const val64_string sti_wiper_state_types[7] = {
1627
    { STI_WIPER_STATE_OFF, "Off" },
1628
    { STI_WIPER_STATE_INTERMITTENT, "Intermittent" },
1629
    { STI_WIPER_STATE_LOW, "Low" },
1630
    { STI_WIPER_STATE_HIGH, "High" },
1631
    { STI_WIPER_STATE_WASHER_IN_USE, "Washer in use" },
1632
    { STI_WIPER_STATE_AUTO, "Auto" },
1633
    { 0, NULL }
1634
};
1635
1636
static const val64_string sti_lightbar_types[8] = {
1637
    { STI_LIGHTBAR_NOT_IN_USE, "Not in use" },
1638
    { STI_LIGHTBAR_IN_USE, "In use" },
1639
    { STI_LIGHTBAR_YELLOW_CAUTION_LIGHTS, "Yellow caution lights" },
1640
    { STI_LIGHTBAR_SCHOOL_BUS_LIGHTS, "School bus lights" },
1641
    { STI_LIGHTBAR_ARROW_SIGNS_ACTIVE, "Arrow signs active" },
1642
    { STI_LIGHTBAR_SLOW_MOVING_VEHICLE, "Slow moving vehicle lights" },
1643
    { STI_LIGHTBAR_FREQ_STOPS, "Frequent stops" },
1644
    { 0, NULL }
1645
};
1646
1647
static const val64_string sti_door_state_types[4] = {
1648
    { STI_DOOR_STATE_NA, "Unknown" },
1649
    { STI_DOOR_STATE_CLOSED, "Closed" },
1650
    { STI_DOOR_STATE_OPEN, "Open" },
1651
    { 0, NULL }
1652
};
1653
1654
static const val64_string sti_fuel_type_types[10] = {
1655
    { STI_FUEL_TYPE_GASOLINE, "Gasoline" },
1656
    { STI_FUEL_TYPE_ETHANOL, "Ethanol" },
1657
    { STI_FUEL_TYPE_DIESEL, "Diesel" },
1658
    { STI_FUEL_TYPE_ELECTRIC, "Electric" },
1659
    { STI_FUEL_TYPE_HYBRID, "Hybrid" },
1660
    { STI_FUEL_TYPE_HYDROGEN, "Hydrogen" },
1661
    { STI_FUEL_TYPE_NAT_GAS_LIQUID, "NAT gas liquefied" },
1662
    { STI_FUEL_TYPE_NAT_GAS_COMP, "NAT gas compressed" },
1663
    { STI_FUEL_TYPE_PROPANE, "Propane" },
1664
    { 0, NULL }
1665
};
1666
1667
static const val64_string sti_road_class_types[5] = {
1668
    { STI_ROAD_CLASS_UNKNOWN, "Unknown" },
1669
    { STI_ROAD_CLASS_MOTORWAY, "Motorway" },
1670
    { STI_ROAD_CLASS_COUNTRY_ROAD, "Country road" },
1671
    { STI_ROAD_CLASS_LOCAL_ROAD, "Local road" },
1672
    { 0, NULL }
1673
};
1674
1675
static const val64_string sti_road_rule_types[3] = {
1676
    { STI_ROAD_RULE_RIGHT_HAND_TRAFFIC, "Right hand traffic" },
1677
    { STI_ROAD_RULE_LEFT_HAND_TRAFFIC, "Left hand traffic" },
1678
    { 0, NULL }
1679
};
1680
1681
static const val64_string sti_area_type_types[3] = {
1682
    { STI_AREA_TYPE_RURAL, "Rural" },
1683
    { STI_AREA_TYPE_URBAN, "Urban" },
1684
    { 0, NULL }
1685
};
1686
1687
static const val64_string sti_belt_buckle_status_types[3] = {
1688
    { STI_BELT_BUCKLE_DISCONNECTED, "Disconnected" },
1689
    { STI_BELT_BUCKLE_CONNECTED, "Connected" },
1690
    { 0, NULL }
1691
};
1692
1693
static const val64_string sti_transmission_type_types[3] = {
1694
    { STI_TRANSMISSION_TYPE_AUTOMATIC, "Automatic" },
1695
    { STI_TRANSMISSION_TYPE_MANUAL, "Manual" },
1696
    { 0, NULL }
1697
};
1698
1699
static const val64_string sti_physical_road_separation_types[3] = {
1700
    { STI_PHYSICAL_ROAD_SEPARATION_NOT_PRESENT, "Not present" },
1701
    { STI_PHYSICAL_ROAD_SEPARATION_PRESENT, "Present" },
1702
    { 0, NULL }
1703
};
1704
1705
static const val64_string sti_siren_types[3] = {
1706
    { STI_SIREN_NOT_IN_USE, "Not in use" },
1707
    { STI_SIREN_IN_USE, "In use" },
1708
    { 0, NULL }
1709
};
1710
1711
static const val64_string sti_lane_position_types[36] = {
1712
    { STI_LANE_POSITION_INNER_HARD_SHOULDER, "Inner hard shoulder position" },
1713
    { STI_LANE_POSITION_INNERMOST_DRIVING_LANE, "Innermost driving lane" },
1714
    { STI_LANE_POSITION_SECOND_LANE_FROM_INSIDE, "Second lane from inside" },
1715
    { STI_LANE_POSITION_THIRD_LANE_FROM_INSIDE, "Third lane from inside" },
1716
    { STI_LANE_POSITION_FOURTH_LANE_FROM_INSIDE, "Fourth lane from inside" },
1717
    { STI_LANE_POSITION_FIFTH_LANE_FROM_INSIDE, "Fifth lane from inside" },
1718
    { STI_LANE_POSITION_SIXTH_LANE_FROM_INSIDE, "Sixth lane from inside" },
1719
    { STI_LANE_POSITION_SEVENTH_LANE_FROM_INSIDE, "Seventh lane from inside" },
1720
    { STI_LANE_POSITION_EIGHTH_LANE_FROM_INSIDE, "Eighth lane from inside" },
1721
    { STI_LANE_POSITION_NINTH_LANE_FROM_INSIDE, "Ninth lane from inside" },
1722
    { STI_LANE_POSITION_TENTH_LANE_FROM_INSIDE, "Tenth lane from inside" },
1723
    { STI_LANE_POSITION_ELEVENTH_LANE_FROM_INSIDE, "Eleventh lane from inside" },
1724
    { STI_LANE_POSITION_TWELFTH_LANE_FROM_INSIDE, "Twelfth lane from inside" },
1725
    { STI_LANE_POSITION_THIRTEENTH_LANE_FROM_INSIDE, "Thirteenth lane from inside" },
1726
    { STI_LANE_POSITION_FOURTEENTH_LANE_FROM_INSIDE, "Fourteenth lane from inside" },
1727
    { STI_LANE_POSITION_FIFTEENTH_LANE_FROM_INSIDE, "Fifteenth lane from inside" },
1728
    { STI_LANE_POSITION_SIXTEENTH_LANE_FROM_INSIDE, "Sixteenth lane from inside" },
1729
    { STI_LANE_POSITION_SEVENTEENTH_LANE_FROM_INSIDE, "Seventeenth lane from inside" },
1730
    { STI_LANE_POSITION_EIGHTEENTH_LANE_FROM_INSIDE, "Eighteenth lane from inside" },
1731
    { STI_LANE_POSITION_NINETEENTH_LANE_FROM_INSIDE, "Nineteenth lane from inside" },
1732
    { STI_LANE_POSITION_TWENTIETH_LANE_FROM_INSIDE, "Twentieth lane from inside" },
1733
    { STI_LANE_POSITION_TWENTY_FIRST_LANE_FROM_INSIDE, "Twenty-first lane from inside" },
1734
    { STI_LANE_POSITION_TWENTY_SECOND_LANE_FROM_INSIDE, "Twenty-second lane from inside" },
1735
    { STI_LANE_POSITION_TWENTY_THIRD_LANE_FROM_INSIDE, "Twenty-third lane from inside" },
1736
    { STI_LANE_POSITION_TWENTY_FOURTH_LANE_FROM_INSIDE, "Twenty-fourth lane from inside" },
1737
    { STI_LANE_POSITION_TWENTY_FIFTH_LANE_FROM_INSIDE, "Twenty-fifth lane from inside" },
1738
    { STI_LANE_POSITION_TWENTY_SIXTH_LANE_FROM_INSIDE, "Twenty-sixth lane from inside" },
1739
    { STI_LANE_POSITION_TWENTY_SEVENTH_LANE_FROM_INSIDE, "Twenty-seventh lane from inside" },
1740
    { STI_LANE_POSITION_TWENTY_EIGHTH_LANE_FROM_INSIDE, "Twenty-eighth lane from inside" },
1741
    { STI_LANE_POSITION_TWENTY_NINTH_LANE_FROM_INSIDE, "Twenty-ninth lane from inside" },
1742
    { STI_LANE_POSITION_THIRTIETH_LANE_FROM_INSIDE, "Thirtieth lane from inside" },
1743
    { STI_LANE_POSITION_THIRTY_FIRST_LANE_FROM_INSIDE, "Thirty-first lane from inside" },
1744
    { STI_LANE_POSITION_THIRTY_SECOND_LANE_FROM_INSIDE, "Thirty-second lane from inside" },
1745
    { STI_LANE_POSITION_OUTER_HARD_SHOULDER, "Outer hard shoulder position" },
1746
    { STI_LANE_POSITION_OFF_THE_ROAD, "Off the road position" },
1747
    { 0, NULL }
1748
};
1749
1750
static const val64_string sti_state_types[3] = {
1751
    { STI_STATE_OFF, "Off" },
1752
    { STI_STATE_ON, "On" },
1753
    { 0, NULL }
1754
};
1755
1756
static const val64_string sti_tristate_types[4] = {
1757
    { STI_TRISTATE_OFF, "Off" },
1758
    { STI_TRISTATE_ON, "On (but not engaged)" },
1759
    { STI_TRISTATE_ENGAGED, "Engaged" },
1760
    { 0, NULL }
1761
};
1762
1763
static const value_string sti_types[STI_TYPE_LAST + 1] = {
1764
    { STI_TRANSMISSION_STATE, "Transmission state" },
1765
    { STI_STEERING_WHEEL_ANGLE, "Steering wheel angle" },
1766
    { STI_STEERING_WHEEL_ANGLE_CONF, "Steering wheel angle confidence" },
1767
    { STI_STEERING_WHEEL_ANGLE_RATE, "Steering wheel angle rate" },
1768
    { STI_DRIVING_WHEEL_ANGLE, "Driving wheel angle" },
1769
    { STI_LONG_ACC, "Longitudinal acceleration" },
1770
    { STI_LONG_ACC_CONF, "Longitudinal acceleration confidence" },
1771
    { STI_LAT_ACC, "Lateral acceleration" },
1772
    { STI_LAT_ACC_CONF, "Lateral acceleration confidence" },
1773
    { STI_VERT_ACC, "Vertical acceleration" },
1774
    { STI_VERT_ACC_CONF, "Vertical acceleration confidence" },
1775
    { STI_YAW_RATE, "Yaw rate" },
1776
    { STI_YAW_RATE_CONF, "Yaw rate confidence" },
1777
    { STI_BRAKE_STATUS_LEFT_FRONT, "Front left brake applied pressure" },
1778
    { STI_BRAKE_STATUS_LEFT_REAR, "Rear left brake applied pressure" },
1779
    { STI_BRAKE_STATUS_RIGHT_FRONT, "Front right brake applied pressure" },
1780
    { STI_BRAKE_STATUS_RIGHT_REAR, "Rear right brake applied pressure" },
1781
    { STI_TRACTION_CONTROL_STATUS, "Traction control status" },
1782
    { STI_ABS, "Anti-lock braking system status" },
1783
    { STI_STABILITY_CONTROL_STATUS, "Stability control status" },
1784
    { STI_EMERGENCY_BRAKE, "Emergency brake status, also known as 'Brake boost'" },
1785
    { STI_AUX_BRAKES, "Auxiliary brake status" },
1786
    { STI_VEHICLE_WIDTH, "Vehicle width" },
1787
    { STI_VEHICLE_LENGTH, "Vehicle length" },
1788
    { STI_VEHICLE_LENGTH_CONF, "Vehicle length confidence" },
1789
    { STI_VEHICLE_HEIGHT, "Vehicle height" },
1790
    { STI_VEHICLE_MASS, "Vehicle mass" },
1791
    { STI_EV_STOP_LINE_VIOLATED, "Stop line violated" },
1792
    { STI_DANGEROUS_GOODS, "Dangerous goods present" },
1793
    { STI_EV_FLAT_TIRE, "Flat tire" },
1794
    { STI_EV_DISABLED_VEHICLE, "Disabled vehicle" },
1795
    { STI_EV_AIRBAG_DEPLOYED, "Airbag deployed" },
1796
    { STI_EXT_LIGHT_LOWBEAM_HEAD, "Low beam headlight" },
1797
    { STI_EXT_LIGHT_HIGHBEAM_HEAD, "High beam headlight" },
1798
    { STI_EXT_LIGHT_LEFT_TURN_SIGNAL, "Left turn signal" },
1799
    { STI_EXT_LIGHT_RIGHT_TURN_SIGNAL, "Right turn signal" },
1800
    { STI_EXT_LIGHT_HAZARD_LIGHT, "Hazard light" },
1801
    { STI_EXT_LIGHT_AUTO_LIGHT_CONTROL, "Auto light control" },
1802
    { STI_EXT_LIGHT_DAYTIME_RUNNING, "Daytime running light" },
1803
    { STI_EXT_LIGHT_FOG, "Fog light" },
1804
    { STI_EXT_LIGHT_PARKING, "Parking light" },
1805
    { STI_EXT_LIGHT_REVERSE, "Reverse light" },
1806
    { STI_STATION_TYPE, "Station type" },
1807
    { STI_VEHICLE_ROLE, "Vehicle role" },
1808
    { STI_BUMPER_HEIGHT_FRONT, "Height of the front bumper" },
1809
    { STI_BUMPER_HEIGHT_REAR, "Height of the rear bumper" },
1810
    { STI_WEATHER_RAIN_RATE, "Rain rate" },
1811
    { STI_RAIN_SENSOR, "Rain sensor" },
1812
    { STI_WEATHER_PRECIP_SITUATON, "Precipitation situation" },
1813
    { STI_WEATHER_SOLAR_RADIATION, "Solar radiation" },
1814
    { STI_WEATHER_COEF_FRICTION, "Coefficient of friction" },
1815
    { STI_WEATHER_AIR_TEMP, "Ambient air temperature" },
1816
    { STI_WEATHER_AIR_PRESSURE, "Ambient air pressure" },
1817
    { STI_WIPER_STATE_FRONT, "Front wiper state" },
1818
    { STI_WIPER_STATE_REAR, "Rear wiper state" },
1819
    { STI_WIPER_RATE_FRONT, "Front wiper rate" },
1820
    { STI_WIPER_RATE_REAR, "Rear wiper rate" },
1821
    { STI_EMBARKATION_STATUS, "Embarkation status" },
1822
    { STI_LIGHTBAR, "Lightbar status" },
1823
    { STI_SIREN, "Siren status" },
1824
    { STI_ACCELERATOR_PEDAL, "Accelerator pedal position" },
1825
    { STI_BRAKE_PEDAL, "Brake pedal position" },
1826
    { STI_COLLISION_WARNING, "Collision warning" },
1827
    { STI_ADAPTIVE_CRUISE_CONTROL, "Adaptive cruise control status" },
1828
    { STI_CRUISE_CONTROL, "Cruise control status" },
1829
    { STI_SPEED_LIMITER, "Speed limiter status" },
1830
    { STI_LANE_POSITION, "Lane position" },
1831
    { STI_TRAILER_WEIGHT, "Trailer weight" },
1832
    { STI_DOOR_STATE_FRONT_LEFT, "Front left door state" },
1833
    { STI_DOOR_STATE_FRONT_RIGHT, "Front right door state" },
1834
    { STI_DOOR_STATE_REAR_LEFT, "Rear left door state" },
1835
    { STI_DOOR_STATE_REAR_RIGHT, "Rear right door state" },
1836
    { STI_DOOR_STATE_BONNET, "Bonnet state" },
1837
    { STI_DOOR_STATE_TRUNK, "Trunk state" },
1838
    { STI_FUEL_TYPE, "Fuel type" },
1839
    { STI_ROAD_CLASS, "Road class" },
1840
    { STI_ROAD_RULE, "Road rule" },
1841
    { STI_AREA_TYPE, "Area type" },
1842
    { STI_AUTOMATIC_EMERGENCY_BRAKE, "Automatic emergency brake status" },
1843
    { STI_REVERSIBLE_OCCUPANT_RESTRAINT_SYSTEM, "Reversible Occupant Restraint System status" },
1844
    { STI_RED_WARNING_ACTIVE, "A red warning light is active in the vehicle" },
1845
    { STI_BELT_BUCKLE_ROW1_DRIVER, "First row belt buckle status on the driver side" },
1846
    { STI_BELT_BUCKLE_ROW1_MIDDLE, "First row belt buckle status on the middle" },
1847
    { STI_BELT_BUCKLE_ROW1_PASSENGER, "First row belt buckle status on the passenger side" },
1848
    { STI_BELT_BUCKLE_ROW2_DRIVER, "Second row belt buckle status on the driver side" },
1849
    { STI_BELT_BUCKLE_ROW2_MIDDLE, "Second row belt buckle status on the middle" },
1850
    { STI_BELT_BUCKLE_ROW2_PASSENGER, "Second row belt buckle status on the passenger side" },
1851
    { STI_BELT_BUCKLE_ROW3_DRIVER, "Third row belt buckle status on the driver side" },
1852
    { STI_BELT_BUCKLE_ROW3_MIDDLE, "Third row belt buckle status on the middle" },
1853
    { STI_BELT_BUCKLE_ROW3_PASSENGER, "Third row belt buckle status on the passenger side" },
1854
    { STI_IGNITION, "Ignition status" },
1855
    { STI_TRANSMISSION_TYPE, "Type of the transmission" },
1856
    { STI_PHYSICAL_ROAD_SEPARATION, "Presence of physical separation between own and oncoming lanes of the road/highway" },
1857
    { STI_MANUAL_ECALL, "Manual eCall triggered" },
1858
    { STI_LOW_SEVERITY_CRASH, "Low severity crash" },
1859
    { STI_PEDESTRIAN_COLLISION, "Pedestrian collision" },
1860
    { STI_HIGH_SEVERITY_CRASH, "High severity crash" },
1861
    { STI_EV_JACKKNIFE, "Jackknife" },
1862
    { STI_COUNTRY_CODE, "Country code" },
1863
    { STI_PROJECT_00, "Project #0" },
1864
    { STI_PROJECT_01, "Project #1" },
1865
    { STI_PROJECT_02, "Project #2" },
1866
    { STI_PROJECT_03, "Project #3" },
1867
    { STI_PROJECT_04, "Project #4" },
1868
    { STI_PROJECT_05, "Project #5" },
1869
    { STI_PROJECT_06, "Project #6" },
1870
    { STI_PROJECT_07, "Project #7" },
1871
    { STI_PROJECT_08, "Project #8" },
1872
    { STI_PROJECT_09, "Project #9" },
1873
    { STI_PROJECT_10, "Project #10" },
1874
    { STI_PROJECT_11, "Project #11" },
1875
    { STI_PROJECT_12, "Project #12" },
1876
    { STI_PROJECT_13, "Project #13" },
1877
    { STI_PROJECT_14, "Project #14" },
1878
    { STI_PROJECT_15, "Project #15" },
1879
    { STI_PROJECT_16, "Project #16" },
1880
    { STI_PROJECT_17, "Project #17" },
1881
    { STI_PROJECT_18, "Project #18" },
1882
    { STI_PROJECT_19, "Project #19" },
1883
    { STI_PROJECT_20, "Project #20" },
1884
    { STI_PROJECT_21, "Project #21" },
1885
    { STI_PROJECT_22, "Project #22" },
1886
    { STI_PROJECT_23, "Project #23" },
1887
    { STI_PROJECT_24, "Project #24" },
1888
    { STI_PROJECT_25, "Project #25" },
1889
    { STI_PROJECT_26, "Project #26" },
1890
    { STI_PROJECT_27, "Project #27" },
1891
    { STI_PROJECT_28, "Project #28" },
1892
    { STI_PROJECT_29, "Project #29" },
1893
    { STI_PROJECT_30, "Project #30" },
1894
    { STI_PROJECT_31, "Project #31" },
1895
    { 0, NULL }
1896
};
1897
1898
1899
/** STI parameters to hf_index mapping */
1900
static const int* const sti_params[STI_TYPE_LAST] = {
1901
    [STI_TRANSMISSION_STATE] = &hf_c2p_sti_value_transmission_state_desc,
1902
    [STI_STEERING_WHEEL_ANGLE] = &hf_c2p_sti_value_angle_desc,
1903
    [STI_STEERING_WHEEL_ANGLE_CONF] = &hf_c2p_sti_value_angle_desc,
1904
    [STI_STEERING_WHEEL_ANGLE_RATE] = &hf_c2p_sti_value_angular_velocity_desc,
1905
    [STI_DRIVING_WHEEL_ANGLE] = &hf_c2p_sti_value_angle_desc,
1906
    [STI_LONG_ACC] = &hf_c2p_sti_value_acceleration_desc,
1907
    [STI_LONG_ACC_CONF] = &hf_c2p_sti_value_acceleration_desc,
1908
    [STI_LAT_ACC] = &hf_c2p_sti_value_acceleration_desc,
1909
    [STI_LAT_ACC_CONF] = &hf_c2p_sti_value_acceleration_desc,
1910
    [STI_VERT_ACC] = &hf_c2p_sti_value_acceleration_desc,
1911
    [STI_VERT_ACC_CONF] = &hf_c2p_sti_value_acceleration_desc,
1912
    [STI_YAW_RATE] = &hf_c2p_sti_value_angular_velocity_desc,
1913
    [STI_YAW_RATE_CONF] = &hf_c2p_sti_value_angular_velocity_desc,
1914
    [STI_BRAKE_STATUS_LEFT_FRONT] = &hf_c2p_sti_value_thousandths_desc,
1915
    [STI_BRAKE_STATUS_LEFT_REAR] = &hf_c2p_sti_value_thousandths_desc,
1916
    [STI_BRAKE_STATUS_RIGHT_FRONT] = &hf_c2p_sti_value_thousandths_desc,
1917
    [STI_BRAKE_STATUS_RIGHT_REAR] = &hf_c2p_sti_value_thousandths_desc,
1918
    [STI_TRACTION_CONTROL_STATUS] = &hf_c2p_sti_value_tristate_desc,
1919
    [STI_ABS] = &hf_c2p_sti_value_tristate_desc,
1920
    [STI_STABILITY_CONTROL_STATUS] = &hf_c2p_sti_value_tristate_desc,
1921
    [STI_EMERGENCY_BRAKE] = &hf_c2p_sti_value_state_desc,
1922
    [STI_AUX_BRAKES] = &hf_c2p_sti_value_aux_breaks_desc,
1923
    [STI_VEHICLE_WIDTH] = &hf_c2p_sti_value_length_desc,
1924
    [STI_VEHICLE_LENGTH] = &hf_c2p_sti_value_length_desc,
1925
    [STI_VEHICLE_LENGTH_CONF] = &hf_c2p_sti_value_vehicle_length_conf_desc,
1926
    [STI_VEHICLE_HEIGHT] = &hf_c2p_sti_value_length_desc,
1927
    [STI_VEHICLE_MASS] = &hf_c2p_sti_value_mass_desc,
1928
    [STI_EV_STOP_LINE_VIOLATED] = &hf_c2p_sti_value_state_desc,
1929
    [STI_DANGEROUS_GOODS] = &hf_c2p_sti_value_dangerous_goods_desc,
1930
    [STI_EV_FLAT_TIRE] = &hf_c2p_sti_value_state_desc,
1931
    [STI_EV_DISABLED_VEHICLE] = &hf_c2p_sti_value_state_desc,
1932
    [STI_EV_AIRBAG_DEPLOYED] = &hf_c2p_sti_value_state_desc,
1933
    [STI_EXT_LIGHT_LOWBEAM_HEAD] = &hf_c2p_sti_value_state_desc,
1934
    [STI_EXT_LIGHT_HIGHBEAM_HEAD] = &hf_c2p_sti_value_state_desc,
1935
    [STI_EXT_LIGHT_LEFT_TURN_SIGNAL] = &hf_c2p_sti_value_state_desc,
1936
    [STI_EXT_LIGHT_RIGHT_TURN_SIGNAL] = &hf_c2p_sti_value_state_desc,
1937
    [STI_EXT_LIGHT_HAZARD_LIGHT] = &hf_c2p_sti_value_state_desc,
1938
    [STI_EXT_LIGHT_AUTO_LIGHT_CONTROL] = &hf_c2p_sti_value_state_desc,
1939
    [STI_EXT_LIGHT_DAYTIME_RUNNING] = &hf_c2p_sti_value_state_desc,
1940
    [STI_EXT_LIGHT_FOG] = &hf_c2p_sti_value_state_desc,
1941
    [STI_EXT_LIGHT_PARKING] = &hf_c2p_sti_value_state_desc,
1942
    [STI_EXT_LIGHT_REVERSE] = &hf_c2p_sti_value_state_desc,
1943
    [STI_STATION_TYPE] = &hf_c2p_sti_value_station_type_desc,
1944
    [STI_VEHICLE_ROLE] = &hf_c2p_sti_value_vehicle_role_desc,
1945
    [STI_BUMPER_HEIGHT_FRONT] = &hf_c2p_sti_value_length_desc,
1946
    [STI_BUMPER_HEIGHT_REAR] = &hf_c2p_sti_value_length_desc,
1947
    [STI_WEATHER_RAIN_RATE] = &hf_c2p_sti_value_rain_rate_desc,
1948
    [STI_RAIN_SENSOR] = &hf_c2p_sti_value_thousandths_desc,
1949
    [STI_WEATHER_PRECIP_SITUATON] = &hf_c2p_sti_value_weather_precip_situation_desc,
1950
    [STI_WEATHER_SOLAR_RADIATION] = &hf_c2p_sti_value_solar_irradiance_desc,
1951
    [STI_WEATHER_COEF_FRICTION] = &hf_c2p_sti_value_thousandths_desc,
1952
    [STI_WEATHER_AIR_TEMP] = &hf_c2p_sti_value_temperature_desc,
1953
    [STI_WEATHER_AIR_PRESSURE] = &hf_c2p_sti_value_pressure_desc,
1954
    [STI_WIPER_STATE_FRONT] = &hf_c2p_sti_value_wiper_state_desc,
1955
    [STI_WIPER_STATE_REAR] = &hf_c2p_sti_value_wiper_state_desc,
1956
    [STI_WIPER_RATE_FRONT] = &hf_c2p_sti_value_sweep_rate_desc,
1957
    [STI_WIPER_RATE_REAR] = &hf_c2p_sti_value_sweep_rate_desc,
1958
    [STI_EMBARKATION_STATUS] = &hf_c2p_sti_value_state_desc,
1959
    [STI_LIGHTBAR] = &hf_c2p_sti_value_lightbar_desc,
1960
    [STI_SIREN] = &hf_c2p_sti_value_siren_desc,
1961
    [STI_ACCELERATOR_PEDAL] = &hf_c2p_sti_value_thousandths_desc,
1962
    [STI_BRAKE_PEDAL] = &hf_c2p_sti_value_thousandths_desc,
1963
    [STI_COLLISION_WARNING] = &hf_c2p_sti_value_state_desc,
1964
    [STI_ADAPTIVE_CRUISE_CONTROL] = &hf_c2p_sti_value_state_desc,
1965
    [STI_CRUISE_CONTROL] = &hf_c2p_sti_value_state_desc,
1966
    [STI_SPEED_LIMITER] = &hf_c2p_sti_value_state_desc,
1967
    [STI_LANE_POSITION] = &hf_c2p_sti_value_lane_position_desc,
1968
    [STI_TRAILER_WEIGHT] = &hf_c2p_sti_value_mass_desc,
1969
    [STI_DOOR_STATE_FRONT_LEFT] = &hf_c2p_sti_value_door_state_desc,
1970
    [STI_DOOR_STATE_FRONT_RIGHT] = &hf_c2p_sti_value_door_state_desc,
1971
    [STI_DOOR_STATE_REAR_LEFT] = &hf_c2p_sti_value_door_state_desc,
1972
    [STI_DOOR_STATE_REAR_RIGHT] = &hf_c2p_sti_value_door_state_desc,
1973
    [STI_DOOR_STATE_BONNET] = &hf_c2p_sti_value_door_state_desc,
1974
    [STI_DOOR_STATE_TRUNK] = &hf_c2p_sti_value_door_state_desc,
1975
    [STI_FUEL_TYPE] = &hf_c2p_sti_value_fuel_type_desc,
1976
    [STI_ROAD_CLASS] = &hf_c2p_sti_value_road_class_desc,
1977
    [STI_ROAD_RULE] = &hf_c2p_sti_value_road_rule_desc,
1978
    [STI_AREA_TYPE] = &hf_c2p_sti_value_area_type_desc,
1979
    [STI_AUTOMATIC_EMERGENCY_BRAKE] = &hf_c2p_sti_value_state_desc,
1980
    [STI_REVERSIBLE_OCCUPANT_RESTRAINT_SYSTEM] = &hf_c2p_sti_value_state_desc,
1981
    [STI_RED_WARNING_ACTIVE] = &hf_c2p_sti_value_state_desc,
1982
    [STI_BELT_BUCKLE_ROW1_DRIVER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1983
    [STI_BELT_BUCKLE_ROW1_MIDDLE] = &hf_c2p_sti_value_belt_buckle_status_desc,
1984
    [STI_BELT_BUCKLE_ROW1_PASSENGER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1985
    [STI_BELT_BUCKLE_ROW2_DRIVER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1986
    [STI_BELT_BUCKLE_ROW2_MIDDLE] = &hf_c2p_sti_value_belt_buckle_status_desc,
1987
    [STI_BELT_BUCKLE_ROW2_PASSENGER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1988
    [STI_BELT_BUCKLE_ROW3_DRIVER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1989
    [STI_BELT_BUCKLE_ROW3_MIDDLE] = &hf_c2p_sti_value_belt_buckle_status_desc,
1990
    [STI_BELT_BUCKLE_ROW3_PASSENGER] = &hf_c2p_sti_value_belt_buckle_status_desc,
1991
    [STI_IGNITION] = &hf_c2p_sti_value_state_desc,
1992
    [STI_TRANSMISSION_TYPE] = &hf_c2p_sti_value_transmission_type_desc,
1993
    [STI_PHYSICAL_ROAD_SEPARATION] = &hf_c2p_sti_value_physical_road_separation_desc,
1994
    [STI_MANUAL_ECALL] = &hf_c2p_sti_value_state_desc,
1995
    [STI_LOW_SEVERITY_CRASH] = &hf_c2p_sti_value_state_desc,
1996
    [STI_PEDESTRIAN_COLLISION] = &hf_c2p_sti_value_state_desc,
1997
    [STI_HIGH_SEVERITY_CRASH] = &hf_c2p_sti_value_state_desc,
1998
    [STI_EV_JACKKNIFE] = &hf_c2p_sti_value_state_desc,
1999
    [STI_COUNTRY_CODE] = &hf_c2p_sti_value_integer_desc,
2000
    [STI_PROJECT_00] = &hf_c2p_sti_value_integer_desc,
2001
    [STI_PROJECT_01] = &hf_c2p_sti_value_integer_desc,
2002
    [STI_PROJECT_02] = &hf_c2p_sti_value_integer_desc,
2003
    [STI_PROJECT_03] = &hf_c2p_sti_value_integer_desc,
2004
    [STI_PROJECT_04] = &hf_c2p_sti_value_integer_desc,
2005
    [STI_PROJECT_05] = &hf_c2p_sti_value_integer_desc,
2006
    [STI_PROJECT_06] = &hf_c2p_sti_value_integer_desc,
2007
    [STI_PROJECT_07] = &hf_c2p_sti_value_integer_desc,
2008
    [STI_PROJECT_08] = &hf_c2p_sti_value_integer_desc,
2009
    [STI_PROJECT_09] = &hf_c2p_sti_value_integer_desc,
2010
    [STI_PROJECT_10] = &hf_c2p_sti_value_integer_desc,
2011
    [STI_PROJECT_11] = &hf_c2p_sti_value_integer_desc,
2012
    [STI_PROJECT_12] = &hf_c2p_sti_value_integer_desc,
2013
    [STI_PROJECT_13] = &hf_c2p_sti_value_integer_desc,
2014
    [STI_PROJECT_14] = &hf_c2p_sti_value_integer_desc,
2015
    [STI_PROJECT_15] = &hf_c2p_sti_value_integer_desc,
2016
    [STI_PROJECT_16] = &hf_c2p_sti_value_integer_desc,
2017
    [STI_PROJECT_17] = &hf_c2p_sti_value_integer_desc,
2018
    [STI_PROJECT_18] = &hf_c2p_sti_value_integer_desc,
2019
    [STI_PROJECT_19] = &hf_c2p_sti_value_integer_desc,
2020
    [STI_PROJECT_20] = &hf_c2p_sti_value_integer_desc,
2021
    [STI_PROJECT_21] = &hf_c2p_sti_value_integer_desc,
2022
    [STI_PROJECT_22] = &hf_c2p_sti_value_integer_desc,
2023
    [STI_PROJECT_23] = &hf_c2p_sti_value_integer_desc,
2024
    [STI_PROJECT_24] = &hf_c2p_sti_value_integer_desc,
2025
    [STI_PROJECT_25] = &hf_c2p_sti_value_integer_desc,
2026
    [STI_PROJECT_26] = &hf_c2p_sti_value_integer_desc,
2027
    [STI_PROJECT_27] = &hf_c2p_sti_value_integer_desc,
2028
    [STI_PROJECT_28] = &hf_c2p_sti_value_integer_desc,
2029
    [STI_PROJECT_29] = &hf_c2p_sti_value_integer_desc,
2030
    [STI_PROJECT_30] = &hf_c2p_sti_value_integer_desc,
2031
    [STI_PROJECT_31] = &hf_c2p_sti_value_integer_desc,
2032
};
2033
2034
static void c2p_set_tst_proto_item_info(tvbuff_t* tvb, int offset, proto_item* ti)
2035
22
{
2036
22
    if((NULL != tvb) && (NULL != ti)) {
2037
22
        uint32_t tst_sec = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
2038
22
        uint32_t tst_msec = tvb_get_uint32(tvb, offset + 4, ENC_BIG_ENDIAN);
2039
2040
22
        static const time_t TIME_2004_IN_ABSTIME = 1072915200ULL;
2041
22
        time_t timestamp = tst_sec + TIME_2004_IN_ABSTIME;
2042
22
        struct tm* utc_time = gmtime(&timestamp);
2043
2044
22
        enum { TIMETAMP_STR_MAX_LEN = 128UL };
2045
22
        char timestamp_str[TIMETAMP_STR_MAX_LEN] = {0};
2046
22
        strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", utc_time);
2047
2048
22
        proto_item_append_text(ti, " - %s.%03lu GMT", timestamp_str, (unsigned long)tst_msec);
2049
22
    }
2050
22
}
2051
2052
static void c2p_channel_format(char* string, uint32_t value)
2053
0
{
2054
0
    static const uint8_t CHANNEL_NA = 0U;
2055
2056
0
    if(CHANNEL_NA == value) {
2057
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%u)", value);
2058
0
    } else {
2059
0
        snprintf(string, ITEM_LABEL_LENGTH, "%u", value);
2060
0
    }
2061
0
}
2062
2063
static void c2p_datarate_format(char* string, uint32_t value)
2064
0
{
2065
0
    static const uint8_t DATARATE_NA = 0U;
2066
2067
0
    if(DATARATE_NA == value) {
2068
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%u)", value);
2069
0
    } else {
2070
0
        static const uint32_t DATARATE_500_KBPS_TO_KBPS_FACTOR = 500UL;
2071
0
        uint32_t value_kbps = value * DATARATE_500_KBPS_TO_KBPS_FACTOR;
2072
0
        snprintf(string, ITEM_LABEL_LENGTH, "%lu Kbps (%u)", (unsigned long)value_kbps, value);
2073
0
    }
2074
0
}
2075
2076
static void c2p_latitude_format(char* string, uint32_t value)
2077
0
{
2078
0
    int32_t lat = (int32_t)value;
2079
0
    static const int32_t LATITUDE_NA = 900000001L;
2080
2081
0
    if(LATITUDE_NA == lat) {
2082
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%ld)", (long int)lat);
2083
0
    } else {
2084
0
        snprintf(string, ITEM_LABEL_LENGTH, "%d°%d'%.3f\"%c (%d)",
2085
0
                 abs(lat) / 10000000,
2086
0
                 abs(lat) % 10000000 * 6 / 1000000,
2087
0
                 abs(lat) % 10000000 * 6 % 1000000 * 6.0 / 100000.0,
2088
0
                 (lat >= 0) ? 'N' : 'S',
2089
0
                 lat);
2090
0
    }
2091
0
}
2092
2093
static void c2p_longitude_format(char* string, uint32_t value)
2094
0
{
2095
0
    int32_t lon = (int32_t)value;
2096
0
    static const int32_t LONGITUDE_NA = 1800000001L;
2097
2098
0
    if(LONGITUDE_NA == lon) {
2099
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%ld)", (long int)lon);
2100
0
    } else {
2101
0
        snprintf(string, ITEM_LABEL_LENGTH, "%d°%d'%.3f\"%c (%d)",
2102
0
                 abs(lon) / 10000000,
2103
0
                 abs(lon) % 10000000 * 6 / 1000000,
2104
0
                 abs(lon) % 10000000 * 6 % 1000000 * 6.0 / 100000.0,
2105
0
                 (lon >= 0) ? 'E' : 'W',
2106
0
                 lon);
2107
0
    }
2108
0
}
2109
2110
static void c2p_altitude_format(char* string, uint32_t value)
2111
0
{
2112
0
    int32_t alt = (int32_t)value;
2113
0
    static const int32_t ALTIITUDE_NA = 800001L;
2114
2115
0
    if(ALTIITUDE_NA == alt) {
2116
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%ld)", (long int)alt);
2117
0
    } else {
2118
0
        static const double FACTOR_0P01_M_TO_M_FACTOR = 0.01;
2119
2120
0
        double value_m = alt * FACTOR_0P01_M_TO_M_FACTOR;
2121
2122
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.2f m (%ld)", value_m, (long int)alt);
2123
0
    }
2124
0
}
2125
2126
static void c2p_speed_format(char* string, uint32_t value)
2127
0
{
2128
0
    static const uint32_t SPEED_STANDSTILL = 0UL;
2129
0
    static const uint32_t SPEED_NA = 16383UL;
2130
2131
0
    if(SPEED_STANDSTILL == value) {
2132
0
        snprintf(string, ITEM_LABEL_LENGTH, "Standstill (%lu)", (unsigned long)value);
2133
0
    } else if(SPEED_NA == value) {
2134
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2135
0
    } else {
2136
0
        static const double FACTOR_0P01_MPS_TO_MPS_FACTOR = 0.01;
2137
0
        static const double FACTOR_MPS_TO_KMPH_FACTOR = 3.6;
2138
2139
0
        double v_mps = value * FACTOR_0P01_MPS_TO_MPS_FACTOR;
2140
0
        double v_kmph = v_mps * FACTOR_MPS_TO_KMPH_FACTOR;
2141
2142
0
        snprintf(string,
2143
0
                 ITEM_LABEL_LENGTH,
2144
0
                 "%.2f m/s = %.1f km/h (%lu)",
2145
0
                 v_mps,
2146
0
                 v_kmph,
2147
0
                 (unsigned long)value);
2148
0
    }
2149
0
}
2150
2151
static void c2p_heading_format(char* string, uint32_t value)
2152
0
{
2153
0
    const char* p = try_val_to_str(value, VALS(heading_predefined_values));
2154
0
    if(NULL != p) {
2155
0
        snprintf(string, ITEM_LABEL_LENGTH, "%s (%lu)", p, (unsigned long)value);
2156
0
    } else {
2157
0
        static const double FACTOR_0P1_DEG_TO_DEG_FACTOR = 0.1;
2158
0
        double value_deg = value * FACTOR_0P1_DEG_TO_DEG_FACTOR;
2159
2160
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.1f° (%lu)", value_deg, (unsigned long)value);
2161
0
    }
2162
0
}
2163
2164
static void c2p_semi_axis_format(char* string, uint32_t value)
2165
0
{
2166
0
    static const uint16_t SEMI_AXIS_NA = 4095U;
2167
0
    static const uint16_t SEMI_AXIS_OOR = 4094U;
2168
2169
0
    if(SEMI_AXIS_NA == value) {
2170
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2171
0
    } else if(SEMI_AXIS_OOR == value) {
2172
0
        snprintf(string, ITEM_LABEL_LENGTH, "Out of range (%lu)", (unsigned long)value);
2173
0
    } else {
2174
0
        static const double FACTOR_0P01_M_TO_M_FACTOR = 0.01;
2175
2176
0
        double value_m = value * FACTOR_0P01_M_TO_M_FACTOR;
2177
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.2f m (%lu)", value_m, (unsigned long)value);
2178
0
    }
2179
0
}
2180
2181
static void c2p_altitude_acc_format(char* string, uint32_t value)
2182
0
{
2183
0
    static const uint16_t ALTITUDE_ACC_NA = 65535U;
2184
2185
0
    if(ALTITUDE_ACC_NA == value) {
2186
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2187
0
    } else {
2188
0
        static const double FACTOR_0P01_M_TO_M_FACTOR = 0.01;
2189
2190
0
        double value_m = value * FACTOR_0P01_M_TO_M_FACTOR;
2191
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.2f m (%lu)", value_m, (unsigned long)value);
2192
0
    }
2193
0
}
2194
2195
static void c2p_heading_acc_format(char* string, uint32_t value)
2196
0
{
2197
0
    static const uint16_t HEADING_ACC_NA = 127U;
2198
2199
0
    if(HEADING_ACC_NA == value) {
2200
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2201
0
    } else {
2202
0
        static const double FACTOR_0P1_DEG_TO_DEG_FACTOR = 0.1;
2203
0
        double value_deg = value * FACTOR_0P1_DEG_TO_DEG_FACTOR;
2204
2205
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.1f° (%lu)", value_deg, (unsigned long)value);
2206
0
    }
2207
0
}
2208
2209
static void c2p_speed_acc_format(char* string, uint32_t value)
2210
0
{
2211
0
    static const uint16_t SPEED_ACC_NA = 127U;
2212
2213
0
    if(SPEED_ACC_NA == value) {
2214
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2215
0
    } else {
2216
0
        static const double FACTOR_0P01_MPS_TO_MPS_FACTOR = 0.01;
2217
0
        static const double FACTOR_MPS_TO_KMPH_FACTOR = 3.6;
2218
2219
0
        double v_mps = value * FACTOR_0P01_MPS_TO_MPS_FACTOR;
2220
0
        double v_kmph = v_mps * FACTOR_MPS_TO_KMPH_FACTOR;
2221
2222
0
        snprintf(string,
2223
0
                 ITEM_LABEL_LENGTH,
2224
0
                 "%.2f m/s = %.1f km/h (%lu)",
2225
0
                 v_mps,
2226
0
                 v_kmph,
2227
0
                 (unsigned long)value);
2228
0
    }
2229
0
}
2230
2231
static void c2p_power_format(char* string, uint32_t value)
2232
0
{
2233
0
    int8_t rssi = (int8_t)value;
2234
0
    static const int8_t RSSI_NA = 127;
2235
2236
0
    if(RSSI_NA == rssi) {
2237
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%d)", rssi);
2238
0
    } else {
2239
0
        snprintf(string, ITEM_LABEL_LENGTH, "%d dBm", rssi);
2240
0
    }
2241
0
}
2242
2243
static void c2p_power_dbm_format(char* string, int32_t value)
2244
0
{
2245
0
    static const int32_t POWER_NA = INT16_MAX;
2246
2247
0
    if(POWER_NA == value) {
2248
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%ld)", (long)value);
2249
0
    } else {
2250
0
        snprintf(string, ITEM_LABEL_LENGTH, "%ld dBm", (long)value);
2251
0
    }
2252
0
}
2253
2254
static const value_string priority_format_vals[] = {
2255
    {0, "Highest priority"},
2256
    {1, "Level 1 priority"},
2257
    {2, "Level 2 priority"},
2258
    {3, "Level 3 priority"},
2259
    {4, "Level 4 priority"},
2260
    {5, "Level 5 priority"},
2261
    {6, "Level 6 priority"},
2262
    {7, "Lowest priority"},
2263
    {0, NULL}
2264
};
2265
2266
static void c2p_cbr_format(char* string, uint32_t value)
2267
0
{
2268
0
    static const uint16_t CBR_NA = 1001U;
2269
2270
0
    if(CBR_NA == value) {
2271
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2272
0
    } else {
2273
0
        static const double FACTOR_0P1_PERC_TO_PERC_FACTOR = 0.1;
2274
0
        double value_perc = value * FACTOR_0P1_PERC_TO_PERC_FACTOR;
2275
2276
0
        snprintf(string, ITEM_LABEL_LENGTH, "%.1f %% (%lu)", value_perc, (unsigned long)value);
2277
0
    }
2278
0
}
2279
2280
static void c2p_gps_timestamp_format(char* string, uint64_t value)
2281
0
{
2282
0
    static const uint64_t GPS_TIMESTAMP_NA = 0U;
2283
2284
0
    if(GPS_TIMESTAMP_NA == value) {
2285
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%" PRIu64 ")", value);
2286
0
    } else {
2287
0
        time_t timestamp = value / 1000ULL;
2288
0
        uint32_t tst_msec = value % 1000UL;
2289
0
        struct tm* utc_time = gmtime(&timestamp);
2290
2291
0
        enum { TIMETAMP_STR_MAX_LEN = 128UL };
2292
0
        char timestamp_str[TIMETAMP_STR_MAX_LEN] = {0};
2293
0
        strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", utc_time);
2294
2295
0
        snprintf(string,
2296
0
                 ITEM_LABEL_LENGTH,
2297
0
                 "%s.%03lu GMT (%" PRIu64 ")",
2298
0
                 timestamp_str,
2299
0
                 (unsigned long)tst_msec,
2300
0
                 value);
2301
0
    }
2302
0
}
2303
2304
static bool c2p_sti_value_common_format(char* string, int64_t value)
2305
0
{
2306
0
    bool formatted = true;
2307
0
    static const int64_t STI_VALUE_NA = INT64_MIN;
2308
0
    static const int64_t STI_VALUE_OOR_MIN = INT64_MIN + INT64_C(1);
2309
0
    static const int64_t STI_VALUE_OOR_MAX = INT64_MAX;
2310
2311
0
    if(STI_VALUE_NA == value) {
2312
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%" PRId64 ")", value);
2313
0
    } else if(STI_VALUE_OOR_MIN == value) {
2314
0
        snprintf(string,
2315
0
                 ITEM_LABEL_LENGTH,
2316
0
                 "Out of range (minimum) (%" PRId64 ")",
2317
0
                 value);
2318
0
    } else if(STI_VALUE_OOR_MAX == value) {
2319
0
        snprintf(string,
2320
0
                 ITEM_LABEL_LENGTH,
2321
0
                 "Out of range (maximum) (%" PRId64 ")",
2322
0
                 value);
2323
0
    } else {
2324
0
        formatted = false;
2325
0
    }
2326
2327
0
    return formatted;
2328
0
}
2329
2330
2331
static void c2p_sti_value_angle_format(char* string, int64_t value)
2332
0
{
2333
0
    if(!c2p_sti_value_common_format(string, value)) {
2334
0
        static const double FACTOR_0P001_DEG_TO_DEG_FACTOR = 0.001;
2335
0
        double value_deg = value * FACTOR_0P001_DEG_TO_DEG_FACTOR;
2336
2337
0
        snprintf(string,
2338
0
                 ITEM_LABEL_LENGTH,
2339
0
                 "%.3f° (%" PRId64 ")",
2340
0
                 value_deg,
2341
0
                 value);
2342
0
    }
2343
0
}
2344
2345
static void c2p_sti_value_acceleration_format(char* string, int64_t value)
2346
0
{
2347
0
    if(!c2p_sti_value_common_format(string, value)) {
2348
0
        static const double MMPS2_TO_MPS2_FACTOR = 0.001;
2349
0
        double value_mps2 = value * MMPS2_TO_MPS2_FACTOR;
2350
2351
0
        snprintf(string,
2352
0
                 ITEM_LABEL_LENGTH,
2353
0
                 "%.3f m/s² (%" PRId64 ")",
2354
0
                 value_mps2,
2355
0
                 value);
2356
0
    }
2357
0
}
2358
2359
static void c2p_sti_value_angular_velocity_format(char* string, int64_t value)
2360
0
{
2361
0
    if(!c2p_sti_value_common_format(string, value)) {
2362
0
        static const double FACTOR_0P001_DEGPS_TO_DEGPS_FACTOR = 0.001;
2363
0
        double value_degps = value * FACTOR_0P001_DEGPS_TO_DEGPS_FACTOR;
2364
2365
0
        snprintf(string,
2366
0
                 ITEM_LABEL_LENGTH,
2367
0
                 "%.3f°/s (%" PRId64 ")",
2368
0
                 value_degps,
2369
0
                 value);
2370
0
    }
2371
0
}
2372
2373
static void c2p_sti_value_thousandths_format(char* string, int64_t value)
2374
0
{
2375
0
    if(!c2p_sti_value_common_format(string, value)) {
2376
0
        static const double THOUSANDTHS_TO_PERCENT_FACTOR = 0.1;
2377
0
        double value_percent = value * THOUSANDTHS_TO_PERCENT_FACTOR;
2378
2379
0
        snprintf(string,
2380
0
                ITEM_LABEL_LENGTH,
2381
0
                "%.3f%% (%" PRId64 ")",
2382
0
                value_percent,
2383
0
                value);
2384
0
    }
2385
0
}
2386
2387
static void c2p_sti_value_length_format(char* string, int64_t value)
2388
0
{
2389
0
    if(!c2p_sti_value_common_format(string, value)) {
2390
0
        static const double MM_TO_M_FACTOR = 0.001;
2391
0
        double value_m = value * MM_TO_M_FACTOR;
2392
2393
0
        snprintf(string,
2394
0
                 ITEM_LABEL_LENGTH,
2395
0
                 "%.3f m (%" PRId64 ")",
2396
0
                 value_m,
2397
0
                 value);
2398
0
    }
2399
0
}
2400
2401
static void c2p_sti_value_mass_format(char* string, int64_t value)
2402
0
{
2403
0
    if(!c2p_sti_value_common_format(string, value)) {
2404
0
        static const double G_TO_KG_FACTOR = 0.001;
2405
0
        double value_kg = value * G_TO_KG_FACTOR;
2406
2407
0
        snprintf(string,
2408
0
                 ITEM_LABEL_LENGTH,
2409
0
                 "%.3f kg (%" PRId64 ")",
2410
0
                 value_kg,
2411
0
                 value);
2412
0
    }
2413
0
}
2414
2415
static void c2p_sti_value_rain_rate_format(char* string, int64_t value)
2416
0
{
2417
0
    if(!c2p_sti_value_common_format(string, value)) {
2418
0
        snprintf(string,
2419
0
                 ITEM_LABEL_LENGTH,
2420
0
                 "%" PRId64 " g/s/m²",
2421
0
                 value);
2422
0
    }
2423
0
}
2424
2425
static void c2p_sti_value_solar_irradiance_format(char* string, int64_t value)
2426
0
{
2427
0
    if(!c2p_sti_value_common_format(string, value)) {
2428
0
        snprintf(string,
2429
0
                 ITEM_LABEL_LENGTH,
2430
0
                 "%" PRId64 " J/m²",
2431
0
                 value);
2432
0
    }
2433
0
}
2434
2435
static void c2p_sti_value_temperature_format(char* string, int64_t value)
2436
0
{
2437
0
    if(!c2p_sti_value_common_format(string, value)) {
2438
0
        static const double FACTOR_0P1_DEG_TO_DEG_FACTOR = 0.1;
2439
0
        double value_deg = value * FACTOR_0P1_DEG_TO_DEG_FACTOR;
2440
2441
0
        snprintf(string,
2442
0
                 ITEM_LABEL_LENGTH,
2443
0
                 "%.1f° (%" PRId64 ")",
2444
0
                 value_deg,
2445
0
                 value);
2446
0
    }
2447
0
}
2448
2449
static void c2p_sti_value_pressure_format(char* string, int64_t value)
2450
0
{
2451
0
    if(!c2p_sti_value_common_format(string, value)) {
2452
0
        snprintf(string,
2453
0
                 ITEM_LABEL_LENGTH,
2454
0
                 "%" PRId64 " Pa",
2455
0
                 value);
2456
0
    }
2457
0
}
2458
2459
static void c2p_sti_value_sweep_rate_format(char* string, int64_t value)
2460
0
{
2461
0
    if(!c2p_sti_value_common_format(string, value)) {
2462
0
        snprintf(string,
2463
0
                 ITEM_LABEL_LENGTH,
2464
0
                 "%" PRId64 " sweeps/min",
2465
0
                 value);
2466
0
    }
2467
0
}
2468
2469
static void c2p_sti_value_integer_format(char* string, int64_t value)
2470
0
{
2471
0
    if(!c2p_sti_value_common_format(string, value)) {
2472
0
        snprintf(string,
2473
0
                 ITEM_LABEL_LENGTH,
2474
0
                 "%" PRId64,
2475
0
                 value);
2476
0
    }
2477
0
}
2478
2479
static void c2p_fac_timestamp_format(char* string, uint64_t value)
2480
0
{
2481
0
    static const uint64_t TIMESTAMP_NA = UINT64_MAX;
2482
2483
0
    if(TIMESTAMP_NA == value) {
2484
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%" PRIu64 ")", value);
2485
0
    } else {
2486
0
        static const uint64_t MSEC_PER_SEC = 1000ULL;
2487
2488
0
        time_t timestamp = (time_t)(value / MSEC_PER_SEC);
2489
0
        uint32_t tst_msec = (uint32_t)(value % MSEC_PER_SEC);
2490
0
        struct tm* utc_time = gmtime(&timestamp);
2491
2492
0
        enum { TIMESTAMP_STR_MAX_LEN = 128UL };
2493
0
        char timestamp_str[TIMESTAMP_STR_MAX_LEN] = {0};
2494
0
        strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", utc_time);
2495
2496
0
        snprintf(string,
2497
0
                 ITEM_LABEL_LENGTH,
2498
0
                 "%s.%03lu GMT (%" PRIu64 ")",
2499
0
                 timestamp_str,
2500
0
                 (unsigned long)tst_msec,
2501
0
                 value);
2502
0
    }
2503
0
}
2504
2505
static void c2p_fac_generation_time_format(char* string, uint64_t value)
2506
0
{
2507
0
    static const uint64_t GENERATION_TIME_NA = 0ULL;
2508
2509
0
    if(GENERATION_TIME_NA == value) {
2510
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%" PRIu64 ")", value);
2511
0
    } else {
2512
0
        static const time_t TIME_2004_IN_ABSTIME = 1072915200ULL;
2513
        /*
2514
         * The generation time is TAI based, subtract the leap seconds inserted
2515
         * since the 2004 epoch to display it as UTC.
2516
         */
2517
0
        static const time_t TAI_UTC_OFFSET_SINCE_2004 = 5;
2518
0
        static const uint64_t USEC_PER_SEC = 1000000ULL;
2519
2520
0
        time_t timestamp = ((time_t)(value / USEC_PER_SEC) + TIME_2004_IN_ABSTIME) -
2521
0
                           TAI_UTC_OFFSET_SINCE_2004;
2522
0
        uint32_t tst_usec = (uint32_t)(value % USEC_PER_SEC);
2523
0
        struct tm* utc_time = gmtime(&timestamp);
2524
2525
0
        enum { TIMESTAMP_STR_MAX_LEN = 128UL };
2526
0
        char timestamp_str[TIMESTAMP_STR_MAX_LEN] = {0};
2527
0
        strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", utc_time);
2528
2529
0
        snprintf(string,
2530
0
                 ITEM_LABEL_LENGTH,
2531
0
                 "%s.%06lu (%" PRIu64 " usec)",
2532
0
                 timestamp_str,
2533
0
                 (unsigned long)tst_usec,
2534
0
                 value);
2535
0
    }
2536
0
}
2537
2538
static void c2p_fac_fingerprint_format(char* string, uint64_t value)
2539
0
{
2540
0
    static const uint64_t FINGERPRINT_NA = 0ULL;
2541
2542
0
    if(FINGERPRINT_NA == value) {
2543
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (0x%" PRIx64 ")", value);
2544
0
    } else {
2545
0
        snprintf(string, ITEM_LABEL_LENGTH, "0x%" PRIx64, value);
2546
0
    }
2547
0
}
2548
2549
static uint32_t c2p_psid_non_p_enc_to_p_enc(uint32_t psid)
2550
0
{
2551
    /* Minimal p-encoded PSID values that occupy 2, 3 and 4 bytes */
2552
0
    static const uint32_t ENC_PSID_MIN_2B = 0x00008000UL;
2553
0
    static const uint32_t ENC_PSID_MIN_3B = 0x00C00000UL;
2554
0
    static const uint32_t ENC_PSID_MIN_4B = 0xE0000000UL;
2555
2556
    /* Maximal non p-encoded PSID values that fit into 1, 2, 3 and 4 bytes */
2557
0
    static const uint32_t PSID_MAX_1B = 0x0000007FUL;
2558
0
    static const uint32_t PSID_MAX_2B = 0x0000407FUL;
2559
0
    static const uint32_t PSID_MAX_3B = 0x0020407FUL;
2560
0
    static const uint32_t PSID_MAX_4B = 0x1020407FUL;
2561
2562
0
    uint32_t result = 0UL;
2563
2564
0
    if(psid > PSID_MAX_4B) {
2565
0
        result = UINT32_MAX;
2566
0
    } else if(psid > PSID_MAX_3B) {
2567
0
        result = (psid - (PSID_MAX_3B + 1UL)) | ENC_PSID_MIN_4B;
2568
0
    } else if(psid > PSID_MAX_2B) {
2569
0
        result = (psid - (PSID_MAX_2B + 1UL)) | ENC_PSID_MIN_3B;
2570
0
    } else if(psid > PSID_MAX_1B) {
2571
0
        result = (psid - (PSID_MAX_1B + 1UL)) | ENC_PSID_MIN_2B;
2572
0
    } else {
2573
0
        result = psid;
2574
0
    }
2575
2576
0
    return result;
2577
0
}
2578
2579
static void c2p_psid_format(char* string, uint32_t value)
2580
0
{
2581
0
    static const uint32_t PSID_NA = UINT32_MAX;
2582
    /* The PSID is only valid if the message was signed */
2583
0
    static const uint32_t PSID_UNSIGNED = 0UL;
2584
2585
0
    if((PSID_NA == value) || (PSID_UNSIGNED == value)) {
2586
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2587
0
    } else {
2588
0
        snprintf(string,
2589
0
                 ITEM_LABEL_LENGTH,
2590
0
                 "0x%lX (0p%lX) (%lu)",
2591
0
                 (unsigned long)value,
2592
0
                 (unsigned long)c2p_psid_non_p_enc_to_p_enc(value),
2593
0
                 (unsigned long)value);
2594
0
    }
2595
0
}
2596
2597
static void c2p_fac_interface_id_format(char* string, uint32_t value)
2598
0
{
2599
0
    static const uint32_t INTERFACE_ID_NA = UINT32_MAX;
2600
2601
0
    if(INTERFACE_ID_NA == value) {
2602
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2603
0
    } else {
2604
0
        snprintf(string, ITEM_LABEL_LENGTH, "%lu", (unsigned long)value);
2605
0
    }
2606
0
}
2607
2608
static void c2p_fac_datarate_format(char* string, uint32_t value)
2609
0
{
2610
0
    static const uint16_t DATARATE_NA = UINT16_MAX;
2611
2612
0
    if(DATARATE_NA == value) {
2613
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2614
0
    } else {
2615
0
        snprintf(string, ITEM_LABEL_LENGTH, "%lu Kbps", (unsigned long)value);
2616
0
    }
2617
0
}
2618
2619
static void c2p_fac_user_prio_format(char* string, uint32_t value)
2620
0
{
2621
0
    static const uint8_t USER_PRIO_NA = UINT8_MAX;
2622
2623
0
    if(USER_PRIO_NA == value) {
2624
0
        snprintf(string, ITEM_LABEL_LENGTH, "Unavailable (%lu)", (unsigned long)value);
2625
0
    } else {
2626
0
        snprintf(string, ITEM_LABEL_LENGTH, "%lu", (unsigned long)value);
2627
0
    }
2628
0
}
2629
2630
static int dissect_c2p_dsrc_rx(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2631
0
{
2632
0
    unsigned offset = 0;
2633
2634
0
    proto_tree_add_item(c2p_tree, hf_c2p_primary_channel_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2635
0
    offset += 1;
2636
0
    proto_tree_add_item(c2p_tree, hf_c2p_secondary_channel_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2637
0
    offset += 1;
2638
0
    proto_tree_add_item(c2p_tree, hf_c2p_used_interface_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2639
0
    offset += 1;
2640
0
    proto_tree_add_item(c2p_tree, hf_c2p_datarate_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2641
0
    offset += 1;
2642
0
    proto_tree_add_item(c2p_tree, hf_c2p_antenna_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2643
0
    offset += 1;
2644
0
    proto_tree_add_item(c2p_tree, hf_c2p_latitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2645
0
    offset += 4;
2646
0
    proto_tree_add_item(c2p_tree, hf_c2p_longitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2647
0
    offset += 4;
2648
0
    proto_tree_add_item(c2p_tree, hf_c2p_speed_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2649
0
    offset += 2;
2650
0
    proto_tree_add_item(c2p_tree, hf_c2p_heading_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2651
0
    offset += 2;
2652
0
    proto_tree_add_item(c2p_tree, hf_c2p_rssi_ant_1_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2653
0
    offset += 1;
2654
0
    proto_tree_add_item(c2p_tree, hf_c2p_rssi_ant_2_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2655
0
    offset += 1;
2656
0
    proto_tree_add_item(c2p_tree, hf_c2p_noise_ant_1_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2657
0
    offset += 1;
2658
0
    proto_tree_add_item(c2p_tree, hf_c2p_noise_ant_2_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2659
0
    offset += 1;
2660
0
    proto_tree_add_item(c2p_tree, hf_c2p_cbr_ant_1_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2661
0
    offset += 2;
2662
0
    proto_tree_add_item(c2p_tree, hf_c2p_cbr_ant_2_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2663
0
    offset += 2;
2664
2665
0
    if(NULL != ieee80211_handle) {
2666
0
        proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2667
0
        tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2668
0
        call_dissector(ieee80211_handle, next_tvb, pinfo, root_tree);
2669
0
    }
2670
2671
0
    return offset;
2672
0
}
2673
2674
static int dissect_c2p_dsrc_tx(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2675
0
{
2676
0
    unsigned offset = 0;
2677
2678
0
    proto_tree_add_item(c2p_tree, hf_c2p_primary_channel_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2679
0
    offset += 1;
2680
0
    proto_tree_add_item(c2p_tree, hf_c2p_secondary_channel_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2681
0
    offset += 1;
2682
0
    proto_tree_add_item(c2p_tree, hf_c2p_used_interface_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2683
0
    offset += 1;
2684
0
    proto_tree_add_item(c2p_tree, hf_c2p_datarate_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2685
0
    offset += 1;
2686
0
    proto_tree_add_item(c2p_tree, hf_c2p_antenna_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2687
0
    offset += 1;
2688
0
    proto_tree_add_item(c2p_tree, hf_c2p_latitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2689
0
    offset += 4;
2690
0
    proto_tree_add_item(c2p_tree, hf_c2p_longitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2691
0
    offset += 4;
2692
0
    proto_tree_add_item(c2p_tree, hf_c2p_speed_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2693
0
    offset += 2;
2694
0
    proto_tree_add_item(c2p_tree, hf_c2p_heading_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2695
0
    offset += 2;
2696
0
    proto_tree_add_item(c2p_tree, hf_c2p_tx_power_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2697
0
    offset += 1;
2698
0
    proto_tree_add_item(c2p_tree, hf_c2p_tssi_ant_1_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2699
0
    offset += 1;
2700
0
    proto_tree_add_item(c2p_tree, hf_c2p_tssi_ant_2_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2701
0
    offset += 1;
2702
2703
0
    if(NULL != ieee80211_handle) {
2704
0
        proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2705
0
        tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2706
0
        call_dissector(ieee80211_handle, next_tvb, pinfo, root_tree);
2707
0
    }
2708
2709
0
    return offset;
2710
0
}
2711
2712
static int dissect_c2p_cv2x_tx(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2713
1
{
2714
1
    unsigned offset = 0;
2715
2716
1
    proto_tree_add_item(c2p_tree, hf_c2p_sps_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2717
1
    offset += 1;
2718
1
    proto_tree_add_item(c2p_tree, hf_c2p_sps_port_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2719
1
    offset += 2;
2720
1
    proto_tree_add_item(c2p_tree, hf_c2p_event_port_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2721
1
    offset += 2;
2722
1
    proto_tree_add_item(c2p_tree, hf_c2p_cv2x_tx_power_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2723
1
    offset += 4;
2724
1
    proto_tree_add_item(c2p_tree, hf_c2p_bw_res_v2xid_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2725
1
    offset += 4;
2726
1
    proto_tree_add_item(c2p_tree, hf_c2p_bw_res_period_interval_ms_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2727
1
    offset += 4;
2728
1
    proto_tree_add_item(c2p_tree, hf_c2p_bw_res_tx_reservation_size_bytes_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2729
1
    offset += 4;
2730
1
    proto_tree_add_item(c2p_tree, hf_c2p_bw_res_tx_priority_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2731
1
    offset += 1;
2732
2733
1
    if(NULL != ieee80211_handle) {
2734
1
        proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2735
1
        tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2736
1
        call_dissector(ieee80211_handle, next_tvb, pinfo, root_tree);
2737
1
    }
2738
2739
1
    return offset;
2740
1
}
2741
2742
static int dissect_c2p_cv2x_rx(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2743
0
{
2744
0
    unsigned offset = 0;
2745
2746
0
    proto_tree_add_item(c2p_tree, hf_c2p_socket_index_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2747
0
    offset += 1;
2748
0
    proto_tree_add_item(c2p_tree, hf_c2p_ethertype_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2749
0
    offset += 2;
2750
0
    proto_tree_add_item(c2p_tree, hf_c2p_rssi_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2751
0
    offset += 1;
2752
0
    proto_tree_add_item(c2p_tree, hf_c2p_datarate_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2753
0
    offset += 1;
2754
2755
0
    if(NULL != ieee80211_handle) {
2756
0
        proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2757
0
        tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
2758
0
        call_dissector(ieee80211_handle, next_tvb, pinfo, root_tree);
2759
0
    }
2760
2761
0
    return offset;
2762
0
}
2763
2764
static int dissect_c2p_nav(tvbuff_t* tvb, proto_tree* c2p_tree)
2765
1
{
2766
1
    unsigned offset = 0;
2767
2768
1
    proto_tree_add_item(c2p_tree, hf_c2p_nav_fix_is_valid_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2769
1
    offset += 1;
2770
1
    proto_tree_add_item(c2p_tree, hf_c2p_gps_timestamp_desc, tvb, offset, 8, ENC_BIG_ENDIAN);
2771
1
    offset += 8;
2772
1
    proto_tree_add_item(c2p_tree, hf_c2p_latitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2773
1
    offset += 4;
2774
1
    proto_tree_add_item(c2p_tree, hf_c2p_longitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2775
1
    offset += 4;
2776
1
    proto_tree_add_item(c2p_tree, hf_c2p_altitude_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2777
1
    offset += 4;
2778
1
    proto_tree_add_item(c2p_tree, hf_c2p_heading_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2779
1
    offset += 2;
2780
1
    proto_tree_add_item(c2p_tree, hf_c2p_speed_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2781
1
    offset += 2;
2782
1
    proto_tree_add_item(c2p_tree, hf_c2p_semi_major_conf_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2783
1
    offset += 2;
2784
1
    proto_tree_add_item(c2p_tree, hf_c2p_semi_minor_conf_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2785
1
    offset += 2;
2786
1
    proto_tree_add_item(c2p_tree, hf_c2p_semi_major_ori_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2787
1
    offset += 2;
2788
1
    proto_tree_add_item(c2p_tree, hf_c2p_alttitude_acc_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2789
1
    offset += 2;
2790
1
    proto_tree_add_item(c2p_tree, hf_c2p_heading_acc_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2791
1
    offset += 2;
2792
1
    proto_tree_add_item(c2p_tree, hf_c2p_speed_acc_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2793
1
    offset += 2;
2794
2795
1
    return offset;
2796
1
}
2797
2798
static int dissect_c2p_sti(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2799
15
{
2800
15
    unsigned offset = 0;
2801
2802
15
    uint32_t length = tvb_get_uint32(tvb, 0, ENC_LITTLE_ENDIAN);
2803
2804
15
    proto_tree_add_item(c2p_tree, hf_c2p_sti_length_desc, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2805
15
    offset += 4;
2806
2807
230
    for(uint32_t i = 0UL; i < length; ++i) {
2808
215
        char* str_display;
2809
215
        str_display = wmem_strdup_printf(pinfo->pool, "STI #%lu", (unsigned long)i);
2810
        /* STI item length is 4 bytes of type and 8 bytes of value */
2811
215
        static const int STI_ITEM_LEN = 12UL;
2812
215
        proto_tree* subtree = proto_tree_add_subtree(c2p_tree,
2813
215
                                                     tvb,
2814
215
                                                     offset,
2815
215
                                                     STI_ITEM_LEN,
2816
215
                                                     ett_c2p,
2817
215
                                                     NULL,
2818
215
                                                     str_display);
2819
215
        sti_type_t sti_type = tvb_get_uint32(tvb, offset, ENC_LITTLE_ENDIAN);
2820
2821
215
        proto_tree_add_item(subtree,
2822
215
                            hf_c2p_sti_type_desc,
2823
215
                            tvb,
2824
215
                            offset,
2825
215
                            4,
2826
215
                            ENC_LITTLE_ENDIAN);
2827
215
        offset += 4;
2828
2829
215
        int hf_index = hf_c2p_sti_value_integer_desc;
2830
2831
215
        if((sti_type < array_length(sti_params)) && (sti_params[sti_type] != NULL)) {
2832
42
            hf_index = *(sti_params[sti_type]);
2833
42
        }
2834
2835
215
        proto_tree_add_item(subtree,
2836
215
                            hf_index,
2837
215
                            tvb,
2838
215
                            offset,
2839
215
                            8,
2840
215
                            ENC_LITTLE_ENDIAN);
2841
215
        offset += 8;
2842
215
    }
2843
2844
15
    return offset;
2845
15
}
2846
2847
/*
2848
 * The payload of an injected facility packet is the facility layer message
2849
 * itself, its message set is determined by the facility message type. Return
2850
 * the dissector of that message set, or NULL if it is not available.
2851
 */
2852
static dissector_handle_t c2p_fac_payload_dissector(uint32_t msg_type)
2853
0
{
2854
    /* Facility message type ranges of the known message sets */
2855
0
    static const uint32_t FAC_MSG_EU_FIRST = 1UL;
2856
0
    static const uint32_t FAC_MSG_EU_LAST = 10UL;
2857
0
    static const uint32_t FAC_MSG_US_FIRST = 100UL;
2858
0
    static const uint32_t FAC_MSG_US_LAST = 132UL;
2859
0
    static const uint32_t FAC_MSG_US_WSA = 111UL;
2860
0
    static const uint32_t FAC_MSG_CN_FIRST = 200UL;
2861
0
    static const uint32_t FAC_MSG_CN_LAST = 204UL;
2862
2863
0
    dissector_handle_t handle = NULL;
2864
2865
0
    if((msg_type >= FAC_MSG_EU_FIRST) && (msg_type <= FAC_MSG_EU_LAST)) {
2866
0
        handle = its_handle;
2867
0
    } else if(FAC_MSG_US_WSA == msg_type) {
2868
        /* The WSA is an IEEE 1609.3 message, not an SAE J2735 MessageFrame */
2869
0
        handle = wsa_handle;
2870
0
    } else if((msg_type >= FAC_MSG_US_FIRST) && (msg_type <= FAC_MSG_US_LAST)) {
2871
0
        handle = j2735_handle;
2872
0
    } else if((msg_type >= FAC_MSG_CN_FIRST) && (msg_type <= FAC_MSG_CN_LAST)) {
2873
0
        handle = cn_msg_frame_handle;
2874
0
    }
2875
2876
0
    return handle;
2877
0
}
2878
2879
static int dissect_c2p_fac_inject(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2880
0
{
2881
    /*
2882
     * Sizes of the facility notification metadata that precedes the injected
2883
     * payload. Every multi-byte field of it is in network byte order.
2884
     */
2885
0
    enum {
2886
0
        RADIO_PARAMS_LEN = 37,
2887
0
        SECURITY_INFO_LEN = 63,
2888
0
        SSP_LEN = 39,
2889
0
        SSP_FIELD_LEN = 31
2890
0
    };
2891
2892
0
    unsigned offset = 0;
2893
0
    uint32_t msg_type = 0;
2894
0
    uint32_t payload_length = 0;
2895
2896
0
    proto_tree_add_item_ret_uint(c2p_tree,
2897
0
                                 hf_c2p_fac_msg_type_desc,
2898
0
                                 tvb,
2899
0
                                 offset,
2900
0
                                 4,
2901
0
                                 ENC_BIG_ENDIAN,
2902
0
                                 &msg_type);
2903
0
    offset += 4;
2904
2905
0
    proto_tree* radio_tree = proto_tree_add_subtree(c2p_tree,
2906
0
                                                    tvb,
2907
0
                                                    offset,
2908
0
                                                    RADIO_PARAMS_LEN,
2909
0
                                                    ett_c2p,
2910
0
                                                    NULL,
2911
0
                                                    "Radio parameters");
2912
2913
0
    proto_tree_add_item(radio_tree, hf_c2p_fac_timestamp_desc, tvb, offset, 8, ENC_BIG_ENDIAN);
2914
0
    offset += 8;
2915
0
    proto_tree_add_item(radio_tree, hf_c2p_fac_interface_id_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2916
0
    offset += 4;
2917
0
    proto_tree_add_item(radio_tree, hf_c2p_fac_source_address_desc, tvb, offset, 6, ENC_NA);
2918
0
    offset += 6;
2919
0
    proto_tree_add_item(radio_tree, hf_c2p_fac_dest_address_desc, tvb, offset, 6, ENC_NA);
2920
0
    offset += 6;
2921
0
    proto_tree_add_item(radio_tree, hf_c2p_fac_datarate_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2922
0
    offset += 2;
2923
0
    proto_tree_add_item(radio_tree, hf_c2p_fac_user_prio_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2924
0
    offset += 1;
2925
0
    proto_tree_add_item(radio_tree, hf_c2p_fac_rssi_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
2926
0
    offset += 2;
2927
0
    proto_tree_add_item(radio_tree, hf_c2p_fac_fingerprint_desc, tvb, offset, 8, ENC_BIG_ENDIAN);
2928
0
    offset += 8;
2929
2930
0
    proto_tree* security_tree = proto_tree_add_subtree(c2p_tree,
2931
0
                                                       tvb,
2932
0
                                                       offset,
2933
0
                                                       SECURITY_INFO_LEN,
2934
0
                                                       ett_c2p,
2935
0
                                                       NULL,
2936
0
                                                       "Security");
2937
2938
0
    proto_tree_add_item(security_tree, hf_c2p_fac_verify_result_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2939
0
    offset += 4;
2940
0
    proto_tree_add_item(security_tree, hf_c2p_fac_psid_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2941
0
    offset += 4;
2942
2943
0
    proto_tree* ssp_tree = proto_tree_add_subtree(security_tree,
2944
0
                                                  tvb,
2945
0
                                                  offset,
2946
0
                                                  SSP_LEN,
2947
0
                                                  ett_c2p,
2948
0
                                                  NULL,
2949
0
                                                  "Service Specific Permissions");
2950
2951
0
    proto_tree_add_item(ssp_tree, hf_c2p_fac_ssp_type_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2952
0
    offset += 4;
2953
0
    proto_tree_add_item(ssp_tree, hf_c2p_fac_ssp_field_desc, tvb, offset, SSP_FIELD_LEN, ENC_NA);
2954
0
    offset += SSP_FIELD_LEN;
2955
0
    proto_tree_add_item(ssp_tree, hf_c2p_fac_ssp_length_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
2956
0
    offset += 4;
2957
2958
0
    proto_tree_add_item(security_tree, hf_c2p_fac_signer_id_desc, tvb, offset, 8, ENC_BIG_ENDIAN);
2959
0
    offset += 8;
2960
0
    proto_tree_add_item(security_tree, hf_c2p_fac_generation_time_desc, tvb, offset, 8, ENC_BIG_ENDIAN);
2961
0
    offset += 8;
2962
2963
0
    proto_tree_add_item_ret_uint(c2p_tree,
2964
0
                                 hf_c2p_fac_payload_length_desc,
2965
0
                                 tvb,
2966
0
                                 offset,
2967
0
                                 2,
2968
0
                                 ENC_BIG_ENDIAN,
2969
0
                                 &payload_length);
2970
0
    offset += 2;
2971
2972
0
    dissector_handle_t payload_handle = c2p_fac_payload_dissector(msg_type);
2973
0
    proto_tree* root_tree = proto_tree_get_root(c2p_tree);
2974
0
    tvbuff_t* next_tvb = tvb_new_subset_length(tvb, offset, payload_length);
2975
2976
0
    if(NULL != payload_handle) {
2977
0
        call_dissector(payload_handle, next_tvb, pinfo, root_tree);
2978
0
    } else {
2979
0
        call_data_dissector(next_tvb, pinfo, root_tree);
2980
0
    }
2981
2982
0
    offset += tvb_reported_length(next_tvb);
2983
2984
0
    return offset;
2985
0
}
2986
2987
/*
2988
 * The payload of a remote API packet is one complete Commsignia API frame,
2989
 * its own frame header included. Hand it to the commsigniaapi dissector when
2990
 * that plugin is installed.
2991
 */
2992
static int dissect_c2p_api(tvbuff_t* tvb, proto_tree* c2p_tree, packet_info* pinfo)
2993
0
{
2994
    /* Every multi-byte field of the API metadata is in network byte order. */
2995
0
    unsigned offset = 0;
2996
0
    uint32_t length = 0;
2997
2998
0
    proto_tree_add_item(c2p_tree, hf_c2p_api_direction_desc, tvb, offset, 1, ENC_BIG_ENDIAN);
2999
0
    offset += 1;
3000
0
    proto_tree_add_item(c2p_tree, hf_c2p_api_client_ip_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
3001
0
    offset += 4;
3002
0
    proto_tree_add_item(c2p_tree, hf_c2p_api_client_port_desc, tvb, offset, 2, ENC_BIG_ENDIAN);
3003
0
    offset += 2;
3004
3005
0
    proto_tree_add_item_ret_uint(c2p_tree,
3006
0
                                 hf_c2p_api_length_desc,
3007
0
                                 tvb,
3008
0
                                 offset,
3009
0
                                 2,
3010
0
                                 ENC_BIG_ENDIAN,
3011
0
                                 &length);
3012
0
    offset += 2;
3013
3014
0
    proto_tree* root_tree = proto_tree_get_root(c2p_tree);
3015
0
    tvbuff_t* next_tvb = tvb_new_subset_length(tvb, offset, length);
3016
3017
0
    if(NULL != commsigniaapi_handle) {
3018
0
        call_dissector(commsigniaapi_handle, next_tvb, pinfo, root_tree);
3019
0
    } else {
3020
0
        call_data_dissector(next_tvb, pinfo, root_tree);
3021
0
    }
3022
3023
0
    offset += tvb_reported_length(next_tvb);
3024
3025
0
    return offset;
3026
0
}
3027
3028
static int dissect_c2p(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
3029
22
{
3030
22
    unsigned offset = 0;
3031
22
    uint32_t type, version;
3032
22
    char* str_type;
3033
3034
22
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "C2P");
3035
22
    col_clear(pinfo->cinfo, COL_INFO);
3036
3037
3038
22
    proto_item* ti = proto_tree_add_item(tree, proto_desc, tvb, 0, -1, ENC_NA);
3039
3040
22
    proto_tree* c2p_tree = proto_item_add_subtree(ti, ett_c2p);
3041
3042
    /* Version & type */
3043
22
    proto_tree_add_item_ret_uint(c2p_tree, hf_c2p_version_desc, tvb, offset, 1, ENC_BIG_ENDIAN, &version);
3044
22
    proto_tree_add_item_ret_uint(c2p_tree, hf_c2p_type_desc, tvb, offset, 1, ENC_BIG_ENDIAN, &type);
3045
22
    str_type = val_to_str(pinfo->pool, type, c2p_types, "Unknown (%d)");
3046
22
    proto_item_append_text(ti, ", Type: %s", str_type);
3047
22
    col_add_fstr(pinfo->cinfo, COL_INFO, "Type: %s", str_type);
3048
22
    offset += 1;
3049
3050
    /* Timestamp */
3051
22
    proto_tree* c2p_tst_tree = proto_tree_add_subtree(c2p_tree,
3052
22
                                                      tvb,
3053
22
                                                      offset,
3054
22
                                                      -1,
3055
22
                                                      ett_c2p,
3056
22
                                                      NULL,
3057
22
                                                      "Timestamp");
3058
3059
22
    c2p_set_tst_proto_item_info(tvb, offset, c2p_tst_tree);
3060
3061
22
    proto_tree_add_item(c2p_tst_tree, hf_c2p_tst_sec_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
3062
22
    offset += 4;
3063
22
    proto_tree_add_item(c2p_tst_tree, hf_c2p_tst_msec_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
3064
22
    offset += 4;
3065
3066
    /* Set 'Timestamp' length */
3067
22
    proto_item_set_len(c2p_tst_tree, 8);
3068
3069
    /* Dissect the rest depending on type */
3070
22
    tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
3071
3072
22
    static const uint8_t C2P_VERSION_0 = 0U;
3073
22
    static const uint8_t C2P_VERSION_1 = 1U;
3074
22
    static const uint8_t C2P_VERSION_2 = 2U;
3075
3076
22
    (void)C2P_VERSION_0;
3077
3078
22
    if(C2P_VERSION_1 == version) {
3079
3
        switch(type) {
3080
0
        case C2P_TYPE_DSRC_RX:
3081
0
            offset += dissect_c2p_dsrc_rx(next_tvb, c2p_tree, pinfo);
3082
0
            break;
3083
0
        case C2P_TYPE_DSRC_TX:
3084
0
            offset += dissect_c2p_dsrc_tx(next_tvb, c2p_tree, pinfo);
3085
0
            break;
3086
1
        case C2P_TYPE_NAV:
3087
1
            offset += dissect_c2p_nav(next_tvb, c2p_tree);
3088
1
            break;
3089
0
        case C2P_TYPE_CV2X_RX:
3090
0
            offset += dissect_c2p_cv2x_rx(next_tvb, c2p_tree, pinfo);
3091
0
            break;
3092
1
        case C2P_TYPE_CV2X_TX:
3093
1
            offset += dissect_c2p_cv2x_tx(next_tvb, c2p_tree, pinfo);
3094
1
            break;
3095
1
        default:
3096
1
            break;
3097
3
        }
3098
19
    } else if(C2P_VERSION_2 == version) {
3099
16
        switch(type) {
3100
15
        case C2P_TYPE_STI:
3101
15
            offset += dissect_c2p_sti(next_tvb, c2p_tree, pinfo);
3102
15
            break;
3103
0
        case C2P_TYPE_API:
3104
0
            offset += dissect_c2p_api(next_tvb, c2p_tree, pinfo);
3105
0
            break;
3106
0
        case C2P_TYPE_FAC_INJECT:
3107
0
            offset += dissect_c2p_fac_inject(next_tvb, c2p_tree, pinfo);
3108
0
            break;
3109
1
        default:
3110
1
            break;
3111
16
        }
3112
16
    }
3113
3114
    /* Set C2P length */
3115
6
    proto_item_set_len(ti, offset);
3116
3117
6
    return offset;
3118
22
}
3119
3120
void proto_register_c2p(void)
3121
16
{
3122
16
    static hf_register_info header_fields[] = {
3123
16
        {
3124
16
            &hf_c2p_version_desc,
3125
16
            {
3126
16
                "Version",
3127
16
                "c2p.version",
3128
16
                FT_UINT8,
3129
16
                BASE_DEC,
3130
16
                NULL,
3131
16
                0xF0,
3132
16
                NULL,
3133
16
                HFILL
3134
16
            }
3135
16
        },
3136
16
        {
3137
16
            &hf_c2p_type_desc,
3138
16
            {
3139
16
                "Type",
3140
16
                "c2p.type",
3141
16
                FT_UINT8,
3142
16
                BASE_DEC,
3143
16
                VALS(c2p_types),
3144
16
                0x0F,
3145
16
                NULL,
3146
16
                HFILL
3147
16
            }
3148
16
        },
3149
16
        {
3150
16
            &hf_c2p_tst_sec_desc,
3151
16
            {
3152
16
                "Seconds",
3153
16
                "c2p.tst.sec",
3154
16
                FT_UINT32,
3155
16
                BASE_DEC | BASE_UNIT_STRING,
3156
16
                UNS(&units_seconds),
3157
16
                0x00,
3158
16
                NULL,
3159
16
                HFILL
3160
16
            }
3161
16
        },
3162
16
        {
3163
16
            &hf_c2p_tst_msec_desc,
3164
16
            {
3165
16
                "Milliseconds",
3166
16
                "c2p.tst.msec",
3167
16
                FT_UINT32,
3168
16
                BASE_DEC | BASE_UNIT_STRING,
3169
16
                UNS(&units_milliseconds),
3170
16
                0x00,
3171
16
                NULL,
3172
16
                HFILL
3173
16
            }
3174
16
        },
3175
16
        {
3176
16
            &hf_c2p_primary_channel_desc,
3177
16
            {
3178
16
                "Primary channel",
3179
16
                "c2p.primary_channel",
3180
16
                FT_UINT8,
3181
16
                BASE_CUSTOM,
3182
16
                CF_FUNC(c2p_channel_format),
3183
16
                0x00,
3184
16
                NULL,
3185
16
                HFILL
3186
16
            }
3187
16
        },
3188
16
        {
3189
16
            &hf_c2p_secondary_channel_desc,
3190
16
            {
3191
16
                "Secondary channel",
3192
16
                "c2p.secondary_channel",
3193
16
                FT_UINT8,
3194
16
                BASE_CUSTOM,
3195
16
                CF_FUNC(c2p_channel_format),
3196
16
                0x00,
3197
16
                NULL,
3198
16
                HFILL
3199
16
            }
3200
16
        },
3201
16
        {
3202
16
            &hf_c2p_used_interface_desc,
3203
16
            {
3204
16
                "Used interface",
3205
16
                "c2p.used_interface",
3206
16
                FT_UINT8,
3207
16
                BASE_DEC,
3208
16
                NULL,
3209
16
                0x00,
3210
16
                NULL,
3211
16
                HFILL
3212
16
            }
3213
16
        },
3214
16
        {
3215
16
            &hf_c2p_datarate_desc,
3216
16
            {
3217
16
                "Datarate",
3218
16
                "c2p.datarate",
3219
16
                FT_UINT8,
3220
16
                BASE_CUSTOM,
3221
16
                CF_FUNC(c2p_datarate_format),
3222
16
                0x00,
3223
16
                NULL,
3224
16
                HFILL
3225
16
            }
3226
16
        },
3227
16
        {
3228
16
            &hf_c2p_antenna_desc,
3229
16
            {
3230
16
                "Used antenna",
3231
16
                "c2p.used_antenna",
3232
16
                FT_UINT8,
3233
16
                BASE_DEC,
3234
16
                NULL,
3235
16
                0x00,
3236
16
                NULL,
3237
16
                HFILL
3238
16
            }
3239
16
        },
3240
16
        {
3241
16
            &hf_c2p_latitude_desc,
3242
16
            {
3243
16
                "Latitude",
3244
16
                "c2p.latitude",
3245
16
                FT_INT32,
3246
16
                BASE_CUSTOM,
3247
16
                CF_FUNC(c2p_latitude_format),
3248
16
                0x00,
3249
16
                NULL,
3250
16
                HFILL
3251
16
            }
3252
16
        },
3253
16
        {
3254
16
            &hf_c2p_longitude_desc,
3255
16
            {
3256
16
                "Longitude",
3257
16
                "c2p.longitude",
3258
16
                FT_INT32,
3259
16
                BASE_CUSTOM,
3260
16
                CF_FUNC(c2p_longitude_format),
3261
16
                0x00,
3262
16
                NULL,
3263
16
                HFILL
3264
16
            }
3265
16
        },
3266
16
        {
3267
16
            &hf_c2p_altitude_desc,
3268
16
            {
3269
16
                "Altitude",
3270
16
                "c2p.altitude",
3271
16
                FT_INT32,
3272
16
                BASE_CUSTOM,
3273
16
                CF_FUNC(c2p_altitude_format),
3274
16
                0x00,
3275
16
                NULL,
3276
16
                HFILL
3277
16
            }
3278
16
        },
3279
16
        {
3280
16
            &hf_c2p_speed_desc,
3281
16
            {
3282
16
                "Speed",
3283
16
                "c2p.speed",
3284
16
                FT_UINT16,
3285
16
                BASE_CUSTOM,
3286
16
                CF_FUNC(c2p_speed_format),
3287
16
                0x00,
3288
16
                NULL,
3289
16
                HFILL
3290
16
            }
3291
16
        },
3292
16
        {
3293
16
            &hf_c2p_heading_desc,
3294
16
            {
3295
16
                "Heading",
3296
16
                "c2p.heading",
3297
16
                FT_UINT16,
3298
16
                BASE_CUSTOM,
3299
16
                CF_FUNC(c2p_heading_format),
3300
16
                0x00,
3301
16
                NULL,
3302
16
                HFILL
3303
16
            }
3304
16
        },
3305
16
        {
3306
16
            &hf_c2p_semi_major_conf_desc,
3307
16
            {
3308
16
                "Semi major confidence",
3309
16
                "c2p.semi_major_conf",
3310
16
                FT_UINT16,
3311
16
                BASE_CUSTOM,
3312
16
                CF_FUNC(c2p_semi_axis_format),
3313
16
                0x00,
3314
16
                NULL,
3315
16
                HFILL
3316
16
            }
3317
16
        },
3318
16
        {
3319
16
            &hf_c2p_semi_minor_conf_desc,
3320
16
            {
3321
16
                "Semi minor confidence",
3322
16
                "c2p.semi_minor_conf",
3323
16
                FT_UINT16,
3324
16
                BASE_CUSTOM,
3325
16
                CF_FUNC(c2p_semi_axis_format),
3326
16
                0x00,
3327
16
                NULL,
3328
16
                HFILL
3329
16
            }
3330
16
        },
3331
16
        {
3332
16
            &hf_c2p_semi_major_ori_desc,
3333
16
            {
3334
16
                "Semi major orientation",
3335
16
                "c2p.semi_major_orientation",
3336
16
                FT_UINT16,
3337
16
                BASE_CUSTOM,
3338
16
                CF_FUNC(c2p_heading_format),
3339
16
                0x00,
3340
16
                NULL,
3341
16
                HFILL
3342
16
            }
3343
16
        },
3344
16
        {
3345
16
            &hf_c2p_alttitude_acc_desc,
3346
16
            {
3347
16
                "Altitude accuracy",
3348
16
                "c2p.altitude_accuracy",
3349
16
                FT_UINT16,
3350
16
                BASE_CUSTOM,
3351
16
                CF_FUNC(c2p_altitude_acc_format),
3352
16
                0x00,
3353
16
                NULL,
3354
16
                HFILL
3355
16
            }
3356
16
        },
3357
16
        {
3358
16
            &hf_c2p_heading_acc_desc,
3359
16
            {
3360
16
                "Heading accuracy",
3361
16
                "c2p.heading_accuracy",
3362
16
                FT_UINT16,
3363
16
                BASE_CUSTOM,
3364
16
                CF_FUNC(c2p_heading_acc_format),
3365
16
                0x00,
3366
16
                NULL,
3367
16
                HFILL
3368
16
            }
3369
16
        },
3370
16
        {
3371
16
            &hf_c2p_speed_acc_desc,
3372
16
            {
3373
16
                "Speed accuracy",
3374
16
                "c2p.speed_accuracy",
3375
16
                FT_UINT16,
3376
16
                BASE_CUSTOM,
3377
16
                CF_FUNC(c2p_speed_acc_format),
3378
16
                0x00,
3379
16
                NULL,
3380
16
                HFILL
3381
16
            }
3382
16
        },
3383
16
        {
3384
16
            &hf_c2p_rssi_ant_1_desc,
3385
16
            {
3386
16
                "RSSI on antenna #1",
3387
16
                "c2p.rssi_antenna1",
3388
16
                FT_INT8,
3389
16
                BASE_CUSTOM,
3390
16
                CF_FUNC(c2p_power_format),
3391
16
                0x00,
3392
16
                NULL,
3393
16
                HFILL
3394
16
            }
3395
16
        },
3396
16
        {
3397
16
            &hf_c2p_rssi_ant_2_desc,
3398
16
            {
3399
16
                "RSSI on antenna #2",
3400
16
                "c2p.rssi_antenna2",
3401
16
                FT_INT8,
3402
16
                BASE_CUSTOM,
3403
16
                CF_FUNC(c2p_power_format),
3404
16
                0x00,
3405
16
                NULL,
3406
16
                HFILL
3407
16
            }
3408
16
        },
3409
16
        {
3410
16
            &hf_c2p_noise_ant_1_desc,
3411
16
            {
3412
16
                "Noise on antenna #1",
3413
16
                "c2p.noise_antenna1",
3414
16
                FT_INT8,
3415
16
                BASE_CUSTOM,
3416
16
                CF_FUNC(c2p_power_format),
3417
16
                0x00,
3418
16
                NULL,
3419
16
                HFILL
3420
16
            }
3421
16
        },
3422
16
        {
3423
16
            &hf_c2p_noise_ant_2_desc,
3424
16
            {
3425
16
                "Noise on antenna #2",
3426
16
                "c2p.noise_antenna2",
3427
16
                FT_INT8,
3428
16
                BASE_CUSTOM,
3429
16
                CF_FUNC(c2p_power_format),
3430
16
                0x00,
3431
16
                NULL,
3432
16
                HFILL
3433
16
            }
3434
16
        },
3435
16
        {
3436
16
            &hf_c2p_cbr_ant_1_desc,
3437
16
            {
3438
16
                "CBR on antenna #1",
3439
16
                "c2p.cbr_antenna1",
3440
16
                FT_UINT16,
3441
16
                BASE_CUSTOM,
3442
16
                CF_FUNC(c2p_cbr_format),
3443
16
                0x00,
3444
16
                NULL,
3445
16
                HFILL
3446
16
            }
3447
16
        },
3448
16
        {
3449
16
            &hf_c2p_cbr_ant_2_desc,
3450
16
            {
3451
16
                "CBR on antenna #2",
3452
16
                "c2p.cbr_antenna2",
3453
16
                FT_UINT16,
3454
16
                BASE_CUSTOM,
3455
16
                CF_FUNC(c2p_cbr_format),
3456
16
                0x00,
3457
16
                NULL,
3458
16
                HFILL
3459
16
            }
3460
16
        },
3461
16
        {
3462
16
            &hf_c2p_tx_power_desc,
3463
16
            {
3464
16
                "Transmission power",
3465
16
                "c2p.tx_power",
3466
16
                FT_INT8,
3467
16
                BASE_CUSTOM,
3468
16
                CF_FUNC(c2p_power_format),
3469
16
                0x00,
3470
16
                NULL,
3471
16
                HFILL
3472
16
            }
3473
16
        },
3474
16
        {
3475
16
            &hf_c2p_tssi_ant_1_desc,
3476
16
            {
3477
16
                "TSSI on antenna #1",
3478
16
                "c2p.tssi_antenna1",
3479
16
                FT_INT8,
3480
16
                BASE_CUSTOM,
3481
16
                CF_FUNC(c2p_power_format),
3482
16
                0x00,
3483
16
                NULL,
3484
16
                HFILL
3485
16
            }
3486
16
        },
3487
16
        {
3488
16
            &hf_c2p_tssi_ant_2_desc,
3489
16
            {
3490
16
                "TSSI on antenna #2",
3491
16
                "c2p.tssi_antenna2",
3492
16
                FT_INT8,
3493
16
                BASE_CUSTOM,
3494
16
                CF_FUNC(c2p_power_format),
3495
16
                0x00,
3496
16
                NULL,
3497
16
                HFILL
3498
16
            }
3499
16
        },
3500
16
        {
3501
16
            &hf_c2p_sps_desc,
3502
16
            {
3503
16
                "Is SPS port",
3504
16
                "c2p.cv2x_sps",
3505
16
                FT_BOOLEAN,
3506
16
                BASE_NONE,
3507
16
                NULL,
3508
16
                0x00,
3509
16
                NULL,
3510
16
                HFILL
3511
16
            }
3512
16
        },
3513
16
        {
3514
16
            &hf_c2p_sps_port_desc,
3515
16
            {
3516
16
                "SPS port",
3517
16
                "c2p.cv2x_sps_port",
3518
16
                FT_UINT16,
3519
16
                BASE_DEC,
3520
16
                NULL,
3521
16
                0x00,
3522
16
                NULL,
3523
16
                HFILL
3524
16
            }
3525
16
        },
3526
16
        {
3527
16
            &hf_c2p_event_port_desc,
3528
16
            {
3529
16
                "Event port",
3530
16
                "c2p.cv2x_event_port",
3531
16
                FT_UINT16,
3532
16
                BASE_DEC,
3533
16
                NULL,
3534
16
                0x00,
3535
16
                NULL,
3536
16
                HFILL
3537
16
            }
3538
16
        },
3539
16
        {
3540
16
            &hf_c2p_cv2x_tx_power_desc,
3541
16
            {
3542
16
                "Transmission power",
3543
16
                "c2p.tx_power",
3544
16
                FT_INT32,
3545
16
                BASE_CUSTOM,
3546
16
                CF_FUNC(c2p_power_dbm_format),
3547
16
                0x00,
3548
16
                NULL,
3549
16
                HFILL
3550
16
            }
3551
16
        },
3552
16
        {
3553
16
            &hf_c2p_bw_res_v2xid_desc,
3554
16
            {
3555
16
                "V2X ID",
3556
16
                "c2p.cv2x_id",
3557
16
                FT_INT32,
3558
16
                BASE_DEC,
3559
16
                NULL,
3560
16
                0x00,
3561
16
                NULL,
3562
16
                HFILL
3563
16
            }
3564
16
        },
3565
16
        {
3566
16
            &hf_c2p_bw_res_period_interval_ms_desc,
3567
16
            {
3568
16
                "Bandwidth-reserved periodicity interval",
3569
16
                "c2p.cv2x_bw_res_period_interval",
3570
16
                FT_INT32,
3571
16
                BASE_DEC | BASE_UNIT_STRING,
3572
16
                UNS(&units_seconds),
3573
16
                0x00,
3574
16
                NULL,
3575
16
                HFILL
3576
16
            }
3577
16
        },
3578
16
        {
3579
16
            &hf_c2p_bw_res_tx_reservation_size_bytes_desc,
3580
16
            {
3581
16
                "Tx bandwidth sent bytes",
3582
16
                "c2p.cv2x_bw_res_tx_reservation_size_bytes",
3583
16
                FT_INT32,
3584
16
                BASE_DEC,
3585
16
                NULL,
3586
16
                0x00,
3587
16
                NULL,
3588
16
                HFILL
3589
16
            }
3590
16
        },
3591
16
        {
3592
16
            &hf_c2p_bw_res_tx_priority_desc,
3593
16
            {
3594
16
                "Preserved SPS Tx priority'",
3595
16
                "c2p.cv2x_bw_res_tx_priority",
3596
16
                FT_UINT8,
3597
16
                BASE_DEC,
3598
16
                VALS(priority_format_vals),
3599
16
                0x00,
3600
16
                NULL,
3601
16
                HFILL
3602
16
            }
3603
16
        },
3604
16
        {
3605
16
            &hf_c2p_socket_index_desc,
3606
16
            {
3607
16
                "Socket index",
3608
16
                "c2p.cv2x_socket_index",
3609
16
                FT_UINT8,
3610
16
                BASE_DEC,
3611
16
                NULL,
3612
16
                0x00,
3613
16
                NULL,
3614
16
                HFILL
3615
16
            }
3616
16
        },
3617
16
        {
3618
16
            &hf_c2p_ethertype_desc,
3619
16
            {
3620
16
                "Ethernet header type",
3621
16
                "c2p.cv2x_ethertype",
3622
16
                FT_UINT16,
3623
16
                BASE_HEX,
3624
16
                NULL,
3625
16
                0x00,
3626
16
                NULL,
3627
16
                HFILL
3628
16
            }
3629
16
        },
3630
16
        {
3631
16
            &hf_c2p_rssi_desc,
3632
16
            {
3633
16
                "RSSI",
3634
16
                "c2p.cv2x_rssi",
3635
16
                FT_INT8,
3636
16
                BASE_CUSTOM,
3637
16
                CF_FUNC(c2p_power_format),
3638
16
                0x00,
3639
16
                NULL,
3640
16
                HFILL
3641
16
            }
3642
16
        },
3643
16
        {
3644
16
            &hf_c2p_nav_fix_is_valid_desc,
3645
16
            {
3646
16
                "Is valid",
3647
16
                "c2p.nav_fix_is_valid",
3648
16
                FT_BOOLEAN,
3649
16
                BASE_NONE,
3650
16
                NULL,
3651
16
                0x00,
3652
16
                NULL,
3653
16
                HFILL
3654
16
            }
3655
16
        },
3656
16
        {
3657
16
            &hf_c2p_gps_timestamp_desc,
3658
16
            {
3659
16
                "GPS timestamp",
3660
16
                "c2p.gps_timestamp",
3661
16
                FT_UINT64,
3662
16
                BASE_CUSTOM,
3663
16
                CF_FUNC(c2p_gps_timestamp_format),
3664
16
                0x00,
3665
16
                NULL,
3666
16
                HFILL
3667
16
            }
3668
16
        },
3669
16
        {
3670
16
            &hf_c2p_sti_length_desc,
3671
16
            {
3672
16
                "Number of STI parameters",
3673
16
                "c2p.sti_length",
3674
16
                FT_UINT32,
3675
16
                BASE_DEC,
3676
16
                NULL,
3677
16
                0x00,
3678
16
                NULL,
3679
16
                HFILL
3680
16
            }
3681
16
        },
3682
16
        {
3683
16
            &hf_c2p_sti_type_desc,
3684
16
            {
3685
16
                "Type",
3686
16
                "c2p.sti_type",
3687
16
                FT_UINT32,
3688
16
                BASE_DEC,
3689
16
                VALS(sti_types),
3690
16
                0x00,
3691
16
                NULL,
3692
16
                HFILL
3693
16
            }
3694
16
        },
3695
16
        {
3696
16
            &hf_c2p_sti_value_angle_desc,
3697
16
            {
3698
16
                "Value",
3699
16
                "c2p.sti_value",
3700
16
                FT_INT64,
3701
16
                BASE_CUSTOM,
3702
16
                CF_FUNC(c2p_sti_value_angle_format),
3703
16
                0x00,
3704
16
                NULL,
3705
16
                HFILL
3706
16
            }
3707
16
        },
3708
16
        {
3709
16
            &hf_c2p_sti_value_acceleration_desc,
3710
16
            {
3711
16
                "Value",
3712
16
                "c2p.sti_value",
3713
16
                FT_INT64,
3714
16
                BASE_CUSTOM,
3715
16
                CF_FUNC(c2p_sti_value_acceleration_format),
3716
16
                0x00,
3717
16
                NULL,
3718
16
                HFILL
3719
16
            }
3720
16
        },
3721
16
        {
3722
16
            &hf_c2p_sti_value_angular_velocity_desc,
3723
16
            {
3724
16
                "Value",
3725
16
                "c2p.sti_value",
3726
16
                FT_INT64,
3727
16
                BASE_CUSTOM,
3728
16
                CF_FUNC(c2p_sti_value_angular_velocity_format),
3729
16
                0x00,
3730
16
                NULL,
3731
16
                HFILL
3732
16
            }
3733
16
        },
3734
16
        {
3735
16
            &hf_c2p_sti_value_thousandths_desc,
3736
16
            {
3737
16
                "Value",
3738
16
                "c2p.sti_value",
3739
16
                FT_INT64,
3740
16
                BASE_CUSTOM,
3741
16
                CF_FUNC(c2p_sti_value_thousandths_format),
3742
16
                0x00,
3743
16
                NULL,
3744
16
                HFILL
3745
16
            }
3746
16
        },
3747
16
        {
3748
16
            &hf_c2p_sti_value_length_desc,
3749
16
            {
3750
16
                "Value",
3751
16
                "c2p.sti_value",
3752
16
                FT_INT64,
3753
16
                BASE_CUSTOM,
3754
16
                CF_FUNC(c2p_sti_value_length_format),
3755
16
                0x00,
3756
16
                NULL,
3757
16
                HFILL
3758
16
            }
3759
16
        },
3760
16
        {
3761
16
            &hf_c2p_sti_value_mass_desc,
3762
16
            {
3763
16
                "Value",
3764
16
                "c2p.sti_value",
3765
16
                FT_INT64,
3766
16
                BASE_CUSTOM,
3767
16
                CF_FUNC(c2p_sti_value_mass_format),
3768
16
                0x00,
3769
16
                NULL,
3770
16
                HFILL
3771
16
            }
3772
16
        },
3773
16
        {
3774
16
            &hf_c2p_sti_value_rain_rate_desc,
3775
16
            {
3776
16
                "Value",
3777
16
                "c2p.sti_value",
3778
16
                FT_INT64,
3779
16
                BASE_CUSTOM,
3780
16
                CF_FUNC(c2p_sti_value_rain_rate_format),
3781
16
                0x00,
3782
16
                NULL,
3783
16
                HFILL
3784
16
            }
3785
16
        },
3786
16
        {
3787
16
            &hf_c2p_sti_value_solar_irradiance_desc,
3788
16
            {
3789
16
                "Value",
3790
16
                "c2p.sti_value",
3791
16
                FT_INT64,
3792
16
                BASE_CUSTOM,
3793
16
                CF_FUNC(c2p_sti_value_solar_irradiance_format),
3794
16
                0x00,
3795
16
                NULL,
3796
16
                HFILL
3797
16
            }
3798
16
        },
3799
16
        {
3800
16
            &hf_c2p_sti_value_temperature_desc,
3801
16
            {
3802
16
                "Value",
3803
16
                "c2p.sti_value",
3804
16
                FT_INT64,
3805
16
                BASE_CUSTOM,
3806
16
                CF_FUNC(c2p_sti_value_temperature_format),
3807
16
                0x00,
3808
16
                NULL,
3809
16
                HFILL
3810
16
            }
3811
16
        },
3812
16
        {
3813
16
            &hf_c2p_sti_value_pressure_desc,
3814
16
            {
3815
16
                "Value",
3816
16
                "c2p.sti_value",
3817
16
                FT_INT64,
3818
16
                BASE_CUSTOM,
3819
16
                CF_FUNC(c2p_sti_value_pressure_format),
3820
16
                0x00,
3821
16
                NULL,
3822
16
                HFILL
3823
16
            }
3824
16
        },
3825
16
        {
3826
16
            &hf_c2p_sti_value_sweep_rate_desc,
3827
16
            {
3828
16
                "Value",
3829
16
                "c2p.sti_value",
3830
16
                FT_INT64,
3831
16
                BASE_CUSTOM,
3832
16
                CF_FUNC(c2p_sti_value_sweep_rate_format),
3833
16
                0x00,
3834
16
                NULL,
3835
16
                HFILL
3836
16
            }
3837
16
        },
3838
16
        {
3839
16
            &hf_c2p_sti_value_integer_desc,
3840
16
            {
3841
16
                "Value",
3842
16
                "c2p.sti_value",
3843
16
                FT_INT64,
3844
16
                BASE_CUSTOM,
3845
16
                CF_FUNC(c2p_sti_value_integer_format),
3846
16
                0x00,
3847
16
                NULL,
3848
16
                HFILL
3849
16
            }
3850
16
        },
3851
16
        {
3852
16
            &hf_c2p_sti_value_transmission_state_desc,
3853
16
            {
3854
16
                "Value",
3855
16
                "c2p.sti_value",
3856
16
                FT_INT64,
3857
16
                BASE_DEC|BASE_VAL64_STRING,
3858
16
                VALS64(sti_transmission_state_types),
3859
16
                0x00,
3860
16
                NULL,
3861
16
                HFILL
3862
16
            }
3863
16
        },
3864
16
        {
3865
16
            &hf_c2p_sti_value_aux_breaks_desc,
3866
16
            {
3867
16
                "Value",
3868
16
                "c2p.sti_value",
3869
16
                FT_INT64,
3870
16
                BASE_DEC|BASE_VAL64_STRING,
3871
16
                VALS64(sti_aux_breaks_types),
3872
16
                0x00,
3873
16
                NULL,
3874
16
                HFILL
3875
16
            }
3876
16
        },
3877
16
        {
3878
16
            &hf_c2p_sti_value_vehicle_length_conf_desc,
3879
16
            {
3880
16
                "Value",
3881
16
                "c2p.sti_value",
3882
16
                FT_INT64,
3883
16
                BASE_DEC|BASE_VAL64_STRING,
3884
16
                VALS64(sti_vehicle_length_conf_types),
3885
16
                0x00,
3886
16
                NULL,
3887
16
                HFILL
3888
16
            }
3889
16
        },
3890
16
        {
3891
16
            &hf_c2p_sti_value_dangerous_goods_desc,
3892
16
            {
3893
16
                "Value",
3894
16
                "c2p.sti_value",
3895
16
                FT_INT64,
3896
16
                BASE_DEC|BASE_VAL64_STRING,
3897
16
                VALS64(sti_dangerous_goods_types),
3898
16
                0x00,
3899
16
                NULL,
3900
16
                HFILL
3901
16
            }
3902
16
        },
3903
16
        {
3904
16
            &hf_c2p_sti_value_station_type_desc,
3905
16
            {
3906
16
                "Value",
3907
16
                "c2p.sti_value",
3908
16
                FT_INT64,
3909
16
                BASE_DEC|BASE_VAL64_STRING,
3910
16
                VALS64(sti_station_type_types),
3911
16
                0x00,
3912
16
                NULL,
3913
16
                HFILL
3914
16
            }
3915
16
        },
3916
16
        {
3917
16
            &hf_c2p_sti_value_vehicle_role_desc,
3918
16
            {
3919
16
                "Value",
3920
16
                "c2p.sti_value",
3921
16
                FT_INT64,
3922
16
                BASE_DEC|BASE_VAL64_STRING,
3923
16
                VALS64(sti_vehicle_role_types),
3924
16
                0x00,
3925
16
                NULL,
3926
16
                HFILL
3927
16
            }
3928
16
        },
3929
16
        {
3930
16
            &hf_c2p_sti_value_weather_precip_situation_desc,
3931
16
            {
3932
16
                "Value",
3933
16
                "c2p.sti_value",
3934
16
                FT_INT64,
3935
16
                BASE_DEC|BASE_VAL64_STRING,
3936
16
                VALS64(sti_weather_precip_situation_types),
3937
16
                0x00,
3938
16
                NULL,
3939
16
                HFILL
3940
16
            }
3941
16
        },
3942
16
        {
3943
16
            &hf_c2p_sti_value_wiper_state_desc,
3944
16
            {
3945
16
                "Value",
3946
16
                "c2p.sti_value",
3947
16
                FT_INT64,
3948
16
                BASE_DEC|BASE_VAL64_STRING,
3949
16
                VALS64(sti_wiper_state_types),
3950
16
                0x00,
3951
16
                NULL,
3952
16
                HFILL
3953
16
            }
3954
16
        },
3955
16
        {
3956
16
            &hf_c2p_sti_value_door_state_desc,
3957
16
            {
3958
16
                "Value",
3959
16
                "c2p.sti_value",
3960
16
                FT_INT64,
3961
16
                BASE_DEC|BASE_VAL64_STRING,
3962
16
                VALS64(sti_door_state_types),
3963
16
                0x00,
3964
16
                NULL,
3965
16
                HFILL
3966
16
            }
3967
16
        },
3968
16
        {
3969
16
            &hf_c2p_sti_value_fuel_type_desc,
3970
16
            {
3971
16
                "Value",
3972
16
                "c2p.sti_value",
3973
16
                FT_INT64,
3974
16
                BASE_DEC|BASE_VAL64_STRING,
3975
16
                VALS64(sti_fuel_type_types),
3976
16
                0x00,
3977
16
                NULL,
3978
16
                HFILL
3979
16
            }
3980
16
        },
3981
16
        {
3982
16
            &hf_c2p_sti_value_road_class_desc,
3983
16
            {
3984
16
                "Value",
3985
16
                "c2p.sti_value",
3986
16
                FT_INT64,
3987
16
                BASE_DEC|BASE_VAL64_STRING,
3988
16
                VALS64(sti_road_class_types),
3989
16
                0x00,
3990
16
                NULL,
3991
16
                HFILL
3992
16
            }
3993
16
        },
3994
16
        {
3995
16
            &hf_c2p_sti_value_road_rule_desc,
3996
16
            {
3997
16
                "Value",
3998
16
                "c2p.sti_value",
3999
16
                FT_INT64,
4000
16
                BASE_DEC|BASE_VAL64_STRING,
4001
16
                VALS64(sti_road_rule_types),
4002
16
                0x00,
4003
16
                NULL,
4004
16
                HFILL
4005
16
            }
4006
16
        },
4007
16
        {
4008
16
            &hf_c2p_sti_value_area_type_desc,
4009
16
            {
4010
16
                "Value",
4011
16
                "c2p.sti_value",
4012
16
                FT_INT64,
4013
16
                BASE_DEC|BASE_VAL64_STRING,
4014
16
                VALS64(sti_area_type_types),
4015
16
                0x00,
4016
16
                NULL,
4017
16
                HFILL
4018
16
            }
4019
16
        },
4020
16
        {
4021
16
            &hf_c2p_sti_value_belt_buckle_status_desc,
4022
16
            {
4023
16
                "Value",
4024
16
                "c2p.sti_value",
4025
16
                FT_INT64,
4026
16
                BASE_DEC|BASE_VAL64_STRING,
4027
16
                VALS64(sti_belt_buckle_status_types),
4028
16
                0x00,
4029
16
                NULL,
4030
16
                HFILL
4031
16
            }
4032
16
        },
4033
16
        {
4034
16
            &hf_c2p_sti_value_transmission_type_desc,
4035
16
            {
4036
16
                "Value",
4037
16
                "c2p.sti_value",
4038
16
                FT_INT64,
4039
16
                BASE_DEC|BASE_VAL64_STRING,
4040
16
                VALS64(sti_transmission_type_types),
4041
16
                0x00,
4042
16
                NULL,
4043
16
                HFILL
4044
16
            }
4045
16
        },
4046
16
        {
4047
16
            &hf_c2p_sti_value_physical_road_separation_desc,
4048
16
            {
4049
16
                "Value",
4050
16
                "c2p.sti_value",
4051
16
                FT_INT64,
4052
16
                BASE_DEC|BASE_VAL64_STRING,
4053
16
                VALS64(sti_physical_road_separation_types),
4054
16
                0x00,
4055
16
                NULL,
4056
16
                HFILL
4057
16
            }
4058
16
        },
4059
16
        {
4060
16
            &hf_c2p_sti_value_siren_desc,
4061
16
            {
4062
16
                "Value",
4063
16
                "c2p.sti_value",
4064
16
                FT_INT64,
4065
16
                BASE_DEC|BASE_VAL64_STRING,
4066
16
                VALS64(sti_siren_types),
4067
16
                0x00,
4068
16
                NULL,
4069
16
                HFILL
4070
16
            }
4071
16
        },
4072
16
        {
4073
16
            &hf_c2p_sti_value_lightbar_desc,
4074
16
            {
4075
16
                "Value",
4076
16
                "c2p.sti_value",
4077
16
                FT_INT64,
4078
16
                BASE_DEC|BASE_VAL64_STRING,
4079
16
                VALS64(sti_lightbar_types),
4080
16
                0x00,
4081
16
                NULL,
4082
16
                HFILL
4083
16
            }
4084
16
        },
4085
16
        {
4086
16
            &hf_c2p_sti_value_lane_position_desc,
4087
16
            {
4088
16
                "Value",
4089
16
                "c2p.sti_value",
4090
16
                FT_INT64,
4091
16
                BASE_DEC|BASE_VAL64_STRING,
4092
16
                VALS64(sti_lane_position_types),
4093
16
                0x00,
4094
16
                NULL,
4095
16
                HFILL
4096
16
            }
4097
16
        },
4098
16
        {
4099
16
            &hf_c2p_sti_value_state_desc,
4100
16
            {
4101
16
                "Value",
4102
16
                "c2p.sti_value",
4103
16
                FT_INT64,
4104
16
                BASE_DEC|BASE_VAL64_STRING,
4105
16
                VALS64(sti_state_types),
4106
16
                0x00,
4107
16
                NULL,
4108
16
                HFILL
4109
16
            }
4110
16
        },
4111
16
        {
4112
16
            &hf_c2p_sti_value_tristate_desc,
4113
16
            {
4114
16
                "Value",
4115
16
                "c2p.sti_value",
4116
16
                FT_INT64,
4117
16
                BASE_DEC|BASE_VAL64_STRING,
4118
16
                VALS64(sti_tristate_types),
4119
16
                0x00,
4120
16
                NULL,
4121
16
                HFILL
4122
16
            }
4123
16
        },
4124
16
        {
4125
16
            &hf_c2p_fac_msg_type_desc,
4126
16
            {
4127
16
                "Facility message type",
4128
16
                "c2p.fac.msg_type",
4129
16
                FT_UINT32,
4130
16
                BASE_DEC,
4131
16
                VALS(fac_msg_types),
4132
16
                0x00,
4133
16
                NULL,
4134
16
                HFILL
4135
16
            }
4136
16
        },
4137
16
        {
4138
16
            &hf_c2p_fac_timestamp_desc,
4139
16
            {
4140
16
                "Timestamp",
4141
16
                "c2p.fac.timestamp",
4142
16
                FT_UINT64,
4143
16
                BASE_CUSTOM,
4144
16
                CF_FUNC(c2p_fac_timestamp_format),
4145
16
                0x00,
4146
16
                NULL,
4147
16
                HFILL
4148
16
            }
4149
16
        },
4150
16
        {
4151
16
            &hf_c2p_fac_interface_id_desc,
4152
16
            {
4153
16
                "Interface ID",
4154
16
                "c2p.fac.interface_id",
4155
16
                FT_UINT32,
4156
16
                BASE_CUSTOM,
4157
16
                CF_FUNC(c2p_fac_interface_id_format),
4158
16
                0x00,
4159
16
                NULL,
4160
16
                HFILL
4161
16
            }
4162
16
        },
4163
16
        {
4164
16
            &hf_c2p_fac_source_address_desc,
4165
16
            {
4166
16
                "Source address",
4167
16
                "c2p.fac.source_address",
4168
16
                FT_ETHER,
4169
16
                BASE_NONE,
4170
16
                NULL,
4171
16
                0x00,
4172
16
                NULL,
4173
16
                HFILL
4174
16
            }
4175
16
        },
4176
16
        {
4177
16
            &hf_c2p_fac_dest_address_desc,
4178
16
            {
4179
16
                "Destination address",
4180
16
                "c2p.fac.dest_address",
4181
16
                FT_ETHER,
4182
16
                BASE_NONE,
4183
16
                NULL,
4184
16
                0x00,
4185
16
                NULL,
4186
16
                HFILL
4187
16
            }
4188
16
        },
4189
16
        {
4190
16
            &hf_c2p_fac_datarate_desc,
4191
16
            {
4192
16
                "Datarate",
4193
16
                "c2p.fac.datarate",
4194
16
                FT_UINT16,
4195
16
                BASE_CUSTOM,
4196
16
                CF_FUNC(c2p_fac_datarate_format),
4197
16
                0x00,
4198
16
                NULL,
4199
16
                HFILL
4200
16
            }
4201
16
        },
4202
16
        {
4203
16
            &hf_c2p_fac_user_prio_desc,
4204
16
            {
4205
16
                "User priority",
4206
16
                "c2p.fac.user_prio",
4207
16
                FT_UINT8,
4208
16
                BASE_CUSTOM,
4209
16
                CF_FUNC(c2p_fac_user_prio_format),
4210
16
                0x00,
4211
16
                NULL,
4212
16
                HFILL
4213
16
            }
4214
16
        },
4215
16
        {
4216
16
            &hf_c2p_fac_rssi_desc,
4217
16
            {
4218
16
                "RSSI",
4219
16
                "c2p.fac.rssi",
4220
16
                FT_INT16,
4221
16
                BASE_CUSTOM,
4222
16
                CF_FUNC(c2p_power_dbm_format),
4223
16
                0x00,
4224
16
                NULL,
4225
16
                HFILL
4226
16
            }
4227
16
        },
4228
16
        {
4229
16
            &hf_c2p_fac_fingerprint_desc,
4230
16
            {
4231
16
                "Fingerprint",
4232
16
                "c2p.fac.fingerprint",
4233
16
                FT_UINT64,
4234
16
                BASE_CUSTOM,
4235
16
                CF_FUNC(c2p_fac_fingerprint_format),
4236
16
                0x00,
4237
16
                NULL,
4238
16
                HFILL
4239
16
            }
4240
16
        },
4241
16
        {
4242
16
            &hf_c2p_fac_verify_result_desc,
4243
16
            {
4244
16
                "Verification result",
4245
16
                "c2p.fac.verify_result",
4246
16
                FT_UINT32,
4247
16
                BASE_DEC,
4248
16
                VALS(fac_verify_results),
4249
16
                0x00,
4250
16
                NULL,
4251
16
                HFILL
4252
16
            }
4253
16
        },
4254
16
        {
4255
16
            &hf_c2p_fac_psid_desc,
4256
16
            {
4257
16
                "PSID",
4258
16
                "c2p.fac.psid",
4259
16
                FT_UINT32,
4260
16
                BASE_CUSTOM,
4261
16
                CF_FUNC(c2p_psid_format),
4262
16
                0x00,
4263
16
                NULL,
4264
16
                HFILL
4265
16
            }
4266
16
        },
4267
16
        {
4268
16
            &hf_c2p_fac_ssp_type_desc,
4269
16
            {
4270
16
                "Type",
4271
16
                "c2p.fac.ssp.type",
4272
16
                FT_UINT32,
4273
16
                BASE_DEC,
4274
16
                VALS(fac_ssp_types),
4275
16
                0x00,
4276
16
                NULL,
4277
16
                HFILL
4278
16
            }
4279
16
        },
4280
16
        {
4281
16
            &hf_c2p_fac_ssp_field_desc,
4282
16
            {
4283
16
                "Field",
4284
16
                "c2p.fac.ssp.field",
4285
16
                FT_BYTES,
4286
16
                BASE_NONE,
4287
16
                NULL,
4288
16
                0x00,
4289
16
                NULL,
4290
16
                HFILL
4291
16
            }
4292
16
        },
4293
16
        {
4294
16
            &hf_c2p_fac_ssp_length_desc,
4295
16
            {
4296
16
                "Length",
4297
16
                "c2p.fac.ssp.length",
4298
16
                FT_UINT32,
4299
16
                BASE_DEC,
4300
16
                NULL,
4301
16
                0x00,
4302
16
                NULL,
4303
16
                HFILL
4304
16
            }
4305
16
        },
4306
16
        {
4307
16
            &hf_c2p_fac_signer_id_desc,
4308
16
            {
4309
16
                "Signer ID",
4310
16
                "c2p.fac.signer_id",
4311
16
                FT_UINT64,
4312
16
                BASE_HEX,
4313
16
                NULL,
4314
16
                0x00,
4315
16
                NULL,
4316
16
                HFILL
4317
16
            }
4318
16
        },
4319
16
        {
4320
16
            &hf_c2p_fac_generation_time_desc,
4321
16
            {
4322
16
                "Generation time",
4323
16
                "c2p.fac.generation_time",
4324
16
                FT_UINT64,
4325
16
                BASE_CUSTOM,
4326
16
                CF_FUNC(c2p_fac_generation_time_format),
4327
16
                0x00,
4328
16
                NULL,
4329
16
                HFILL
4330
16
            }
4331
16
        },
4332
16
        {
4333
16
            &hf_c2p_fac_payload_length_desc,
4334
16
            {
4335
16
                "Payload length",
4336
16
                "c2p.fac.payload_length",
4337
16
                FT_UINT16,
4338
16
                BASE_DEC,
4339
16
                NULL,
4340
16
                0x00,
4341
16
                NULL,
4342
16
                HFILL
4343
16
            }
4344
16
        },
4345
16
        {
4346
16
            &hf_c2p_api_direction_desc,
4347
16
            {
4348
16
                "Direction",
4349
16
                "c2p.api.direction",
4350
16
                FT_UINT8,
4351
16
                BASE_DEC,
4352
16
                VALS(api_directions),
4353
16
                0x00,
4354
16
                NULL,
4355
16
                HFILL
4356
16
            }
4357
16
        },
4358
16
        {
4359
16
            &hf_c2p_api_client_ip_desc,
4360
16
            {
4361
16
                "Client address",
4362
16
                "c2p.api.client_ip",
4363
16
                FT_IPv4,
4364
16
                BASE_NONE,
4365
16
                NULL,
4366
16
                0x00,
4367
16
                NULL,
4368
16
                HFILL
4369
16
            }
4370
16
        },
4371
16
        {
4372
16
            &hf_c2p_api_client_port_desc,
4373
16
            {
4374
16
                "Client port",
4375
16
                "c2p.api.client_port",
4376
16
                FT_UINT16,
4377
16
                BASE_DEC,
4378
16
                NULL,
4379
16
                0x00,
4380
16
                NULL,
4381
16
                HFILL
4382
16
            }
4383
16
        },
4384
16
        {
4385
16
            &hf_c2p_api_length_desc,
4386
16
            {
4387
16
                "API frame length",
4388
16
                "c2p.api.length",
4389
16
                FT_UINT16,
4390
16
                BASE_DEC,
4391
16
                NULL,
4392
16
                0x00,
4393
16
                NULL,
4394
16
                HFILL
4395
16
            }
4396
16
        },
4397
16
    };
4398
4399
16
    int* ett[] = {
4400
16
        &ett_c2p
4401
16
    };
4402
4403
16
    proto_desc = proto_register_protocol("C2P (Commsignia Capture Protocol)", "C2P", "c2p");
4404
4405
16
    proto_register_field_array(proto_desc, header_fields, array_length(header_fields));
4406
16
    proto_register_subtree_array(ett, array_length(ett));
4407
16
}
4408
4409
void proto_reg_handoff_c2p(void)
4410
16
{
4411
16
    dissector_handle_t c2p_handle = NULL;
4412
4413
16
    c2p_handle = create_dissector_handle(dissect_c2p, proto_desc);
4414
4415
16
    ieee80211_handle = find_dissector_add_dependency("wlan", proto_desc);
4416
16
    its_handle = find_dissector_add_dependency("its", proto_desc);
4417
16
    j2735_handle = find_dissector_add_dependency("j2735", proto_desc);
4418
16
    wsa_handle = find_dissector_add_dependency("wsa", proto_desc);
4419
16
    cn_msg_frame_handle = find_dissector_add_dependency("cn-msg-frame", proto_desc);
4420
16
    commsigniaapi_handle = find_dissector_add_dependency("commsigniaapi", proto_desc);
4421
4422
16
    static const uint32_t C2P_PORT = 7943UL;
4423
16
    static const char* const UDP_PORT_NAME = "udp.port";
4424
4425
16
    dissector_add_uint(UDP_PORT_NAME, C2P_PORT, c2p_handle);
4426
16
}
4427