Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-uavcan-dsdl.c
blob309804095c889ab93ec746a623b6abdf40e1de75
1 /* packet-uavcan-dsdl.c
2 * Routines for dissection of DSDL used in UAVCAN
4 * Copyright 2020-2021 NXP
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include "config.h"
14 #include <inttypes.h>
15 #include <epan/packet.h>
16 #include <epan/prefs.h>
17 #include <epan/address_types.h>
18 #include <epan/to_str.h>
19 #include <epan/proto_data.h>
21 #include "packet-uavcan-dsdl.h"
23 void proto_register_dsdl(void);
24 void proto_reg_handoff_dsdl(void);
26 static int proto_dsdl;
28 static int hf_heartbeat_uptime;
29 static int hf_heartbeat_health;
30 static int hf_heartbeat_mode;
31 static int hf_heartbeat_status_code;
33 static int hf_list_index;
34 static int hf_register_name;
35 static int hf_register_access_mutable;
36 static int hf_register_access_persistent;
37 static int hf_register_value_tag;
38 static int hf_register_value_size;
41 static int hf_node_id;
42 static int hf_pnp_unique_id;
43 static int hf_pnp_unique_id_hash;
44 static int hf_pnp_alloc;
46 static int hf_uavcan_primitive_Empty;
47 static int hf_uavcan_primitive_String;
48 static int hf_uavcan_primitive_Unstructured;
49 static int hf_uavcan_primitive_array_Integer64;
50 static int hf_uavcan_primitive_array_Integer32;
51 static int hf_uavcan_primitive_array_Integer16;
52 static int hf_uavcan_primitive_array_Integer8;
53 static int hf_uavcan_primitive_array_Natural64;
54 static int hf_uavcan_primitive_array_Natural32;
55 static int hf_uavcan_primitive_array_Natural16;
56 static int hf_uavcan_primitive_array_Natural8;
57 static int hf_uavcan_primitive_array_Real64;
58 static int hf_uavcan_primitive_array_Real32;
59 static int hf_uavcan_primitive_array_Real16;
62 static int hf_uavcan_getinfo_path;
63 static int hf_uavcan_getinfo_error;
64 static int hf_uavcan_getinfo_size;
65 static int hf_uavcan_getinfo_timestamp;
66 static int hf_uavcan_getinfo_is_file_not_directory;
67 static int hf_uavcan_getinfo_is_link;
68 static int hf_uavcan_getinfo_is_readable;
69 static int hf_uavcan_getinfo_is_writeable;
70 static int hf_uavcan_directory_path;
71 static int hf_uavcan_entry_base_name;
72 static int hf_uavcan_modify_error;
73 static int hf_uavcan_modify_source_path;
74 static int hf_uavcan_modify_destination_path;
75 static int hf_uavcan_modify_preserve_source;
76 static int hf_uavcan_modify_overwrite_destination;
77 static int hf_uavcan_read_offset;
78 static int hf_uavcan_read_path;
79 static int hf_uavcan_read_error;
80 static int hf_uavcan_write_offset;
81 static int hf_uavcan_write_path;
82 static int hf_uavcan_write_error;
83 static int hf_uavcan_entry_index;
85 static int hf_uavcan_time_syncronizedtimestamp;
86 static int hf_uavcan_diagnostic_severity;
88 static int ett_dsdl;
90 const range_string uavcan_subject_id_vals[] = {
91 { 0, 6143, "Unregulated identifier" },
92 { 6144, 7167, "Non-standard fixed regulated identifier"},
93 { 7168, 7168, "Synchronization.1.0" },
94 { 7509, 7509, "Heartbeat.1.0" },
95 { 7510, 7510, "List.0.1" },
96 { 8165, 8165, "NodeIDAllocationData.2.0" },
97 { 8166, 8166, "NodeIDAllocationData.1.0" },
98 { 8184, 8184, "Record.1.X" },
99 { 0, 0, NULL }
102 const range_string uavcan_service_id_vals[] = {
103 { 0, 255, "Unregulated identifier" },
104 { 256, 383, "Non-standard fixed regulated identifier"},
105 { 384, 384, "Access.1.0" },
106 { 385, 385, "List.1.0" },
107 { 405, 405, "GetInfo.0.X" },
108 { 406, 406, "List.0.X" },
109 { 407, 407, "Modify.1.X" },
110 { 408, 408, "Read.1.X" },
111 { 409, 409, "Write.1.X" },
112 { 430, 430, "GetInfo.1.0" },
113 { 434, 434, "GetTransportStatistics.1.0" },
114 { 435, 435, "ExecuteCommand.1.X" },
115 { 0, 0, NULL }
118 static const address anonymous_address = ADDRESS_INIT(AT_NONE, 9, "Anonymous");
120 static const value_string uavcan_file_error_vals[] = {
121 { 0, "Ok" },
122 { 2, "Not found" },
123 { 5, "I/O error" },
124 { 13, "Access denied" },
125 { 21, "Is directory" },
126 { 22, "Invalid value" },
127 { 27, "File too large" },
128 { 28, "Out of space" },
129 { 38, "Not supported" },
130 { 65535, "Unknown" },
131 { 0, NULL }
134 static const value_string uavcan_diagnostic_severity_vals[] = {
135 { 0, "Trace" },
136 { 1, "Debug" },
137 { 2, "Info" },
138 { 3, "Notice" },
139 { 4, "Warning" },
140 { 5, "Error" },
141 { 6, "Critical" },
142 { 7, "Alert" },
143 { 0, NULL }
146 static const value_string uavcan_heartbeat_mode_vals[] = {
147 { 0, "Operational" },
148 { 1, "Initialization" },
149 { 2, "Maintenance" },
150 { 3, "Software update" },
151 { 0, NULL }
154 static const value_string uavcan_heartbeat_health_vals[] = {
155 { 0, "Nominal" },
156 { 1, "Advisory" },
157 { 2, "Caution" },
158 { 3, "Warning" },
159 { 0, NULL }
162 static const value_string uavcan_value_tag_vals[] = {
163 { 0, "Empty" },
164 { 1, "String" },
165 { 2, "Unstructured" },
166 { 3, "Bit array" },
167 { 4, "Integer 64 Array" },
168 { 5, "Integer 32 Array" },
169 { 6, "Integer 16 Array" },
170 { 7, "Integer 8 Array" },
171 { 8, "Natural 64 Array" },
172 { 9, "Natural 32 Array" },
173 { 10, "Natural 16 Array" },
174 { 11, "Natural 8 Array" },
175 { 12, "Real 64 Array" },
176 { 13, "Real 32 Array" },
177 { 14, "Real 16 Array" },
178 { 0, NULL }
181 static const value_string uavcan_nodeid_alloc_vals[] = {
182 { 0, "request message" },
183 { 1, "response message" },
184 { 0, NULL }
187 static void
188 dissect_list_service_data(tvbuff_t *tvb, int tvb_offset, proto_tree *tree, bool is_request)
190 if (is_request == true) {
191 proto_tree_add_item(tree, hf_list_index, tvb, tvb_offset, 2, ENC_LITTLE_ENDIAN);
192 } else {
193 /* FT_UINT_STRING counted string, with count being the first byte */
194 proto_tree_add_item(tree, hf_register_name,
195 tvb, tvb_offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
199 static void
200 dissect_access_service_data(tvbuff_t *tvb, int tvb_offset, proto_tree *tree, bool is_request)
202 uint32_t tag;
203 int offset;
205 offset = tvb_offset;
207 if (is_request == true) {
208 int len;
209 /* FT_UINT_STRING counted string, with count being the first byte */
210 proto_tree_add_item_ret_length(tree, hf_register_name,
211 tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN, &len);
212 offset += len;
213 } else {
214 proto_tree_add_item(tree, hf_uavcan_time_syncronizedtimestamp,
215 tvb, offset, 7, ENC_LITTLE_ENDIAN);
216 offset += 7;
217 proto_tree_add_item(tree, hf_register_access_mutable,
218 tvb, offset, 1, ENC_NA);
219 proto_tree_add_item(tree, hf_register_access_persistent,
220 tvb, offset, 1, ENC_NA);
222 offset += 1;
225 proto_tree_add_item_ret_uint(tree, hf_register_value_tag,
226 tvb, offset, 1, ENC_NA, &tag);
227 offset += 1;
229 if (tag == 1) { /* String */
230 proto_tree_add_item(tree, hf_register_value_size,
231 tvb, offset, 1, ENC_NA);
232 /* FT_UINT_STRING counted string, with count being the first byte */
233 proto_tree_add_item(tree, hf_register_name,
234 tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
235 } else if (tag == 2 || tag == 3) {
236 return; // Raw data do nothing
237 } else {
238 uint8_t array_len = tvb_get_uint8(tvb, offset);
240 if (array_len == 0 || tag == 0) {
241 proto_tree_add_item(tree, hf_uavcan_primitive_Empty,
242 tvb, 0, 0, ENC_NA);
243 } else {
244 proto_tree_add_item(tree, hf_register_value_size,
245 tvb, offset, 1, ENC_NA);
246 offset += 1;
248 for (uint8_t i = 0; i < array_len; i++) {
249 switch (tag) {
250 case 4: /*Integer64*/
251 proto_tree_add_item(tree, hf_uavcan_primitive_array_Integer64,
252 tvb, offset, 8, ENC_LITTLE_ENDIAN);
253 offset += 8;
254 break;
256 case 5: /*Integer32*/
257 proto_tree_add_item(tree, hf_uavcan_primitive_array_Integer32,
258 tvb, offset, 4, ENC_LITTLE_ENDIAN);
259 offset += 4;
260 break;
262 case 6: /*Integer16*/
263 proto_tree_add_item(tree, hf_uavcan_primitive_array_Integer16,
264 tvb, offset, 2, ENC_LITTLE_ENDIAN);
265 offset += 2;
266 break;
268 case 7: /*Integer8*/
269 proto_tree_add_item(tree, hf_uavcan_primitive_array_Integer8,
270 tvb, offset, 1, ENC_LITTLE_ENDIAN);
271 offset += 1;
272 break;
274 case 8: /*Natural64*/
275 proto_tree_add_item(tree, hf_uavcan_primitive_array_Natural64,
276 tvb, offset, 8, ENC_LITTLE_ENDIAN);
277 offset += 8;
278 break;
280 case 9: /*Natural32*/
281 proto_tree_add_item(tree, hf_uavcan_primitive_array_Natural32,
282 tvb, offset, 4, ENC_LITTLE_ENDIAN);
283 offset += 4;
284 break;
286 case 10: /*Natural16*/
287 proto_tree_add_item(tree, hf_uavcan_primitive_array_Natural16,
288 tvb, offset, 2, ENC_LITTLE_ENDIAN);
289 offset += 2;
290 break;
292 case 11: /*Natural8*/
293 proto_tree_add_item(tree, hf_uavcan_primitive_array_Natural8,
294 tvb, offset, 1, ENC_LITTLE_ENDIAN);
295 offset += 1;
296 break;
298 case 12: /*Real64*/
299 proto_tree_add_item(tree, hf_uavcan_primitive_array_Real64,
300 tvb, offset, 8, ENC_LITTLE_ENDIAN);
301 offset += 8;
302 break;
304 case 13: /*Real32*/
305 proto_tree_add_item(tree, hf_uavcan_primitive_array_Real32,
306 tvb, offset, 4, ENC_LITTLE_ENDIAN);
307 offset += 4;
308 break;
310 case 14: /*Real16*/
311 proto_tree_add_item(tree, hf_uavcan_primitive_array_Real16,
312 tvb, offset, 2, ENC_LITTLE_ENDIAN);
313 offset += 2;
314 break;
316 default:
317 proto_tree_add_item(tree, hf_uavcan_primitive_Empty,
318 tvb, 0, 0, ENC_NA);
325 static int
326 dissect_dsdl_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
328 uint32_t id = GPOINTER_TO_INT(data);
330 proto_item_append_text(tree, " DSDL (%s)",
331 rval_to_str_const(id, uavcan_subject_id_vals, "Reserved"));
333 if (id == 7509) {
334 /* Dissect Heartbeat1.0 frame */
335 proto_tree_add_item(tree, hf_heartbeat_uptime, tvb, 0, 4, ENC_LITTLE_ENDIAN);
336 proto_tree_add_item(tree, hf_heartbeat_health, tvb, 4, 1, ENC_NA);
337 proto_tree_add_item(tree, hf_heartbeat_mode, tvb, 5, 1, ENC_NA);
338 proto_tree_add_item(tree, hf_heartbeat_status_code, tvb, 6, 1, ENC_NA);
339 return tvb_captured_length(tvb);
340 } else if (id == 8166) {
341 /* Dissect NodeIDAllocationData1.0 allocation request */
342 proto_tree_add_item(tree, hf_pnp_unique_id_hash, tvb, 0, 6, ENC_NA);
343 proto_tree_add_item(tree, hf_pnp_alloc, tvb, 6, 1, ENC_NA);
344 if (tvb_captured_length(tvb) > 8) {
345 proto_tree_add_item(tree, hf_node_id, tvb, 7, 2, ENC_LITTLE_ENDIAN);
347 return tvb_captured_length(tvb);
348 } else if (id == 8165) {
349 /* Dissect NodeIDAllocationData2.0 allocation request/response */
350 proto_tree_add_item(tree, hf_node_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
351 proto_tree_add_item(tree, hf_pnp_unique_id, tvb, 2, 16, ENC_NA);
352 proto_tree_add_uint(tree, hf_pnp_alloc, tvb, 0, 0,
353 (cmp_address(&anonymous_address, (const address *) &pinfo->src) != 0));
354 return tvb_captured_length(tvb);
355 } else if (id == 8184) {
356 /* Dissect Synchronization.1.0 frame */
357 proto_tree_add_item(tree, hf_uavcan_time_syncronizedtimestamp, tvb, 0, 7,
358 ENC_LITTLE_ENDIAN);
359 proto_tree_add_item(tree, hf_uavcan_diagnostic_severity, tvb, 7, 1, ENC_NA);
360 proto_tree_add_item(tree, hf_uavcan_primitive_String, tvb, 8, 1,
361 ENC_ASCII|ENC_BIG_ENDIAN);
362 return tvb_captured_length(tvb);
365 return 0;
368 static int
369 dissect_dsdl_service_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
371 uint32_t id = GPOINTER_TO_INT(data);
373 (void) pinfo;
375 proto_item_append_text(tree, " DSDL (%s)",
376 rval_to_str_const(id, uavcan_service_id_vals, "Reserved"));
378 if (id == 384) { /* Dissect Access.1.0 frame */
379 dissect_access_service_data(tvb, 0, tree, true);
380 return tvb_captured_length(tvb);
381 } else if (id == 385) { /* Dissect List.1.0 frame */
382 dissect_list_service_data(tvb, 0, tree, true);
383 return tvb_captured_length(tvb);
384 } else if (id == 405) { /* Dissect GetInfo.0.X frame */
385 proto_tree_add_item(tree, hf_uavcan_getinfo_path,
386 tvb, 0, 1, ENC_ASCII|ENC_BIG_ENDIAN);
387 return tvb_captured_length(tvb);
388 } else if (id == 406) { /* Dissect List.0.X frame */
389 proto_tree_add_item(tree, hf_uavcan_entry_index,
390 tvb, 0, 4, ENC_LITTLE_ENDIAN);
391 proto_tree_add_item(tree, hf_uavcan_directory_path,
392 tvb, 8, 1, ENC_ASCII|ENC_BIG_ENDIAN);
393 return tvb_captured_length(tvb);
394 } else if (id == 407) { /* Dissect Modify.1.X frame */
395 proto_tree_add_item(tree, hf_uavcan_modify_preserve_source,
396 tvb, 0, 1, ENC_NA);
397 proto_tree_add_item(tree, hf_uavcan_modify_overwrite_destination,
398 tvb, 0, 1, ENC_NA);
399 int len;
400 proto_tree_add_item_ret_length(tree, hf_uavcan_modify_source_path,
401 tvb, 4, 1, ENC_ASCII|ENC_BIG_ENDIAN, &len);
402 proto_tree_add_item(tree, hf_uavcan_modify_destination_path,
403 tvb, 4 + len, 1, ENC_ASCII|ENC_BIG_ENDIAN);
404 return tvb_captured_length(tvb);
405 } else if (id == 408) { /* Dissect Read.1.X frame */
406 proto_tree_add_item(tree, hf_uavcan_read_offset,
407 tvb, 0, 5, ENC_LITTLE_ENDIAN);
408 proto_tree_add_item(tree, hf_uavcan_read_path,
409 tvb, 5, 1, ENC_ASCII|ENC_BIG_ENDIAN);
410 return tvb_captured_length(tvb);
411 } else if (id == 409) { /* Dissect Write.1.X frame */
412 proto_tree_add_item(tree, hf_uavcan_write_offset,
413 tvb, 0, 5, ENC_LITTLE_ENDIAN);
414 int len;
415 proto_tree_add_item_ret_length(tree, hf_uavcan_write_path,
416 tvb, 5, 1, ENC_ASCII|ENC_BIG_ENDIAN, &len);
417 uint16_t data_len = tvb_get_uint16(tvb, 5 + len, ENC_LITTLE_ENDIAN);
418 proto_tree_add_item(tree, hf_uavcan_primitive_Unstructured,
419 tvb, 7 + len, data_len, ENC_NA);
420 return tvb_captured_length(tvb);
423 return 0;
426 static int
427 dissect_dsdl_service_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
429 uint32_t id = GPOINTER_TO_INT(data);
431 (void) pinfo;
433 proto_item_append_text(tree, " DSDL (%s)",
434 rval_to_str_const(id, uavcan_service_id_vals, "Reserved"));
436 if (id == 384) { /* Dissect Access.1.0 frame */
437 dissect_access_service_data(tvb, 0, tree, false);
438 return tvb_captured_length(tvb);
439 } else if (id == 385) { /* Dissect List.1.0 frame */
440 dissect_list_service_data(tvb, 0, tree, false);
441 return tvb_captured_length(tvb);
442 } else if (id == 405) { /* Dissect GetInfo.0.X frame */
443 proto_tree_add_item(tree, hf_uavcan_getinfo_error,
444 tvb, 0, 2, ENC_LITTLE_ENDIAN);
445 proto_tree_add_item(tree, hf_uavcan_getinfo_size,
446 tvb, 2, 5, ENC_LITTLE_ENDIAN);
447 proto_tree_add_item(tree, hf_uavcan_getinfo_timestamp,
448 tvb, 7, 5, ENC_LITTLE_ENDIAN);
449 proto_tree_add_item(tree, hf_uavcan_getinfo_is_file_not_directory,
450 tvb, 13, 1, ENC_LITTLE_ENDIAN);
451 proto_tree_add_item(tree, hf_uavcan_getinfo_is_link,
452 tvb, 13, 1, ENC_LITTLE_ENDIAN);
453 proto_tree_add_item(tree, hf_uavcan_getinfo_is_readable,
454 tvb, 13, 1, ENC_LITTLE_ENDIAN);
455 proto_tree_add_item(tree, hf_uavcan_getinfo_is_writeable,
456 tvb, 13, 1, ENC_LITTLE_ENDIAN);
457 return tvb_captured_length(tvb);
458 } else if (id == 406) { /* Dissect List.0.X frame */
459 /* FT_UINT_STRING counted string, with count being the first byte */
460 proto_tree_add_item(tree, hf_uavcan_entry_base_name,
461 tvb, 4, 1, ENC_ASCII|ENC_BIG_ENDIAN);
462 return tvb_captured_length(tvb);
463 } else if (id == 407) { /* Dissect Modify.1.X frame */
464 proto_tree_add_item(tree, hf_uavcan_modify_error,
465 tvb, 0, 2, ENC_LITTLE_ENDIAN);
466 return tvb_captured_length(tvb);
467 } else if (id == 408) { /* Dissect Read.1.X frame */
468 proto_tree_add_item(tree, hf_uavcan_read_error,
469 tvb, 0, 2, ENC_LITTLE_ENDIAN);
470 uint16_t data_len = tvb_get_uint16(tvb, 2, ENC_LITTLE_ENDIAN);
471 proto_tree_add_item(tree, hf_uavcan_primitive_Unstructured,
472 tvb, 4, data_len, ENC_NA);
473 return tvb_captured_length(tvb);
474 } else if (id == 409) { /* Dissect Write.1.X frame */
475 proto_tree_add_item(tree, hf_uavcan_write_error,
476 tvb, 0, 2, ENC_LITTLE_ENDIAN);
477 return tvb_captured_length(tvb);
480 return 0;
483 void
484 proto_register_dsdl(void)
486 static hf_register_info hf[] = {
487 {&hf_node_id,
488 {"Node ID", "uavcan_dsdl.node.id",
489 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
490 {&hf_pnp_unique_id,
491 {"Unique ID", "uavcan_dsdl.pnp.unique_id",
492 FT_BYTES, BASE_NONE | BASE_ALLOW_ZERO, NULL, 0x0, NULL, HFILL}},
493 {&hf_pnp_unique_id_hash,
494 {"Unique ID hash", "uavcan_dsdl.pnp.unique_id_hash",
495 FT_BYTES, BASE_NONE | BASE_ALLOW_ZERO, NULL, 0x0, NULL, HFILL}},
496 {&hf_pnp_alloc,
497 {"allocation type", "uavcan_dsdl.pnp.allocation",
498 FT_UINT8, BASE_DEC, VALS(uavcan_nodeid_alloc_vals), 0x0, NULL, HFILL}},
500 // Heartbeat 1.0
501 {&hf_heartbeat_uptime,
502 {"Uptime", "uavcan_dsdl.Heartbeat.uptime",
503 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
504 {&hf_heartbeat_health,
505 {"Health", "uavcan_dsdl.Heartbeat.health",
506 FT_UINT8, BASE_DEC, VALS(uavcan_heartbeat_health_vals), 0x0, NULL, HFILL}},
507 {&hf_heartbeat_mode,
508 {"Mode", "uavcan_dsdl.Heartbeat.mode",
509 FT_UINT8, BASE_DEC, VALS(uavcan_heartbeat_mode_vals), 0x0, NULL, HFILL}},
510 {&hf_heartbeat_status_code,
511 {"Vendor specific status code",
512 "uavcan_dsdl.Heartbeat.vendor_specific_status_code",
513 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
514 {&hf_uavcan_time_syncronizedtimestamp,
515 {"Timestamp (usec)", "uavcan_dsdl.time.SynchronizedTimestamp",
516 FT_UINT56, BASE_DEC, NULL, 0x0, NULL, HFILL}},
517 {&hf_uavcan_diagnostic_severity,
518 {"Severity", "uavcan_dsdl.diagnostic.severity",
519 FT_UINT8, BASE_DEC, VALS(uavcan_diagnostic_severity_vals), 0x0, NULL, HFILL}},
521 // List1.0 Request
522 {&hf_list_index,
523 {"Index", "uavcan_dsdl.register.List.index",
524 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
525 {&hf_register_name,
526 {"Name", "uavcan_dsdl.register.Name",
527 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
529 // Access1.0 Value1.0
530 {&hf_register_access_mutable,
531 {"Mutable", "uavcan_dsdl.register.Access.mutable",
532 FT_UINT8, BASE_DEC, NULL, 0x1, NULL, HFILL}},
533 {&hf_register_access_persistent,
534 {"Persistent", "uavcan_dsdl.register.Access.persistent",
535 FT_UINT8, BASE_DEC, NULL, 0x2, NULL, HFILL}},
536 {&hf_register_value_tag,
537 {"Tag", "uavcan_dsdl.register.Value.tag",
538 FT_UINT8, BASE_DEC, VALS(uavcan_value_tag_vals), 0x0, NULL, HFILL}},
539 {&hf_register_value_size,
540 {"Array size", "uavcan_dsdl.primitive.array.size",
541 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
542 {&hf_uavcan_primitive_Empty,
543 {"Empty", "uavcan_dsdl.primitive.Empty",
544 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
545 {&hf_uavcan_primitive_String,
546 {"String", "uavcan_dsdl.primitive.String",
547 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
548 {&hf_uavcan_primitive_Unstructured,
549 {"Unstructured", "uavcan_dsdl.primitive.array.Unstructured",
550 FT_BYTES, BASE_NONE | BASE_ALLOW_ZERO, NULL, 0x0, NULL, HFILL}},
551 {&hf_uavcan_primitive_array_Integer64,
552 {"Integer64", "uavcan_dsdl.primitive.array.Integer64",
553 FT_INT64, BASE_DEC, NULL, 0x0, NULL, HFILL}},
554 {&hf_uavcan_primitive_array_Integer32,
555 {"Integer32", "uavcan_dsdl.primitive.array.Integer32",
556 FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
557 {&hf_uavcan_primitive_array_Integer16,
558 {"Integer16", "uavcan_dsdl.primitive.array.Integer16",
559 FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
560 {&hf_uavcan_primitive_array_Integer8,
561 {"Integer8", "uavcan_dsdl.primitive.array.Integer8",
562 FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
563 {&hf_uavcan_primitive_array_Natural64,
564 {"Natural64", "uavcan_dsdl.primitive.array.Natural64",
565 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}},
566 {&hf_uavcan_primitive_array_Natural32,
567 {"Natural32", "uavcan_dsdl.primitive.array.Natural32",
568 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
569 {&hf_uavcan_primitive_array_Natural16,
570 {"Natural16", "uavcan_dsdl.primitive.array.Natural16",
571 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
572 {&hf_uavcan_primitive_array_Natural8,
573 {"Natural8", "uavcan_dsdl.primitive.array.Natural8",
574 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
575 {&hf_uavcan_primitive_array_Real64,
576 {"Real64", "uavcan_dsdl.primitive.array.Real64",
577 FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
578 {&hf_uavcan_primitive_array_Real32,
579 {"Real32", "uavcan_dsdl.primitive.array.Real32",
580 FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL}},
581 {&hf_uavcan_primitive_array_Real16,
582 {"Real16", "uavcan_dsdl.primitive.array.Real16",
583 FT_IEEE_11073_SFLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL} /* TODO not sure check */
585 {&hf_uavcan_getinfo_path,
586 {"Path", "uavcan_dsdl.file.GetInfo.path",
587 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
588 {&hf_uavcan_getinfo_error,
589 {"Error", "uavcan_dsdl.file.GetInfo.error",
590 FT_UINT16, BASE_DEC, VALS(uavcan_file_error_vals), 0x0, NULL, HFILL}},
591 {&hf_uavcan_getinfo_size,
592 {"Size", "uavcan_dsdl.file.GetInfo.size",
593 FT_UINT40, BASE_DEC, NULL, 0x0, NULL, HFILL}},
594 {&hf_uavcan_getinfo_timestamp,
595 {"Timestamp", "uavcan_dsdl.file.GetInfo.timestamp",
596 FT_UINT40, BASE_DEC, NULL, 0x0, NULL, HFILL}},
597 {&hf_uavcan_getinfo_is_file_not_directory,
598 {"Is file not directory",
599 "uavcan_dsdl.file.GetInfo.is_file_not_directory",
600 FT_UINT8, BASE_DEC, NULL, 0x1, NULL, HFILL}},
601 {&hf_uavcan_getinfo_is_link,
602 {"Is link", "uavcan_dsdl.file.GetInfo.is_link",
603 FT_UINT8, BASE_DEC, NULL, 0x2, NULL, HFILL}},
604 {&hf_uavcan_getinfo_is_readable,
605 {"Is readable", "uavcan_dsdl.file.GetInfo.is_readable",
606 FT_UINT8, BASE_DEC, NULL, 0x4, NULL, HFILL}},
607 {&hf_uavcan_getinfo_is_writeable,
608 {"Is writeable", "uavcan_dsdl.file.GetInfo.is_writeable",
609 FT_UINT8, BASE_DEC, NULL, 0x8, NULL, HFILL}},
610 {&hf_uavcan_read_path,
611 {"Path", "uavcan_dsdl.file.Read.path",
612 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
613 {&hf_uavcan_write_path,
614 {"Path", "uavcan_dsdl.file.Write.path",
615 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
616 {&hf_uavcan_directory_path,
617 {"Directory path", "uavcan_dsdl.file.list.directory_path",
618 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
619 {&hf_uavcan_entry_base_name,
620 {"Base name", "uavcan_dsdl.file.list.entry_base_name",
621 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
622 {&hf_uavcan_modify_source_path,
623 {"Source", "uavcan_dsdl.file.Modify.source",
624 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
625 {&hf_uavcan_modify_destination_path,
626 {"Destination", "uavcan_dsdl.file.Modify.Destination",
627 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
628 {&hf_uavcan_modify_preserve_source,
629 {"Preserve source", "uavcan_dsdl.Modify.preserve_source",
630 FT_UINT8, BASE_DEC, NULL, 0x1, NULL, HFILL}},
631 {&hf_uavcan_modify_overwrite_destination,
632 {"Overwrite destination", "uavcan_dsdl.Modify.overwrite_destination",
633 FT_UINT8, BASE_DEC, NULL, 0x2, NULL, HFILL}},
634 {&hf_uavcan_modify_error,
635 {"Error", "uavcan_dsdl.Modify.error",
636 FT_UINT16, BASE_DEC, VALS(uavcan_file_error_vals), 0x0, NULL, HFILL}},
637 {&hf_uavcan_read_offset,
638 {"Offset", "uavcan_dsdl.Read.offset",
639 FT_UINT40, BASE_DEC, NULL, 0x0, NULL, HFILL}},
640 {&hf_uavcan_read_error,
641 {"Error", "uavcan_dsdl.Read.error",
642 FT_UINT16, BASE_DEC, VALS(uavcan_file_error_vals), 0x0, NULL, HFILL}},
643 {&hf_uavcan_write_offset,
644 {"Offset", "uavcan_dsdl.Write.offset",
645 FT_UINT40, BASE_DEC, NULL, 0x0, NULL, HFILL}},
646 {&hf_uavcan_write_error,
647 {"Error", "uavcan_dsdl.Write.error",
648 FT_UINT16, BASE_DEC, VALS(uavcan_file_error_vals), 0x0, NULL, HFILL}},
649 {&hf_uavcan_entry_index,
650 {"Entry index", "uavcan_dsdl.file.list.entry_index",
651 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
654 static int *ett[] = {
655 &ett_dsdl,
658 proto_dsdl = proto_register_protocol("UAVCAN DSDL", "DSDL", "uavcan_dsdl");
660 proto_register_field_array(proto_dsdl, hf, array_length(hf));
661 proto_register_subtree_array(ett, array_length(ett));
663 register_dissector("uavcan_dsdl.message", dissect_dsdl_message, proto_dsdl);
664 register_dissector("uavcan_dsdl.request", dissect_dsdl_service_request, proto_dsdl);
665 register_dissector("uavcan_dsdl.response", dissect_dsdl_service_response, proto_dsdl);
668 void
669 proto_reg_handoff_dsdl(void)
674 * Editor modelines - https://www.wireshark.org/tools/modelines.html
676 * Local variables:
677 * c-basic-offset: 4
678 * tab-width: 8
679 * indent-tabs-mode: nil
680 * End:
682 * vi: set shiftwidth=4 tabstop=8 expandtab:
683 * :indentSize=4:tabSize=8:noTabs=true: