| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
packet-opensafety.h
1/* packet-opensafety.h
2 *
3 * openSAFETY is a machine-safety protocol, encapsulated in modern fieldbus
4 * and industrial ethernet solutions.
5 *
6 * For more information see http://www.open-safety.org
7 *
8 * This header contains commonly used headers, which may be used by programs
9 * utilizing the tap-interface of the dissector
10 *
11 * By Roland Knall <roland.knall@br-automation.com>
12 * Copyright 2011-2015 Bernecker + Rainer Industrie-Elektronik Ges.m.b.H.
13 *
14 * Wireshark - Network traffic analyzer
15 * By Gerald Combs <gerald@wireshark.org>
16 * Copyright 1998 Gerald Combs
17 *
18 * SPDX-License-Identifier: GPL-2.0-or-later
19 */
20
21#ifndef _OPENSAFETY_HEADER_
22#define _OPENSAFETY_HEADER_
23
24#include <epan/tfs.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif /* __cplusplus */
29
30/* openSAFETY UDP Port */
31#ifndef OPENSAFETY_UDP_PORT
32#define OPENSAFETY_UDP_PORT 9877
33#endif
34
35/* SercosIII UDP Port */
36#ifndef OPENSAFETY_UDP_PORT_SIII
37#define OPENSAFETY_UDP_PORT_SIII 8755
38#endif
39
40#define OPENSAFETY_DEFAULT_DOMAIN 0x1
41
42/* openSAFETY CRC types */
43#define OPENSAFETY_CHECKSUM_CRC8 0x01
44#define OPENSAFETY_CHECKSUM_CRC16 0x02
45#define OPENSAFETY_CHECKSUM_CRC32 0x04
46#define OPENSAFETY_CHECKSUM_CRC16SLIM 0x08
47#define OPENSAFETY_CHECKSUM_INVALID 0xFF
48
49static const value_string opensafety_frame_crc_type[] = {
50 { OPENSAFETY_CHECKSUM_CRC8, "CRC8" },
51 { OPENSAFETY_CHECKSUM_CRC16, "CRC16" },
52 { OPENSAFETY_CHECKSUM_CRC32, "CRC32" },
53 { OPENSAFETY_CHECKSUM_CRC16SLIM, "CRC16 Slim" },
54 { 0, NULL }
55};
56
57/* openSAFETY Message Types */
58#define OPENSAFETY_SNMT_MESSAGE_TYPE 0xA0
59#define OPENSAFETY_SPDO_MESSAGE_TYPE 0xC0
60#define OPENSAFETY_SSDO_MESSAGE_TYPE 0xE0
61#define OPENSAFETY_SLIM_SSDO_MESSAGE_TYPE 0xE8
62
63/* We shift the values by 5, otherwise they won't get picked up by the
64 * hf_field value dissection */
65static const value_string opensafety_msg_id_values[] = {
66 { OPENSAFETY_SNMT_MESSAGE_TYPE >> 5, "openSAFETY SNMT" },
67 { OPENSAFETY_SPDO_MESSAGE_TYPE >> 5, "openSAFETY SPDO" },
68 { OPENSAFETY_SSDO_MESSAGE_TYPE >> 5, "openSAFETY SSDO" },
69 { 0, NULL }
70};
71
72/* openSAFETY Message IDs */
73#define OPENSAFETY_MSG_SPDO_DATA_ONLY 0xC0
74#define OPENSAFETY_MSG_SPDO_DATA_WITH_TIME_REQUEST 0xC8
75#define OPENSAFETY_MSG_SPDO_DATA_WITH_TIME_RESPONSE 0xD0
76#define OPENSAFETY_MSG_SPDO_RESERVED 0xD8
77
78#define OPENSAFETY_MSG_SSDO_SERVICE_REQUEST 0xE0
79#define OPENSAFETY_MSG_SSDO_SERVICE_RESPONSE 0xE4
80#define OPENSAFETY_MSG_SSDO_SLIM_SERVICE_REQUEST 0xE8
81#define OPENSAFETY_MSG_SSDO_SLIM_SERVICE_RESPONSE 0xEC
82
83#define OPENSAFETY_MSG_SNMT_REQUEST_UDID 0xA0
84#define OPENSAFETY_MSG_SNMT_RESPONSE_UDID 0xA4
85#define OPENSAFETY_MSG_SNMT_ASSIGN_SADR 0xA8
86#define OPENSAFETY_MSG_SNMT_SADR_ASSIGNED 0xAC
87#define OPENSAFETY_MSG_SNMT_SERVICE_REQUEST 0xB0
88#define OPENSAFETY_MSG_SNMT_SERVICE_RESPONSE 0xB4
89#define OPENSAFETY_MSG_SNMT_SN_RESET_GUARDING_SCM 0xBC
90
91static const value_string opensafety_message_type_values[] = {
92 { OPENSAFETY_MSG_SPDO_DATA_ONLY, "SPDO Data only" },
93 { OPENSAFETY_MSG_SPDO_DATA_WITH_TIME_REQUEST, "SPDO Data with Time Request" },
94 { OPENSAFETY_MSG_SPDO_DATA_WITH_TIME_RESPONSE, "SPDO Data with Time Response" },
95 { OPENSAFETY_MSG_SPDO_RESERVED, "SPDO Reserved" },
96
97 { OPENSAFETY_MSG_SSDO_SERVICE_REQUEST, "SSDO Service Request" },
98 { OPENSAFETY_MSG_SSDO_SERVICE_RESPONSE, "SSDO Service Response" },
99 { OPENSAFETY_MSG_SSDO_SLIM_SERVICE_REQUEST, "SSDO Slim Service Request" },
100 { OPENSAFETY_MSG_SSDO_SLIM_SERVICE_RESPONSE, "SSDO Slim Service Response" },
101
102 { OPENSAFETY_MSG_SNMT_REQUEST_UDID, "SNMT Request UDID" },
103 { OPENSAFETY_MSG_SNMT_RESPONSE_UDID, "SNMT Response UDID" },
104 { OPENSAFETY_MSG_SNMT_ASSIGN_SADR, "SNMT Assign SADR" },
105 { OPENSAFETY_MSG_SNMT_SADR_ASSIGNED, "SNMT SADR Assigned" },
106 { OPENSAFETY_MSG_SNMT_SERVICE_REQUEST, "SNMT Service Request" },
107 { OPENSAFETY_MSG_SNMT_SERVICE_RESPONSE, "SNMT Service Response" },
108 { OPENSAFETY_MSG_SNMT_SN_RESET_GUARDING_SCM, "SNMT SN reset guarding SCM" },
109 {0, NULL }
110};
111
112/* SNTM extended Services */
113#define OPENSAFETY_MSG_SNMT_EXT_SN_SET_TO_PRE_OP 0x00
114#define OPENSAFETY_MSG_SNMT_EXT_SN_SET_TO_OP 0x02
115#define OPENSAFETY_MSG_SNMT_EXT_SCM_SET_TO_STOP 0x04
116#define OPENSAFETY_MSG_SNMT_EXT_SCM_SET_TO_OP 0x06
117#define OPENSAFETY_MSG_SNMT_EXT_SCM_GUARD_SN 0x08
118#define OPENSAFETY_MSG_SNMT_EXT_ASSIGN_ADDITIONAL_SADR 0x0A
119#define OPENSAFETY_MSG_SNMT_EXT_SN_ACKNOWLEDGE 0x0C
120#define OPENSAFETY_MSG_SNMT_EXT_SN_ASSIGN_UDID_SCM 0x0E
121#define OPENSAFETY_MSG_SNMT_EXT_SN_STATUS_PRE_OP 0x01
122#define OPENSAFETY_MSG_SNMT_EXT_SN_STATUS_OP 0x03
123#define OPENSAFETY_MSG_SNMT_EXT_SN_ASSIGNED_ADDITIONAL_SADR 0x05
124#define OPENSAFETY_MSG_SNMT_EXT_SN_FAIL 0x07
125#define OPENSAFETY_MSG_SNMT_EXT_SN_BUSY 0x09
126#define OPENSAFETY_MSG_SNMT_EXT_SN_ASSIGNED_UDID_SCM 0x0F
127#define OPENSAFETY_MSG_SNMT_EXT_ASSIGN_INIT_CT 0x10
128#define OPENSAFETY_MSG_SNMT_EXT_ASSIGNED_INIT_CT 0x11
129
130static const value_string opensafety_message_service_type[] = {
131 { OPENSAFETY_MSG_SNMT_EXT_SN_SET_TO_PRE_OP, "SN set to pre Operational" },
132 { OPENSAFETY_MSG_SNMT_EXT_SN_SET_TO_OP, "SN set to Operational" },
133 { OPENSAFETY_MSG_SNMT_EXT_SCM_SET_TO_STOP, "SCM set to Stop" },
134 { OPENSAFETY_MSG_SNMT_EXT_SCM_SET_TO_OP, "SCM set to Operational" },
135 { OPENSAFETY_MSG_SNMT_EXT_SCM_GUARD_SN, "SCM guard SN" },
136 { OPENSAFETY_MSG_SNMT_EXT_ASSIGN_ADDITIONAL_SADR, "Assign additional SADR" },
137 { OPENSAFETY_MSG_SNMT_EXT_SN_ACKNOWLEDGE, "SN Acknowledge" },
138 { OPENSAFETY_MSG_SNMT_EXT_SN_ASSIGN_UDID_SCM, "SN assign UDID SCM" },
139 { OPENSAFETY_MSG_SNMT_EXT_SN_STATUS_PRE_OP, "SN status pre Operational" },
140 { OPENSAFETY_MSG_SNMT_EXT_SN_STATUS_OP, "SN status Operational" },
141 { OPENSAFETY_MSG_SNMT_EXT_SN_ASSIGNED_ADDITIONAL_SADR, "Assigned additional SADR" },
142 { OPENSAFETY_MSG_SNMT_EXT_SN_FAIL, "SN Fail" },
143 { OPENSAFETY_MSG_SNMT_EXT_SN_BUSY, "SN Busy" },
144 { OPENSAFETY_MSG_SNMT_EXT_SN_ASSIGNED_UDID_SCM, "SN assigned UDID SCM" },
145 { OPENSAFETY_MSG_SNMT_EXT_ASSIGN_INIT_CT, "Assign initial CT for SN" },
146 { OPENSAFETY_MSG_SNMT_EXT_ASSIGNED_INIT_CT, "Acknowledge initial CT for SN" },
147 { 0, NULL }
148};
149
150/* Values 6-255 are reserved for future use. They will be presented as "Reserved [%d]"
151 * during dissection
152 */
153#define OPENSAFETY_ERROR_GROUP_APPLICATION 0x01
154#define OPENSAFETY_ERROR_GROUP_PARAMETER 0x02
155#define OPENSAFETY_ERROR_GROUP_VENDOR_SPECIFIC 0x03
156#define OPENSAFETY_ERROR_GROUP_OPENSAFETY_STACK 0x04
157#define OPENSAFETY_ERROR_GROUP_ADD_PARAMETER 0x05
158
159static const value_string opensafety_sn_fail_error_group[] = {
160 { OPENSAFETY_ERROR_GROUP_APPLICATION, "Application" },
161 { OPENSAFETY_ERROR_GROUP_PARAMETER, "Parameter" },
162 { OPENSAFETY_ERROR_GROUP_VENDOR_SPECIFIC, "Vendor specific" },
163 { OPENSAFETY_ERROR_GROUP_OPENSAFETY_STACK, "openSAFETY Stack" },
164 { OPENSAFETY_ERROR_GROUP_ADD_PARAMETER, "Additional parameter needed" },
165 { 0, NULL }
166};
167
168/* SSDO Access Command */
169
170#define OPENSAFETY_SSDO_SACMD_ACC 0x01
171#define OPENSAFETY_SSDO_SACMD_PRLD 0x02
172#define OPENSAFETY_SSDO_SACMD_ABRT 0x04
173#define OPENSAFETY_SSDO_SACMD_SEG 0x08
174#define OPENSAFETY_SSDO_SACMD_TGL 0x10
175#define OPENSAFETY_SSDO_SACMD_INI 0x20
176#define OPENSAFETY_SSDO_SACMD_ENSG 0x40
177#define OPENSAFETY_SSDO_SACMD_RES 0x80
178
179#define OPENSAFETY_SSDO_UPLOAD 0x00
180#define OPENSAFETY_SSDO_DOWNLOAD 0x01
181
182#define OPENSAFETY_MSG_SSDO_ABORT ( OPENSAFETY_SSDO_SACMD_ABRT )
183#define OPENSAFETY_MSG_SSDO_UPLOAD_SEGMENT_MIDDLE ( OPENSAFETY_SSDO_SACMD_SEG | OPENSAFETY_SSDO_UPLOAD )
184#define OPENSAFETY_MSG_SSDO_DOWNLOAD_SEGMENT_MIDDLE ( OPENSAFETY_SSDO_SACMD_SEG | OPENSAFETY_SSDO_DOWNLOAD )
185#define OPENSAFETY_MSG_SSDO_UPLOAD_SEGMENT_MID_PRELOAD ( OPENSAFETY_MSG_SSDO_UPLOAD_SEGMENT_MIDDLE | OPENSAFETY_SSDO_SACMD_PRLD )
186#define OPENSAFETY_MSG_SSDO_DOWNLOAD_SEGMENT_MID_PRELOAD ( OPENSAFETY_MSG_SSDO_DOWNLOAD_SEGMENT_MIDDLE | OPENSAFETY_SSDO_SACMD_PRLD )
187#define OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_EXPEDITED ( OPENSAFETY_SSDO_SACMD_INI | OPENSAFETY_SSDO_UPLOAD )
188#define OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_EXPEDITED ( OPENSAFETY_SSDO_SACMD_INI | OPENSAFETY_SSDO_DOWNLOAD )
189#define OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_EXP_PRELOAD ( OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_EXPEDITED | OPENSAFETY_SSDO_SACMD_PRLD )
190#define OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_EXP_PRELOAD ( OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_EXPEDITED | OPENSAFETY_SSDO_SACMD_PRLD )
191#define OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_SEGMENTED ( OPENSAFETY_SSDO_SACMD_INI | OPENSAFETY_SSDO_SACMD_SEG | OPENSAFETY_SSDO_UPLOAD )
192#define OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_SEGMENTED ( OPENSAFETY_SSDO_SACMD_INI | OPENSAFETY_SSDO_SACMD_SEG | OPENSAFETY_SSDO_DOWNLOAD )
193#define OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_SEG_PRELOAD ( OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_SEGMENTED | OPENSAFETY_SSDO_SACMD_PRLD )
194#define OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_SEG_PRELOAD ( OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_SEGMENTED | OPENSAFETY_SSDO_SACMD_PRLD )
195#define OPENSAFETY_MSG_SSDO_UPLOAD_SEGMENT_END ( OPENSAFETY_SSDO_SACMD_ENSG | OPENSAFETY_SSDO_SACMD_SEG | OPENSAFETY_SSDO_UPLOAD )
196#define OPENSAFETY_MSG_SSDO_DOWNLOAD_SEGMENT_END ( OPENSAFETY_SSDO_SACMD_ENSG | OPENSAFETY_SSDO_SACMD_SEG | OPENSAFETY_SSDO_DOWNLOAD )
197
198static const value_string opensafety_ssdo_sacmd_values[] = {
199 { OPENSAFETY_MSG_SSDO_DOWNLOAD_SEGMENT_END, "Download End Segment" },
200 { OPENSAFETY_MSG_SSDO_UPLOAD_SEGMENT_END, "Upload End Segment" },
201 { OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_EXPEDITED, "Download Expedited Initiate" },
202 { OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_SEGMENTED, "Upload Initiate Segmented" },
203 { OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_SEGMENTED, "Download Initiate Segmented" },
204 { OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_EXPEDITED, "Upload Expedited Initiate" },
205 { OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_EXP_PRELOAD, "Upload Expedited Initiate w.Preload" },
206 { OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_EXP_PRELOAD, "Download Initiate Segmented w.Preload" },
207 { OPENSAFETY_MSG_SSDO_UPLOAD_INITIATE_SEG_PRELOAD, "Upload Initiate Segmented w. Preload" },
208 { OPENSAFETY_MSG_SSDO_DOWNLOAD_INITIATE_SEG_PRELOAD, "Download Expedited Initiate w.Preload" },
209 { OPENSAFETY_MSG_SSDO_DOWNLOAD_SEGMENT_MIDDLE, "Download Middle Segment" },
210 { OPENSAFETY_MSG_SSDO_UPLOAD_SEGMENT_MIDDLE, "Upload Middle Segment" },
211 { OPENSAFETY_MSG_SSDO_DOWNLOAD_SEGMENT_MID_PRELOAD, "Download Middle Segment w. Preload" },
212 { OPENSAFETY_MSG_SSDO_UPLOAD_SEGMENT_MID_PRELOAD, "Upload Middle Segment w. Preload" },
213 { OPENSAFETY_MSG_SSDO_ABORT, "Abort" },
214 { 0, NULL }
215};
216
217static const true_false_string opensafety_sacmd_acc = { "Download", "Upload" };
218static const true_false_string opensafety_sacmd_abrt = { "Abort Transfer", "Successful Transfer" };
219static const true_false_string opensafety_sacmd_seg = { "Segmented Access", "Expedited Access" };
220static const true_false_string opensafety_sacmd_ini = { "Initiate", "No Initiate" };
221static const true_false_string opensafety_sacmd_ensg = { "No more segments", "More segments" };
222
223static const value_string opensafety_sod_idx_names[] = {
224 /* SSDO dictionary names, only names that are in common use are presented */
225 { 0x100C0000, "Life Guarding" },
226 { 0x100C0001, "Guard Time" },
227 { 0x100C0002, "LifeTimeFactor" },
228
229 { 0x100D0000, "Number of Retries for Reset Guarding" },
230
231 { 0x10180000, "Device Vendor Information" },
232 { 0x10180001, "VendorID" },
233 { 0x10180002, "ProductCode" },
234 { 0x10180003, "RevisionNumber" },
235 { 0x10180004, "SerialNumber" },
236 { 0x10180005, "FirmWareChecksum" },
237 { 0x10180006, "Parameter Checksum" },
238 { 0x10180007, "Parameter Timestamp" },
239
240 { 0x10190000, "Unique Device ID" },
241 { 0x101A0000, "Parameter Download" },
242 { 0x101B0000, "SCM Parameters" },
243
244 { 0x12000000, "Common Communication Parameters" },
245 { 0x12000001, "Safety Domain Number" },
246 { 0x12000002, "SADR" },
247 { 0x12000003, "Consecutive Timebase" },
248 { 0x12000004, "UDID of SCM" },
249
250 { 0x14000000, "RxSPDO Communication Parameters" },
251 { 0x14000001, "SADR" },
252 { 0x14000002, "SCT" },
253 { 0x14000003, "Number of consecutive TReq" },
254 { 0x14000004, "Time delay TReq" },
255 { 0x14000005, "Time delay Sync" },
256 { 0x14000006, "Min TSync Propagation Delay" },
257 { 0x14000007, "Max TSync Propagation Delay" },
258 { 0x14000008, "Min SPDO Propagation Delay" },
259 { 0x14000009, "Max SPDO Propagation Delay" },
260 { 0x1400000A, "Best case TRes Delay" },
261 { 0x1400000B, "Time Request Cycle" },
262 { 0x1400000C, "TxSPDO No" },
263
264 { 0x18000000, "RxSPDO Mapping Parameters" },
265
266 { 0x1C000000, "TxSPDO Communication Parameters" },
267 { 0x1C000001, "SADR for broadcast" },
268 { 0x1C000002, "Refresh Prescale" },
269 { 0x1C000003, "Number of TRes" },
270
271 { 0x20000000, "Manufacturer Parameters" },
272 { 0x20010000, "Used Channels" },
273
274 { 0x21000000, "Safe Machine Options" },
275
276 { 0x21010000, "SDG CRC Configuration" },
277 { 0x21010001, "SDG CRC #1" },
278 { 0x21010002, "SDG CRC #2" },
279 { 0x21010003, "SDG CRC #3" },
280 { 0x21010004, "SDG CRC #4" },
281 { 0x21010005, "SDG CRC #5" },
282 { 0x21010006, "SDG CRC #6" },
283 { 0x21010007, "SDG CRC #7" },
284 { 0x21010008, "SDG CRC #8" },
285 { 0x21010009, "SDG CRC #9" },
286 { 0x2101000A, "SDG CRC #10" },
287
288 { 0x21120000, "Manufacturer - Module specific" },
289 { 0x21120002, "PDOmapRx" },
290 { 0x21120003, "PDOmapTx" },
291 { 0x21120004, "CycleTime min [us]" },
292 { 0x21120005, "CycleTime max [us]" },
293 { 0x21120006, "Used Channels (same as 0x2001)" },
294 { 0x21120007, "External Machine Options" },
295 { 0x21120008, "Parameter for SafeMC" },
296
297 { 0xC0000000, "TxSPDO Mapping Parameters" },
298
299 { 0xD0000000, "SCM Module Flags" },
300 { 0xD0000001, "BCM" },
301 { 0xD0000002, "Optional" },
302 { 0xD0000003, "Startup" },
303 { 0xD0000004, "EMOs" },
304 { 0xD0000005, "ext. Startup-Flags allowed" },
305 { 0xD0000006, "Remote-Ctrl allowed" },
306 { 0xD0000007, "Scans at startup" },
307 { 0xD0000008, "Not Present" },
308 { 0xD0000009, "Use Remanent Data" },
309 { 0xD000000A, "SCM-AR specific" },
310
311 { 0xD0100000, "Remanent Data" },
312 { 0xD0100001, "DINT" },
313
314 { 0xD0110000, "Remanent Data" },
315 { 0xD0110001, "DUINT" },
316
317 { 0, NULL }
318};
319static value_string_ext opensafety_sod_idx_names_ext = VALUE_STRING_EXT_INIT(opensafety_sod_idx_names);
320
321static const value_string opensafety_abort_codes[] = {
322
323 /* SSDO abort codes */
324 { 0x05030000, "Reserved" },
325
326 { 0x05040000, "SSDO protocol timed out" },
327 { 0x05040001, "Client/server Command ID not valid or unknown" },
328 { 0x05040002, "Invalid block size" },
329 { 0x05040003, "Invalid sequence number" },
330 { 0x05040004, "Reserved" },
331 { 0x05040005, "Out of memory" },
332
333 { 0x06010000, "Unsupported access to an object" },
334 { 0x06010001, "Attempt to read a write-only object" },
335 { 0x06010002, "Attempt to write a read-only object" },
336
337 { 0x06020000, "Object does not exist in the object dictionary" },
338
339 { 0x06040041, "Object cannot be mapped to the SPDO" },
340 { 0x06040042, "The number and length of the objects to be mapped would exceed SPDO length" },
341 { 0x06040043, "General parameter incompatibility" },
342 { 0x06040047, "General internal incompatibility in the device" },
343
344 { 0x06060000, "Access failed due to a hardware error" },
345
346 { 0x06070010, "Data type does not match, length of service parameter does not match" },
347 { 0x06070012, "Data type does not match, length of service parameter too high" },
348 { 0x06070013, "Data type does not match, length of service parameter too low" },
349
350 { 0x06090011, "Sub-index does not exist" },
351 { 0x06090030, "Value range o parameter exceeded (only for write access)" },
352 { 0x06090031, "Value of parameter written too high" },
353 { 0x06090032, "Value of parameter written too low" },
354 { 0x06090036, "Maximum value is less than minimum value" },
355
356 { 0x08000000, "General error" },
357 { 0x08000020, "Data cannot be transferred or stored to the application" },
358 { 0x08000021, "Data cannot be transferred or stored to the application because of local control" },
359 { 0x08000022, "Data cannot be transferred or stored to the application because of the present device state" },
360 { 0x08000023, "Data cannot be transferred or stored to the application because of the object data is not available now" },
361
362 { 0, NULL }
363};
364static value_string_ext opensafety_abort_codes_ext = VALUE_STRING_EXT_INIT(opensafety_abort_codes);
365
366static const true_false_string opensafety_message_direction = { "Response", "Request" };
367static const true_false_string opensafety_spdo_direction = { "Producer", "Consumer" };
368static const true_false_string opensafety_addparam_request = { "Header only", "Header & Data" };
369
370 typedef struct _opensafety_packet_spdo
371{
372 uint16_t timerequest;
373
374 bool conn_valid;
375
376 bool counter_40bit;
377
378 union {
379 uint16_t b16;
380 uint64_t b40;
381 } counter;
382
383 struct {
384 bool enabled40bit;
385 bool requested40bit;
386 } flags;
387
388} opensafety_packet_spdo;
389
390 typedef struct _opensafety_packet_ssdo
391{
392 bool is_slim;
393
394 struct {
395 bool end_segment;
396 bool initiate;
397 bool toggle;
398 bool segmented;
399 bool abort_transfer;
400 bool preload;
401 bool read_access;
402 } sacmd;
403} opensafety_packet_ssdo;
404
405 typedef struct _opensafety_packet_snmt
406{
407 uint8_t ext_msg_id;
408
409 struct {
410 bool exists;
411 uint8_t id;
412 uint8_t set;
413 bool full;
414 } add_param;
415
416 struct {
417 uint16_t actual;
418 uint16_t additional;
419 } add_saddr;
420
421 uint64_t init_ct;
422
423 char * scm_udid;
424 char * sn_udid;
425
426 uint8_t error_code;
427} opensafety_packet_snmt;
428
429 typedef struct _opensafety_packet_frame
430{
431 bool malformed;
432
433 uint16_t subframe1;
434 uint16_t subframe2;
435
436 unsigned length;
437
438 uint16_t byte_offset;
439
440 tvbuff_t *frame_tvb;
441
442} opensafety_packet_frame;
443
444 typedef struct _opensafety_packet_crc
445{
446 uint8_t type;
447
448 uint16_t frame1;
449 uint16_t frame2;
450
451 bool valid1;
452 bool valid2;
453} opensafety_packet_crc;
454
455 typedef struct _opensafety_packet_info
456{
457 opensafety_packet_frame frame;
458
459 uint16_t saddr;
460 uint16_t sdn;
461
462 uint16_t sender;
463 uint16_t receiver;
464
465 bool is_request;
466
467 uint8_t msg_id;
468 uint8_t msg_type;
469 uint8_t msg_len;
470 unsigned frame_len;
471
472 uint8_t scm_udid[6];
473 bool scm_udid_valid;
474
475 opensafety_packet_crc crc;
476
477 union {
478 opensafety_packet_snmt *snmt;
479 opensafety_packet_ssdo *ssdo;
480 opensafety_packet_spdo *spdo;
481 } payload;
482
483} opensafety_packet_info;
484
485#ifdef __cplusplus
486}
487#endif /* __cplusplus */
488
489#endif /* _OPENSAFETY_HEADER_ */
490
491/*
492 * Editor modelines - https://www.wireshark.org/tools/modelines.html
493 *
494 * Local variables:
495 * c-basic-offset: 4
496 * tab-width: 8
497 * indent-tabs-mode: nil
498 * End:
499 *
500 * vi: set shiftwidth=4 tabstop=8 expandtab:
501 * :indentSize=4:tabSize=8:noTabs=true:
502 */
_opensafety_packet_crc
Definition packet-opensafety.h:445
_opensafety_packet_frame
Definition packet-opensafety.h:430
_opensafety_packet_info
Definition packet-opensafety.h:456
_opensafety_packet_info::msg_type
uint8_t msg_type
Definition packet-opensafety.h:468
_opensafety_packet_info::msg_id
uint8_t msg_id
Definition packet-opensafety.h:467
_opensafety_packet_snmt
Definition packet-opensafety.h:406
_opensafety_packet_spdo
Definition packet-opensafety.h:371
_opensafety_packet_ssdo
Definition packet-opensafety.h:391
_value_string_ext
Extended metadata for a value_string array.
Definition value_string.h:325
_value_string
Mapping between a 32-bit integer value and its string representation.
Definition value_string.h:33
true_false_string
Definition tfs.h:27
tvbuff
Definition tvbuff-int.h:35
tfs.h