regen pidl all: rm epan/dissectors/pidl/*-stamp; pushd epan/dissectors/pidl/ && make...
[wireshark-sm.git] / plugins / epan / gryphon / packet-gryphon.c
blob41922ac68e1aec28237fa2c87e83f67058105d6a
1 /* packet-gryphon.c
3 * Updated routines for Gryphon protocol packet dissection
4 * By Mark C. <markc@dgtech.com>
5 * Copyright (C) 2018 DG Technologies, Inc. (Dearborn Group, Inc.) USA
7 * Routines for Gryphon protocol packet disassembly
8 * By Steve Limkemann <stevelim@dgtech.com>
9 * Copyright 1998 Steve Limkemann
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * SPDX-License-Identifier: GPL-2.0-or-later
17 * Specification: http://www.dgtech.com/product/gryphon/manual/html/GCprotocol/
21 #include "config.h"
23 #include <epan/packet.h>
24 #include <epan/prefs.h>
25 #include <epan/expert.h>
26 #include <epan/proto_data.h>
27 #include <epan/conversation.h>
28 #include <epan/dissectors/packet-tcp.h>
29 #include <epan/tfs.h>
30 #include <wsutil/array.h>
31 #include <wsutil/str_util.h>
32 #include "packet-gryphon.h"
35 * See
37 * https://www.dgtech.com/product/gryphon/manual/html/GCprotocol/
40 void proto_register_gryphon(void);
41 void proto_reg_handoff_gryphon(void);
43 static dissector_handle_t gryphon_handle;
45 #define GRYPHON_TCP_PORT 7000 /* Not IANA registed */
47 static int proto_gryphon;
49 static int hf_gryphon_src;
50 static int hf_gryphon_srcchan;
51 static int hf_gryphon_srcchanclient;
52 static int hf_gryphon_dest;
53 static int hf_gryphon_destchan;
54 static int hf_gryphon_destchanclient;
55 static int hf_gryphon_type;
56 static int hf_gryphon_cmd;
57 static int hf_gryphon_cmd_context;
58 static int hf_gryphon_cmd_ioctl_context;
59 static int hf_gryphon_data;
60 static int hf_gryphon_data_length;
61 static int hf_gryphon_reserved;
62 static int hf_gryphon_padding;
63 static int hf_gryphon_ignored;
64 static int hf_gryphon_wait_flags;
65 static int hf_gryphon_wait_resp;
66 static int hf_gryphon_wait_prev_resp;
67 static int hf_gryphon_status;
68 static int hf_gryphon_response_in;
69 static int hf_gryphon_response_to;
70 static int hf_gryphon_response_time;
71 static int hf_gryphon_data_header_length;
72 static int hf_gryphon_data_header_length_bits;
73 static int hf_gryphon_data_data_length;
74 static int hf_gryphon_data_extra_data_length;
75 static int hf_gryphon_data_mode;
76 static int hf_gryphon_data_mode_transmitted;
77 static int hf_gryphon_data_mode_receive;
78 static int hf_gryphon_data_mode_local;
79 static int hf_gryphon_data_mode_remote;
80 static int hf_gryphon_data_mode_oneshot;
81 static int hf_gryphon_data_mode_combined;
82 static int hf_gryphon_data_mode_nomux;
83 static int hf_gryphon_data_mode_internal;
84 static int hf_gryphon_data_priority;
85 static int hf_gryphon_data_error_status;
86 static int hf_gryphon_data_time;
87 static int hf_gryphon_data_context;
88 static int hf_gryphon_data_header_data;
89 static int hf_gryphon_data_data;
90 static int hf_gryphon_data_extra_data;
91 static int hf_gryphon_data_padding;
92 static int hf_gryphon_event_id;
93 static int hf_gryphon_event_context;
94 static int hf_gryphon_event_time;
95 static int hf_gryphon_event_data;
96 static int hf_gryphon_event_padding;
97 static int hf_gryphon_misc_text;
98 static int hf_gryphon_misc_padding;
99 static int hf_gryphon_eventnum;
100 static int hf_gryphon_resp_time;
101 static int hf_gryphon_setfilt;
102 static int hf_gryphon_setfilt_length;
103 static int hf_gryphon_setfilt_discard_data;
104 static int hf_gryphon_setfilt_padding;
105 static int hf_gryphon_ioctl;
106 static int hf_gryphon_ioctl_nbytes;
107 static int hf_gryphon_ioctl_data;
108 static int hf_gryphon_addfilt_pass;
109 static int hf_gryphon_addfilt_active;
110 static int hf_gryphon_addfilt_blocks;
111 static int hf_gryphon_addfilt_handle;
112 static int hf_gryphon_modfilt;
113 static int hf_gryphon_modfilt_action;
114 static int hf_gryphon_filthan;
115 static int hf_gryphon_filthan_id;
116 static int hf_gryphon_filthan_padding;
117 static int hf_gryphon_dfiltmode;
118 static int hf_gryphon_filtmode;
119 static int hf_gryphon_event_name;
120 static int hf_gryphon_register_username;
121 static int hf_gryphon_register_password;
122 static int hf_gryphon_register_client_id;
123 static int hf_gryphon_register_privileges;
124 static int hf_gryphon_getspeeds_set_ioctl;
125 static int hf_gryphon_getspeeds_get_ioctl;
126 static int hf_gryphon_getspeeds_size;
127 static int hf_gryphon_getspeeds_preset;
128 static int hf_gryphon_getspeeds_data;
129 static int hf_gryphon_cmd_sort;
130 static int hf_gryphon_cmd_optimize;
131 static int hf_gryphon_config_device_name;
132 static int hf_gryphon_config_device_version;
133 static int hf_gryphon_config_device_serial_number;
134 static int hf_gryphon_config_num_channels;
135 static int hf_gryphon_config_name_version_ext;
136 static int hf_gryphon_config_driver_name;
137 static int hf_gryphon_config_driver_version;
138 static int hf_gryphon_config_device_security;
139 static int hf_gryphon_config_max_data_length;
140 static int hf_gryphon_config_min_data_length;
141 static int hf_gryphon_config_hardware_serial_number;
142 static int hf_gryphon_config_protocol_type;
143 static int hf_gryphon_config_channel_id;
144 static int hf_gryphon_config_card_slot_number;
145 static int hf_gryphon_config_max_extra_data;
146 static int hf_gryphon_config_min_extra_data;
147 static int hf_gryphon_sched_num_iterations;
148 static int hf_gryphon_sched_flags;
149 static int hf_gryphon_sched_flags_scheduler;
150 static int hf_gryphon_sched_sleep;
151 static int hf_gryphon_sched_transmit_count;
152 static int hf_gryphon_sched_transmit_period;
153 static int hf_gryphon_sched_transmit_flags;
154 static int hf_gryphon_sched_skip_transmit_period;
155 static int hf_gryphon_sched_skip_sleep;
156 static int hf_gryphon_sched_channel;
157 static int hf_gryphon_sched_channel0;
158 static int hf_gryphon_sched_rep_id;
159 static int hf_gryphon_sched_rep_message_index;
160 static int hf_gryphon_blm_data_time;
161 static int hf_gryphon_blm_data_bus_load;
162 static int hf_gryphon_blm_data_current_bus_load;
163 static int hf_gryphon_blm_data_peak_bus_load;
164 static int hf_gryphon_blm_data_historic_peak_bus_load;
165 static int hf_gryphon_blm_stat_receive_frame_count;
166 static int hf_gryphon_blm_stat_transmit_frame_count;
167 static int hf_gryphon_blm_stat_receive_dropped_frame_count;
168 static int hf_gryphon_blm_stat_transmit_dropped_frame_count;
169 static int hf_gryphon_blm_stat_receive_error_count;
170 static int hf_gryphon_blm_stat_transmit_error_count;
171 static int hf_gryphon_addresp_flags;
172 static int hf_gryphon_addresp_flags_active;
173 static int hf_gryphon_addresp_blocks;
174 static int hf_gryphon_addresp_responses;
175 static int hf_gryphon_addresp_old_handle;
176 static int hf_gryphon_addresp_action;
177 static int hf_gryphon_addresp_action_period;
178 static int hf_gryphon_addresp_action_deact_on_event;
179 static int hf_gryphon_addresp_action_deact_after_period;
180 static int hf_gryphon_addresp_action_period_type;
181 static int hf_gryphon_addresp_handle;
182 static int hf_gryphon_ldf_list;
183 static int hf_gryphon_ldf_number;
184 static int hf_gryphon_ldf_nodenumber;
185 static int hf_gryphon_ldf_remaining;
186 static int hf_gryphon_ldf_name;
187 static int hf_gryphon_ldf_info_pv;
188 static int hf_gryphon_ldf_info_lv;
189 static int hf_gryphon_ldf_ui;
190 static int hf_gryphon_lin_nodename;
191 static int hf_gryphon_lin_data_length;
192 static int hf_gryphon_lin_slave_table_enable;
193 static int hf_gryphon_lin_slave_table_cs;
194 static int hf_gryphon_lin_slave_table_data;
195 static int hf_gryphon_lin_slave_table_datacs;
196 static int hf_gryphon_lin_masterevent;
197 static int hf_gryphon_lin_numdata;
198 static int hf_gryphon_lin_numextra;
199 static int hf_gryphon_ldf_description;
200 static int hf_gryphon_ldf_size;
201 static int hf_gryphon_ldf_exists;
202 static int hf_gryphon_ldf_blockn;
203 static int hf_gryphon_ldf_file;
204 static int hf_gryphon_ldf_desc_pad;
205 static int hf_gryphon_ldf_restore_session;
206 static int hf_gryphon_ldf_schedule_name;
207 static int hf_gryphon_ldf_schedule_msg_dbytes;
208 static int hf_gryphon_ldf_schedule_flags;
209 static int hf_gryphon_ldf_schedule_event;
210 static int hf_gryphon_ldf_schedule_sporadic;
211 static int hf_gryphon_ldf_ioctl_setflags;
212 static int hf_gryphon_ldf_numb_ids;
213 static int hf_gryphon_ldf_bitrate;
214 static int hf_gryphon_ldf_ioctl_setflags_flags;
215 static int hf_gryphon_ldf_sched_size_place;
216 static int hf_gryphon_ldf_sched_numb_place;
217 static int hf_gryphon_ldf_sched_size;
218 static int hf_gryphon_ldf_num_node_names;
219 static int hf_gryphon_ldf_num_frames;
220 static int hf_gryphon_ldf_num_signal_names;
221 static int hf_gryphon_ldf_num_schedules;
222 static int hf_gryphon_ldf_num_encodings;
223 static int hf_gryphon_ldf_encoding_value;
224 static int hf_gryphon_ldf_encoding_min;
225 static int hf_gryphon_ldf_encoding_max;
226 static int hf_gryphon_ldf_master_node_name;
227 static int hf_gryphon_ldf_slave_node_name;
228 static int hf_gryphon_ldf_node_name;
229 static int hf_gryphon_ldf_signal_name;
230 static int hf_gryphon_ldf_signal_encoding_name;
231 static int hf_gryphon_ldf_signal_encoding_type;
232 static int hf_gryphon_ldf_signal_encoding_logical;
233 static int hf_gryphon_ldf_signal_offset;
234 static int hf_gryphon_ldf_signal_length;
235 static int hf_gryphon_ldf_get_frame;
236 static int hf_gryphon_ldf_get_frame_num;
237 static int hf_gryphon_ldf_get_frame_pub;
238 static int hf_gryphon_ldf_get_frame_num_signals;
239 static int hf_gryphon_cnvt_valuef;
240 static int hf_gryphon_cnvt_valuei;
241 static int hf_gryphon_cnvt_values;
242 static int hf_gryphon_cnvt_units;
243 static int hf_gryphon_cnvt_flags_getvalues;
244 static int hf_gryphon_dd_stream;
245 static int hf_gryphon_dd_value;
246 static int hf_gryphon_dd_time;
247 static int hf_gryphon_modresp_handle;
248 static int hf_gryphon_modresp_action;
249 static int hf_gryphon_num_resphan;
250 static int hf_gryphon_handle;
251 static int hf_gryphon_transmit_sched_id;
252 static int hf_gryphon_desc_program_size;
253 static int hf_gryphon_desc_program_name;
254 static int hf_gryphon_desc_program_description;
255 static int hf_gryphon_desc_flags;
256 static int hf_gryphon_desc_flags_program;
257 static int hf_gryphon_desc_handle;
258 static int hf_gryphon_upload_block_number;
259 static int hf_gryphon_upload_handle;
260 static int hf_gryphon_upload_data;
261 static int hf_gryphon_delete;
262 static int hf_gryphon_list_block_number;
263 static int hf_gryphon_list_num_programs;
264 static int hf_gryphon_list_num_remain_programs;
265 static int hf_gryphon_list_name;
266 static int hf_gryphon_list_description;
267 static int hf_gryphon_start_arguments;
268 static int hf_gryphon_start_channel;
269 static int hf_gryphon_status_num_running_copies;
270 static int hf_gryphon_options_handle;
271 static int hf_gryphon_files;
272 static int hf_gryphon_usdt_flags_register;
273 static int hf_gryphon_usdt_action_flags;
274 static int hf_gryphon_usdt_action_flags_non_legacy;
275 static int hf_gryphon_usdt_action_flags_register;
276 static int hf_gryphon_usdt_action_flags_action;
277 static int hf_gryphon_usdt_transmit_options_flags;
278 static int hf_gryphon_usdt_transmit_options_flags_echo;
279 static int hf_gryphon_usdt_transmit_options_done_event;
280 static int hf_gryphon_usdt_transmit_options_echo_short;
281 static int hf_gryphon_usdt_transmit_options_rx_nth_fc;
282 static int hf_gryphon_usdt_transmit_options_action;
283 static int hf_gryphon_usdt_transmit_options_send_done;
284 static int hf_gryphon_usdt_receive_options_flags;
285 static int hf_gryphon_usdt_receive_options_action;
286 static int hf_gryphon_usdt_receive_options_firstframe_event;
287 static int hf_gryphon_usdt_receive_options_lastframe_event;
288 static int hf_gryphon_usdt_receive_options_tx_nth_fc;
289 static int hf_gryphon_usdt_length_options_flags;
290 static int hf_gryphon_usdt_length_control_j1939;
291 static int hf_gryphon_usdt_stmin_fc;
292 static int hf_gryphon_usdt_bsmax_fc;
293 static int hf_gryphon_usdt_stmin_override;
294 static int hf_gryphon_usdt_stmin_override_active;
295 static int hf_gryphon_usdt_stmin_override_activate;
296 static int hf_gryphon_usdt_set_stmin_mul;
297 static int hf_gryphon_usdt_receive_options_firstframe;
298 static int hf_gryphon_usdt_receive_options_lastframe;
299 static int hf_gryphon_usdt_ext_address;
300 static int hf_gryphon_usdt_ext_address_id;
301 static int hf_gryphon_usdt_block_size;
302 static int hf_gryphon_bits_in_input1;
303 static int hf_gryphon_bits_in_input2;
304 static int hf_gryphon_bits_in_input3;
305 static int hf_gryphon_bits_in_pushbutton;
306 static int hf_gryphon_bits_out_output1;
307 static int hf_gryphon_bits_out_output2;
308 static int hf_gryphon_init_strat_reset_limit;
309 static int hf_gryphon_init_strat_delay;
310 static int hf_gryphon_speed_baud_rate_index;
311 static int hf_gryphon_filter_block_filter_start;
312 static int hf_gryphon_filter_block_filter_length;
313 static int hf_gryphon_filter_block_filter_type;
314 static int hf_gryphon_filter_block_filter_operator;
315 static int hf_gryphon_filter_block_filter_value1;
316 static int hf_gryphon_filter_block_filter_value2;
317 static int hf_gryphon_filter_block_filter_value4;
318 static int hf_gryphon_filter_block_filter_value_bytes;
319 static int hf_gryphon_blm_mode;
320 static int hf_gryphon_blm_mode_avg_period;
321 static int hf_gryphon_blm_mode_avg_frames;
322 static int hf_gryphon_command;
323 static int hf_gryphon_cmd_mode;
324 static int hf_gryphon_option;
325 static int hf_gryphon_option_data;
326 static int hf_gryphon_cmd_file;
327 static int hf_gryphon_bit_in_digital_data;
328 static int hf_gryphon_bit_out_digital_data;
329 static int hf_gryphon_filter_block_pattern;
330 static int hf_gryphon_filter_block_mask;
331 static int hf_gryphon_usdt_request;
332 static int hf_gryphon_usdt_request_ext;
333 static int hf_gryphon_usdt_nids;
334 static int hf_gryphon_usdt_response;
335 static int hf_gryphon_usdt_response_ext;
336 static int hf_gryphon_uudt_response;
337 static int hf_gryphon_uudt_response_ext;
338 static int hf_gryphon_more_filenames;
339 static int hf_gryphon_filenames;
340 static int hf_gryphon_program_channel_number;
341 static int hf_gryphon_valid_header_length;
343 static int ett_gryphon;
344 static int ett_gryphon_header;
345 static int ett_gryphon_body;
346 static int ett_gryphon_command_data;
347 static int ett_gryphon_response_data;
348 static int ett_gryphon_data_header;
349 static int ett_gryphon_flags;
350 static int ett_gryphon_data_body;
351 static int ett_gryphon_cmd_filter_block;
352 static int ett_gryphon_cmd_events_data;
353 static int ett_gryphon_cmd_config_device;
354 static int ett_gryphon_cmd_sched_data;
355 static int ett_gryphon_cmd_sched_cmd;
356 static int ett_gryphon_cmd_response_block;
357 static int ett_gryphon_pgm_list;
358 static int ett_gryphon_pgm_status;
359 static int ett_gryphon_pgm_options;
360 static int ett_gryphon_valid_headers;
361 static int ett_gryphon_usdt_data;
362 static int ett_gryphon_usdt_action_flags;
363 static int ett_gryphon_usdt_tx_options_flags;
364 static int ett_gryphon_usdt_rx_options_flags;
365 static int ett_gryphon_usdt_len_options_flags;
366 static int ett_gryphon_usdt_data_block;
367 static int ett_gryphon_lin_emulate_node;
368 static int ett_gryphon_ldf_block;
369 static int ett_gryphon_ldf_schedule_name;
370 static int ett_gryphon_lin_schedule_msg;
371 static int ett_gryphon_cnvt_getflags;
372 static int ett_gryphon_digital_data;
373 static int ett_gryphon_blm_mode;
375 static expert_field ei_gryphon_type;
377 /* desegmentation of Gryphon */
378 static bool gryphon_desegment = true;
381 * Length of the frame header.
383 #define GRYPHON_FRAME_HEADER_LEN 8
385 static int dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool is_msgresp_add);
386 static int cmd_ioctl(tvbuff_t*, packet_info*, int, proto_tree*, uint32_t ui_command);
387 static int cmd_ioctl_resp(tvbuff_t*, packet_info*, int, proto_tree*, uint32_t ui_command);
389 static const value_string action_vals[] = {
390 { FR_RESP_AFTER_EVENT,
391 "Send response(s) for each conforming message" },
392 { FR_RESP_AFTER_PERIOD,
393 "Send response(s) after the specified period expires following a conforming message" },
394 { FR_IGNORE_DURING_PER,
395 "Send response(s) for a conforming message and ignore further messages until the specified period expires" },
396 { 0,
397 NULL }
400 static const value_string deact_on_event_vals[] = {
401 { FR_DEACT_ON_EVENT,
402 "Deactivate this response for a conforming message" },
403 { FR_DELETE|FR_DEACT_ON_EVENT,
404 "Delete this response for a conforming message" },
405 { 0,
406 NULL }
409 static const value_string deact_after_per_vals[] = {
410 { FR_DEACT_AFTER_PER,
411 "Deactivate this response after the specified period following a conforming message" },
412 { FR_DELETE|FR_DEACT_AFTER_PER,
413 "Delete this response after the specified period following a conforming message" },
414 { 0,
415 NULL }
418 static const value_string cmd_optimize_type[] = {
419 {0, "Optimize for throughput (Nagle algorithm enabled)"},
420 {1, "Optimize for latency (Nagle algorithm disabled)"},
421 {0, NULL}
424 static const value_string usdt_action_vals[] = {
425 { 0, "Use 11 bit headers only" },
426 { 1, "Use 29 bit headers only" },
427 { 2, "Use both 11 & 29 bit headers" },
428 { 3, "undefined" },
429 { 0, NULL }
432 static const value_string xmit_opt_nth_fc_event[] = {
433 { 0, "Do not send a USDT_RX_NTH_FLOWCONTROL event when the 1st, 2nd, 3rd, etc. flow control message is received" },
434 { 1, "Send a USDT_RX_NTH_FLOWCONTROL event when the 1st, 2nd, 3rd, etc. flow control message is received" },
435 { 0, NULL }
438 static const value_string xmit_opt_echo_short[] = {
439 { 0, "Do not Echo short transmitted messages back to the client (message less than 8 bytes)" },
440 { 1, "Echo short transmitted messages back to the client (message less than 8 bytes)" },
441 { 0, NULL }
444 static const value_string xmit_opt_done[] = {
445 { 0, "Do not send a USDT_DONE event when the last frame of a multi-frame message is transmitted" },
446 { 1, "Send a USDT_DONE event when the last frame of a multi-frame message is transmitted" },
447 { 0, NULL }
450 static const value_string xmit_opt_vals[] = {
451 { 0, "Pad messages with less than 8 data bytes with 0x00's" },
452 { 1, "Pad messages with less than 8 data bytes with 0xFF's" },
453 { 2, "Do not pad messages with less than 8 data bytes" },
454 { 3, "undefined" },
455 { 0, NULL }
458 static const value_string xmit_opt_echo_long[] = {
459 { 0, "Do not Echo long transmitted messages back to the client (message longer than 6 or 7 bytes)" },
460 { 1, "Echo long transmitted messages back to the client (message longer than 6 or 7 bytes)" },
461 { 0, NULL }
465 static const value_string recv_opt_nth_fc_event[] = {
466 { 0, "Do not send a USDT_TX_NTH_FLOWCONTROL event when the 1st, 2nd, 3rd, etc. flow control message is sent" },
467 { 1, "Send a USDT_TX_NTH_FLOWCONTROL event when the 1st, 2nd, 3rd, etc. flow control message is sent" },
468 { 0, NULL }
470 static const value_string recv_opt_lastframe_event[] = {
471 { 0, "Do not send a USDT_LASTFRAME event when the last frame of a multi-frame message is received" },
472 { 1, "Send a USDT_LASTFRAME event when the last frame of a multi-frame message is received" },
473 { 0, NULL }
475 static const value_string recv_opt_firstframe_event[] = {
476 { 0, "Do not send a USDT_FIRSTFRAME event when the first frame of a multi-frame message is received" },
477 { 1, "Send a USDT_FIRSTFRAME event when the first frame of a multi-frame message is received" },
478 { 0, NULL }
481 static const value_string recv_opt_j1939[] = {
482 { 0, "Treat the length as a regular 4-byte size in calculating the multi-ID block range (not J1939-style)" },
483 { 1, "Use J1939-style length (the source and destination bytes are swapped in response (for 29-bit ID/headers only))" },
484 { 2, "undefined" },
485 { 0, NULL }
488 static const value_string recv_opt_vals[] = {
489 { 0, "Do not verify the integrity of long received messages and do not send them to the client" },
490 { 1, "Verify the integrity of long received messages and send them to the client" },
491 { 2, "Verify the integrity of long received messages but do not send them to the client" },
492 { 3, "undefined" },
493 { 0, NULL }
496 static const value_string register_unregister [] = {
497 { 0, "Unregister" },
498 { 1, "Register" },
499 { 0, NULL }
502 static const value_string ldf_exists[] = {
503 { 0, "Name is OK, does not already exist" },
504 { 1, "*** Warning ***: LDF file with same name already exists" },
505 { 0, NULL }
508 static const value_string lin_slave_table_enable[] = {
509 { 0, "Disabled" },
510 { 1, "Enabled" },
511 { 2, "One-shot enabled" },
512 { 0, NULL }
515 static const value_string lin_slave_table_cs[] = {
516 { 0, "Good" },
517 { 1, "Bad" },
518 { 0, NULL }
521 static const value_string lin_ldf_ioctl_setflags[] = {
522 {0, "Clear all flags first"},
523 {1, "Leave existing flags intact"},
524 {0, NULL}
526 static const value_string lin_cnvt_getflags[] = {
527 {1, "Float value"},
528 {2, "Int value"},
529 {3, "Float and Int value"},
530 {4, "String value"},
531 {5, "Float and String value"},
532 {6, "Int and String value"},
533 {7, "Float, Int, and String value"},
534 {0, NULL}
537 static const value_string lin_ioctl_masterevent[] = {
538 {0, "LIN driver will not send an event on master schedule start-of-cycle"},
539 {1, "LIN driver will send an event on master schedule start-of-cycle"},
540 {0, NULL}
543 static const value_string blm_mode_vals[] = {
544 { 0, "Off" },
545 { 1, "Average over time" },
546 { 2, "Average over frame count" },
547 { 0, NULL }
550 static const value_string dmodes[] = {
551 {DEFAULT_FILTER_BLOCK, "Block"},
552 {DEFAULT_FILTER_PASS, "Pass"},
553 {0, NULL},
556 static const value_string frame_type[] = {
557 {0, ""},
558 {1, "Command request"},
559 {2, "Command response"},
560 {3, "Network (vehicle) data"},
561 {4, "Event"},
562 {5, "Miscellaneous"},
563 {6, "Text string"},
564 {7, "Signal (vehicle) network"},
565 {0, NULL}
568 static const value_string src_dest[] = {
569 {SD_CARD, "Card"},
570 {SD_SERVER, "Server"},
571 {SD_CLIENT, "Client"},
572 {SD_SCHED, "Scheduler"},
573 {SD_SCRIPT, "Script Processor"},
574 {SD_PGM, "Program Loader"},
575 {SD_USDT, "USDT Server"},
576 {SD_BLM, "Bus Load Monitoring"},
577 {SD_LIN, "LIN LDF Server"}, /* 20171031 mc */
578 {SD_FLIGHT, "Flight Recorder / Data Logger"},
579 {SD_RESP, "Message Responder"},
580 {SD_IOPWR, "I/O and power"},
581 {SD_UTIL, "Utility/Miscellaneous"},
582 {SD_CNVT, "Signal Conversion Utility"}, /* 20171031 mc */
583 {0, NULL}
586 /* 20180305 use with BASE_SPECIAL_VALS */
587 static const value_string channel_or_broadcast[] = {
588 {CH_BROADCAST, "Broadcast"},
589 {0, NULL}
592 static const value_string cmd_vals[] = {
593 { CMD_INIT, "Initialize" },
594 { CMD_GET_STAT, "Get status" },
595 { CMD_GET_CONFIG, "Get configuration" },
596 { CMD_EVENT_ENABLE, "Enable event" },
597 { CMD_EVENT_DISABLE, "Disable event" },
598 { CMD_GET_TIME, "Get time" },
599 { CMD_GET_RXDROP, "Get number of dropped RX messages" },
600 { CMD_RESET_RXDROP, "Clear number of dropped RX messages" },
601 { CMD_BCAST_ON, "Set broadcasts on" },
602 { CMD_BCAST_OFF, "Set broadcasts off" },
603 { CMD_SET_TIME, "Set time" },
604 { CMD_CARD_SET_SPEED, "Set channel baud rate" },
605 { CMD_CARD_GET_SPEED, "Get channel baud rate" },
606 { CMD_CARD_SET_FILTER, "Set filter (deprecated)" },
607 { CMD_CARD_GET_FILTER, "Get filter" },
608 { CMD_CARD_TX, "Transmit message" },
609 { CMD_CARD_TX_LOOP_ON, "Set transmit loopback on" },
610 { CMD_CARD_TX_LOOP_OFF, "Set transmit loopback off" },
611 { CMD_CARD_IOCTL, "IOCTL pass-through" },
612 { CMD_CARD_ADD_FILTER, "Add a filter" },
613 { CMD_CARD_MODIFY_FILTER, "Modify a filter" },
614 { CMD_CARD_GET_FILTER_HANDLES, "Get filter handles" },
615 { CMD_CARD_SET_DEFAULT_FILTER, "Set default filter" },
616 { CMD_CARD_GET_DEFAULT_FILTER, "Get default filter mode" },
617 { CMD_CARD_SET_FILTER_MODE, "Set filter mode" },
618 { CMD_CARD_GET_FILTER_MODE, "Get filter mode" },
619 { CMD_CARD_GET_EVNAMES, "Get event names" },
620 { CMD_CARD_GET_SPEEDS, "Get defined speeds" },
621 { CMD_SERVER_REG, "Register with server" },
622 { CMD_SERVER_SET_SORT, "Set the sorting behavior" },
623 { CMD_SERVER_SET_OPT, "Set the type of optimization" },
624 { CMD_PGM_START2, "Start an uploaded program" },
625 { CMD_SCHED_TX, "Schedule transmission of messages" },
626 { CMD_SCHED_KILL_TX, "Stop and destroy a message schedule transmission" },
627 { CMD_SCHED_MSG_REPLACE, "Replace a scheduled message" },
628 { CMD_PGM_DESC, "Describe program to be uploaded" },
629 { CMD_PGM_UPLOAD, "Upload a program to the Gryphon" },
630 { CMD_PGM_DELETE, "Delete an uploaded program" },
631 { CMD_PGM_LIST, "Get a list of uploaded programs" },
632 { CMD_PGM_START, "Start an uploaded program" },
633 { CMD_PGM_STOP, "Stop an uploaded program" },
634 { CMD_PGM_STATUS, "Get status of an uploaded program" },
635 { CMD_PGM_OPTIONS, "Set program upload options" },
636 { CMD_PGM_FILES, "Get a list of files & directories" },
637 { CMD_USDT_REGISTER, "Register/Unregister with USDT server (deprecated)" },
638 { CMD_USDT_SET_FUNCTIONAL, "Set IDs to use extended addressing (deprecated)" },
639 { CMD_USDT_SET_STMIN_MULT, "Set USDT STMIN multiplier" },
640 { CMD_USDT_SET_STMIN_FC, "Set USDT STMIN flow control (new command July 2017)" },
641 { CMD_USDT_GET_STMIN_FC, "Get USDT STMIN flow control (new command July 2017)" },
642 { CMD_USDT_SET_BSMAX_FC, "Set USDT BSMAX flow control (new command July 2017)" },
643 { CMD_USDT_GET_BSMAX_FC, "Get USDT BSMAX flow control (new command July 2017)" },
644 { CMD_USDT_REGISTER_NON_LEGACY, "Register/Unregister with USDT (ISO-15765) server, non-legacy (new command July 2017)" },
645 { CMD_USDT_SET_STMIN_OVERRIDE, "Set USDT STMIN override (new command July 2017)" },
646 { CMD_USDT_GET_STMIN_OVERRIDE, "Get USDT STMIN override (new command July 2017)" },
647 { CMD_USDT_ACTIVATE_STMIN_OVERRIDE, "Activate/deactivate USDT STMIN override (new command July 2017)" },
648 { CMD_BLM_SET_MODE, "Set Bus Load Monitoring mode" },
649 { CMD_BLM_GET_MODE, "Get Bus Load Monitoring mode" },
650 { CMD_BLM_GET_DATA, "Get Bus Load data" },
651 { CMD_BLM_GET_STATS, "Get Bus Load statistics" },
652 { CMD_GET_FRAMES, "Get frames defined in the LIN LDF file" },
653 { CMD_LDF_DESC, "Set Name and description of LIN LDF file" },
654 { CMD_LDF_UPLOAD, "Upload a LIN LDF file to the Gryphon" },
655 { CMD_LDF_LIST, "Get list of loaded LIN LDFs" },
656 { CMD_LDF_DELETE, "Delete LIN LDF" },
657 { CMD_LDF_PARSE, "Parse an uploaded LIN LDF file" },
658 { CMD_GET_LDF_INFO, "Get info of a parsed LDF file" },
659 { CMD_GET_NODE_NAMES, "Get names of nodes defined in the LIN LDF file" },
660 { CMD_EMULATE_NODES, "Emulate LIN nodes" },
661 { CMD_GET_FRAME_INFO, "Get info from a frame defined in the LIN LDF file" },
662 { CMD_GET_SIGNAL_INFO, "Get info from a signal defined in the LIN LDF file" },
663 { CMD_GET_SIGNAL_DETAIL, "Get details from a signal defined in the LIN LDF file" },
664 { CMD_GET_ENCODING_INFO, "Get details from an encoding name defined in the LIN LDF file" },
665 { CMD_GET_SCHEDULES, "Get schedules of the LIN LDF file" },
666 { CMD_START_SCHEDULE, "Start a LIN schedule from the LIN LDF file" },
667 { CMD_SAVE_SESSION, "Save an internal representation of the LIN LDF file" },
668 { CMD_RESTORE_SESSION, "Restore a previously saved LIN LDF session" },
669 { CMD_GET_NODE_SIGNALS, "Get signal names of the node defined in the LIN LDF file" },
670 { CMD_FLIGHT_GET_CONFIG, "Get flight recorder channel info" },
671 { CMD_FLIGHT_START_MON, "Start flight recorder monitoring" },
672 { CMD_FLIGHT_STOP_MON, "Stop flight recorder monitoring" },
673 { CMD_MSGRESP_ADD, "Add response message" },
674 { CMD_MSGRESP_GET, "Get response message" },
675 { CMD_MSGRESP_MODIFY, "Modify response message state" },
676 { CMD_MSGRESP_GET_HANDLES, "Get response message handles" },
677 { CMD_IOPWR_GETINP, "Read current digital inputs" },
678 { CMD_IOPWR_GETLATCH, "Read latched digital inputs" },
679 { CMD_IOPWR_CLRLATCH, "Read & clear latched digital inputs" },
680 { CMD_IOPWR_GETOUT, "Read digital outputs" },
681 { CMD_IOPWR_SETOUT, "Write digital outputs" },
682 { CMD_IOPWR_SETBIT, "Set indicated output bits" },
683 { CMD_IOPWR_CLRBIT, "Clear indicated output bits" },
684 { CMD_IOPWR_GETPOWER, "Read digital inputs at power on time" },
685 { CMD_UTIL_SET_INIT_STRATEGY, "Set initialization strategy" },
686 { CMD_UTIL_GET_INIT_STRATEGY, "Get initialization strategy" },
687 { CMD_CNVT_GET_VALUES, "Read one or more signal values from LIN Signal Conversion" },
688 { CMD_CNVT_GET_UNITS, "Read one or more signal units from LIN Signal Conversion" },
689 { CMD_CNVT_SET_VALUES, "Write one or more signal values for LIN Signal Conversion" },
690 { CMD_CNVT_DESTROY_SESSION, "Destroy internal LIN Signal Conversion info" },
691 { CMD_CNVT_SAVE_SESSION, "Save an internal representation of the LIN Signal Conversion" },
692 { CMD_CNVT_RESTORE_SESSION, "Restore a previously saved LIN Signal Conversion session" },
693 { CMD_CNVT_GET_NODE_SIGNALS, "Get signal names of the node defined in the LIN Signal Conversion Session" },
694 { 0, NULL},
697 static value_string_ext cmd_vals_ext = VALUE_STRING_EXT_INIT(cmd_vals);
699 static const value_string responses_vs[] = {
700 {RESP_OK, "OK - no error"},
701 {RESP_UNKNOWN_ERR, "Unknown error"},
702 {RESP_UNKNOWN_CMD, "Unrecognised command"},
703 {RESP_UNSUPPORTED, "Unsupported command"},
704 {RESP_INVAL_CHAN, "Invalid channel specified"},
705 {RESP_INVAL_DST, "Invalid destination"},
706 {RESP_INVAL_PARAM, "Invalid parameter(s)"},
707 {RESP_INVAL_MSG, "Invalid message"},
708 {RESP_INVAL_LEN, "Invalid length field"},
709 {RESP_TX_FAIL, "Transmit failed"},
710 {RESP_RX_FAIL, "Receive failed"},
711 {RESP_AUTH_FAIL, "Authorization failed"},
712 {RESP_MEM_ALLOC_ERR, "Memory allocation error"},
713 {RESP_TIMEOUT, "Command timed out"},
714 {RESP_UNAVAILABLE, "Unavailable"},
715 {RESP_BUF_FULL, "Buffer full"},
716 {RESP_NO_SUCH_JOB, "No such job"},
717 {0, NULL},
720 static const value_string filter_data_types[] = {
721 {FILTER_DATA_TYPE_HEADER_FRAME, "frame header"},
722 {FILTER_DATA_TYPE_HEADER, "data message header"},
723 {FILTER_DATA_TYPE_DATA, "data message data"},
724 {FILTER_DATA_TYPE_EXTRA_DATA, "data message extra data"},
725 {FILTER_EVENT_TYPE_HEADER, "event message header"},
726 {FILTER_EVENT_TYPE_DATA, "event message"},
727 {0, NULL},
730 static const value_string operators[] = {
731 {BIT_FIELD_CHECK, "Bit field check"},
732 {SVALUE_GT, "Greater than (signed)"},
733 {SVALUE_GE, "Greater than or equal to (signed)"},
734 {SVALUE_LT, "Less than (signed)"},
735 {SVALUE_LE, "Less than or equal to (signed)"},
736 {VALUE_EQ, "Equal to"},
737 {VALUE_NE, "Not equal to"},
738 {UVALUE_GT, "Greater than (unsigned)"},
739 {UVALUE_GE, "Greater than or equal to (unsigned)"},
740 {UVALUE_LT, "Less than (unsigned)"},
741 {UVALUE_LE, "Less than or equal to (unsigned)"},
742 {DIG_LOW_TO_HIGH, "Digital, low to high transition"},
743 {DIG_HIGH_TO_LOW, "Digital, high to low transition"},
744 {DIG_TRANSITION, "Digital, change of state"},
745 {0, NULL},
748 static const value_string modes[] = {
749 {FILTER_OFF_PASS_ALL, "Filter off, pass all messages"},
750 {FILTER_OFF_BLOCK_ALL, "Filter off, block all messages"},
751 {FILTER_ON, "Filter on"},
752 {0, NULL},
755 static const value_string filtacts[] = {
756 {DELETE_FILTER, "Delete"},
757 {ACTIVATE_FILTER, "Activate"},
758 {DEACTIVATE_FILTER, "Deactivate"},
759 {0, NULL},
762 static const value_string ioctls[] = {
763 {GINIT, "GINIT: Initialize"},
764 {GLOOPON, "GLOOPON: Loop on"},
765 {GLOOPOFF, "GLOOPOFF: Loop off"},
766 {GGETHWTYPE, "GGETHWTYPE: Get hardware type"},
767 {GGETREG, "GGETREG: Get register"},
768 {GSETREG, "GSETREG: Set register"},
769 {GGETRXCOUNT, "GGETRXCOUNT: Get the receive message counter"},
770 {GSETRXCOUNT, "GSETRXCOUNT: Set the receive message counter"},
771 {GGETTXCOUNT, "GGETTXCOUNT: Get the transmit message counter"},
772 {GSETTXCOUNT, "GSETTXCOUNT: Set the transmit message counter"},
773 {GGETRXDROP, "GGETRXDROP: Get the number of dropped receive messages"},
774 {GSETRXDROP, "GSETRXDROP: Set the number of dropped receive messages"},
775 {GGETTXDROP, "GGETTXDROP: Get the number of dropped transmit messages"},
776 {GSETTXDROP, "GSETTXDROP: Set the number of dropped transmit messages"},
777 {GGETRXBAD, "GGETRXBAD: Get the number of bad receive messages"},
778 {GGETTXBAD, "GGETTXBAD: Get the number of bad transmit messages"},
779 {GGETCOUNTS, "GGETCOUNTS: Get total message counter"},
780 {GGETBLMON, "GGETBLMON: Get bus load monitoring status"},
781 {GSETBLMON, "GSETBLMON: Set bus load monitoring status (turn on/off)"},
782 {GGETERRLEV, "GGETERRLEV: Get error level"},
783 {GSETERRLEV, "GSETERRLEV: Set error level"},
784 {GGETBITRATE, "GGETBITRATE: Get bit rate"},
785 {GGETRAM, "GGETRAM: Read value from RAM"},
786 {GSETRAM, "GSETRAM: Write value to RAM"},
787 {GCANGETBTRS, "GCANGETBTRS: Read CAN bit timing registers"},
788 {GCANSETBTRS, "GCANSETBTRS: Write CAN bit timing registers"},
789 {GCANGETBC, "GCANGETBC: Read CAN bus configuration register"},
790 {GCANSETBC, "GCANSETBC: Write CAN bus configuration register"},
791 {GCANGETMODE, "GCANGETMODE"},
792 {GCANSETMODE, "GCANSETMODE"},
793 {GCANGETTRANS, "GCANGETTRANS"},
794 {GCANSETTRANS, "GCANSETTRANS"},
795 {GCANSENDERR, "GCANSENDERR"},
796 {GCANRGETOBJ, "GCANRGETOBJ"},
797 {GCANRSETSTDID, "GCANRSETSTDID"},
798 {GCANRSETEXTID, "GCANRSETEXTID"},
799 {GCANRSETDATA, "GCANRSETDATA"},
800 {GCANRENABLE, "GCANRENABLE"},
801 {GCANRDISABLE, "GCANRDISABLE"},
802 {GCANRGETMASKS, "GCANRGETMASKS"},
803 {GCANRSETMASKS, "GCANRSETMASKS"},
804 {GCANSWGETMODE, "GCANSWGETMODE"},
805 {GCANSWSETMODE, "GCANSWSETMODE"},
806 {GDLCGETFOURX, "GDLCGETFOURX"},
807 {GDLCSETFOURX, "GDLCSETFOURX"},
808 {GDLCGETLOAD, "GDLCGETLOAD"},
809 {GDLCSETLOAD, "GDLCSETLOAD"},
810 {GDLCSENDBREAK, "GDLCSENDBREAK"},
811 {GDLCABORTTX, "GDLCABORTTX"},
812 {GDLCGETHDRMODE, "DLCGETHDRMODE"},
813 {GDLCSETHDRMODE, "GDLCSETHDRMODE"},
814 {GHONSLEEP, "GHONSLEEP"},
815 {GHONSILENCE, "GHONSILENCE"},
816 {GKWPSETPTIMES, "GKWPSETPTIMES"},
817 {GKWPSETWTIMES, "GKWPSETWTIMES"},
818 {GKWPDOWAKEUP, "GKWPDOWAKEUP"},
819 {GKWPGETBITTIME, "GKWPGETBITTIME"},
820 {GKWPSETBITTIME, "GKWPSETBITTIME"},
821 {GKWPSETNODEADDR, "GKWPSETNODEADDR"},
822 {GKWPGETNODETYPE, "GKWPGETNODETYPE"},
823 {GKWPSETNODETYPE, "GKWPSETNODETYPE"},
824 {GKWPSETWAKETYPE, "GKWPSETWAKETYPE"},
825 {GKWPSETTARGADDR, "GKWPSETTARGADDR"},
826 {GKWPSETKEYBYTES, "GKWPSETKEYBYTES"},
827 {GKWPSETSTARTREQ, "GKWPSETSTARTREQ"},
828 {GKWPSETSTARTRESP, "GKWPSETSTARTRESP"},
829 {GKWPSETPROTOCOL, "GKWPSETPROTOCOL"},
830 {GKWPGETLASTKEYBYTES, "GKWPGETLASTKEYBYTES"},
831 {GKWPSETLASTKEYBYTES, "GKWPSETLASTKEYBYTES"},
832 {GSCPGETBBR, "GSCPGETBBR"},
833 {GSCPSETBBR, "GSCPSETBBR"},
834 {GSCPGETID, "GSCPGETID"},
835 {GSCPSETID, "GSCPSETID"},
836 {GSCPADDFUNCID, "GSCPADDFUNCID"},
837 {GSCPCLRFUNCID, "GSCPCLRFUNCID"},
838 {GUBPGETBITRATE, "GUBPGETBITRATE"},
839 {GUBPSETBITRATE, "GUBPSETBITRATE"},
840 {GUBPGETINTERBYTE, "GUBPGETINTERBYTE"},
841 {GUBPSETINTERBYTE, "GUBPSETINTERBYTE"},
842 {GUBPGETNACKMODE, "GUBPGETNACKMODE"},
843 {GUBPSETNACKMODE, "GUBPSETNACKMODE"},
844 {GUBPGETRETRYDELAY, "GUBPGETRETRYDELAY"},
845 {GUBPSETRETRYDELAY, "GUBPSETRETRYDELAY"},
846 {GRESETHC08, "GRESETHC08: Reset the HC08 processor"},
847 {GTESTHC08COP, "GTESTHC08COP: Stop updating the HC08 watchdog timer"},
848 {GSJAGETLISTEN, "GSJAGETLISTEN"},
849 {GSJASETLISTEN, "GSJASETLISTEN"},
850 {GSJAGETSELFTEST, "GSJAGETSELFTEST"},
851 {GSJASETSELFTEST, "GSJASETSELFTEST"},
852 {GSJAGETXMITONCE, "GSJAGETXMITONCE"},
853 {GSJASETXMITONCE, "GSJASETXMITONCE"},
854 {GSJAGETTRIGSTATE, "GSJAGETTRIGSTATE"},
855 {GSJASETTRIGCTRL, "GSJASETTRIGCTRL"},
856 {GSJAGETTRIGCTRL, "GSJAGETTRIGCTRL"},
857 {GSJAGETOUTSTATE, "GSJAGETOUTSTATE"},
858 {GSJASETOUTSTATE, "GSJASETOUTSTATE"},
859 {GSJAGETFILTER, "GSJAGETFILTER"},
860 {GSJASETFILTER, "GSJASETFILTER"},
861 {GSJAGETMASK, "GSJAGETMASK"},
862 {GSJASETMASK, "GSJASETMASK"},
863 {GSJAGETINTTERM, "GSJAGETINTTERM"},
864 {GSJASETINTTERM, "GSJASETINTTERM"},
865 {GSJAGETFTTRANS, "GSJAGETFTTRANS"},
866 {GSJASETFTTRANS, "GSJASETFTTRANS"},
867 {GSJAGETFTERROR, "GSJAGETFTERROR"},
868 {GLINGETBITRATE, "GLINGETBITRATE: Get the current bit rate"},
869 {GLINSETBITRATE, "GLINSETBITRATE: Set the bit rate"},
870 {GLINGETBRKSPACE, "GLINGETBRKSPACE"},
871 {GLINSETBRKSPACE, "GLINSETBRKSPACE"},
872 {GLINGETBRKMARK, "GLINGETBRKMARK"},
873 {GLINSETBRKMARK, "GLINSETBRKMARK"},
874 {GLINGETIDDELAY, "GLINGETIDDELAY"},
875 {GLINSETIDDELAY, "GLINSETIDDELAY"},
876 {GLINGETRESPDELAY, "GLINGETRESPDELAY"},
877 {GLINSETRESPDELAY, "GLINSETRESPDELAY"},
878 {GLINGETINTERBYTE, "GLINGETINTERBYTE"},
879 {GLINSETINTERBYTE, "GLINSETINTERBYTE"},
880 {GLINGETWAKEUPDELAY, "GLINGETWAKEUPDELAY"},
881 {GLINSETWAKEUPDELAY, "GLINSETWAKEUPDELAY"},
882 {GLINGETWAKEUPTIMEOUT, "GLINGETWAKEUPTIMEOUT"},
883 {GLINSETWAKEUPTIMEOUT, "GLINSETWAKEUPTIMEOUT"},
884 {GLINGETWUTIMOUT3BR, "GLINGETWUTIMOUT3BR"},
885 {GLINSETWUTIMOUT3BR, "GLINSETWUTIMOUT3BR"},
886 {GLINSENDWAKEUP, "GLINSENDWAKEUP"},
887 {GLINGETMODE, "GLINGETMODE"},
888 {GLINSETMODE, "GLINSETMODE"},
889 /* 20171109 lin LDF */
890 {GLINGETSLEW, "GLINGETSLEW: get slew rate"},
891 {GLINSETSLEW, "GLINSETSLEW: set slew rate"},
892 {GLINADDSCHED, "GLINADDSCHED: add a LIN schedule"},
893 {GLINGETSCHED, "GLINGETSCHED: get a LIN schedule"},
894 {GLINGETSCHEDSIZE, "GLINGETSCHEDSIZE: get schedule size"},
895 {GLINDELSCHED, "GLINDELSCHED: delete a LIN schedule"},
896 {GLINACTSCHED, "GLINACTSCHED: activate a LIN schedule"},
897 {GLINDEACTSCHED, "GLINDEACTSCHED: deactivate a LIN schedule"},
898 {GLINGETACTSCHED, "GLINGETACTSCHED: get active LIN schedule"},
899 {GLINGETNUMSCHEDS, "GLINGETNUMSCHED: get number of LIN schedules"},
900 {GLINGETSCHEDNAMES, "GLINGETSCHEDNAMES: get LIN schedule names"},
901 {GLINGETMASTEREVENTENABLE, "GLINGETMASTEREVENTENABLE: get LIN master schedule event enable flag"},
902 {GLINSETMASTEREVENTENABLE, "GLINSETMASTEREVENTENABLE: set LIN master schedule event enable flag"},
903 {GLINGETNSLAVETABLE, "GLINGETNSLAVETABLE: set number of LIN slave table entries"},
904 {GLINGETSLAVETABLEPIDS, "GLINGETSLAVETABLEPIDS: get list of LIN slave table PIDs"},
905 {GLINGETSLAVETABLE, "GLINGETSLAVETABLE: get LIN slave table entry for this PID"},
906 {GLINSETSLAVETABLE, "GLINSETSLAVETABLE: set LIN slave table entry for this PID"},
907 {GLINCLEARSLAVETABLE, "GLINCLEARSLAVETABLE: clear LIN slave table entry for this PID"},
908 {GLINCLEARALLSLAVETABLE, "GLINCLEARALLSLAVETABLE: clear all LIN slave table entries"},
909 {GLINGETONESHOT, "GLINGETONESHOT: get LIN one-shot entry"},
910 {GLINSETONESHOT, "GLINSETONESHOT: set LIN one-shot entry"},
911 {GLINCLEARONESHOT, "GLINCLEARONESHOT: clear LIN one-shot entry"},
912 {GLINSETFLAGS, "GLINSETFLAGS"},
913 {GLINGETAUTOCHECKSUM, "GLINGETAUTOCHECKSUM: get LIN auto checksum"},
914 {GLINSETAUTOCHECKSUM, "GLINSETAUTOCHECKSUM: set LIN auto checksum"},
915 {GLINGETAUTOPARITY, "GLINGETAUTOPARITY: get LIN auto parity"},
916 {GLINSETAUTOPARITY, "GLINSETAUTOPARITY: set LIN auto parity"},
917 {GLINGETSLAVETABLEENABLE, "GLINGETSLAVETABLEENABLE: get LIN slave table enable"},
918 {GLINSETSLAVETABLEENABLE, "GLINSETSLAVETABLEENABLE: set LIN slave table enable"},
919 {GLINGETFLAGS, "GLINGETFLAGS"},
920 {GLINGETWAKEUPMODE, "GLINGETWAKEUPMODE: get LIN wakeup mode"},
921 {GLINSETWAKEUPMODE, "GLINSETWAKEUPMODE: set LIN wakeup mode"},
922 {GDLYGETHIVALUE, "GDLYGETHIVALUE: get the high water value"},
923 {GDLYSETHIVALUE, "GDLYSETHIVALUE: set the high water value"},
924 {GDLYGETLOVALUE, "GDLYGETLOVALUE: get the low water value"},
925 {GDLYSETLOVALUE, "GDLYSETLOVALUE: set the low water value"},
926 {GDLYGETHITIME, "GDLYGETHITIME: get the high water time"},
927 {GDLYSETHITIME, "GDLYSETHITIME: set the high water time"},
928 {GDLYGETLOTIME, "GDLYGETLOTIME: get the low water time"},
929 {GDLYSETLOTIME, "GDLYSETLOTIME: set the low water time"},
930 {GDLYGETLOREPORT, "GDLYGETLOREPORT:get the low water report flag"},
931 {GDLYFLUSHSTREAM, "GDLYFLUSHSTREAM: flush the delay buffer"},
932 {GDLYINITSTREAM, "GDLYINITSTREAM: set default hi & lo water marks"},
933 {GDLYPARTIALFLUSHSTREAM, "GDLYPARTIALFLUSHSTREAM: flush the delay buffer"},
934 {GINPGETINP, "GINPGETINP: Read current digital inputs"},
935 {GINPGETLATCH, "GINPGETLATCH: Read latched digital inputs"},
936 {GINPCLRLATCH, "GINPCLRLATCH: Read and clear latched digital inputs"},
937 {GOUTGET, "GOUTGET: Read digital outputs"},
938 {GOUTSET, "GOUTSET: Write digital outputs"},
939 {GOUTSETBIT, "GOUTSETBIT: Set digital output bits"},
940 {GOUTCLEARBIT, "GOUTCLEARBIT"},
941 {GPWRGETWHICH, "GPWRGETWHICH"},
942 {GPWROFF, "GPWROFF"},
943 {GPWROFFRESET, "GPWROFFRESET"},
944 {GPWRRESET, "GPWRRESET"},
945 {0, NULL},
949 static const value_string cmd_sort_type[] = {
950 {0, "Do not sort messages"},
951 {1, "Sort into blocks of up to 16 messages"},
952 {0, NULL}
955 static const value_string protocol_types[] = {
956 {GDUMMY * 256 + GDGDMARKONE, "Dummy device driver"},
957 {GCAN * 256 + G82527, "CAN, 82527 subtype"},
958 {GCAN * 256 + GSJA1000, "CAN, SJA1000 subtype"},
959 {GCAN * 256 + G82527SW, "CAN, 82527 single wire subtype"},
960 {GCAN * 256 + G82527ISO11992, "CAN, 82527 ISO11992 subtype"},
961 {GCAN * 256 + G82527_SINGLECHAN, "CAN, Fiber Optic 82527 subtype"},
962 {GCAN * 256 + G82527SW_SINGLECHAN, "CAN, Fiber Optic 82527 single wire subtype"},
963 {GCAN * 256 + G82527ISO11992_SINGLECHAN, "CAN, Fiber Optic ISO11992 subtype"},
964 {GCAN * 256 + GSJA1000FT, "CAN, SJA1000 Fault Tolerant subtype"},
965 {GCAN * 256 + GSJA1000C, "CAN, SJA1000 onboard subtype"},
966 {GCAN * 256 + GSJA1000FT_FO, "CAN, SJA1000 Fiber Optic Fault Tolerant subtype"},
967 {GCAN * 256 + GSJA1000_BEACON_CANFD, "CAN, SJA1000 BEACON CAN-FD subtype"},
968 {GCAN * 256 + GSJA1000_BEACON_SW, "CAN, SJA1000 BEACON CAN single wire subtype"},
969 {GCAN * 256 + GSJA1000_BEACON_FT, "CAN, SJA1000 BEACON CAN Fault Tolerant subtype"},
970 {GJ1850 * 256 + GHBCCPAIR, "J1850, HBCC subtype"},
971 {GJ1850 * 256 + GDLC, "J1850, GM DLC subtype"},
972 {GJ1850 * 256 + GCHRYSLER, "J1850, Chrysler subtype"},
973 {GJ1850 * 256 + GDEHC12, "J1850, DE HC12 KWP/BDLC subtype"},
974 {GKWP2000 * 256 + GDEHC12KWP, "Keyword protocol 2000/ISO 9141"},
975 {GHONDA * 256 + GDGHC08, "Honda UART, DG HC08 subtype"},
976 {GFORDUBP * 256 + GDGUBP08, "Ford UBP, DG HC08 subtype"},
977 {GSCI * 256 + G16550SCI, "Chrysler SCI, UART subtype"},
978 {GCCD * 256 + G16550CDP68HC68, "Chrysler C2D, UART / CDP68HC68S1 subtype"},
979 {GLIN * 256 + GDGLIN08, "LIN, DG HC08 subtype"},
980 {GLIN * 256 + GDGLIN_BEACON, "LIN, BEACON LIN updated subtype"},
981 {0, NULL},
985 * Note: using external tfs strings doesn't work in a plugin.
986 * The address of a data item exported from a shared library
987 * such as libwireshark is not known until the library is
988 * loaded, so "&data_item" is not a constant; MSVC complains
989 * about that.
991 * (*Direct* references to the item in code can execute a
992 * different code sequence to get the address and then load
993 * from that address, but references from a data structure
994 * can't do that.)
996 static const true_false_string tfs_wait_response = { "Wait", "Don't Wait" };
997 static const true_false_string true_false = { "True", "False" };
998 static const true_false_string register_unregister_action_flags = { "Register", "Unregister" };
999 static const true_false_string tfs_passed_blocked = { "Pass", "Block" };
1000 static const true_false_string active_inactive = { "Active", "Inactive" };
1001 static const true_false_string critical_normal = { "Critical", "Normal" };
1002 static const true_false_string skip_not_skip = { "Skip", "Do not skip" };
1003 static const true_false_string frames_01seconds = { "Frames", "0.01 seconds" };
1004 static const true_false_string present_not_present = { "Present", "Not present" };
1005 static const true_false_string yes_no = { "Yes", "No" };
1006 static const true_false_string set_not_set = { "Set", "Not set" };
1009 * returns 1 if the ID is one of the special servers
1010 * return 0 otherwise
1012 static int is_special_client(uint32_t id)
1014 if((id == SD_SERVER) || (id == SD_CLIENT)) {
1015 return 1;
1017 return 0;
1020 static int
1021 decode_data(tvbuff_t *tvb, int offset, proto_tree *pt)
1023 proto_tree *tree;
1024 int hdrsize, datasize, extrasize, msgsize, padding;
1025 nstime_t timestamp;
1026 /*int hdrbits;*/
1028 static int * const data_mode_flags[] = {
1029 &hf_gryphon_data_mode_transmitted,
1030 &hf_gryphon_data_mode_receive,
1031 &hf_gryphon_data_mode_local,
1032 &hf_gryphon_data_mode_remote,
1033 &hf_gryphon_data_mode_oneshot,
1034 &hf_gryphon_data_mode_combined,
1035 &hf_gryphon_data_mode_nomux,
1036 &hf_gryphon_data_mode_internal,
1037 NULL
1040 hdrsize = tvb_get_uint8(tvb, offset+0);
1041 /* hdrbits = tvb_get_uint8(tvb, offset+1); */
1042 datasize = tvb_get_ntohs(tvb, offset+2);
1043 extrasize = tvb_get_uint8(tvb, offset+4);
1044 padding = 3 - (hdrsize + datasize + extrasize + 3) % 4;
1045 msgsize = hdrsize + datasize + extrasize + padding + 16;
1047 tree = proto_tree_add_subtree(pt, tvb, offset, 16, ett_gryphon_data_header, NULL, "Message header");
1049 /* fixed major problem with header length, length is 1-byte not 2-bytes */
1050 proto_tree_add_item(tree, hf_gryphon_data_header_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1051 proto_tree_add_item(tree, hf_gryphon_data_header_length_bits, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1052 proto_tree_add_item(tree, hf_gryphon_data_data_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1053 proto_tree_add_item(tree, hf_gryphon_data_extra_data_length, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1055 /* 20171012 always display mode bits, not just conditionally */
1056 proto_tree_add_bitmask(tree, tvb, offset+5, hf_gryphon_data_mode, ett_gryphon_flags, data_mode_flags, ENC_BIG_ENDIAN);
1058 proto_tree_add_item(tree, hf_gryphon_data_priority, tvb, offset+6, 1, ENC_BIG_ENDIAN);
1059 proto_tree_add_item(tree, hf_gryphon_data_error_status, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1061 timestamp.secs = tvb_get_ntohl(tvb, offset+8)/100000;
1062 timestamp.nsecs = (tvb_get_ntohl(tvb, offset+8)%100000)*1000;
1063 proto_tree_add_time(tree, hf_gryphon_data_time, tvb, offset+8, 4, &timestamp);
1065 proto_tree_add_item(tree, hf_gryphon_data_context, tvb, offset+12, 1, ENC_BIG_ENDIAN);
1066 proto_tree_add_item(tree, hf_gryphon_reserved, tvb, offset+13, 3, ENC_NA);
1067 offset += 16;
1069 tree = proto_tree_add_subtree(pt, tvb, offset, msgsize-16-padding, ett_gryphon_data_body, NULL, "Message Body");
1070 if (hdrsize) {
1071 proto_tree_add_item(tree, hf_gryphon_data_header_data, tvb, offset, hdrsize, ENC_NA);
1072 offset += hdrsize;
1074 if (datasize) {
1075 proto_tree_add_item(tree, hf_gryphon_data_data, tvb, offset, datasize, ENC_NA);
1076 offset += datasize;
1078 if (extrasize) {
1079 proto_tree_add_item(tree, hf_gryphon_data_extra_data, tvb, offset, extrasize, ENC_NA);
1080 offset += extrasize;
1082 if (padding) {
1083 proto_tree_add_item(tree, hf_gryphon_data_padding, tvb, offset, padding, ENC_NA);
1084 offset += padding;
1086 /*proto_tree_add_debug_text(pt, "decode_data() debug offset=%d msgsize=%d", offset, msgsize);*/
1087 return offset;
1090 static int
1091 decode_event(tvbuff_t *tvb, int offset, proto_tree *pt)
1093 int msglen, msgend, padding, length;
1094 nstime_t timestamp;
1096 msglen = tvb_reported_length_remaining(tvb, offset);
1097 padding = 3 - (msglen + 3) % 4;
1098 msgend = offset + msglen;
1100 proto_tree_add_item(pt, hf_gryphon_event_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1101 proto_tree_add_item(pt, hf_gryphon_event_context, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1102 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
1103 offset += 4;
1105 timestamp.secs = tvb_get_ntohl(tvb, offset)/100000;
1106 timestamp.nsecs = (tvb_get_ntohl(tvb, offset)%100000)*1000;
1107 proto_tree_add_time(pt, hf_gryphon_event_time, tvb, offset, 4, &timestamp);
1108 offset += 4;
1110 if (offset < msgend) {
1111 length = msgend - offset;
1112 proto_tree_add_item(pt, hf_gryphon_event_data, tvb, offset, length, ENC_NA);
1113 offset += length;
1115 if (padding) {
1116 proto_tree_add_item(pt, hf_gryphon_event_padding, tvb, offset, padding, ENC_NA);
1117 offset += padding;
1119 return offset;
1122 static int
1123 // NOLINTNEXTLINE(misc-no-recursion)
1124 decode_misc (tvbuff_t *tvb, int offset, packet_info* pinfo, proto_tree *pt)
1126 tvbuff_t *next_tvb;
1128 /* proto_tree_add_debug_text(pt, "decode_misc() debug a offset=%d msglen=%d",offset, msglen); */
1129 while(tvb_reported_length_remaining(tvb, offset) > 0) {
1131 * 20180221
1132 * This function is called because Gryphon Protocol MISC packets contain within
1133 * them Gryphon Protocol packets (including possibly MISC packets!). So, this
1134 * function decodes that packet and return the offset. Loop thru all such packets
1135 * in the MISC packet.
1138 next_tvb = tvb_new_subset_remaining(tvb, offset);
1139 offset += dissect_gryphon_message(next_tvb, pinfo, pt, true);
1141 return offset;
1144 static int
1145 decode_text (tvbuff_t *tvb, int offset, int msglen, proto_tree *pt)
1147 int padding, length;
1149 padding = 3 - (msglen + 3) % 4;
1151 proto_tree_add_item_ret_length(pt, hf_gryphon_misc_text, tvb, offset, -1, ENC_NA|ENC_ASCII, &length);
1152 offset += length;
1153 if (padding) {
1154 proto_tree_add_item(pt, hf_gryphon_misc_padding, tvb, offset, padding, ENC_NA);
1155 offset += padding;
1157 return offset;
1160 static int
1161 cmd_init(tvbuff_t *tvb, int offset, proto_tree *pt)
1163 uint8_t mode = tvb_get_uint8(tvb, offset);
1165 if (mode == 0)
1166 proto_tree_add_uint_format_value(pt, hf_gryphon_cmd_mode, tvb, offset, 1, mode, "Always initialize");
1167 else
1168 proto_tree_add_uint_format_value(pt, hf_gryphon_cmd_mode, tvb, offset, 1, mode, "Initialize if not previously initialized");
1169 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1170 offset += 4;
1171 return offset;
1173 static int
1174 eventnum(tvbuff_t *tvb, int offset, proto_tree *pt)
1176 uint8_t event = tvb_get_uint8(tvb, offset);
1178 if (event)
1179 proto_tree_add_item(pt, hf_gryphon_eventnum, tvb, offset, 1, ENC_BIG_ENDIAN);
1180 else
1181 proto_tree_add_uint_format_value(pt, hf_gryphon_eventnum, tvb, offset, 1, 0, "All Events.");
1182 offset += 1;
1183 return offset;
1186 static int
1187 resp_time(tvbuff_t *tvb, int offset, proto_tree *pt)
1189 uint64_t val;
1190 nstime_t timestamp;
1192 val = tvb_get_ntoh64(tvb, offset);
1193 timestamp.secs = (time_t)(val/100000);
1194 timestamp.nsecs = (int)((val%100000)*1000);
1196 proto_tree_add_time(pt, hf_gryphon_resp_time, tvb, offset, 8, &timestamp);
1197 offset += 8;
1199 return offset;
1202 static int
1203 cmd_setfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
1205 int flag = tvb_get_ntohl(tvb, offset);
1206 int length, padding;
1208 length = tvb_get_uint8(tvb, offset+4) + tvb_get_uint8(tvb, offset+5)
1209 + tvb_get_ntohs(tvb, offset+6);
1211 proto_tree_add_uint_format_value(pt, hf_gryphon_setfilt, tvb, offset, 4,
1212 flag, "%s%s", ((flag) ? "Pass" : "Block"), ((length == 0) ? " all" : ""));
1213 proto_tree_add_uint(pt, hf_gryphon_setfilt_length, tvb, offset+4, 4, length);
1214 offset += 8;
1215 if (length) {
1216 proto_tree_add_item(pt, hf_gryphon_setfilt_discard_data, tvb, offset, length * 2, ENC_NA);
1217 offset += length * 2;
1219 padding = 3 - (length * 2 + 3) % 4;
1220 if (padding) {
1221 proto_tree_add_item(pt, hf_gryphon_setfilt_padding, tvb, offset, padding, ENC_NA);
1222 offset += padding;
1224 return offset;
1227 static int
1228 cmd_ioctl_details(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt, uint32_t ui_command, int msglen)
1230 char *string;
1231 int length;
1232 int32_t nbytes;
1233 int32_t block_nbytes;
1234 int16_t us_stream;
1235 int16_t us_value;
1236 proto_tree *tree;
1237 unsigned int msg;
1238 uint8_t number_ids;
1239 uint8_t number_bytes;
1240 uint8_t number_extra_bytes;
1241 uint8_t flags;
1242 uint8_t pid;
1243 uint8_t datalen;
1244 uint8_t extralen;
1245 int i;
1246 uint32_t mtime;
1247 uint16_t us_nsched;
1248 float value;
1249 static int * const ldf_schedule_flags[] = {
1250 &hf_gryphon_ldf_schedule_event,
1251 &hf_gryphon_ldf_schedule_sporadic,
1252 NULL
1255 /* TODO Gryphon Protocol has LOTS more ioctls, for CANbus, etc. */
1256 /* 20171109 mc */
1257 switch(ui_command) {
1258 case GLINDEACTSCHED:
1260 /* 20180104 done */
1262 break;
1263 case GLINACTSCHED:
1265 /* schedule name */
1266 proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
1267 offset += 32;
1269 break;
1270 case GLINGETNUMSCHEDS:
1272 /* 20180227 */
1273 us_nsched = tvb_get_letohs(tvb, offset);
1274 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_sched_numb_place, tvb, offset, 2, us_nsched, "%d", us_nsched);
1275 offset += 2;
1277 break;
1278 case GLINGETSCHEDNAMES:
1280 nbytes = tvb_reported_length_remaining(tvb, offset);
1281 while(nbytes > 0)
1283 /* schedule name */
1284 proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
1285 offset += 32;
1286 nbytes -= 32;
1289 break;
1290 case GLINGETSCHED:
1292 /* 20180227 */
1293 nbytes = tvb_get_letohl(tvb, offset);
1294 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_sched_size, tvb, offset, 4, nbytes, "%d", nbytes);
1295 offset += 4;
1296 /* schedule name */
1297 proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
1298 offset += 32;
1300 /* delay time */
1301 mtime = tvb_get_letohl(tvb, offset);
1302 value = (float)mtime / (float)10.0;
1303 proto_tree_add_float_format_value(pt, hf_gryphon_init_strat_delay, tvb, offset, 4, value, "%.1f milliseconds", value);
1304 offset += 4;
1306 number_ids = tvb_get_uint8(tvb, offset);
1308 /* header length, number of IDs to follow */
1309 proto_tree_add_item(pt, hf_gryphon_data_header_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1310 offset += 1;
1312 number_bytes = tvb_get_uint8(tvb, offset);
1313 number_bytes &= 0x0F; /* bit0 thru bit3 */
1315 /* data length, number data bytes to follow */
1316 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_schedule_msg_dbytes, tvb, offset, 1, number_bytes, "%d", number_bytes);
1317 /* sporadic, event-driven flags */
1318 proto_tree_add_bitmask(pt, tvb, offset, hf_gryphon_ldf_schedule_flags, ett_gryphon_flags, ldf_schedule_flags, ENC_BIG_ENDIAN);
1319 offset += 1;
1321 /* id's */
1322 proto_tree_add_item(pt, hf_gryphon_data_header_data, tvb, offset, number_ids, ENC_NA);
1323 offset += number_ids;
1324 proto_tree_add_item(pt, hf_gryphon_data_data, tvb, offset, number_bytes, ENC_NA);
1325 offset += number_bytes;
1327 break;
1328 case GLINGETSCHEDSIZE:
1330 /* 20180227 */
1331 nbytes = tvb_get_letohl(tvb, offset);
1332 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_sched_size_place, tvb, offset, 4, nbytes, "%d", nbytes);
1333 offset += 4;
1334 /* schedule name */
1335 proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
1336 offset += 32;
1338 break;
1339 case GLINDELSCHED:
1341 string = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &length, ENC_ASCII);
1342 /*proto_tree_add_debug_text(pt, "cmd_ioctl_details() debug offset=%d length=%d string='%s'",offset,length,string); */
1343 if(string[0] == '\0') {
1344 proto_tree_add_string(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, "All schedules");
1345 } else {
1346 proto_tree_add_string(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, string);
1348 offset += 32;
1350 break;
1351 case GLINADDSCHED:
1353 /* 20180227 */
1354 /* number of bytes to follow */
1355 nbytes = tvb_get_letohl(tvb, offset);
1356 /*proto_tree_add_item(pt, hf_gryphon_ioctl_nbytes, tvb, offset, 4, ENC_BIG_ENDIAN);*/
1357 proto_tree_add_uint_format_value(pt, hf_gryphon_ioctl_nbytes, tvb, offset, 4, nbytes, "%d", nbytes);
1358 offset += 4;
1359 nbytes -= 4;
1360 /* schedule name */
1361 proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
1362 offset += 32;
1363 nbytes -= 32;
1365 /* messages */
1366 msg = 1;
1367 while(nbytes > 0) {
1369 /* calc the number of bytes in this block */
1370 number_ids = tvb_get_uint8(tvb, offset+4);
1371 number_bytes = tvb_get_uint8(tvb, offset+5);
1373 number_bytes &= 0x0F; /* bit0 thru bit3 */
1374 block_nbytes = 4 + 1 + 1 + number_ids + number_bytes;
1376 /* message number */
1377 tree = proto_tree_add_subtree_format(pt, tvb, offset, block_nbytes, ett_gryphon_lin_schedule_msg, NULL, "LIN message %u", msg);
1379 /* delay time */
1380 /*mtime = tvb_get_ntohl(tvb, offset);*/
1381 mtime = tvb_get_letohl(tvb, offset);
1382 value = (float)mtime / (float)10.0;
1383 proto_tree_add_float_format_value(tree, hf_gryphon_init_strat_delay, tvb, offset, 4, value, "%.1f milliseconds", value);
1384 offset += 4;
1386 /* header length, number of IDs to follow */
1387 proto_tree_add_item(tree, hf_gryphon_data_header_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1388 offset += 1;
1390 /* data length, number data bytes to follow */
1391 /*proto_tree_add_item(tree, hf_gryphon_data_data_length, tvb, offset, 1, ENC_BIG_ENDIAN);*/
1392 proto_tree_add_uint_format_value(tree, hf_gryphon_ldf_schedule_msg_dbytes, tvb, offset, 1, number_bytes, "%d", number_bytes);
1393 /* sporadic, event-driven flags */
1394 proto_tree_add_bitmask(tree, tvb, offset, hf_gryphon_ldf_schedule_flags, ett_gryphon_flags, ldf_schedule_flags, ENC_BIG_ENDIAN);
1395 offset += 1;
1397 /* id's */
1398 proto_tree_add_item(tree, hf_gryphon_data_header_data, tvb, offset, number_ids, ENC_NA);
1399 offset += number_ids;
1400 proto_tree_add_item(tree, hf_gryphon_data_data, tvb, offset, number_bytes, ENC_NA);
1401 offset += number_bytes;
1403 nbytes -= block_nbytes;
1404 msg++;
1405 /* proto_tree_add_debug_text(pt, "cmd_ioctl_details() debug offset=%d msglen=%d nbytes=%d",offset,msglen,nbytes);*/
1408 break;
1409 case GLINSETFLAGS:
1411 /* 20171113 */
1412 proto_tree_add_item(pt, hf_gryphon_ldf_ioctl_setflags, tvb, offset, 1, ENC_BIG_ENDIAN);
1413 offset += 1;
1414 number_ids = tvb_get_uint8(tvb, offset);
1415 proto_tree_add_item(pt, hf_gryphon_ldf_numb_ids, tvb, offset, 1, ENC_BIG_ENDIAN);
1416 offset += 1;
1417 for(i = 0; i < number_ids; i++) {
1418 flags = tvb_get_uint8(tvb, offset);
1419 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, flags, "0x%x %s",i,flags==0 ? "Classic checksum" : (flags==0x80?"Enhanced checksum":(flags==0x40?"Event":"UNKNOWN")));
1420 offset += 1;
1423 break;
1424 case GLINSETBITRATE:
1426 /* 20180227 */
1427 /* 20171113 */
1428 mtime = tvb_get_letohl(tvb, offset);
1429 value = (float)mtime / (float)1000.0;
1430 proto_tree_add_float_format_value(pt, hf_gryphon_ldf_bitrate, tvb, offset, 4, value, "%.3f Kbps", value);
1431 offset += 4;
1433 break;
1434 case GLINGETNSLAVETABLE:
1436 /* 20180104 */
1437 proto_tree_add_item(pt, hf_gryphon_ldf_numb_ids, tvb, offset, 1, ENC_BIG_ENDIAN);
1438 offset += 1;
1440 break;
1441 case GLINGETSLAVETABLEPIDS:
1443 /* 20180104 */
1444 number_ids = tvb_get_uint8(tvb, offset);
1445 proto_tree_add_item(pt, hf_gryphon_ldf_numb_ids, tvb, offset, 1, ENC_BIG_ENDIAN);
1446 offset += 1;
1447 for(i = 0; i < number_ids; i++) {
1448 pid = tvb_get_uint8(tvb, offset);
1449 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%x ",pid);
1450 offset += 1;
1453 break;
1454 case GLINGETSLAVETABLE:
1456 /* 20180104 */
1458 * byte 0: PID
1459 * byte 1: datalen
1460 * byte 2: extralen
1461 * byte 3: enabled=1 or disabled=0, 2=has one-shot
1462 * byte 4: good cs=0 or bad cs=1
1463 * byte 5-13: data[datalen]
1464 * byte n: checksum
1466 pid = tvb_get_uint8(tvb, offset);
1467 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%02x ",pid);
1468 offset += 1;
1469 datalen = tvb_get_uint8(tvb, offset);
1470 proto_tree_add_item(pt, hf_gryphon_lin_data_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1471 offset += 1;
1472 extralen = tvb_get_uint8(tvb, offset);
1473 proto_tree_add_item(pt, hf_gryphon_data_extra_data_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1474 offset += 1;
1475 proto_tree_add_item(pt, hf_gryphon_lin_slave_table_enable, tvb, offset, 1, ENC_BIG_ENDIAN);
1476 offset += 1;
1477 proto_tree_add_item(pt, hf_gryphon_lin_slave_table_cs, tvb, offset, 1, ENC_BIG_ENDIAN);
1478 offset += 1;
1479 if(datalen != 0) {
1480 proto_tree_add_item(pt, hf_gryphon_lin_slave_table_data, tvb, offset, datalen, ENC_NA);
1481 offset += datalen;
1483 if(extralen != 0) {
1484 proto_tree_add_item(pt, hf_gryphon_lin_slave_table_datacs, tvb, offset, 1, ENC_NA);
1485 offset += 1;
1488 break;
1489 case GLINSETSLAVETABLE:
1491 /* 20180104 */
1493 * byte 0: PID
1494 * byte 1: datalen
1495 * byte 2: extralen
1496 * byte 3: enabled=1 or disabled=0
1497 * byte 4-12: data[datalen]
1498 * byte n: checksum
1500 pid = tvb_get_uint8(tvb, offset);
1501 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%02x ",pid);
1502 offset += 1;
1503 datalen = tvb_get_uint8(tvb, offset);
1504 proto_tree_add_item(pt, hf_gryphon_lin_data_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1505 offset += 1;
1506 extralen = tvb_get_uint8(tvb, offset);
1507 proto_tree_add_item(pt, hf_gryphon_data_extra_data_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1508 offset += 1;
1509 proto_tree_add_item(pt, hf_gryphon_lin_slave_table_enable, tvb, offset, 1, ENC_BIG_ENDIAN);
1510 offset += 1;
1511 if(datalen != 0) {
1512 proto_tree_add_item(pt, hf_gryphon_lin_slave_table_data, tvb, offset, datalen, ENC_NA);
1513 offset += datalen;
1515 if(extralen != 0) {
1516 proto_tree_add_item(pt, hf_gryphon_lin_slave_table_datacs, tvb, offset, 1, ENC_NA);
1517 offset += 1;
1520 break;
1521 case GLINCLEARSLAVETABLE:
1523 /* 20180104 done */
1524 pid = tvb_get_uint8(tvb, offset);
1525 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%02x ",pid);
1526 offset += 1;
1528 break;
1529 case GLINCLEARALLSLAVETABLE:
1531 /* 20180104 done */
1533 break;
1534 case GLINGETMASTEREVENTENABLE:
1535 case GLINSETMASTEREVENTENABLE:
1537 /* 20180227 */
1538 proto_tree_add_item(pt, hf_gryphon_lin_masterevent, tvb, offset, 1, ENC_BIG_ENDIAN);
1539 offset += 1;
1541 break;
1542 case GLINGETONESHOT:
1543 case GLINSETONESHOT:
1545 /* 20180104 */
1546 /* 20180228 */
1547 number_bytes = tvb_get_uint8(tvb, offset+1);
1548 number_extra_bytes = tvb_get_uint8(tvb, offset+2);
1549 /* id */
1550 proto_tree_add_item(pt, hf_gryphon_data_header_data, tvb, offset, 1, ENC_NA);
1551 offset += 1;
1552 proto_tree_add_item(pt, hf_gryphon_lin_numdata, tvb, offset, 1, ENC_BIG_ENDIAN);
1553 offset += 1;
1554 proto_tree_add_item(pt, hf_gryphon_lin_numextra, tvb, offset, 1, ENC_BIG_ENDIAN);
1555 offset += 1;
1556 if (number_bytes) {
1557 proto_tree_add_item(pt, hf_gryphon_data_data, tvb, offset, number_bytes, ENC_NA);
1558 offset += number_bytes;
1560 if (number_extra_bytes) {
1561 proto_tree_add_item(pt, hf_gryphon_data_extra_data, tvb, offset, number_extra_bytes, ENC_NA);
1562 offset += number_extra_bytes;
1565 break;
1566 case GLINCLEARONESHOT:
1568 /* 20180104 */
1569 /* 20180227 done */
1571 break;
1572 case GDLYGETHIVALUE:
1573 case GDLYSETHIVALUE:
1574 case GDLYGETLOVALUE:
1575 case GDLYSETLOVALUE:
1577 /* 20180227 */
1578 /* 20180104 */
1579 us_stream = tvb_get_letohs(tvb, offset);
1580 proto_tree_add_uint_format_value(pt, hf_gryphon_dd_stream, tvb, offset, 2, us_stream, "%d (0x%04X)", us_stream, us_stream);
1581 offset += 2;
1582 us_value = tvb_get_letohs(tvb, offset);
1583 /* proto_tree_add_item(pt, hf_gryphon_dd_value, tvb, offset, 2, ENC_BIG_ENDIAN);*/
1584 proto_tree_add_uint_format_value(pt, hf_gryphon_dd_value, tvb, offset, 2, us_value, "%d (0x%04X)", us_value, us_value);
1585 offset += 2;
1587 break;
1588 case GDLYGETHITIME:
1589 case GDLYSETHITIME:
1590 case GDLYGETLOTIME:
1591 case GDLYSETLOTIME:
1593 /* 20180227 */
1594 /* 20180104 */
1595 us_stream = tvb_get_letohs(tvb, offset);
1596 proto_tree_add_uint_format_value(pt, hf_gryphon_dd_stream, tvb, offset, 2, us_stream, "%d (0x%04X)", us_stream, us_stream);
1597 offset += 2;
1598 mtime = tvb_get_letohs(tvb, offset);
1599 proto_tree_add_uint_format_value(pt, hf_gryphon_dd_time, tvb, offset, 2, mtime, "%d", mtime);
1600 offset += 2;
1602 break;
1603 /* TODO implement remaining delay driver ioctls */
1604 #if 0
1605 case GDLYGETLOREPORT: /*get the low water report flag*/
1606 break;
1607 case GDLYFLUSHSTREAM: /*flush the delay buffer*/
1608 break;
1609 case GDLYINITSTREAM: /*set default hi & lo water marks*/
1610 break;
1611 case GDLYPARTIALFLUSHSTREAM: /*flush the delay buffer */
1612 break;
1613 #endif
1614 default:
1615 proto_tree_add_item(pt, hf_gryphon_ioctl_data, tvb, offset, msglen, ENC_NA);
1616 offset += msglen;
1617 break;
1619 return offset;
1623 * cmd_ioctl() performs the initial decode of the IOCTL command, then
1624 * calls cmd_ioctl_details()
1626 static int
1627 cmd_ioctl(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt, uint32_t ui_command)
1629 int msglen;
1630 /*uint32_t ioctl;*/
1631 int padding;
1633 msglen = tvb_reported_length_remaining(tvb, offset);
1634 /* 20171109 mc */
1635 /*ioctl = tvb_get_ntohl(tvb, offset);*/
1637 /* 20171012 debug */
1638 /*proto_tree_add_debug_text(pt, "cmd_ioctl() debug offset=%d msglen=%d",offset,msglen);*/
1639 proto_tree_add_item(pt, hf_gryphon_ioctl, tvb, offset, 4, ENC_BIG_ENDIAN);
1640 offset += 4;
1641 msglen -= 4;
1643 if (msglen > 0) {
1644 offset = cmd_ioctl_details(tvb, pinfo, offset, pt, ui_command, msglen);
1647 padding = tvb_reported_length_remaining(tvb, offset);
1648 /*proto_tree_add_debug_text(pt, "cmd_ioctl() debug offset=%d msglen=%d padding=%d",offset,msglen,padding);*/
1649 if (padding > 0) {
1650 proto_tree_add_item(pt, hf_gryphon_setfilt_padding, tvb, offset, padding, ENC_NA);
1651 offset += padding;
1653 return offset;
1657 * cmd_ioctl_resp()
1658 * displays the IOCTL data in the IOCTL response to the IOCTL request
1659 * Here is an issue with the IOCTLs. The IOCTL request contains the IOCTL number,
1660 * but the IOCTL response does not contain the number. IOCTL response
1661 * contains the context byte of the request, so application software can match
1662 * the IOCTL response to the request.
1664 static int
1665 cmd_ioctl_resp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt, uint32_t ui_command)
1667 int msglen = tvb_reported_length_remaining(tvb, offset);
1669 /* 20171012 debug */
1670 /*proto_tree_add_debug_text(pt, "cmd_ioctl_resp() debug offset=%d msglen=%d",offset,msglen);*/
1672 if (msglen > 0) {
1673 /*proto_tree_add_item(pt, hf_gryphon_ioctl_data, tvb, offset, msglen, ENC_NA);*/
1674 /*offset += msglen;*/
1675 offset = cmd_ioctl_details(tvb, pinfo, offset, pt, ui_command, msglen);
1677 return offset;
1680 static int
1681 filter_block(tvbuff_t *tvb, int offset, proto_tree *pt)
1683 uint32_t op, length, padding;
1685 /* 20171017 fixed display of filter block padding */
1687 /* start 2bytes */
1688 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_start, tvb, offset, 2, ENC_BIG_ENDIAN);
1689 offset += 2;
1691 /* length 2bytes */
1692 proto_tree_add_item_ret_uint(pt, hf_gryphon_filter_block_filter_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
1693 offset += 2;
1695 /* type 1byte */
1696 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1697 offset += 1;
1699 /* operator 1byte */
1700 proto_tree_add_item_ret_uint(pt, hf_gryphon_filter_block_filter_operator, tvb, offset, 1, ENC_BIG_ENDIAN, &op);
1701 offset += 1;
1703 /* rsvd 2bytes */
1704 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 2, ENC_NA);
1705 offset += 2;
1707 if (op == BIT_FIELD_CHECK) {
1708 proto_tree_add_item(pt, hf_gryphon_filter_block_pattern, tvb, offset, length, ENC_NA);
1709 proto_tree_add_item(pt, hf_gryphon_filter_block_mask, tvb, offset + length, length, ENC_NA);
1711 offset += length * 2;
1712 padding = (length * 2) % 4;
1713 if (padding) {
1714 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, padding, ENC_NA);
1715 offset += padding;
1718 else {
1719 switch (length) {
1720 case 1:
1721 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value1, tvb, offset, 1, ENC_BIG_ENDIAN);
1722 offset += 1;
1723 break;
1724 case 2:
1725 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value2, tvb, offset, 2, ENC_BIG_ENDIAN);
1726 offset += 2;
1727 break;
1728 case 4:
1729 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value4, tvb, offset, 4, ENC_BIG_ENDIAN);
1730 offset += 4;
1731 break;
1732 default:
1733 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value_bytes, tvb, offset, length, ENC_NA);
1734 offset += length;
1737 padding = 3 - ((length + 3) % 4);
1738 if (padding) {
1739 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, padding, ENC_NA);
1740 offset += padding;
1743 return offset;
1746 static int
1747 cmd_addfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
1749 proto_tree *tree;
1750 int blocks, i, length;
1751 int padding;
1753 tree = proto_tree_add_subtree(pt, tvb, offset, 1, ett_gryphon_flags, NULL, "Flags");
1754 proto_tree_add_item(tree, hf_gryphon_addfilt_pass, tvb, offset, 1, ENC_BIG_ENDIAN);
1755 proto_tree_add_item(tree, hf_gryphon_addfilt_active, tvb, offset, 1, ENC_BIG_ENDIAN);
1756 offset += 1;
1758 blocks = tvb_get_uint8(tvb, offset);
1759 proto_tree_add_item(pt, hf_gryphon_addfilt_blocks, tvb, offset, 1, ENC_BIG_ENDIAN);
1760 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 6, ENC_NA);
1761 offset += 7;
1763 for (i = 1; i <= blocks; i++) {
1764 length = tvb_get_ntohs(tvb, offset+2) + 8;
1765 /*length += 3 - (length + 3) % 4; */
1766 padding = 3 - (length + 3) % 4;
1767 tree = proto_tree_add_subtree_format(pt, tvb, offset, length + padding, ett_gryphon_cmd_filter_block, NULL, "Filter block %d", i);
1768 offset = filter_block(tvb, offset, tree);
1770 return offset;
1773 static int
1774 resp_addfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
1776 proto_tree_add_item(pt, hf_gryphon_addfilt_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
1777 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1778 offset += 4;
1779 return offset;
1782 static int
1783 cmd_modfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
1785 uint8_t filter_handle = tvb_get_uint8(tvb, offset);
1787 if (filter_handle)
1788 proto_tree_add_item(pt, hf_gryphon_modfilt, tvb, offset, 1, ENC_BIG_ENDIAN);
1789 else
1790 proto_tree_add_uint_format_value(pt, hf_gryphon_modfilt, tvb, offset, 1,
1791 0, "Filter handles: all");
1793 proto_tree_add_item(pt, hf_gryphon_modfilt_action, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1794 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
1795 offset += 4;
1796 return offset;
1799 static int
1800 resp_filthan(tvbuff_t *tvb, int offset, proto_tree *pt)
1802 int handles = tvb_get_uint8(tvb, offset);
1803 int i, padding, handle;
1805 proto_tree_add_item(pt, hf_gryphon_filthan, tvb, offset, 1, ENC_BIG_ENDIAN);
1806 for (i = 1; i <= handles; i++){
1807 handle = tvb_get_uint8(tvb, offset+i);
1808 proto_tree_add_uint_format_value(pt, hf_gryphon_filthan_id, tvb, offset+i, 1,
1809 handle, "Handle %d: %u", i, handle);
1811 padding = 3 - (handles + 1 + 3) % 4;
1812 if (padding)
1813 proto_tree_add_item(pt, hf_gryphon_filthan_padding, tvb, offset+1+handles, padding, ENC_NA);
1814 offset += 1+handles+padding;
1815 return offset;
1818 static int
1819 dfiltmode(tvbuff_t *tvb, int offset, proto_tree *pt)
1821 proto_tree_add_item(pt, hf_gryphon_dfiltmode, tvb, offset, 1, ENC_BIG_ENDIAN);
1822 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1823 offset += 4;
1824 return offset;
1827 static int
1828 filtmode(tvbuff_t *tvb, int offset, proto_tree *pt)
1830 proto_tree_add_item(pt, hf_gryphon_filtmode, tvb, offset, 1, ENC_BIG_ENDIAN);
1831 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1832 offset += 4;
1833 return offset;
1836 static int
1837 resp_events(tvbuff_t *tvb, int offset, proto_tree *pt)
1839 int msglen;
1840 unsigned int i;
1841 proto_tree *tree;
1843 msglen = tvb_reported_length_remaining(tvb, offset);
1844 i = 1;
1845 while (msglen != 0) {
1846 tree = proto_tree_add_subtree_format(pt, tvb, offset, 20, ett_gryphon_cmd_events_data, NULL, "Event %d:", i);
1847 proto_tree_add_item(tree, hf_gryphon_event_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1848 proto_tree_add_item(tree, hf_gryphon_event_name, tvb, offset+1, 19, ENC_NA|ENC_ASCII);
1849 offset += 20;
1850 msglen -= 20;
1851 i++;
1853 return offset;
1856 static int
1857 cmd_register(tvbuff_t *tvb, int offset, proto_tree *pt)
1859 proto_tree_add_item(pt, hf_gryphon_register_username, tvb, offset, 16, ENC_NA|ENC_ASCII);
1860 offset += 16;
1861 proto_tree_add_item(pt, hf_gryphon_register_password, tvb, offset, 32, ENC_NA|ENC_ASCII);
1862 offset += 32;
1863 return offset;
1866 static int
1867 resp_register(tvbuff_t *tvb, int offset, proto_tree *pt)
1869 proto_tree_add_item(pt, hf_gryphon_register_client_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1870 proto_tree_add_item(pt, hf_gryphon_register_privileges, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1871 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
1872 offset += 4;
1873 return offset;
1877 static int
1878 resp_getspeeds(tvbuff_t *tvb, int offset, proto_tree *pt)
1880 int indx,
1881 size = tvb_get_uint8(tvb, offset+8),
1882 number = tvb_get_uint8(tvb, offset+9);
1884 proto_tree_add_item(pt, hf_gryphon_getspeeds_set_ioctl, tvb, offset, 4, ENC_BIG_ENDIAN);
1885 proto_tree_add_item(pt, hf_gryphon_getspeeds_get_ioctl, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1886 proto_tree_add_item(pt, hf_gryphon_getspeeds_size, tvb, offset+8, 1, ENC_BIG_ENDIAN);
1887 proto_tree_add_item(pt, hf_gryphon_getspeeds_preset, tvb, offset+9, 1, ENC_BIG_ENDIAN);
1888 offset += 10;
1890 for (indx = 1; indx <= number; indx++) {
1891 proto_tree_add_bytes_format(pt, hf_gryphon_getspeeds_data, tvb, offset, size,
1892 tvb_get_ptr(tvb, offset, size), "Data for preset %d", indx);
1893 offset += size;
1895 return offset;
1898 static int
1899 cmd_sort(tvbuff_t *tvb, int offset, proto_tree *pt)
1901 proto_tree_add_item(pt, hf_gryphon_cmd_sort, tvb, offset, 1, ENC_BIG_ENDIAN);
1902 return (offset+1);
1905 static int
1906 cmd_optimize(tvbuff_t *tvb, int offset, proto_tree *pt)
1908 proto_tree_add_item(pt, hf_gryphon_cmd_optimize, tvb, offset, 1, ENC_BIG_ENDIAN);
1909 return (offset+1);
1912 static int
1913 resp_config(tvbuff_t *tvb, int offset, proto_tree *pt)
1915 proto_tree *ft, *tree;
1916 int devices;
1917 int i;
1918 unsigned int j, x;
1920 proto_tree_add_item(pt, hf_gryphon_config_device_name, tvb, offset, 20, ENC_NA|ENC_ASCII);
1921 offset += 20;
1923 proto_tree_add_item(pt, hf_gryphon_config_device_version, tvb, offset, 8, ENC_NA|ENC_ASCII);
1924 offset += 8;
1926 proto_tree_add_item(pt, hf_gryphon_config_device_serial_number, tvb, offset, 20, ENC_NA|ENC_ASCII);
1927 offset += 20;
1929 devices = tvb_get_uint8(tvb, offset);
1931 proto_tree_add_item(pt, hf_gryphon_config_num_channels, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1932 proto_tree_add_item(pt, hf_gryphon_config_name_version_ext, tvb, offset+1, 11, ENC_NA|ENC_ASCII);
1933 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+12, 4, ENC_NA);
1934 offset += 16;
1936 for (i = 1; i <= devices; i++) {
1937 ft = proto_tree_add_subtree_format(pt, tvb, offset, 80, ett_gryphon_cmd_config_device, NULL, "Channel %d:", i);
1939 proto_tree_add_item(ft, hf_gryphon_config_driver_name, tvb, offset, 20, ENC_NA|ENC_ASCII);
1940 offset += 20;
1942 proto_tree_add_item(ft, hf_gryphon_config_driver_version, tvb, offset, 8, ENC_NA|ENC_ASCII);
1943 offset += 8;
1945 proto_tree_add_item(ft, hf_gryphon_config_device_security, tvb, offset, 16, ENC_NA|ENC_ASCII);
1946 offset += 16;
1948 x = tvb_get_ntohl (tvb, offset);
1949 if (x) {
1950 tree = proto_tree_add_subtree(ft, tvb, offset, 4, ett_gryphon_valid_headers, NULL, "Valid Header lengths");
1951 for (j = 0; ; j++) {
1952 if (x & 1) {
1953 proto_tree_add_uint_format(tree, hf_gryphon_valid_header_length, tvb, offset, 4, j, "%d byte%s", j,
1954 j == 1 ? "" : "s");
1956 if ((x >>= 1) == 0)
1957 break;
1960 offset += 4;
1962 proto_tree_add_item(ft, hf_gryphon_config_max_data_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1963 offset += 2;
1965 proto_tree_add_item(ft, hf_gryphon_config_min_data_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1966 offset += 2;
1968 proto_tree_add_item(ft, hf_gryphon_config_hardware_serial_number, tvb, offset, 20, ENC_NA|ENC_ASCII);
1969 offset += 20;
1971 proto_tree_add_item(ft, hf_gryphon_config_protocol_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1972 offset += 2;
1974 proto_tree_add_item(ft, hf_gryphon_config_channel_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1975 offset++;
1977 proto_tree_add_item(ft, hf_gryphon_config_card_slot_number, tvb, offset, 1, ENC_BIG_ENDIAN);
1978 offset ++;
1980 proto_tree_add_item(ft, hf_gryphon_config_max_extra_data, tvb, offset, 2, ENC_BIG_ENDIAN);
1981 offset += 2;
1983 proto_tree_add_item(ft, hf_gryphon_config_min_extra_data, tvb, offset, 2, ENC_BIG_ENDIAN);
1984 offset += 2;
1987 return offset;
1990 static int
1991 cmd_sched(tvbuff_t *tvb, int offset, proto_tree *pt)
1993 int msglen;
1994 proto_item *item, *item1;
1995 proto_tree *tree, *tree1;
1996 int save_offset;
1997 unsigned int i, x, length;
1998 uint8_t def_chan = tvb_get_uint8(tvb, offset-9);
2000 msglen = tvb_reported_length_remaining(tvb, offset);
2002 if (tvb_get_ntohl(tvb, offset) == 0xFFFFFFFF)
2003 proto_tree_add_uint_format_value(pt, hf_gryphon_sched_num_iterations, tvb, offset, 4,
2004 0, "\"infinite\"");
2005 else
2006 proto_tree_add_item(pt, hf_gryphon_sched_num_iterations, tvb, offset, 4, ENC_BIG_ENDIAN);
2007 offset += 4;
2008 msglen -= 4;
2011 item = proto_tree_add_item(pt, hf_gryphon_sched_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
2012 tree = proto_item_add_subtree (item, ett_gryphon_flags);
2013 proto_tree_add_item(tree, hf_gryphon_sched_flags_scheduler, tvb, offset, 4, ENC_BIG_ENDIAN);
2014 offset += 4;
2015 msglen -= 4;
2017 i = 1;
2018 while (msglen > 0) {
2020 length = 16 + tvb_get_uint8(tvb, offset+16) + tvb_get_ntohs(tvb, offset+18) + tvb_get_uint8(tvb, offset+20) + 16;
2021 length += 3 - (length + 3) % 4;
2023 tree = proto_tree_add_subtree_format(pt, tvb, offset, length, ett_gryphon_cmd_sched_data, NULL, "Message %d", i);
2024 proto_tree_add_item(tree, hf_gryphon_sched_sleep, tvb, offset, 4, ENC_BIG_ENDIAN);
2025 offset += 4;
2026 msglen -= 4;
2028 proto_tree_add_item(tree, hf_gryphon_sched_transmit_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2029 offset += 4;
2030 msglen -= 4;
2032 proto_tree_add_item(tree, hf_gryphon_sched_transmit_period, tvb, offset, 4, ENC_BIG_ENDIAN);
2033 offset += 4;
2034 msglen -= 4;
2036 item1 = proto_tree_add_item(tree, hf_gryphon_sched_transmit_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
2037 tree1 = proto_item_add_subtree (item1, ett_gryphon_flags);
2038 proto_tree_add_item(tree1, hf_gryphon_sched_skip_transmit_period, tvb, offset, 2, ENC_BIG_ENDIAN);
2039 if (i == 1) {
2040 /* N.B. Same bit as skip_transmit_period..? */
2041 proto_tree_add_item(tree1, hf_gryphon_sched_skip_sleep, tvb, offset, 2, ENC_BIG_ENDIAN);
2044 x = tvb_get_uint8(tvb, offset+2);
2045 /* 20171026 */
2046 if (x == 0) {
2047 x = def_chan;
2048 proto_tree_add_uint(tree, hf_gryphon_sched_channel0, tvb, offset+2, 1, x);
2049 } else {
2050 proto_tree_add_uint(tree, hf_gryphon_sched_channel, tvb, offset+2, 1, x);
2053 proto_tree_add_item(tree, hf_gryphon_reserved, tvb, offset+3, 1, ENC_NA);
2054 offset += 4;
2055 msglen -= 4;
2057 tree1 = proto_tree_add_subtree(tree, tvb, offset, msglen, ett_gryphon_cmd_sched_cmd, NULL, "Message");
2058 save_offset = offset;
2059 offset = decode_data(tvb, offset, tree1);
2060 msglen -= offset - save_offset;
2061 i++;
2063 return offset;
2066 static int
2067 cmd_sched_rep(tvbuff_t *tvb, int offset, proto_tree *pt)
2069 unsigned int x;
2070 const char *type;
2072 x = tvb_get_ntohl(tvb, offset);
2073 if (x & 0x80000000)
2074 type = "Critical";
2075 else
2076 type = "Normal";
2077 proto_tree_add_uint_format_value(pt, hf_gryphon_sched_rep_id, tvb,
2078 offset, 4, x, "%s schedule ID: %u", type, x);
2079 offset += 4;
2081 proto_tree_add_item(pt, hf_gryphon_sched_rep_message_index, tvb, offset, 1, ENC_BIG_ENDIAN);
2082 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
2083 offset += 4;
2084 offset = decode_data(tvb, offset, pt);
2085 return offset;
2088 static int
2089 resp_blm_data(tvbuff_t *tvb, int offset, proto_tree *pt)
2091 int x;
2093 nstime_t timestamp;
2095 timestamp.secs = tvb_get_ntohl(tvb, offset)/100000;
2096 timestamp.nsecs = (tvb_get_ntohl(tvb, offset)%100000)*1000;
2097 proto_tree_add_time(pt, hf_gryphon_blm_data_time, tvb, offset, 4, &timestamp);
2098 offset += 4;
2100 x = tvb_get_ntohs(tvb, offset);
2101 proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_bus_load, tvb,
2102 offset, 2, x, "%d.%02d%%", x / 100, x % 100);
2103 offset += 2;
2104 x = tvb_get_ntohs(tvb, offset);
2105 proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_current_bus_load, tvb,
2106 offset, 2, x, "%d.%02d%%", x / 100, x % 100);
2107 offset += 2;
2108 x = tvb_get_ntohs(tvb, offset);
2109 proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_peak_bus_load, tvb,
2110 offset, 2, x, "%d.%02d%%", x / 100, x % 100);
2111 offset += 2;
2112 x = tvb_get_ntohs(tvb, offset);
2113 proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_historic_peak_bus_load, tvb,
2114 offset, 2, x, "%d.%02d%%", x / 100, x % 100);
2115 offset += 2;
2117 return offset;
2120 static int
2121 resp_blm_stat(tvbuff_t *tvb, int offset, proto_tree *pt)
2123 offset = resp_blm_data(tvb, offset, pt);
2125 proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2126 offset += 4;
2127 proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2128 offset += 4;
2129 proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_dropped_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2130 offset += 4;
2131 proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_dropped_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2132 offset += 4;
2133 proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_error_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2134 offset += 4;
2135 proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_error_count, tvb, offset, 4, ENC_BIG_ENDIAN);
2136 offset += 4;
2137 return offset;
2141 * command to get a list of LDFs
2143 static int
2144 cmd_ldf_list(tvbuff_t *tvb, int offset, proto_tree *pt)
2147 /* block index */
2148 proto_tree_add_item(pt, hf_gryphon_ldf_list, tvb, offset, 1, ENC_BIG_ENDIAN);
2149 offset += 1;
2151 return offset;
2154 static int
2155 resp_ldf_list(tvbuff_t *tvb, int offset, proto_tree *pt)
2157 int blocks;
2158 int i;
2159 proto_tree *localTree;
2161 /* block index */
2162 blocks = tvb_get_uint8(tvb, offset);
2163 proto_tree_add_item(pt, hf_gryphon_ldf_number, tvb, offset, 1, ENC_BIG_ENDIAN);
2164 offset += 1;
2166 /* rsvd */
2167 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 1, ENC_NA);
2168 offset += 1;
2170 /* number remaining */
2171 proto_tree_add_item(pt, hf_gryphon_ldf_remaining, tvb, offset, 2, ENC_BIG_ENDIAN);
2172 offset += 2;
2174 /* LDF blocks */
2175 for(i=0;i<blocks;i++) {
2176 localTree = proto_tree_add_subtree_format(pt, tvb, offset, 32+80, ett_gryphon_ldf_block, NULL, "LDF %d",i+1);
2177 proto_tree_add_item(localTree, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
2178 offset += 32;
2179 proto_tree_add_item(localTree, hf_gryphon_ldf_description, tvb, offset, 80, ENC_ASCII|ENC_NA);
2180 offset += 80;
2183 return offset;
2186 static int
2187 cmd_ldf_delete(tvbuff_t *tvb, int offset, proto_tree *pt)
2189 /* name */
2190 proto_tree_add_item(pt, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
2191 offset += 32;
2193 return offset;
2196 static int
2197 cmd_ldf_desc(tvbuff_t *tvb, int offset, proto_tree *pt)
2199 uint32_t size;
2201 /* size 4 bytes */
2202 size = tvb_get_ntohl(tvb, offset);
2203 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_size, tvb, offset, 4, size, "%u", size);
2204 offset += 4;
2205 proto_tree_add_item(pt, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
2206 offset += 32;
2207 proto_tree_add_item(pt, hf_gryphon_ldf_description, tvb, offset, 80, ENC_ASCII|ENC_NA);
2208 offset += 80;
2209 return offset;
2212 static int
2213 resp_ldf_desc(tvbuff_t *tvb, int offset, proto_tree *pt)
2215 proto_tree_add_item(pt, hf_gryphon_ldf_exists, tvb, offset, 1, ENC_BIG_ENDIAN);
2216 offset += 1;
2217 proto_tree_add_item(pt, hf_gryphon_ldf_desc_pad, tvb, offset, 2, ENC_NA);
2218 offset += 2;
2219 return offset;
2222 static int
2223 cmd_ldf_upload(tvbuff_t *tvb, int offset, proto_tree *pt)
2225 int msglen;
2226 /*int blockn;*/
2228 msglen = tvb_reported_length_remaining(tvb, offset);
2230 /* block number */
2231 /*blockn = tvb_get_ntohs(tvb, offset);*/
2232 /* 20171101 debug */
2233 /*proto_tree_add_debug_text(pt, "------------------debug offset=%d blockn=%d msglen=%d",offset,blockn,msglen);*/
2234 proto_tree_add_item(pt, hf_gryphon_ldf_blockn, tvb, offset, 2, ENC_BIG_ENDIAN);
2235 offset += 2;
2237 /* 20171101 file string */
2238 proto_tree_add_item(pt, hf_gryphon_ldf_file, tvb, offset, msglen - 2, ENC_NA|ENC_ASCII);
2239 offset += msglen - 2;
2240 return offset;
2243 static int
2244 cmd_ldf_parse(tvbuff_t *tvb, int offset, proto_tree *pt)
2246 proto_tree_add_item(pt, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
2247 offset += 32;
2248 return offset;
2251 static int
2252 resp_get_ldf_info(tvbuff_t *tvb, int offset, proto_tree *pt)
2254 uint32_t bitrate;
2255 float value;
2256 proto_tree_add_item(pt, hf_gryphon_ldf_info_pv, tvb, offset, 16, ENC_ASCII|ENC_NA);
2257 offset += 16;
2258 proto_tree_add_item(pt, hf_gryphon_ldf_info_lv, tvb, offset, 16, ENC_ASCII|ENC_NA);
2259 offset += 16;
2260 bitrate = tvb_get_ntohl(tvb, offset);
2261 value = (float)bitrate / (float)1000.0;
2262 proto_tree_add_float_format_value(pt, hf_gryphon_ldf_bitrate, tvb, offset, 4, value, "%.3f Kbps", value);
2263 offset += 4;
2264 return offset;
2267 static int
2268 cmd_cnvt_get_values(tvbuff_t *tvb, int offset, proto_tree *pt)
2270 uint8_t num_signals;
2271 int length;
2272 int i;
2273 num_signals = tvb_get_uint8(tvb, offset);
2274 proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN);
2275 offset += 1;
2276 for(i=0;i< num_signals; i++) {
2277 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2278 offset += length;
2280 return offset;
2283 static int
2284 resp_cnvt_get_values(tvbuff_t *tvb, int offset, proto_tree *pt)
2286 uint8_t flag;
2287 uint8_t num_signals;
2288 float fvalue;
2289 int i;
2290 int length;
2291 num_signals = tvb_get_uint8(tvb, offset);
2292 proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN);
2293 offset += 1;
2294 for(i=0;i< num_signals; i++) {
2295 /* flag */
2296 flag = tvb_get_uint8(tvb, offset);
2297 proto_tree_add_item(pt, hf_gryphon_cnvt_flags_getvalues, tvb, offset, 1, ENC_BIG_ENDIAN);
2298 offset += 1;
2300 if(flag & 0x01) {
2301 /* float */
2302 fvalue = tvb_get_ntohieee_float (tvb, offset);
2303 proto_tree_add_float_format_value(pt, hf_gryphon_cnvt_valuef, tvb, offset, 4, fvalue, "%.1f", fvalue);
2304 offset += 4;
2306 if(flag & 0x02) {
2307 /* int */
2308 proto_tree_add_item(pt, hf_gryphon_cnvt_valuei, tvb, offset, 4, ENC_BIG_ENDIAN);
2309 offset += 4;
2311 if(flag & 0x04) {
2312 /* string */
2313 proto_tree_add_item_ret_length(pt, hf_gryphon_cnvt_values, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2314 offset += length;
2318 return offset;
2321 static int
2322 cmd_cnvt_get_units(tvbuff_t *tvb, int offset, proto_tree *pt)
2324 uint8_t num_signals;
2325 int length;
2326 int i;
2327 num_signals = tvb_get_uint8(tvb, offset);
2328 proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN);
2329 offset += 1;
2330 for(i=0;i< num_signals; i++) {
2331 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2332 offset += length;
2334 return offset;
2337 static int
2338 resp_cnvt_get_units(tvbuff_t *tvb, int offset, proto_tree *pt)
2340 uint8_t num_signals;
2341 int i;
2342 int length;
2343 num_signals = tvb_get_uint8(tvb, offset);
2344 proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN);
2345 offset += 1;
2346 for(i=0;i< num_signals; i++) {
2347 /* string */
2348 proto_tree_add_item_ret_length(pt, hf_gryphon_cnvt_units, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2349 offset += length;
2351 return offset;
2354 static int
2355 cmd_cnvt_set_values(tvbuff_t *tvb, int offset, proto_tree *pt)
2357 uint8_t num_signals;
2358 int length;
2359 int i;
2360 float fvalue;
2361 num_signals = tvb_get_uint8(tvb, offset);
2362 proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN);
2363 offset += 1;
2364 for(i=0;i< num_signals; i++) {
2365 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2366 offset += length;
2368 fvalue = tvb_get_ntohieee_float (tvb, offset);
2369 proto_tree_add_float_format_value(pt, hf_gryphon_cnvt_valuef, tvb, offset, 4, fvalue, "%.2f", fvalue);
2370 offset += 4;
2372 return offset;
2375 static int
2376 cmd_cnvt_destroy_session(tvbuff_t *tvb, int offset, proto_tree *pt)
2378 int msglen;
2379 msglen = tvb_reported_length_remaining(tvb, offset);
2380 proto_tree_add_item(pt, hf_gryphon_ldf_ui, tvb, offset, msglen, ENC_NA);
2381 offset += msglen;
2382 return offset;
2385 static int
2386 resp_ldf_get_node_names(tvbuff_t *tvb, int offset, proto_tree *pt)
2388 int length;
2389 uint16_t us_num;
2390 /* number */
2391 us_num = tvb_get_ntohs(tvb, offset);
2392 proto_tree_add_item(pt, hf_gryphon_ldf_num_node_names, tvb, offset, 2, ENC_BIG_ENDIAN);
2393 offset += 2;
2394 /* master node name */
2395 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_master_node_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2396 offset += length;
2397 us_num -= 1;
2398 while(us_num > 0) {
2399 /* slave node names */
2400 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_slave_node_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2401 offset += length;
2402 us_num -= 1;
2404 return offset;
2407 static int
2408 cmd_ldf_get_frames(tvbuff_t *tvb, int offset, proto_tree *pt)
2410 int length;
2411 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_get_frame, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2412 offset += length;
2413 return offset;
2416 static int
2417 resp_ldf_get_frames(tvbuff_t *tvb, int offset, proto_tree *pt)
2419 int length;
2420 uint16_t us_num;
2421 uint8_t pid;
2422 /* number */
2423 us_num = tvb_get_ntohs(tvb, offset);
2424 proto_tree_add_item(pt, hf_gryphon_ldf_num_frames, tvb, offset, 2, ENC_BIG_ENDIAN);
2425 offset += 2;
2426 while(us_num > 0) {
2427 /* id */
2428 pid = tvb_get_uint8(tvb, offset);
2429 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%x ",pid);
2430 offset += 1;
2431 /* frame name */
2432 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_get_frame, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2433 offset += length;
2434 us_num -= 1;
2436 return offset;
2439 static int
2440 cmd_ldf_get_frame_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt)
2442 char *string;
2443 int length;
2444 uint8_t id;
2445 string = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &length, ENC_ASCII);
2446 if(length > 1) {
2447 proto_tree_add_string(pt, hf_gryphon_ldf_get_frame, tvb, offset, length, string);
2448 offset += length;
2449 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, 0, "(Id not used)");
2450 offset += 1;
2451 } else {
2452 id = tvb_get_uint8(tvb, offset);
2453 proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, id, "0x%x ",id);
2454 offset += 1;
2456 return offset;
2459 static int
2460 resp_ldf_get_frame_info(tvbuff_t *tvb, int offset, proto_tree *pt)
2462 int length;
2463 uint8_t count, i;
2464 proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num, tvb, offset, 1, ENC_BIG_ENDIAN);
2465 offset += 1;
2466 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_get_frame_pub, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2467 offset += length;
2468 count = tvb_get_uint8(tvb, offset);
2469 proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN);
2470 offset += 1;
2471 for (i = 0; i < count; i++) {
2472 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2473 offset += length;
2475 return offset;
2478 static int
2479 cmd_ldf_get_signal_info(tvbuff_t *tvb, int offset, proto_tree *pt)
2481 int length;
2482 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2483 offset += length;
2484 return offset;
2487 static int
2488 resp_ldf_get_signal_info(tvbuff_t *tvb, int offset, proto_tree *pt)
2490 int length;
2491 /* offset */
2492 proto_tree_add_item(pt, hf_gryphon_ldf_signal_offset, tvb, offset, 1, ENC_BIG_ENDIAN);
2493 offset += 1;
2495 /* length */
2496 proto_tree_add_item(pt, hf_gryphon_ldf_signal_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2497 offset += 1;
2499 /* signal encoding name */
2500 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2501 offset += length;
2502 return offset;
2505 static int
2506 cmd_ldf_get_signal_detail(tvbuff_t *tvb, int offset, proto_tree *pt)
2508 int length;
2509 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2510 offset += length;
2511 return offset;
2514 static int
2515 resp_ldf_do_encoding_block(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt)
2517 char *string;
2518 int length;
2519 /* encoding */
2520 string = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &length, ENC_ASCII);
2521 proto_tree_add_string(pt, hf_gryphon_ldf_signal_encoding_type, tvb, offset, 12, string);
2522 offset += 12;
2523 if(string[0] == 'l') {
2524 /* logical */
2525 proto_tree_add_item(pt, hf_gryphon_ldf_encoding_value, tvb, offset, 2, ENC_BIG_ENDIAN);
2526 offset += 2;
2527 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_logical, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2528 offset += length;
2529 } else if(string[0] == 'p') {
2530 /* physical */
2531 proto_tree_add_item(pt, hf_gryphon_ldf_encoding_min, tvb, offset, 2, ENC_BIG_ENDIAN);
2532 offset += 2;
2533 proto_tree_add_item(pt, hf_gryphon_ldf_encoding_max, tvb, offset, 2, ENC_BIG_ENDIAN);
2534 offset += 2;
2535 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_logical, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2536 offset += length;
2537 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_logical, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2538 offset += length;
2539 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_logical, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2540 offset += length;
2541 } else if(string[0] == 'b') {
2542 proto_tree_add_item(pt, hf_gryphon_ldf_encoding_value, tvb, offset, 2, ENC_BIG_ENDIAN);
2543 offset += 2;
2544 /* bcd */
2545 } else if(string[0] == 'a') {
2546 proto_tree_add_item(pt, hf_gryphon_ldf_encoding_value, tvb, offset, 2, ENC_BIG_ENDIAN);
2547 offset += 2;
2548 /* ascii */
2549 } else {
2550 /* error */
2552 return(offset);
2555 static int
2556 resp_ldf_get_signal_detail(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt)
2558 uint16_t us_num;
2559 /* offset */
2560 proto_tree_add_item(pt, hf_gryphon_ldf_signal_offset, tvb, offset, 1, ENC_BIG_ENDIAN);
2561 offset += 1;
2563 /* length */
2564 proto_tree_add_item(pt, hf_gryphon_ldf_signal_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2565 offset += 1;
2567 /* number */
2568 us_num = tvb_get_ntohs(tvb, offset);
2569 proto_tree_add_item(pt, hf_gryphon_ldf_num_encodings, tvb, offset, 2, ENC_BIG_ENDIAN);
2570 offset += 2;
2571 while(us_num > 0) {
2572 offset = resp_ldf_do_encoding_block(tvb, pinfo, offset, pt);
2573 us_num -= 1;
2576 return offset;
2579 static int
2580 cmd_ldf_get_encoding_info(tvbuff_t *tvb, int offset, proto_tree *pt)
2582 int length;
2583 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2584 offset += length;
2585 return offset;
2588 static int
2589 resp_ldf_get_encoding_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt)
2591 uint16_t us_num;
2592 /* number */
2593 us_num = tvb_get_ntohs(tvb, offset);
2594 proto_tree_add_item(pt, hf_gryphon_ldf_num_encodings, tvb, offset, 2, ENC_BIG_ENDIAN);
2595 offset += 2;
2596 while(us_num > 0) {
2597 /* encoding data */
2598 offset = resp_ldf_do_encoding_block(tvb, pinfo, offset, pt);
2599 us_num -= 1;
2601 return offset;
2604 static int
2605 cmd_ldf_save_session(tvbuff_t *tvb, int offset, proto_tree *pt)
2607 int msglen;
2608 msglen = tvb_reported_length_remaining(tvb, offset);
2609 proto_tree_add_item(pt, hf_gryphon_ldf_restore_session, tvb, offset, msglen, ENC_NA);
2610 offset += msglen;
2611 return offset;
2614 static int
2615 cmd_ldf_emulate_nodes(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt)
2617 int nnodes;
2618 int node_numb=1;
2619 int i;
2620 unsigned int xchannel;
2621 char *string;
2622 int length;
2623 proto_tree *tree2;
2625 nnodes = tvb_get_uint8(tvb, offset);
2626 proto_tree_add_item(pt, hf_gryphon_ldf_nodenumber, tvb, offset, 1, ENC_BIG_ENDIAN);
2627 offset += 1;
2629 for(i=0;i<nnodes;i++) {
2630 /* first, find the end of the string, then use that string len to build a subtree */
2632 string = tvb_get_stringz_enc(pinfo->pool, tvb, offset+1, &length, ENC_ASCII);
2634 tree2 = proto_tree_add_subtree_format(pt, tvb, offset, 1+length, ett_gryphon_lin_emulate_node, NULL, "Node %u", node_numb);
2636 xchannel = tvb_get_uint8(tvb, offset);
2637 proto_tree_add_uint(tree2, hf_gryphon_sched_channel, tvb, offset, 1, xchannel);
2638 offset += 1;
2640 proto_tree_add_string(tree2, hf_gryphon_lin_nodename, tvb, offset, length, string);
2641 offset += length;
2643 node_numb++;
2645 return offset;
2648 static int
2649 resp_ldf_get_schedules(tvbuff_t *tvb, int offset, proto_tree *pt)
2651 int length;
2652 uint16_t us_num;
2653 /* number */
2654 us_num = tvb_get_ntohs(tvb, offset);
2655 proto_tree_add_item(pt, hf_gryphon_ldf_num_schedules, tvb, offset, 2, ENC_BIG_ENDIAN);
2656 offset += 2;
2657 while(us_num > 0) {
2658 /* slave node names */
2659 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_schedule_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2660 offset += length;
2661 us_num -= 1;
2663 return offset;
2666 static int
2667 cmd_ldf_start_schedule(tvbuff_t *tvb, int offset, proto_tree *pt)
2669 int length;
2670 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_schedule_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2671 offset += length;
2672 return offset;
2675 static int
2676 cmd_ldf_get_node_signals(tvbuff_t *tvb, int offset, proto_tree *pt)
2678 int length;
2679 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_node_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2680 offset += length;
2681 return offset;
2684 static int
2685 resp_ldf_get_node_signals(tvbuff_t *tvb, int offset, proto_tree *pt)
2687 int length;
2688 uint16_t us_num;
2689 /* number */
2690 us_num = tvb_get_ntohs(tvb, offset);
2691 proto_tree_add_item(pt, hf_gryphon_ldf_num_signal_names, tvb, offset, 2, ENC_BIG_ENDIAN);
2692 offset += 2;
2693 while(us_num > 0) {
2694 /* signal names */
2695 proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length);
2696 offset += length;
2697 us_num -= 1;
2699 return offset;
2702 static int
2703 cmd_restore_session(tvbuff_t *tvb, int offset, proto_tree *pt)
2705 int msglen;
2706 msglen = tvb_reported_length_remaining(tvb, offset);
2707 proto_tree_add_item(pt, hf_gryphon_ldf_restore_session, tvb, offset, msglen, ENC_NA);
2708 offset += msglen;
2709 return offset;
2712 static int
2713 resp_restore_session(tvbuff_t *tvb, int offset, proto_tree *pt)
2715 proto_tree_add_item(pt, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
2716 offset += 32;
2717 return offset;
2720 static int
2721 // NOLINTNEXTLINE(misc-no-recursion)
2722 cmd_addresp(tvbuff_t *tvb, int offset, packet_info* pinfo, proto_tree *pt)
2724 proto_item *item;
2725 proto_tree *tree;
2726 unsigned blocks, responses, i, msglen, length;
2727 int padding;
2728 int action, actionType, actionValue;
2729 tvbuff_t *next_tvb;
2731 actionType = 0;
2732 /* flags */
2733 item = proto_tree_add_item(pt, hf_gryphon_addresp_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
2734 tree = proto_item_add_subtree (item, ett_gryphon_flags);
2735 /* 20171017 fixed display of filter flags */
2736 /* flags: active */
2737 proto_tree_add_item(tree, hf_gryphon_addresp_flags_active, tvb, offset, 1, ENC_BIG_ENDIAN);
2739 offset += 1;
2741 /* number of filter blocks */
2742 proto_tree_add_item_ret_uint(pt, hf_gryphon_addresp_blocks, tvb, offset, 1, ENC_BIG_ENDIAN, &blocks);
2743 offset += 1;
2745 /* number of responses */
2746 proto_tree_add_item_ret_uint(pt, hf_gryphon_addresp_responses, tvb, offset, 1, ENC_BIG_ENDIAN, &responses);
2747 offset += 1;
2749 /* old handle */
2750 proto_tree_add_item(pt, hf_gryphon_addresp_old_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
2751 offset += 1;
2753 /* action */
2754 action = tvb_get_uint8(tvb, offset);
2755 item = proto_tree_add_item(pt, hf_gryphon_addresp_action, tvb, offset, 1, ENC_BIG_ENDIAN);
2756 tree = proto_item_add_subtree (item, ett_gryphon_flags);
2757 actionValue = tvb_get_ntohs(tvb, offset+2);
2758 if (actionValue) {
2759 if (action & FR_PERIOD_MSGS) {
2760 actionType = 1;
2761 } else {
2762 actionType = 0;
2765 proto_tree_add_item(tree, hf_gryphon_addresp_action_period, tvb, offset, 1, ENC_BIG_ENDIAN);
2768 proto_tree_add_item(tree, hf_gryphon_addresp_action_deact_on_event, tvb, offset, 1, ENC_BIG_ENDIAN);
2769 proto_tree_add_item(tree, hf_gryphon_addresp_action_deact_after_period, tvb, offset, 1, ENC_BIG_ENDIAN);
2770 offset += 1;
2772 /* reserved */
2773 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 1, ENC_NA);
2774 offset += 1;
2775 if (actionValue) {
2776 if (actionType == 1) {
2777 proto_tree_add_uint_format_value(pt, hf_gryphon_addresp_action_period_type, tvb,
2778 offset, 2, actionValue, "Period: %d messages", actionValue);
2779 } else {
2780 proto_tree_add_uint_format_value(pt, hf_gryphon_addresp_action_period_type, tvb,
2781 offset, 2, actionValue, "Period: %d.%02d seconds", actionValue/100, actionValue%100);
2783 } else {
2784 /* 20171017 */
2785 /* value 2-bytes */
2786 proto_tree_add_uint_format_value(pt, hf_gryphon_addresp_action_period_type, tvb, offset, 2, actionValue, "(not used)");
2788 offset += 2;
2790 for (i = 1; i <= blocks; i++) {
2791 length = tvb_get_ntohs(tvb, offset+2) + 8;
2792 padding = 3 - (length + 3) % 4;
2793 tree = proto_tree_add_subtree_format(pt, tvb, offset, length + padding, ett_gryphon_cmd_filter_block, NULL, "Filter block %d", i);
2794 /* 20171017 fixed display of filter block padding */
2795 offset = filter_block(tvb, offset, tree);
2797 for (i = 1; i <= responses; i++) {
2798 msglen = tvb_get_ntohs(tvb, offset+4) + 8;
2799 padding = 3 - (msglen + 3) % 4;
2800 tree = proto_tree_add_subtree_format(pt, tvb, offset, msglen + padding, ett_gryphon_cmd_response_block, NULL, "Response block %d", i);
2801 next_tvb = tvb_new_subset_length(tvb, offset, msglen + padding);
2802 dissect_gryphon_message(next_tvb, pinfo, tree, true);
2803 offset += msglen + padding;
2805 return offset;
2808 static int
2809 resp_addresp(tvbuff_t *tvb, int offset, proto_tree *pt)
2811 proto_tree_add_item(pt, hf_gryphon_addresp_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
2812 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
2813 offset += 4;
2814 return offset;
2817 static int
2818 cmd_modresp(tvbuff_t *tvb, int offset, proto_tree *pt)
2820 uint8_t dest = tvb_get_uint8(tvb, offset-5),
2821 resp_handle = tvb_get_uint8(tvb, offset);
2823 if (resp_handle)
2824 proto_tree_add_item(pt, hf_gryphon_modresp_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
2825 else if (dest)
2826 proto_tree_add_uint_format_value(pt, hf_gryphon_modresp_handle, tvb,
2827 offset, 1, dest, "Response handles: all on channel %c", dest);
2828 else
2829 proto_tree_add_uint_format_value(pt, hf_gryphon_modresp_handle, tvb, offset, 1,
2830 0, "Response handles: all");
2832 proto_tree_add_item(pt, hf_gryphon_modresp_action, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2833 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
2834 offset += 4;
2835 return offset;
2838 static int
2839 resp_resphan(tvbuff_t *tvb, int offset, proto_tree *pt)
2841 int handles = tvb_get_uint8(tvb, offset);
2842 int i, padding, handle;
2844 proto_tree_add_item(pt, hf_gryphon_num_resphan, tvb, offset, 1, ENC_BIG_ENDIAN);
2845 for (i = 1; i <= handles; i++){
2846 handle = tvb_get_uint8(tvb, offset+i);
2847 proto_tree_add_uint_format(pt, hf_gryphon_handle, tvb, offset+i, 1, handle, "Handle %d: %u", i,
2848 handle);
2850 padding = 3 - (handles + 1 + 3) % 4;
2851 if (padding)
2852 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset+1+handles, padding, ENC_NA);
2853 offset += 1+handles+padding;
2854 return offset;
2857 static int
2858 resp_sched(tvbuff_t *tvb, int offset, proto_tree *pt)
2860 proto_tree_add_item(pt, hf_gryphon_transmit_sched_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2861 offset += 4;
2862 return offset;
2865 static int
2866 cmd_desc(tvbuff_t *tvb, int offset, proto_tree *pt)
2868 proto_tree_add_item(pt, hf_gryphon_desc_program_size, tvb, offset, 4, ENC_BIG_ENDIAN);
2869 offset += 4;
2871 proto_tree_add_item(pt, hf_gryphon_desc_program_name, tvb, offset, 32, ENC_NA|ENC_ASCII);
2872 offset += 32;
2874 proto_tree_add_item(pt, hf_gryphon_desc_program_description, tvb, offset, 80, ENC_NA|ENC_ASCII);
2875 offset += 80;
2877 return offset;
2880 static int
2881 resp_desc(tvbuff_t *tvb, int offset, proto_tree *pt)
2883 proto_item *item;
2884 proto_tree *tree;
2886 item = proto_tree_add_item(pt, hf_gryphon_desc_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
2887 tree = proto_item_add_subtree (item, ett_gryphon_flags);
2888 proto_tree_add_item(tree, hf_gryphon_desc_flags_program, tvb, offset, 1, ENC_BIG_ENDIAN);
2889 proto_tree_add_item(pt, hf_gryphon_desc_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
2890 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
2891 offset += 4;
2892 return offset;
2895 static int
2896 cmd_upload(tvbuff_t *tvb, int offset, proto_tree *pt)
2898 int msglen;
2899 unsigned int length;
2901 msglen = tvb_reported_length_remaining(tvb, offset);
2902 proto_tree_add_item(pt, hf_gryphon_upload_block_number, tvb, offset, 2, ENC_BIG_ENDIAN);
2903 proto_tree_add_item(pt, hf_gryphon_upload_handle, tvb, offset+2, 1, ENC_BIG_ENDIAN);
2904 offset += 3;
2905 msglen -= 3;
2907 length = msglen;
2908 proto_tree_add_item(pt, hf_gryphon_upload_data, tvb, offset, length, ENC_NA);
2909 offset += length;
2911 length = 3 - (length + 3) % 4;
2912 if (length) {
2913 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA);
2914 offset += length;
2916 return offset;
2919 static int
2920 cmd_delete(tvbuff_t *tvb, int offset, proto_tree *pt)
2922 proto_tree_add_item(pt, hf_gryphon_delete, tvb, offset, 32, ENC_NA|ENC_ASCII);
2923 offset += 32;
2924 return offset;
2927 static int
2928 cmd_list(tvbuff_t *tvb, int offset, proto_tree *pt)
2930 proto_tree_add_item(pt, hf_gryphon_list_block_number, tvb, offset, 1, ENC_BIG_ENDIAN);
2931 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
2932 offset += 4;
2933 return offset;
2936 static int
2937 resp_list(tvbuff_t *tvb, int offset, proto_tree *pt)
2939 proto_tree *tree;
2940 uint32_t i, count;
2942 proto_tree_add_item_ret_uint(pt, hf_gryphon_list_num_programs, tvb, offset, 1, ENC_BIG_ENDIAN, &count);
2943 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 1, ENC_NA);
2944 offset += 2;
2946 proto_tree_add_item(pt, hf_gryphon_list_num_remain_programs, tvb, offset, 2, ENC_BIG_ENDIAN);
2947 offset += 2;
2949 for (i = 1; i <= count; i++) {
2950 tree = proto_tree_add_subtree_format(pt, tvb, offset, 112, ett_gryphon_pgm_list, NULL, "Program %u", i);
2951 proto_tree_add_item(tree, hf_gryphon_list_name, tvb, offset, 32, ENC_NA|ENC_ASCII);
2952 offset += 32;
2954 proto_tree_add_item(tree, hf_gryphon_list_description, tvb, offset, 80, ENC_NA|ENC_ASCII);
2955 offset += 80;
2957 return offset;
2960 static int
2961 cmd_start(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt)
2963 char *string;
2964 int length;
2965 int msglen;
2966 int hdr_stuff = offset;
2968 msglen = tvb_reported_length_remaining(tvb, offset);
2969 offset = cmd_delete(tvb, offset, pt); /* decode the name */
2970 if (offset < msglen + hdr_stuff) {
2971 string = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &length, ENC_ASCII);
2972 if (length > 1) {
2973 proto_tree_add_string(pt, hf_gryphon_start_arguments, tvb, offset,
2974 length, string);
2975 offset += length;
2977 length = 3 - (length + 3) % 4;
2978 if (length) {
2979 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA);
2980 offset += length;
2984 return offset;
2987 static int
2988 resp_start(tvbuff_t *tvb, int offset, proto_tree *pt)
2990 int msglen;
2992 msglen = tvb_reported_length_remaining(tvb, offset);
2993 if (msglen > 0) {
2994 proto_tree_add_item(pt, hf_gryphon_start_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
2995 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
2996 offset += 4;
2998 return offset;
3001 static int
3002 resp_status(tvbuff_t *tvb, int offset, proto_tree *pt)
3004 proto_item *item;
3005 proto_tree *tree;
3006 unsigned int i, copies, length, channel;
3008 copies = tvb_get_uint8(tvb, offset);
3009 item = proto_tree_add_item(pt, hf_gryphon_status_num_running_copies, tvb, offset, 1, ENC_BIG_ENDIAN);
3010 tree = proto_item_add_subtree (item, ett_gryphon_pgm_status);
3011 offset += 1;
3012 if (copies) {
3013 for (i = 1; i <= copies; i++) {
3014 channel = tvb_get_uint8(tvb, offset);
3015 proto_tree_add_uint_format(tree, hf_gryphon_program_channel_number, tvb, offset, 1, channel,
3016 "Program %u channel (client) number %u", i, channel);
3017 offset += 1;
3020 length = 3 - (copies + 1 + 3) % 4;
3021 if (length) {
3022 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA);
3023 offset += length;
3025 return offset;
3028 static int
3029 cmd_options(tvbuff_t *tvb, int offset, proto_tree *pt)
3031 int msglen;
3032 proto_tree *tree;
3033 unsigned int i, size, padding, option, option_length, option_value;
3034 const char *string, *string1;
3036 msglen = tvb_reported_length_remaining(tvb, offset);
3037 proto_tree_add_item(pt, hf_gryphon_options_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
3038 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
3039 offset += 4;
3040 msglen -= 4;
3042 for (i = 1; msglen > 0; i++) {
3043 option_length = tvb_get_uint8(tvb, offset+1);
3044 size = option_length + 2;
3045 padding = 3 - ((size + 3) %4);
3046 tree = proto_tree_add_subtree_format(pt, tvb, offset, size + padding, ett_gryphon_pgm_options, NULL, "Option number %u", i);
3047 option = tvb_get_uint8(tvb, offset);
3048 switch (option_length) {
3049 case 1:
3050 option_value = tvb_get_uint8(tvb, offset+2);
3051 break;
3052 case 2:
3053 option_value = tvb_get_ntohs(tvb, offset+2);
3054 break;
3055 case 4:
3056 option_value = tvb_get_ntohl(tvb, offset+2);
3057 break;
3058 default:
3059 option_value = 0;
3061 string = "unknown option";
3062 string1 = "unknown option data";
3063 switch (option) {
3064 case PGM_CONV:
3065 string = "Type of data in the file";
3066 switch (option_value) {
3067 case PGM_BIN:
3068 string1 = "Binary - Don't modify";
3069 break;
3070 case PGM_ASCII:
3071 string1 = "ASCII - Remove CR's";
3072 break;
3074 break;
3075 case PGM_TYPE:
3076 string = "Type of file";
3077 switch (option_value) {
3078 case PGM_PGM:
3079 string1 = "Executable";
3080 break;
3081 case PGM_DATA:
3082 string1 = "Data";
3083 break;
3085 break;
3087 proto_tree_add_uint_format_value(tree, hf_gryphon_option, tvb, offset, 1, option, "%s", string);
3088 proto_tree_add_bytes_format_value(tree, hf_gryphon_option_data, tvb, offset+2, option_length, NULL, "%s", string1);
3089 if (padding)
3090 proto_tree_add_item(tree, hf_gryphon_padding, tvb, offset+option_length+2, padding, ENC_NA);
3091 offset += size + padding;
3092 msglen -= size + padding;
3094 return offset;
3097 static int
3098 cmd_files(tvbuff_t *tvb, int offset, proto_tree *pt)
3100 int msglen;
3101 uint8_t file;
3103 msglen = tvb_reported_length_remaining(tvb, offset);
3104 file = tvb_get_uint8(tvb, offset);
3105 if (file == 0)
3106 proto_tree_add_uint_format(pt, hf_gryphon_cmd_file, tvb, offset, 1, file, "First group of names");
3107 else
3108 proto_tree_add_uint_format(pt, hf_gryphon_cmd_file, tvb, offset, 1, file, "Subsequent group of names");
3110 proto_tree_add_item(pt, hf_gryphon_files, tvb, offset+1, msglen-1, ENC_NA|ENC_ASCII);
3111 offset += msglen;
3112 return offset;
3115 static int
3116 resp_files(tvbuff_t *tvb, int offset, proto_tree *pt)
3118 int msglen;
3120 msglen = tvb_reported_length_remaining(tvb, offset);
3121 proto_tree_add_item(pt, hf_gryphon_more_filenames, tvb, offset, 1, ENC_NA);
3122 proto_tree_add_item(pt, hf_gryphon_filenames, tvb, offset+1, msglen-1, ENC_ASCII|ENC_NA);
3123 offset += msglen;
3124 return offset;
3127 /* 20171012 gryphon command for USDT */
3128 static int
3129 cmd_usdt_register_non_legacy(tvbuff_t *tvb, int offset, proto_tree *pt)
3131 int remain;
3132 unsigned int ui_block;
3133 uint32_t ui_ids;
3134 int id_usdtreq;
3135 int id_usdtresp;
3136 int id_uudtresp;
3137 uint8_t u8_options;
3138 uint8_t u8USDTReqExtAddr_bit;
3139 uint8_t u8USDTRespExtAddr_bit;
3140 uint8_t u8UUDTRespExtAddr_bit;
3141 uint8_t u8USDTReqExtAddr;
3142 uint8_t u8USDTRespExtAddr;
3143 uint8_t u8UUDTRespExtAddr;
3144 uint8_t u8USDTReqHeaderSize;
3145 uint8_t u8USDTRespHeaderSize;
3146 uint8_t u8UUDTRespHeaderSize;
3147 uint8_t flags;
3148 proto_tree *tree1;
3149 proto_tree *tree2;
3150 proto_tree *tree3;
3151 proto_tree *tree4;
3152 proto_tree *tree5;
3153 static int * const transmit_options_flags[] = {
3154 &hf_gryphon_usdt_transmit_options_flags_echo,
3155 &hf_gryphon_usdt_transmit_options_action,
3156 &hf_gryphon_usdt_transmit_options_done_event,
3157 &hf_gryphon_usdt_transmit_options_echo_short,
3158 &hf_gryphon_usdt_transmit_options_rx_nth_fc,
3159 NULL
3161 static int * const receive_options_flags[] = {
3162 &hf_gryphon_usdt_receive_options_action,
3163 &hf_gryphon_usdt_receive_options_firstframe_event,
3164 &hf_gryphon_usdt_receive_options_lastframe_event,
3165 &hf_gryphon_usdt_receive_options_tx_nth_fc,
3166 NULL
3168 static int * const length_options_flags[] = {
3169 &hf_gryphon_usdt_length_control_j1939,
3170 NULL
3172 remain = tvb_reported_length_remaining(tvb, offset);
3174 /* 20171012 */
3175 /* Action flags */
3176 flags = tvb_get_uint8(tvb, offset);
3177 tree1 = proto_tree_add_subtree_format(pt, tvb, offset, 1, ett_gryphon_usdt_action_flags, NULL, "Action flags 0x%02x", flags);
3178 proto_tree_add_item(tree1, hf_gryphon_usdt_action_flags_non_legacy, tvb, offset, 1, ENC_BIG_ENDIAN);
3179 offset += 1;
3180 remain -= 1;
3182 /* tx options */
3183 flags = tvb_get_uint8(tvb, offset);
3184 tree2 = proto_tree_add_subtree_format(pt, tvb, offset, 1, ett_gryphon_usdt_tx_options_flags, NULL, "Transmit options 0x%02x", flags);
3185 proto_tree_add_bitmask(tree2, tvb, offset, hf_gryphon_usdt_transmit_options_flags, ett_gryphon_flags, transmit_options_flags, ENC_BIG_ENDIAN);
3186 offset += 1;
3187 remain -= 1;
3189 /* rx options */
3190 flags = tvb_get_uint8(tvb, offset);
3191 tree3 = proto_tree_add_subtree_format(pt, tvb, offset, 1, ett_gryphon_usdt_rx_options_flags, NULL, "Receive options 0x%02x", flags);
3192 proto_tree_add_bitmask(tree3, tvb, offset, hf_gryphon_usdt_receive_options_flags, ett_gryphon_flags, receive_options_flags, ENC_BIG_ENDIAN);
3193 offset += 1;
3194 remain -= 1;
3196 /* reserved */
3197 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 1, ENC_NA);
3198 offset += 1;
3199 remain -= 1;
3201 /* blocks */
3202 ui_block = 1;
3203 while (remain > 0) {
3204 tree4 = proto_tree_add_subtree_format(pt, tvb, offset, 20, ett_gryphon_usdt_data_block, NULL, "Block %u", ui_block);
3206 /* TODO implement J1939-style length address src and dst byte swap */
3208 /* mask the upper bits of the long */
3209 /* number of IDs in the block */
3210 ui_ids = tvb_get_ntohl (tvb, offset);
3211 u8_options = ((ui_ids >> 24) & 0xE0);
3212 ui_ids &= 0x1FFFFFFF; /* mask the upper control bits */
3213 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_nids, tvb, offset, 4, ui_ids, "%u", ui_ids);
3215 if(ui_ids == 0) {
3216 proto_item_set_len(tree4, 20);
3217 } else {
3220 /* display control bits */
3221 tree5 = proto_tree_add_subtree_format(tree4, tvb, offset, 1, ett_gryphon_usdt_len_options_flags, NULL, "Options 0x%02x", u8_options);
3222 proto_tree_add_bitmask(tree5, tvb, offset, hf_gryphon_usdt_length_options_flags, ett_gryphon_flags, length_options_flags, ENC_BIG_ENDIAN);
3223 offset += 4;
3224 remain -= 4;
3226 u8UUDTRespExtAddr = tvb_get_uint8(tvb, offset+10);
3227 u8USDTRespExtAddr = tvb_get_uint8(tvb, offset+13);
3228 u8USDTReqExtAddr = tvb_get_uint8(tvb, offset+16);
3229 if(ui_ids == 1) {
3230 /* single ID */
3232 /* add extended address display of the IDs */
3233 /* mask the upper bits of the IDs */
3234 /* usdt req */
3235 id_usdtreq = tvb_get_ntohl (tvb, offset);
3236 u8USDTReqExtAddr_bit = ((id_usdtreq >> 24) & 0x20);
3237 u8USDTReqHeaderSize = ((id_usdtreq >> 24) & 0x80);
3238 id_usdtreq &= 0x1FFFFFFF;
3239 /* usdt req */
3240 if(u8USDTReqExtAddr_bit == 0) {
3241 if(u8USDTReqHeaderSize == 0) {
3242 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%02x (11-bit)", id_usdtreq);
3243 } else {
3244 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%04x (29-bit)", id_usdtreq);
3246 } else {
3247 u8USDTReqExtAddr = tvb_get_uint8(tvb, offset+16);
3248 if(u8USDTReqHeaderSize == 0) {
3249 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%02x (11-bit extended address %01x)", id_usdtreq, u8USDTReqExtAddr);
3250 } else {
3251 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%04x (29-bit extended address %01x)", id_usdtreq, u8USDTReqExtAddr);
3254 offset += 4;
3255 remain -= 4;
3257 /* usdt resp */
3258 id_usdtresp = tvb_get_ntohl (tvb, offset);
3259 u8USDTRespExtAddr_bit = ((id_usdtresp >> 24) & 0x20);
3260 u8USDTRespHeaderSize = ((id_usdtresp >> 24) & 0x80);
3261 id_usdtresp &= 0x1FFFFFFF;
3262 /* usdt resp */
3263 if(u8USDTRespExtAddr_bit == 0) {
3264 if(u8USDTRespHeaderSize == 0) {
3265 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%02x (11-bit)", id_usdtresp);
3266 } else {
3267 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%04x (29-bit)", id_usdtresp);
3269 } else {
3270 u8USDTRespExtAddr = tvb_get_uint8(tvb, offset+13);
3271 if(u8USDTRespHeaderSize == 0) {
3272 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%02x (11-bit extended address %01x)", id_usdtresp, u8USDTRespExtAddr);
3273 } else {
3274 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%04x (29-bit extended address %01x)", id_usdtresp, u8USDTRespExtAddr);
3277 offset += 4;
3278 remain -= 4;
3281 /* uudt resp */
3282 id_uudtresp = tvb_get_ntohl (tvb, offset);
3283 u8UUDTRespExtAddr_bit = ((id_uudtresp >> 24) & 0x20);
3284 u8UUDTRespHeaderSize = ((id_uudtresp >> 24) & 0x80);
3285 id_uudtresp &= 0x1FFFFFFF;
3286 /* uudt resp */
3287 if(u8UUDTRespExtAddr_bit == 0) {
3288 if(u8UUDTRespHeaderSize == 0) {
3289 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%02x (11-bit)", id_uudtresp);
3290 } else {
3291 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%04x (29-bit)", id_uudtresp);
3293 } else {
3294 u8UUDTRespExtAddr = tvb_get_uint8(tvb, offset+10);
3295 if(u8UUDTRespHeaderSize == 0) {
3296 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%02x (11-bit extended address %01x)", id_uudtresp, u8UUDTRespExtAddr);
3297 } else {
3298 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%04x (29-bit extended address %01x)", id_uudtresp, u8UUDTRespExtAddr);
3301 offset += 4;
3302 remain -= 4;
3305 } else {
3306 /* multiple IDs */
3308 /* add extended address display of the IDs */
3309 /* mask the upper bits of the IDs */
3311 /* usdt req */
3312 id_usdtreq = tvb_get_ntohl (tvb, offset);
3313 u8USDTReqExtAddr_bit = ((id_usdtreq >> 24) & 0x20);
3314 u8USDTReqHeaderSize = ((id_usdtreq >> 24) & 0x80);
3315 id_usdtreq &= 0x1FFFFFFF;
3316 /* usdt req */
3317 if(u8USDTReqExtAddr_bit == 0) {
3318 if(u8USDTReqHeaderSize == 0) {
3319 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%02x through 0x%02x (11-bit)", id_usdtreq, id_usdtreq + ui_ids-1);
3320 } else {
3321 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%04x through 0x%04x (29-bit)", id_usdtreq, id_usdtreq + ui_ids-1);
3323 } else {
3324 u8USDTReqExtAddr = tvb_get_uint8(tvb, offset+16);
3325 if(u8USDTReqHeaderSize == 0) {
3326 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%02x through 0x%02x (11-bit extended address %0x)", id_usdtreq, id_usdtreq + ui_ids-1, u8USDTReqExtAddr);
3327 } else {
3328 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%04x through 0x%04x (29-bit extended address %0x)", id_usdtreq, id_usdtreq + ui_ids-1, u8USDTReqExtAddr);
3331 offset += 4;
3332 remain -= 4;
3334 /* usdt resp */
3335 id_usdtresp = tvb_get_ntohl (tvb, offset);
3336 u8USDTRespExtAddr_bit = ((id_usdtresp >> 24) & 0x20);
3337 u8USDTRespHeaderSize = ((id_usdtresp >> 24) & 0x80);
3338 id_usdtresp &= 0x1FFFFFFF;
3339 /* usdt resp */
3340 if(u8USDTRespExtAddr_bit == 0) {
3341 if(u8USDTRespHeaderSize == 0) {
3342 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%02x through 0x%02x (11-bit)", id_usdtresp, id_usdtresp + ui_ids-1);
3343 } else {
3344 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%04x through 0x%04x (29-bit)", id_usdtresp, id_usdtresp + ui_ids-1);
3346 } else {
3347 u8USDTRespExtAddr = tvb_get_uint8(tvb, offset+13);
3348 if(u8USDTRespHeaderSize == 0) {
3349 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%02x through 0x%02x (11-bit extended address %01x)", id_usdtresp, id_usdtresp + ui_ids-1, u8USDTRespExtAddr);
3350 } else {
3351 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%04x through 0x%04x (29-bit extended address %01x)", id_usdtresp, id_usdtresp + ui_ids-1, u8USDTRespExtAddr);
3354 offset += 4;
3355 remain -= 4;
3357 /* uudt resp */
3358 id_uudtresp = tvb_get_ntohl (tvb, offset);
3359 u8UUDTRespExtAddr_bit = ((id_uudtresp >> 24) & 0x20);
3360 u8UUDTRespHeaderSize = ((id_uudtresp >> 24) & 0x80);
3361 id_uudtresp &= 0x1FFFFFFF;
3362 /* uudt resp */
3363 if(u8UUDTRespExtAddr_bit == 0) {
3364 if(u8UUDTRespHeaderSize == 0) {
3365 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%02x through 0x%02x (11-bit)", id_uudtresp, id_uudtresp + ui_ids-1);
3366 } else {
3367 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%04x through 0x%04x (29-bit)", id_uudtresp, id_uudtresp + ui_ids-1);
3369 } else {
3370 u8UUDTRespExtAddr = tvb_get_uint8(tvb, offset+10);
3371 if(u8UUDTRespHeaderSize == 0) {
3372 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%02x through 0x%02x (11-bit extended address %01x)", id_uudtresp, id_uudtresp + ui_ids-1, u8UUDTRespExtAddr);
3373 } else {
3374 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%04x through 0x%04x (29-bit extended address %01x)", id_uudtresp, id_uudtresp + ui_ids-1, u8UUDTRespExtAddr);
3377 offset += 4;
3378 remain -= 4;
3381 if(u8USDTReqExtAddr_bit == 0) {
3382 /* proto_tree_add_item(tree4, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); */
3383 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request_ext, tvb, offset, 1, 0, "(no extended address)");
3384 } else {
3385 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request_ext, tvb, offset, 1, u8USDTReqExtAddr, "0x%01x", u8USDTReqExtAddr);
3387 offset += 1;
3388 remain -= 1;
3390 if(u8USDTRespExtAddr_bit == 0) {
3391 /* proto_tree_add_item(tree4, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); */
3392 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response_ext, tvb, offset, 1, 0, "(no extended address)");
3393 } else {
3394 proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response_ext, tvb, offset, 1, u8USDTRespExtAddr, "0x%01x", u8USDTRespExtAddr);
3396 offset += 1;
3397 remain -= 1;
3399 if(u8UUDTRespExtAddr_bit == 0) {
3400 /* proto_tree_add_item(tree4, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); */
3401 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response_ext, tvb, offset, 1, 0, "(no extended address)");
3402 } else {
3403 proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response_ext, tvb, offset, 1, u8UUDTRespExtAddr, "0x%01x", u8UUDTRespExtAddr);
3405 offset += 1;
3406 remain -= 1;
3408 proto_tree_add_item(tree4, hf_gryphon_reserved, tvb, offset, 1, ENC_NA);
3409 offset += 1;
3410 remain -= 1;
3414 ui_block += 1;
3417 return offset;
3420 /* 20171012 gryphon command for USDT */
3421 static int
3422 cmd_usdt_stmin_fc(tvbuff_t *tvb, int offset, proto_tree *pt)
3424 proto_tree_add_item(pt, hf_gryphon_usdt_stmin_fc, tvb, offset, 1, ENC_NA);
3425 offset += 1;
3427 return offset;
3430 /* 20171012 gryphon command for USDT */
3431 static int
3432 cmd_usdt_bsmax_fc(tvbuff_t *tvb, int offset, proto_tree *pt)
3434 proto_tree_add_item(pt, hf_gryphon_usdt_bsmax_fc, tvb, offset, 1, ENC_NA);
3435 offset += 1;
3437 return offset;
3440 /* 20171012 gryphon command for USDT */
3441 static int
3442 cmd_usdt_stmin_override(tvbuff_t *tvb, int offset, proto_tree *pt)
3444 proto_tree_add_item(pt, hf_gryphon_usdt_stmin_override, tvb, offset, 1, ENC_NA);
3445 offset += 1;
3447 return offset;
3450 /* 20171012 gryphon command for USDT */
3451 static int
3452 cmd_usdt_get_stmin_override(tvbuff_t *tvb, int offset, proto_tree *pt)
3454 proto_tree_add_item(pt, hf_gryphon_usdt_stmin_override, tvb, offset, 1, ENC_NA);
3455 offset += 1;
3456 /* fixed this for get */
3457 proto_tree_add_item(pt, hf_gryphon_usdt_stmin_override_active, tvb, offset, 1, ENC_BIG_ENDIAN);
3458 offset += 1;
3460 return offset;
3463 /* 20171012 gryphon command for USDT */
3464 static int
3465 cmd_usdt_stmin_override_activate(tvbuff_t *tvb, int offset, proto_tree *pt)
3467 proto_tree_add_item(pt, hf_gryphon_usdt_stmin_override_activate, tvb, offset, 1, ENC_BIG_ENDIAN);
3468 offset += 1;
3470 return offset;
3473 /* 20171012 gryphon command for USDT */
3474 static int
3475 cmd_usdt_set_stmin_mul(tvbuff_t *tvb, int offset, proto_tree *pt)
3477 float value;
3478 /* TODO fix this float value? */
3479 value = tvb_get_ntohieee_float (tvb, offset);
3480 proto_tree_add_float_format_value(pt, hf_gryphon_usdt_set_stmin_mul, tvb, offset, 4,
3481 value, "%.1f", value);
3482 offset += 4;
3484 return offset;
3488 * legacy command for usdt register
3490 static int
3491 cmd_usdt(tvbuff_t *tvb, int offset, proto_tree *pt)
3493 int ids, id, remain, size, i, bytes;
3494 uint8_t flags;
3495 proto_tree *localTree;
3496 proto_item *localItem;
3498 flags = tvb_get_uint8(tvb, offset);
3499 proto_tree_add_item(pt, hf_gryphon_usdt_flags_register, tvb, offset, 1, ENC_BIG_ENDIAN);
3501 if (flags & 1) {
3502 static int * const action_flags[] = {
3503 &hf_gryphon_usdt_action_flags_register,
3504 &hf_gryphon_usdt_action_flags_action,
3505 NULL
3508 static int * const transmit_option_flags[] = {
3509 &hf_gryphon_usdt_transmit_options_flags_echo,
3510 &hf_gryphon_usdt_transmit_options_action,
3511 &hf_gryphon_usdt_transmit_options_send_done,
3512 NULL
3515 static int * const receive_option_flags[] = {
3516 &hf_gryphon_usdt_receive_options_action,
3517 &hf_gryphon_usdt_receive_options_firstframe,
3518 &hf_gryphon_usdt_receive_options_lastframe,
3519 NULL
3522 proto_tree_add_bitmask(pt, tvb, offset, hf_gryphon_usdt_action_flags, ett_gryphon_flags, action_flags, ENC_BIG_ENDIAN);
3523 proto_tree_add_bitmask(pt, tvb, offset+1, hf_gryphon_usdt_transmit_options_flags, ett_gryphon_flags, transmit_option_flags, ENC_BIG_ENDIAN);
3524 proto_tree_add_bitmask(pt, tvb, offset+2, hf_gryphon_usdt_receive_options_flags, ett_gryphon_flags, receive_option_flags, ENC_BIG_ENDIAN);
3526 if ((ids = tvb_get_uint8(tvb, offset+3))) {
3527 localItem = proto_tree_add_item(pt, hf_gryphon_usdt_ext_address, tvb, offset+3, 1, ENC_BIG_ENDIAN);
3528 offset += 4;
3530 localTree = proto_item_add_subtree (localItem, ett_gryphon_usdt_data);
3531 while (ids) {
3532 proto_tree_add_item(localTree, hf_gryphon_usdt_ext_address_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3533 offset += 4;
3534 ids--;
3536 } else {
3537 proto_tree_add_uint_format_value(pt, hf_gryphon_usdt_ext_address, tvb, offset+3, 1,
3538 0, "Using extended addressing for the single, internally defined, ID");
3539 offset += 4;
3541 for (i = 0; i < 2; i++) {
3542 bytes = tvb_reported_length_remaining (tvb, offset);
3543 if (bytes <= 0)
3544 break;
3545 localTree = proto_tree_add_subtree_format(pt, tvb, offset, 16, ett_gryphon_usdt_data, NULL, "%s block of USDT/UUDT IDs", i==0?"First":"Second");
3547 size = tvb_get_ntohl (tvb, offset);
3548 localItem = proto_tree_add_item(localTree, hf_gryphon_usdt_block_size, tvb, offset, 4, ENC_BIG_ENDIAN);
3549 localTree = proto_item_add_subtree (localItem, ett_gryphon_usdt_data_block);
3550 if (size == 0) {
3551 proto_item_set_len(localItem, 16);
3552 } else {
3553 offset += 4;
3554 id = tvb_get_ntohl (tvb, offset);
3555 proto_tree_add_uint_format_value(localTree, hf_gryphon_usdt_request, tvb, offset, 4, id, "%04X through %04X", id, id+size-1);
3556 offset += 4;
3558 id = tvb_get_ntohl (tvb, offset);
3559 proto_tree_add_uint_format_value(localTree, hf_gryphon_usdt_response, tvb, offset, 4, id, "%04X through %04X", id, id+size-1);
3560 offset += 4;
3562 id = tvb_get_ntohl (tvb, offset);
3563 proto_tree_add_uint_format_value(localTree, hf_gryphon_uudt_response, tvb, offset, 4, id, "%04X through %04X", id, id+size-1);
3564 offset += 4;
3567 } else {
3568 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
3569 offset += 4;
3572 if ((remain = tvb_reported_length_remaining(tvb, offset))) {
3573 proto_tree_add_item(pt, hf_gryphon_ignored, tvb, offset, remain, ENC_NA);
3574 offset += remain;
3577 return offset;
3580 static int
3581 cmd_bits_in (tvbuff_t *tvb, int offset, proto_tree *pt)
3583 int value;
3585 value = tvb_get_uint8(tvb, offset);
3586 if (value) {
3587 static int * const digital_values[] = {
3588 &hf_gryphon_bits_in_input1,
3589 &hf_gryphon_bits_in_input2,
3590 &hf_gryphon_bits_in_input3,
3591 &hf_gryphon_bits_in_pushbutton,
3592 NULL
3594 proto_tree_add_bitmask(pt, tvb, 1, hf_gryphon_bit_in_digital_data, ett_gryphon_digital_data, digital_values, ENC_NA);
3595 } else {
3596 proto_tree_add_uint_format(pt, hf_gryphon_bit_in_digital_data, tvb, offset, 1, value, "No digital values are set");
3599 offset++;
3600 return offset;
3603 static int
3604 cmd_bits_out (tvbuff_t *tvb, int offset, proto_tree *pt)
3606 int value;
3608 value = tvb_get_uint8(tvb, offset);
3609 if (value) {
3610 static int * const digital_values[] = {
3611 &hf_gryphon_bits_out_output1,
3612 &hf_gryphon_bits_out_output2,
3613 NULL
3615 proto_tree_add_bitmask(pt, tvb, 1, hf_gryphon_bit_out_digital_data, ett_gryphon_digital_data, digital_values, ENC_NA);
3616 } else {
3617 proto_tree_add_uint_format(pt, hf_gryphon_bit_out_digital_data, tvb, offset, 1, value, "No digital values are set");
3620 offset++;
3621 return offset;
3624 static int
3625 cmd_init_strat (tvbuff_t *tvb, int offset, proto_tree *pt)
3627 uint32_t reset_limit;
3628 int msglen, indx;
3629 float value;
3631 msglen = tvb_reported_length_remaining(tvb, offset);
3632 reset_limit = tvb_get_ntohl(tvb, offset);
3633 proto_tree_add_uint_format_value(pt, hf_gryphon_init_strat_reset_limit, tvb, offset, 4,
3634 reset_limit, "Reset Limit = %u messages", reset_limit);
3635 offset += 4;
3636 msglen -= 4;
3637 for (indx = 1; msglen; indx++, offset++, msglen--) {
3638 value = tvb_get_uint8(tvb, offset);
3639 if (value)
3640 proto_tree_add_float_format_value(pt, hf_gryphon_init_strat_delay, tvb, offset, 1,
3641 value/4, "Delay %d = %.2f seconds", indx, value/4);
3642 else
3643 proto_tree_add_float_format_value(pt, hf_gryphon_init_strat_delay, tvb, offset, 1,
3644 0, "Delay %d = infinite", indx);
3647 return offset;
3650 static int
3651 speed(tvbuff_t *tvb, int offset, proto_tree *pt)
3653 proto_tree_add_item(pt, hf_gryphon_speed_baud_rate_index, tvb, offset, 1, ENC_BIG_ENDIAN);
3654 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
3655 offset += 4;
3656 return offset;
3659 static int
3660 blm_mode(tvbuff_t *tvb, int offset, proto_tree *pt)
3662 proto_item *item;
3663 proto_tree *tree;
3664 uint32_t mode, milliseconds;
3666 item = proto_tree_add_item_ret_uint(pt, hf_gryphon_blm_mode, tvb, offset, 4, ENC_BIG_ENDIAN, &mode);
3667 tree = proto_item_add_subtree(item, ett_gryphon_blm_mode);
3668 offset += 4;
3669 switch (mode) {
3670 case 1:
3671 milliseconds = tvb_get_ntohl(tvb, offset);
3672 proto_tree_add_uint_format_value(tree, hf_gryphon_blm_mode_avg_period, tvb, offset, 4,
3673 milliseconds, "%d.%03d seconds", milliseconds/1000, milliseconds%1000);
3674 break;
3675 case 2:
3676 proto_tree_add_item(tree, hf_gryphon_blm_mode_avg_frames, tvb, offset, 4, ENC_BIG_ENDIAN);
3677 break;
3678 default:
3679 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 4, ENC_NA);
3680 break;
3683 offset += 4;
3684 return offset;
3687 static gryphon_conversation*
3688 get_conversation_data(packet_info* pinfo)
3690 conversation_t *conversation;
3691 gryphon_conversation *conv_data;
3693 /* Find a conversation, create a new if no one exists */
3694 conversation = find_or_create_conversation(pinfo);
3695 conv_data = (gryphon_conversation*)conversation_get_proto_data(conversation, proto_gryphon);
3697 if (conv_data == NULL) {
3698 conv_data = wmem_new(wmem_file_scope(), gryphon_conversation);
3699 conv_data->request_frame_data = wmem_list_new(wmem_file_scope());
3700 conversation_add_proto_data(conversation, proto_gryphon, (void *)conv_data);
3703 return conv_data;
3706 static int
3707 // NOLINTNEXTLINE(misc-no-recursion)
3708 decode_command(tvbuff_t *tvb, packet_info* pinfo, int msglen, int offset, int dst, proto_tree *pt)
3710 uint32_t cmd;
3711 uint32_t context, ioctl_command;
3712 proto_tree *ft;
3713 proto_item *hi;
3714 gryphon_pkt_info_t *pkt_info;
3716 hi = proto_tree_add_item_ret_uint(pt, hf_gryphon_cmd, tvb, offset, 1, ENC_BIG_ENDIAN, &cmd);
3717 proto_item_set_hidden(hi);
3719 if (cmd > 0x3F)
3720 cmd += dst * 256;
3722 pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (uint32_t)tvb_raw_offset(tvb));
3724 if (!pkt_info) {
3725 /* Find a conversation, create a new if no one exists */
3726 gryphon_conversation *conv_data = get_conversation_data(pinfo);
3728 pkt_info = wmem_new0(wmem_file_scope(), gryphon_pkt_info_t);
3730 /* load information into the request frame */
3731 pkt_info->cmd = cmd;
3732 pkt_info->req_frame_num = pinfo->num;
3733 pkt_info->req_time = pinfo->abs_ts;
3735 wmem_list_prepend(conv_data->request_frame_data, pkt_info);
3737 p_add_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (uint32_t)tvb_raw_offset(tvb), pkt_info);
3740 proto_tree_add_uint(pt, hf_gryphon_command, tvb, offset, 1, cmd);
3741 proto_tree_add_item_ret_uint(pt, hf_gryphon_cmd_context, tvb, offset + 1, 1, ENC_NA, &context);
3742 if (!pinfo->fd->visited) {
3743 pkt_info->cmd_context = context;
3745 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset + 2, 2, ENC_NA);
3746 if (pkt_info->rsp_frame_num > 0) {
3747 proto_item* it = proto_tree_add_uint(pt, hf_gryphon_response_in,
3748 tvb, 0, 0, pkt_info->rsp_frame_num);
3749 proto_item_set_generated(it);
3751 offset += 4;
3752 msglen -= 4;
3754 if (msglen > 0)
3756 ft = proto_tree_add_subtree_format(pt, tvb, offset, msglen, ett_gryphon_command_data, NULL,
3757 "Data: (%d byte%s)", msglen, plurality(msglen, "", "s"));
3759 increment_dissection_depth(pinfo);
3760 switch (cmd)
3762 case CMD_INIT:
3763 offset = cmd_init(tvb, offset, ft);
3764 break;
3765 case CMD_EVENT_ENABLE:
3766 case CMD_EVENT_DISABLE:
3767 offset = eventnum(tvb, offset, ft);
3768 break;
3769 case CMD_SET_TIME:
3770 offset = resp_time(tvb, offset, ft);
3771 break;
3772 case CMD_CARD_SET_SPEED:
3773 offset = speed(tvb, offset, ft);
3774 break;
3775 case CMD_CARD_SET_FILTER:
3776 offset = cmd_setfilt(tvb, offset, ft);
3777 break;
3778 case CMD_CARD_GET_FILTER:
3779 offset = resp_addfilt(tvb, offset, ft);
3780 break;
3781 case CMD_CARD_TX:
3782 offset = decode_data(tvb, offset, ft);
3783 break;
3784 case CMD_CARD_ADD_FILTER:
3785 offset = cmd_addfilt(tvb, offset, ft);
3786 break;
3787 case CMD_CARD_MODIFY_FILTER:
3788 offset = cmd_modfilt(tvb, offset, ft);
3789 break;
3790 case CMD_CARD_SET_DEFAULT_FILTER:
3791 offset = dfiltmode(tvb, offset, ft);
3792 break;
3793 case CMD_CARD_SET_FILTER_MODE:
3794 offset = filtmode(tvb, offset, ft);
3795 break;
3796 case CMD_SERVER_REG:
3797 offset = cmd_register(tvb, offset, ft);
3798 break;
3799 case CMD_SERVER_SET_SORT:
3800 offset = cmd_sort(tvb, offset, ft);
3801 break;
3802 case CMD_SERVER_SET_OPT:
3803 offset = cmd_optimize(tvb, offset, ft);
3804 break;
3805 case CMD_BLM_SET_MODE:
3806 offset = blm_mode(tvb, offset, ft);
3807 break;
3808 case CMD_LDF_LIST:
3809 offset = cmd_ldf_list(tvb, offset, ft);
3810 break;
3811 case CMD_LDF_DELETE:
3812 offset = cmd_ldf_delete(tvb, offset, ft);
3813 break;
3814 case CMD_LDF_DESC:
3815 offset = cmd_ldf_desc(tvb, offset, ft);
3816 break;
3817 case CMD_LDF_UPLOAD:
3818 offset = cmd_ldf_upload(tvb, offset, ft);
3819 break;
3820 case CMD_LDF_PARSE:
3821 offset = cmd_ldf_parse(tvb, offset, ft);
3822 break;
3823 case CMD_GET_NODE_SIGNALS:
3824 offset = cmd_ldf_get_node_signals(tvb, offset, ft);
3825 break;
3826 case CMD_GET_FRAMES:
3827 offset = cmd_ldf_get_frames(tvb, offset, ft);
3828 break;
3829 case CMD_GET_FRAME_INFO:
3830 offset = cmd_ldf_get_frame_info(tvb, pinfo, offset, ft);
3831 break;
3832 case CMD_GET_SIGNAL_INFO:
3833 offset = cmd_ldf_get_signal_info(tvb, offset, ft);
3834 break;
3835 case CMD_GET_SIGNAL_DETAIL:
3836 offset = cmd_ldf_get_signal_detail(tvb, offset, ft);
3837 break;
3838 case CMD_GET_ENCODING_INFO:
3839 offset = cmd_ldf_get_encoding_info(tvb, offset, ft);
3840 break;
3841 case CMD_SAVE_SESSION:
3842 offset = cmd_ldf_save_session(tvb, offset, ft);
3843 break;
3844 case CMD_EMULATE_NODES:
3845 offset = cmd_ldf_emulate_nodes(tvb, pinfo, offset, ft);
3846 break;
3847 case CMD_START_SCHEDULE:
3848 offset = cmd_ldf_start_schedule(tvb, offset, ft);
3849 break;
3850 case CMD_RESTORE_SESSION:
3851 offset = cmd_restore_session(tvb, offset, ft);
3852 break;
3853 case CMD_CNVT_GET_VALUES:
3854 offset = cmd_cnvt_get_values(tvb, offset, ft);
3855 break;
3856 case CMD_CNVT_GET_UNITS:
3857 offset = cmd_cnvt_get_units(tvb, offset, ft);
3858 break;
3859 case CMD_CNVT_SET_VALUES:
3860 offset = cmd_cnvt_set_values(tvb, offset, ft);
3861 break;
3862 case CMD_CNVT_SAVE_SESSION:
3863 offset = cmd_ldf_save_session(tvb, offset, ft);
3864 break;
3865 case CMD_CNVT_RESTORE_SESSION:
3866 offset = cmd_restore_session(tvb, offset, ft);
3867 break;
3868 case CMD_CNVT_DESTROY_SESSION:
3869 offset = cmd_cnvt_destroy_session(tvb, offset, ft);
3870 break;
3871 case CMD_CNVT_GET_NODE_SIGNALS:
3872 offset = cmd_ldf_get_node_signals(tvb, offset, ft);
3873 break;
3874 case CMD_MSGRESP_ADD:
3875 offset = cmd_addresp(tvb, offset, pinfo, ft);
3876 break;
3877 case CMD_MSGRESP_GET:
3878 offset = resp_addresp(tvb, offset, ft);
3879 break;
3880 case CMD_MSGRESP_MODIFY:
3881 offset = cmd_modresp(tvb, offset, ft);
3882 break;
3883 case CMD_PGM_DESC:
3884 offset = cmd_desc(tvb, offset, ft);
3885 break;
3886 case CMD_PGM_UPLOAD:
3887 offset = cmd_upload(tvb, offset, ft);
3888 break;
3889 case CMD_PGM_DELETE:
3890 offset = cmd_delete(tvb, offset, ft);
3891 break;
3892 case CMD_PGM_LIST:
3893 offset = cmd_list(tvb, offset, ft);
3894 break;
3895 case CMD_PGM_START:
3896 offset = cmd_start(tvb, pinfo, offset, ft);
3897 break;
3898 case CMD_PGM_STOP:
3899 offset = resp_start(tvb, offset, ft);
3900 break;
3901 case CMD_PGM_STATUS:
3902 offset = cmd_delete(tvb, offset, ft);
3903 break;
3904 case CMD_PGM_OPTIONS:
3905 offset = cmd_options(tvb, offset, ft);
3906 break;
3907 case CMD_PGM_FILES:
3908 offset = cmd_files(tvb, offset, ft);
3909 break;
3910 case CMD_SCHED_TX:
3911 offset = cmd_sched(tvb, offset, ft);
3912 break;
3913 case CMD_SCHED_KILL_TX:
3914 offset = resp_sched(tvb, offset, ft);
3915 break;
3916 case CMD_SCHED_MSG_REPLACE:
3917 offset = cmd_sched_rep(tvb, offset, ft);
3918 break;
3919 case CMD_USDT_REGISTER:
3920 offset = cmd_usdt(tvb, offset, ft);
3921 break;
3922 case CMD_USDT_SET_FUNCTIONAL:
3923 offset = cmd_usdt(tvb, offset, ft);
3924 break;
3925 case CMD_USDT_SET_STMIN_MULT:
3926 offset = cmd_usdt_set_stmin_mul(tvb, offset, ft);
3927 break;
3928 case CMD_USDT_REGISTER_NON_LEGACY:
3929 offset = cmd_usdt_register_non_legacy(tvb, offset, ft);
3930 break;
3931 case CMD_USDT_SET_STMIN_FC:
3932 offset = cmd_usdt_stmin_fc(tvb, offset, ft);
3933 break;
3934 case CMD_USDT_SET_BSMAX_FC:
3935 offset = cmd_usdt_bsmax_fc(tvb, offset, ft);
3936 break;
3937 case CMD_USDT_SET_STMIN_OVERRIDE:
3938 offset = cmd_usdt_stmin_override(tvb, offset, ft);
3939 break;
3940 case CMD_USDT_ACTIVATE_STMIN_OVERRIDE:
3941 offset = cmd_usdt_stmin_override_activate(tvb, offset, ft);
3942 break;
3943 case CMD_IOPWR_CLRLATCH:
3944 offset = cmd_bits_in(tvb, offset, ft);
3945 break;
3946 case CMD_IOPWR_SETOUT:
3947 case CMD_IOPWR_SETBIT:
3948 case CMD_IOPWR_CLRBIT:
3949 offset = cmd_bits_out(tvb, offset, ft);
3950 break;
3951 case CMD_UTIL_SET_INIT_STRATEGY:
3952 offset = cmd_init_strat(tvb, offset, ft);
3953 break;
3954 case CMD_CARD_IOCTL:
3955 ioctl_command = tvb_get_ntohl(tvb, offset);
3956 /* save the IOCTL in the context array for use during the command response */
3957 if (!pinfo->fd->visited) {
3958 pkt_info->ioctl_command = ioctl_command;
3960 offset = cmd_ioctl(tvb, pinfo, offset, ft, ioctl_command);
3961 break;
3962 default:
3963 proto_tree_add_item(ft, hf_gryphon_data, tvb, offset, msglen, ENC_NA);
3964 offset += msglen;
3965 break;
3967 decrement_dissection_depth(pinfo);
3970 return offset;
3973 static int
3974 // NOLINTNEXTLINE(misc-no-recursion)
3975 decode_response(tvbuff_t *tvb, packet_info* pinfo, int offset, int src, proto_tree *pt)
3977 int msglen;
3978 uint32_t cmd;
3979 proto_tree *ft;
3980 gryphon_pkt_info_t *pkt_info, *pkt_info_list;
3982 msglen = tvb_reported_length_remaining(tvb, offset);
3983 cmd = tvb_get_uint8(tvb, offset);
3985 if (cmd > 0x3F)
3986 cmd += src * 256;
3988 pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (uint32_t)tvb_raw_offset(tvb));
3990 if (!pkt_info) {
3991 /* Find a conversation, create a new if no one exists */
3992 gryphon_conversation *conv_data = get_conversation_data(pinfo);
3994 pkt_info = wmem_new0(wmem_file_scope(), gryphon_pkt_info_t);
3996 wmem_list_frame_t *frame = wmem_list_head(conv_data->request_frame_data);
3997 /* Step backward through all logged instances of request frames, looking for a request frame number that
3998 occurred immediately prior to current frame number that has a matching command */
3999 while (frame) {
4000 pkt_info_list = (gryphon_pkt_info_t*)wmem_list_frame_data(frame);
4001 if ((pinfo->num > pkt_info_list->req_frame_num) && (pkt_info_list->rsp_frame_num == 0) && (pkt_info_list->cmd == cmd)) {
4002 pkt_info->req_frame_num = pkt_info_list->req_frame_num;
4003 pkt_info->cmd_context = pkt_info_list->cmd_context;
4004 pkt_info->ioctl_command = pkt_info_list->ioctl_command;
4005 pkt_info->req_time = pkt_info_list->req_time;
4006 pkt_info_list->rsp_frame_num = pinfo->num;
4007 break;
4010 frame = wmem_list_frame_next(frame);
4013 p_add_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (uint32_t)tvb_raw_offset(tvb), pkt_info);
4017 * This is the old original way of displaying.
4019 * XXX - is there some reason not to display the context for ioctl
4020 * commands, and to display the ioctl code here, rather than in
4021 * the part of the tree for the ioctl response?
4023 proto_tree_add_uint(pt, hf_gryphon_command, tvb, offset, 1, cmd);
4024 if (pkt_info->ioctl_command != 0) {
4025 proto_tree_add_uint(pt, hf_gryphon_cmd_ioctl_context, tvb, 0, 0, pkt_info->ioctl_command);
4026 } else {
4027 proto_tree_add_item(pt, hf_gryphon_cmd_context, tvb, offset + 1, 1, ENC_NA);
4029 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset + 2, 2, ENC_NA);
4030 offset += 4;
4031 msglen -= 4;
4033 proto_tree_add_item(pt, hf_gryphon_status, tvb, offset, 4, ENC_BIG_ENDIAN);
4034 offset += 4;
4035 msglen -= 4;
4037 if (pkt_info->req_frame_num) {
4038 proto_item *it;
4039 nstime_t ns;
4041 it = proto_tree_add_uint(pt, hf_gryphon_response_to, tvb, 0, 0, pkt_info->req_frame_num);
4042 proto_item_set_generated(it);
4044 nstime_delta(&ns, &pinfo->fd->abs_ts, &pkt_info->req_time);
4045 it = proto_tree_add_time(pt, hf_gryphon_response_time, tvb, 0, 0, &ns);
4046 proto_item_set_generated(it);
4049 if (msglen > 0) {
4050 ft = proto_tree_add_subtree_format(pt, tvb, offset, msglen, ett_gryphon_response_data, NULL,
4051 "Data: (%d byte%s)", msglen, plurality(msglen, "", "s"));
4053 increment_dissection_depth(pinfo);
4054 switch (cmd)
4056 case CMD_GET_CONFIG:
4057 offset = resp_config(tvb, offset, ft);
4058 break;
4059 case CMD_GET_TIME:
4060 offset = resp_time(tvb, offset, ft);
4061 break;
4062 case CMD_CARD_GET_SPEED:
4063 offset = speed(tvb, offset, ft);
4064 break;
4065 case CMD_CARD_GET_FILTER:
4066 offset = cmd_addfilt(tvb, offset, ft);
4067 break;
4068 case CMD_CARD_ADD_FILTER:
4069 offset = resp_addfilt(tvb, offset, ft);
4070 break;
4071 case CMD_CARD_GET_FILTER_HANDLES:
4072 offset = resp_filthan(tvb, offset, ft);
4073 break;
4074 case CMD_CARD_GET_DEFAULT_FILTER:
4075 offset = dfiltmode(tvb, offset, ft);
4076 break;
4077 case CMD_CARD_GET_FILTER_MODE:
4078 offset = filtmode(tvb, offset, ft);
4079 break;
4080 case CMD_CARD_GET_EVNAMES:
4081 offset = resp_events(tvb, offset, ft);
4082 break;
4083 case CMD_CARD_GET_SPEEDS:
4084 offset = resp_getspeeds(tvb, offset, ft);
4085 break;
4086 case CMD_SERVER_REG:
4087 offset = resp_register(tvb, offset, ft);
4088 break;
4089 case CMD_BLM_GET_MODE:
4090 offset = blm_mode(tvb, offset, ft);
4091 break;
4092 case CMD_BLM_GET_DATA:
4093 offset = resp_blm_data(tvb, offset, ft);
4094 break;
4095 case CMD_BLM_GET_STATS:
4096 offset = resp_blm_stat(tvb, offset, ft);
4097 break;
4098 case CMD_LDF_LIST:
4099 offset = resp_ldf_list(tvb, offset, ft);
4100 break;
4101 case CMD_LDF_DESC:
4102 offset = resp_ldf_desc(tvb, offset, ft);
4103 break;
4104 case CMD_GET_LDF_INFO:
4105 offset = resp_get_ldf_info(tvb, offset, ft);
4106 break;
4107 case CMD_GET_NODE_NAMES:
4108 offset = resp_ldf_get_node_names(tvb, offset, ft);
4109 break;
4110 case CMD_GET_NODE_SIGNALS:
4111 offset = resp_ldf_get_node_signals(tvb, offset, ft);
4112 break;
4113 case CMD_GET_FRAMES:
4114 offset = resp_ldf_get_frames(tvb, offset, ft);
4115 break;
4116 case CMD_GET_FRAME_INFO:
4117 offset = resp_ldf_get_frame_info(tvb, offset, ft);
4118 break;
4119 case CMD_GET_SIGNAL_INFO:
4120 offset = resp_ldf_get_signal_info(tvb, offset, ft);
4121 break;
4122 case CMD_GET_SIGNAL_DETAIL:
4123 offset = resp_ldf_get_signal_detail(tvb, pinfo, offset, ft);
4124 break;
4125 case CMD_GET_ENCODING_INFO:
4126 offset = resp_ldf_get_encoding_info(tvb, pinfo, offset, ft);
4127 break;
4128 case CMD_GET_SCHEDULES:
4129 offset = resp_ldf_get_schedules(tvb, offset, ft);
4130 break;
4131 case CMD_RESTORE_SESSION:
4132 offset = resp_restore_session(tvb, offset, ft);
4133 break;
4134 case CMD_CNVT_GET_VALUES:
4135 offset = resp_cnvt_get_values(tvb, offset, ft);
4136 break;
4137 case CMD_CNVT_GET_UNITS:
4138 offset = resp_cnvt_get_units(tvb, offset, ft);
4139 break;
4140 case CMD_CNVT_RESTORE_SESSION:
4141 offset = resp_restore_session(tvb, offset, ft);
4142 break;
4143 case CMD_CNVT_GET_NODE_SIGNALS:
4144 offset = resp_ldf_get_node_signals(tvb, offset, ft);
4145 break;
4146 case CMD_MSGRESP_ADD:
4147 offset = resp_addresp(tvb, offset, ft);
4148 break;
4149 case CMD_MSGRESP_GET:
4150 offset = cmd_addresp(tvb, offset, pinfo, ft);
4151 break;
4152 case CMD_MSGRESP_GET_HANDLES:
4153 offset = resp_resphan(tvb, offset, ft);
4154 break;
4155 case CMD_PGM_DESC:
4156 offset = resp_desc(tvb, offset, ft);
4157 break;
4158 case CMD_PGM_LIST:
4159 offset = resp_list(tvb, offset, ft);
4160 break;
4161 case CMD_PGM_START:
4162 case CMD_PGM_START2:
4163 offset = resp_start(tvb, offset, ft);
4164 break;
4165 case CMD_PGM_STATUS:
4166 case CMD_PGM_OPTIONS:
4167 offset = resp_status(tvb, offset, ft);
4168 break;
4169 case CMD_PGM_FILES:
4170 offset = resp_files(tvb, offset, ft);
4171 break;
4172 case CMD_SCHED_TX:
4173 offset = resp_sched(tvb, offset, ft);
4174 break;
4175 case CMD_USDT_GET_STMIN_FC:
4176 offset = cmd_usdt_stmin_fc(tvb, offset, ft);
4177 break;
4178 case CMD_USDT_GET_BSMAX_FC:
4179 offset = cmd_usdt_bsmax_fc(tvb, offset, ft);
4180 break;
4181 case CMD_USDT_GET_STMIN_OVERRIDE:
4182 offset = cmd_usdt_get_stmin_override(tvb, offset, ft);
4183 break;
4184 case CMD_IOPWR_GETINP:
4185 case CMD_IOPWR_GETLATCH:
4186 case CMD_IOPWR_CLRLATCH:
4187 case CMD_IOPWR_GETPOWER:
4188 offset = cmd_bits_in(tvb, offset, ft);
4189 break;
4190 case CMD_IOPWR_GETOUT:
4191 offset = cmd_bits_out(tvb, offset, ft);
4192 break;
4193 case CMD_UTIL_GET_INIT_STRATEGY:
4194 offset = cmd_init_strat(tvb, offset, ft);
4195 break;
4196 case CMD_CARD_IOCTL:
4197 offset = cmd_ioctl_resp(tvb, pinfo, offset, ft, pkt_info->ioctl_command);
4198 break;
4199 default:
4200 proto_tree_add_item(ft, hf_gryphon_data, tvb, offset, msglen, ENC_NA);
4201 offset += msglen;
4203 decrement_dissection_depth(pinfo);
4206 return offset;
4210 * 20180221
4211 * This function exists because Gryphon Protocol MISC packets contain within them Gryphon Protocol packets.
4212 * So, this function will decode a packet and return the offset.
4214 static int
4215 // NOLINTNEXTLINE(misc-no-recursion)
4216 dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool is_msgresp_add)
4218 proto_tree *gryphon_tree;
4219 proto_item *ti, *type_item;
4220 proto_tree *header_tree, *body_tree;
4221 int msgend, msglen, msgpad;
4222 int offset = 0;
4223 uint32_t src, dest, i, frmtyp, flags;
4225 if (!is_msgresp_add) {
4226 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Gryphon");
4227 col_clear(pinfo->cinfo, COL_INFO);
4229 ti = proto_tree_add_item(tree, proto_gryphon, tvb, 0, -1, ENC_NA);
4230 gryphon_tree = proto_item_add_subtree(ti, ett_gryphon);
4232 else {
4233 gryphon_tree = tree;
4236 header_tree = proto_tree_add_subtree(gryphon_tree, tvb, offset, MSG_HDR_SZ, ett_gryphon_header, NULL, "Header");
4238 /* src */
4239 proto_tree_add_item_ret_uint(header_tree, hf_gryphon_src, tvb, offset, 1, ENC_BIG_ENDIAN, &src);
4240 /* 20180306 20171012 */
4241 /* srcchan */
4242 if (is_special_client(src)) {
4243 proto_tree_add_item(header_tree, hf_gryphon_srcchanclient, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4245 else {
4246 proto_tree_add_item(header_tree, hf_gryphon_srcchan, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4249 /* dest */
4250 proto_tree_add_item_ret_uint(header_tree, hf_gryphon_dest, tvb, offset + 2, 1, ENC_BIG_ENDIAN, &dest);
4251 /* 20180306 20171012 */
4252 /* destchan */
4253 if (is_special_client(dest)) {
4254 proto_tree_add_item(header_tree, hf_gryphon_destchanclient, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
4256 else {
4257 proto_tree_add_item(header_tree, hf_gryphon_destchan, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
4260 proto_tree_add_item_ret_uint(header_tree, hf_gryphon_data_length, tvb, offset + 4, 2, ENC_BIG_ENDIAN, &msglen);
4261 flags = tvb_get_uint8(tvb, offset + 6);
4262 frmtyp = flags & ~RESPONSE_FLAGS;
4263 type_item = proto_tree_add_uint(header_tree, hf_gryphon_type, tvb, offset + 6, 1, frmtyp);
4265 * Indicate what kind of message this is.
4267 if (!is_msgresp_add)
4268 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(frmtyp, frame_type, "- Invalid -"));
4270 if (is_msgresp_add) {
4271 static int * const wait_flags[] = {
4272 &hf_gryphon_wait_resp,
4273 &hf_gryphon_wait_prev_resp,
4274 NULL
4277 proto_tree_add_bitmask(header_tree, tvb, offset + 6, hf_gryphon_wait_flags, ett_gryphon_flags, wait_flags, ENC_NA);
4279 proto_tree_add_item(header_tree, hf_gryphon_reserved, tvb, offset + 7, 1, ENC_NA);
4280 offset += MSG_HDR_SZ;
4282 msgpad = 3 - (msglen + 3) % 4;
4283 msgend = offset + msglen + msgpad;
4285 body_tree = proto_tree_add_subtree(gryphon_tree, tvb, offset, msglen, ett_gryphon_body, NULL, "Body");
4287 increment_dissection_depth(pinfo);
4288 switch (frmtyp) {
4289 case GY_FT_CMD:
4290 offset = decode_command(tvb, pinfo, msglen, offset, dest, body_tree);
4291 break;
4292 case GY_FT_RESP:
4293 offset = decode_response(tvb, pinfo, offset, src, body_tree);
4294 break;
4295 case GY_FT_DATA:
4296 offset = decode_data(tvb, offset, body_tree);
4297 break;
4298 case GY_FT_EVENT:
4299 offset = decode_event(tvb, offset, body_tree);
4300 break;
4301 case GY_FT_MISC:
4302 offset = decode_misc(tvb, offset, pinfo, body_tree);
4303 break;
4304 case GY_FT_TEXT:
4305 offset = decode_text(tvb, offset, msglen, body_tree);
4306 break;
4307 case GY_FT_SIG:
4308 break;
4309 default:
4310 expert_add_info(pinfo, type_item, &ei_gryphon_type);
4311 proto_tree_add_item(body_tree, hf_gryphon_data, tvb, offset, msglen, ENC_NA);
4312 break;
4314 decrement_dissection_depth(pinfo);
4316 /*debug*/
4317 /*i = msgend - offset;*/
4318 /*proto_tree_add_debug_text(gryphon_tree, "debug offset=%d msgend=%d i=%d",offset,msgend,i);*/
4320 if (offset < msgend) {
4321 i = msgend - offset;
4323 * worked when msglen=4, offset=8, msgend=12, get i=4
4324 * did not work when msglen=5, offset=8, msgend=16, i is 8
4326 proto_tree_add_item(gryphon_tree, hf_gryphon_padding, tvb, offset, i, ENC_NA);
4327 offset += i;
4329 return offset;
4332 static unsigned
4333 get_gryphon_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
4335 uint16_t plen;
4336 int padded_len;
4339 * Get the length of the Gryphon packet, and then get the length as
4340 * padded to a 4-byte boundary.
4342 plen = tvb_get_ntohs(tvb, offset + 4);
4343 padded_len = plen + 3 - (plen + 3) % 4;
4346 * That length doesn't include the fixed-length part of the header;
4347 * add that in.
4349 return padded_len + GRYPHON_FRAME_HEADER_LEN;
4352 static int
4353 dissect_gryphon_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
4355 dissect_gryphon_message(tvb, pinfo, tree, false);
4356 return tvb_reported_length(tvb);
4359 static int
4360 dissect_gryphon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
4362 tcp_dissect_pdus(tvb, pinfo, tree, gryphon_desegment, GRYPHON_FRAME_HEADER_LEN,
4363 get_gryphon_pdu_len, dissect_gryphon_pdu, data);
4364 return tvb_reported_length(tvb);
4367 void
4368 proto_register_gryphon(void)
4370 static hf_register_info hf[] = {
4371 { &hf_gryphon_src,
4372 { "Source", "gryphon.src", FT_UINT8, BASE_HEX, VALS(src_dest), 0x0,
4373 NULL, HFILL }},
4374 { &hf_gryphon_srcchan,
4375 { "Source channel", "gryphon.srcchan", FT_UINT8,
4376 BASE_DEC | BASE_SPECIAL_VALS, VALS(channel_or_broadcast), 0x0,
4377 NULL, HFILL }},
4378 { &hf_gryphon_srcchanclient,
4379 { "Source client id", "gryphon.srcchanclient", FT_UINT8,
4380 BASE_DEC | BASE_SPECIAL_VALS, VALS(channel_or_broadcast), 0x0,
4381 NULL, HFILL }},
4382 { &hf_gryphon_dest,
4383 { "Destination", "gryphon.dest", FT_UINT8, BASE_HEX, VALS(src_dest), 0x0,
4384 NULL, HFILL }},
4385 { &hf_gryphon_destchan,
4386 { "Destination channel", "gryphon.destchan", FT_UINT8,
4387 BASE_DEC | BASE_SPECIAL_VALS, VALS(channel_or_broadcast), 0x0,
4388 NULL, HFILL }},
4389 { &hf_gryphon_destchanclient,
4390 { "Destination client id", "gryphon.destchanclient", FT_UINT8,
4391 BASE_DEC | BASE_SPECIAL_VALS, VALS(channel_or_broadcast), 0x0,
4392 NULL, HFILL }},
4393 { &hf_gryphon_type,
4394 { "Frame type", "gryphon.type", FT_UINT8, BASE_DEC, VALS(frame_type), 0x0,
4395 NULL, HFILL }},
4396 { &hf_gryphon_cmd,
4397 { "Command", "gryphon.cmd", FT_UINT8, BASE_DEC, NULL, 0x0,
4398 NULL, HFILL }},
4399 { &hf_gryphon_cmd_context,
4400 { "Context", "gryphon.cmd.context", FT_UINT8, BASE_DEC, NULL, 0x0,
4401 NULL, HFILL }},
4402 { &hf_gryphon_cmd_ioctl_context,
4403 { "IOCTL Response", "gryphon.cmd.ioctl_response", FT_UINT32, BASE_DEC, VALS(ioctls), 0x0,
4404 NULL, HFILL }},
4405 { &hf_gryphon_data,
4406 { "Data", "gryphon.data", FT_BYTES, BASE_NONE, NULL, 0x0,
4407 NULL, HFILL }},
4408 { &hf_gryphon_padding,
4409 { "Padding", "gryphon.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
4410 NULL, HFILL }},
4411 { &hf_gryphon_ignored,
4412 { "Ignored", "gryphon.ignored", FT_BYTES, BASE_NONE, NULL, 0x0,
4413 NULL, HFILL }},
4414 { &hf_gryphon_data_length,
4415 { "Data length (bytes)", "gryphon.data_length", FT_UINT16, BASE_DEC, NULL, 0x0,
4416 NULL, HFILL }},
4417 { &hf_gryphon_reserved,
4418 { "Reserved", "gryphon.reserved", FT_BYTES, BASE_NONE, NULL, 0x0,
4419 NULL, HFILL }},
4420 { &hf_gryphon_wait_flags,
4421 { "Flags", "gryphon.wait_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
4422 NULL, HFILL }},
4423 { &hf_gryphon_wait_resp,
4424 { "Wait for response", "gryphon.wait_resp", FT_BOOLEAN, 8, TFS(&tfs_wait_response), DONT_WAIT_FOR_RESP,
4425 NULL, HFILL }},
4426 { &hf_gryphon_wait_prev_resp,
4427 { "Wait for previous response", "gryphon.wait_prev_resp", FT_BOOLEAN, 8, TFS(&tfs_wait_response), WAIT_FOR_PREV_RESP,
4428 NULL, HFILL }},
4429 { &hf_gryphon_status,
4430 { "Status", "gryphon.status", FT_UINT32, BASE_HEX, VALS(responses_vs), 0x0,
4431 NULL, HFILL }},
4432 { &hf_gryphon_response_in,
4433 { "Response In", "gryphon.response_in", FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0,
4434 "The response to this Gryphon request is in this frame", HFILL }},
4435 { &hf_gryphon_response_to,
4436 { "Request In", "gryphon.response_to", FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
4437 "This is a response to the PANA request in this frame", HFILL }},
4438 { &hf_gryphon_response_time,
4439 { "Response Time", "gryphon.response_time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
4440 "The time between the request and the response", HFILL }},
4441 { &hf_gryphon_data_header_length,
4442 { "Header length (bytes)", "gryphon.data.header_length", FT_UINT8, BASE_DEC, NULL, 0x0,
4443 NULL, HFILL }},
4444 { &hf_gryphon_data_header_length_bits,
4445 { "Header length (bits)", "gryphon.data.header_length", FT_UINT8, BASE_DEC, NULL, 0x0,
4446 NULL, HFILL }},
4447 { &hf_gryphon_data_data_length,
4448 { "Data length (bytes)", "gryphon.data.data_length", FT_UINT16, BASE_DEC, NULL, 0x0,
4449 NULL, HFILL }},
4450 { &hf_gryphon_data_extra_data_length,
4451 { "Extra data length (bytes)", "gryphon.data.extra_length", FT_UINT8, BASE_DEC, NULL, 0x0,
4452 NULL, HFILL }},
4453 { &hf_gryphon_data_mode,
4454 { "Mode", "gryphon.data.mode", FT_UINT8, BASE_DEC, NULL, 0x0,
4455 NULL, HFILL }},
4456 { &hf_gryphon_data_mode_transmitted,
4457 { "Transmitted message", "gryphon.data.mode.transmitted", FT_BOOLEAN, 8, TFS(&true_false), 0x80,
4458 NULL, HFILL }},
4459 { &hf_gryphon_data_mode_receive,
4460 { "Received message", "gryphon.data.mode.receive", FT_BOOLEAN, 8, TFS(&true_false), 0x40,
4461 NULL, HFILL }},
4462 { &hf_gryphon_data_mode_local,
4463 { "Local message", "gryphon.data.mode.local", FT_BOOLEAN, 8, TFS(&true_false), 0x20,
4464 NULL, HFILL }},
4465 { &hf_gryphon_data_mode_remote,
4466 { "Remote message (LIN)", "gryphon.data.mode.remote", FT_BOOLEAN, 8, TFS(&true_false), 0x10,
4467 NULL, HFILL }},
4468 /* 20171012 added additional mode bits */
4469 { &hf_gryphon_data_mode_oneshot,
4470 { "One-shot slave table message (LIN)", "gryphon.data.mode.oneshot", FT_BOOLEAN, 8, TFS(&true_false), 0x08,
4471 NULL, HFILL }},
4472 { &hf_gryphon_data_mode_combined,
4473 { "Channel number is in context", "gryphon.data.mode.combined", FT_BOOLEAN, 8, TFS(&true_false), 0x04,
4474 NULL, HFILL }},
4475 { &hf_gryphon_data_mode_nomux,
4476 { "Do not multiplex message", "gryphon.data.mode.nomux", FT_BOOLEAN, 8, TFS(&true_false), 0x02,
4477 NULL, HFILL }},
4478 { &hf_gryphon_data_mode_internal,
4479 { "Internal message", "gryphon.data.mode.internal", FT_BOOLEAN, 8, TFS(&true_false), 0x01,
4480 NULL, HFILL }},
4481 { &hf_gryphon_data_priority,
4482 { "Priority", "gryphon.data.priority", FT_UINT8, BASE_DEC, NULL, 0x0,
4483 NULL, HFILL }},
4484 { &hf_gryphon_data_error_status,
4485 { "Error status", "gryphon.data.error_status", FT_UINT8, BASE_DEC, NULL, 0x0,
4486 NULL, HFILL }},
4487 { &hf_gryphon_data_time,
4488 { "Timestamp", "gryphon.data.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
4489 NULL, HFILL }},
4490 { &hf_gryphon_data_context,
4491 { "Context", "gryphon.data.context", FT_UINT8, BASE_DEC, NULL, 0x0,
4492 NULL, HFILL }},
4493 { &hf_gryphon_data_header_data,
4494 { "Header", "gryphon.data.header_data", FT_BYTES, BASE_NONE, NULL, 0x0,
4495 NULL, HFILL }},
4496 { &hf_gryphon_data_data,
4497 { "Data", "gryphon.data.data", FT_BYTES, BASE_NONE, NULL, 0x0,
4498 NULL, HFILL }},
4499 { &hf_gryphon_data_extra_data,
4500 { "Extra data", "gryphon.data.extra_data", FT_BYTES, BASE_NONE, NULL, 0x0,
4501 NULL, HFILL }},
4502 { &hf_gryphon_data_padding,
4503 { "Padding", "gryphon.data.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
4504 NULL, HFILL }},
4505 { &hf_gryphon_event_id,
4506 { "Event ID", "gryphon.event.id", FT_UINT8, BASE_DEC, NULL, 0x0,
4507 NULL, HFILL }},
4508 { &hf_gryphon_event_name,
4509 { "Event name", "gryphon.event.name", FT_STRING, BASE_NONE, NULL, 0x0,
4510 NULL, HFILL }},
4511 { &hf_gryphon_event_context,
4512 { "Event context", "gryphon.event.context", FT_UINT8, BASE_DEC, NULL, 0x0,
4513 NULL, HFILL }},
4514 { &hf_gryphon_event_time,
4515 { "Timestamp", "gryphon.event.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
4516 NULL, HFILL }},
4517 { &hf_gryphon_event_data,
4518 { "Data", "gryphon.event.data", FT_BYTES, BASE_NONE, NULL, 0x0,
4519 NULL, HFILL }},
4520 { &hf_gryphon_event_padding,
4521 { "Padding", "gryphon.event.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
4522 NULL, HFILL }},
4523 { &hf_gryphon_misc_text,
4524 { "Text", "gryphon.misc.text", FT_STRING, BASE_NONE, NULL, 0x0,
4525 NULL, HFILL }},
4526 { &hf_gryphon_misc_padding,
4527 { "Padding", "gryphon.misc.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
4528 NULL, HFILL }},
4529 { &hf_gryphon_eventnum,
4530 { "Event numbers", "gryphon.eventnum", FT_UINT8, BASE_DEC, NULL, 0x0,
4531 NULL, HFILL }},
4532 { &hf_gryphon_resp_time,
4533 { "Date/Time", "gryphon.resp_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
4534 NULL, HFILL }},
4535 { &hf_gryphon_setfilt,
4536 { "Pass/Block flag", "gryphon.setfilt.flag", FT_UINT32, BASE_DEC, NULL, 0x0,
4537 NULL, HFILL }},
4538 { &hf_gryphon_setfilt_length,
4539 { "Length of Pattern & Mask", "gryphon.setfilt.length", FT_UINT32, BASE_DEC, NULL, 0x0,
4540 NULL, HFILL }},
4541 { &hf_gryphon_setfilt_discard_data,
4542 { "Discarded data", "gryphon.setfilt.discard_data", FT_BYTES, BASE_NONE, NULL, 0x0,
4543 NULL, HFILL }},
4544 { &hf_gryphon_setfilt_padding,
4545 { "Padding", "gryphon.setfilt.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
4546 NULL, HFILL }},
4547 { &hf_gryphon_ioctl,
4548 { "IOCTL", "gryphon.ioctl", FT_UINT32, BASE_HEX, VALS(ioctls), 0x0,
4549 NULL, HFILL }},
4550 { &hf_gryphon_ioctl_nbytes,
4551 { "Number of bytes to follow (bytes)", "gryphon.ioctl_nbytes", FT_UINT32, BASE_DEC, NULL, 0x0,
4552 NULL, HFILL }},
4553 { &hf_gryphon_ioctl_data,
4554 { "Data", "gryphon.ioctl.data", FT_BYTES, BASE_NONE, NULL, 0x0,
4555 NULL, HFILL }},
4556 { &hf_gryphon_addfilt_pass,
4557 { "Conforming messages", "gryphon.addfilt.pass", FT_BOOLEAN, 8, TFS(&tfs_passed_blocked), FILTER_PASS_FLAG,
4558 NULL, HFILL }},
4559 { &hf_gryphon_addfilt_active,
4560 { "Filter", "gryphon.addfilt.active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG,
4561 NULL, HFILL }},
4562 { &hf_gryphon_addfilt_blocks,
4563 { "Number of filter blocks", "gryphon.addfilt.blocks", FT_UINT8, BASE_DEC, NULL, 0x0,
4564 NULL, HFILL }},
4565 { &hf_gryphon_addfilt_handle,
4566 { "Filter handle", "gryphon.addfilt.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
4567 NULL, HFILL }},
4568 { &hf_gryphon_modfilt,
4569 { "Filter handle", "gryphon.modfilt", FT_UINT8, BASE_DEC, NULL, 0x0,
4570 NULL, HFILL }},
4571 { &hf_gryphon_modfilt_action,
4572 { "Action", "gryphon.modfilt.action", FT_UINT8, BASE_DEC, VALS(filtacts), 0x0,
4573 NULL, HFILL }},
4574 { &hf_gryphon_filthan,
4575 { "Number of filter handles", "gryphon.filthan", FT_UINT8, BASE_DEC, NULL, 0x0,
4576 NULL, HFILL }},
4577 { &hf_gryphon_filthan_id,
4578 { "Filter handle ID", "gryphon.filthan.id", FT_UINT8, BASE_DEC, NULL, 0x0,
4579 NULL, HFILL }},
4580 { &hf_gryphon_filthan_padding,
4581 { "Padding", "gryphon.filthan.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
4582 NULL, HFILL }},
4583 { &hf_gryphon_dfiltmode,
4584 { "Filter mode", "gryphon.dfiltmode", FT_UINT8, BASE_DEC, VALS(dmodes), 0x0,
4585 NULL, HFILL }},
4586 { &hf_gryphon_filtmode,
4587 { "Filter mode", "gryphon.filtmode", FT_UINT8, BASE_DEC, VALS(modes), 0x0,
4588 NULL, HFILL }},
4589 { &hf_gryphon_register_username,
4590 { "Username", "gryphon.register.username", FT_STRING, BASE_NONE, NULL, 0x0,
4591 NULL, HFILL }},
4592 { &hf_gryphon_register_password,
4593 { "Password", "gryphon.register.password", FT_STRING, BASE_NONE, NULL, 0x0,
4594 NULL, HFILL }},
4595 { &hf_gryphon_register_client_id,
4596 { "Client ID", "gryphon.register.client_id", FT_UINT8, BASE_DEC, NULL, 0x0,
4597 NULL, HFILL }},
4598 { &hf_gryphon_register_privileges,
4599 { "Privileges", "gryphon.register.privileges", FT_UINT8, BASE_DEC, NULL, 0x0,
4600 NULL, HFILL }},
4601 { &hf_gryphon_getspeeds_set_ioctl,
4602 { "Set Speed IOCTL", "gryphon.getspeeds.set_ioctl", FT_UINT32, BASE_DEC, NULL, 0x0,
4603 NULL, HFILL }},
4604 { &hf_gryphon_getspeeds_get_ioctl,
4605 { "Get Speed IOCTL", "gryphon.getspeeds.get_ioctl", FT_UINT32, BASE_DEC, NULL, 0x0,
4606 NULL, HFILL }},
4607 { &hf_gryphon_getspeeds_size,
4608 { "Speed data size (bytes)", "gryphon.getspeeds.size", FT_UINT8, BASE_DEC, NULL, 0x0,
4609 NULL, HFILL }},
4610 { &hf_gryphon_getspeeds_preset,
4611 { "Preset speed numbers", "gryphon.getspeeds.preset", FT_UINT8, BASE_DEC, NULL, 0x0,
4612 NULL, HFILL }},
4613 { &hf_gryphon_getspeeds_data,
4614 { "Data for preset", "gryphon.getspeeds.data", FT_BYTES, BASE_NONE, NULL, 0x0,
4615 NULL, HFILL }},
4616 { &hf_gryphon_cmd_sort,
4617 { "Set sorting", "gryphon.cmd_sort", FT_UINT8, BASE_DEC, VALS(cmd_sort_type), 0x0,
4618 NULL, HFILL }},
4619 { &hf_gryphon_cmd_optimize,
4620 { "Set optimization", "gryphon.cmd_optimize", FT_UINT8, BASE_DEC, VALS(cmd_optimize_type), 0x0,
4621 NULL, HFILL }},
4622 { &hf_gryphon_config_device_name,
4623 { "Device name", "gryphon.config.device_name", FT_STRING, BASE_NONE, NULL, 0x0,
4624 NULL, HFILL }},
4625 { &hf_gryphon_config_device_version,
4626 { "Device version", "gryphon.config.device_version", FT_STRING, BASE_NONE, NULL, 0x0,
4627 NULL, HFILL }},
4628 { &hf_gryphon_config_device_serial_number,
4629 { "Device serial number", "gryphon.config.device_serial_number", FT_STRING, BASE_NONE, NULL, 0x0,
4630 NULL, HFILL }},
4631 { &hf_gryphon_config_num_channels,
4632 { "Number of channels", "gryphon.config.num_channels", FT_UINT8, BASE_DEC, NULL, 0x0,
4633 NULL, HFILL }},
4634 { &hf_gryphon_config_name_version_ext,
4635 { "Name & version extension", "gryphon.config.name_version_ext", FT_STRING, BASE_NONE, NULL, 0x0,
4636 NULL, HFILL }},
4637 { &hf_gryphon_config_driver_name,
4638 { "Driver name", "gryphon.config.driver_name", FT_STRING, BASE_NONE, NULL, 0x0,
4639 NULL, HFILL }},
4640 { &hf_gryphon_config_driver_version,
4641 { "Driver version", "gryphon.config.driver_version", FT_STRING, BASE_NONE, NULL, 0x0,
4642 NULL, HFILL }},
4643 { &hf_gryphon_config_device_security,
4644 { "Device security string", "gryphon.config.device_security", FT_STRING, BASE_NONE, NULL, 0x0,
4645 NULL, HFILL }},
4646 { &hf_gryphon_config_max_data_length,
4647 { "Maximum data length (bytes)", "gryphon.config.max_data_length", FT_UINT16, BASE_DEC, NULL, 0x0,
4648 NULL, HFILL }},
4649 { &hf_gryphon_config_min_data_length,
4650 { "Minimum data length (bytes)", "gryphon.config.min_data_length", FT_UINT16, BASE_DEC, NULL, 0x0,
4651 NULL, HFILL }},
4652 { &hf_gryphon_config_hardware_serial_number,
4653 { "Hardware serial number", "gryphon.config.hardware_serial_number", FT_STRING, BASE_NONE, NULL, 0x0,
4654 NULL, HFILL }},
4655 { &hf_gryphon_config_protocol_type,
4656 { "Protocol type & subtype", "gryphon.config.protocol_type", FT_UINT16, BASE_HEX, VALS(protocol_types), 0x0,
4657 NULL, HFILL }},
4658 { &hf_gryphon_config_channel_id,
4659 { "Channel ID", "gryphon.config.channel_id", FT_UINT8, BASE_DEC, NULL, 0x0,
4660 NULL, HFILL }},
4661 { &hf_gryphon_config_card_slot_number,
4662 { "Card slot number", "gryphon.config.card_slot_number", FT_UINT8, BASE_DEC, NULL, 0x0,
4663 NULL, HFILL }},
4664 { &hf_gryphon_config_max_extra_data,
4665 { "Maximum extra data (bytes)", "gryphon.config.max_extra_data", FT_UINT16, BASE_DEC, NULL, 0x0,
4666 NULL, HFILL }},
4667 { &hf_gryphon_config_min_extra_data,
4668 { "Minimum extra data (bytes)", "gryphon.config.min_extra_data", FT_UINT16, BASE_DEC, NULL, 0x0,
4669 NULL, HFILL }},
4670 { &hf_gryphon_sched_num_iterations,
4671 { "Number of iterations", "gryphon.sched.num_iterations", FT_UINT32, BASE_DEC, NULL, 0x0,
4672 NULL, HFILL }},
4673 { &hf_gryphon_sched_flags,
4674 { "Flags", "gryphon.sched.flags", FT_UINT32, BASE_HEX, NULL, 0x0,
4675 NULL, HFILL }},
4676 { &hf_gryphon_sched_flags_scheduler,
4677 { "Scheduler", "gryphon.sched.flags.scheduler", FT_BOOLEAN, 32, TFS(&critical_normal), 0x00000001,
4678 NULL, HFILL }},
4679 { &hf_gryphon_sched_sleep,
4680 { "Sleep (milliseconds)", "gryphon.sched.sleep", FT_UINT32, BASE_DEC, NULL, 0x0,
4681 NULL, HFILL }},
4682 { &hf_gryphon_sched_transmit_count,
4683 { "Transmit count", "gryphon.sched.transmit_count", FT_UINT32, BASE_DEC, NULL, 0x0,
4684 NULL, HFILL }},
4685 { &hf_gryphon_sched_transmit_period,
4686 { "Transmit period (milliseconds)", "gryphon.sched.transmit_period", FT_UINT32, BASE_DEC, NULL, 0x0,
4687 NULL, HFILL }},
4688 { &hf_gryphon_sched_transmit_flags,
4689 { "Flags", "gryphon.sched.transmit_flags", FT_UINT16, BASE_HEX, NULL, 0x0,
4690 NULL, HFILL }},
4691 { &hf_gryphon_sched_skip_transmit_period,
4692 { "Last transmit period", "gryphon.sched.skip_transmit_period", FT_BOOLEAN, 16, TFS(&skip_not_skip), 0x0001,
4693 NULL, HFILL }},
4694 { &hf_gryphon_sched_skip_sleep,
4695 { "Last transmit period", "gryphon.sched.skip_transmit_period", FT_BOOLEAN, 16, TFS(&skip_not_skip), 0x0001,
4696 NULL, HFILL }},
4697 { &hf_gryphon_sched_channel,
4698 { "Channel", "gryphon.sched.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
4699 NULL, HFILL }},
4700 { &hf_gryphon_sched_channel0,
4701 { "Channel (specified by the destination channel)", "gryphon.sched.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
4702 NULL, HFILL }},
4703 { &hf_gryphon_sched_rep_id,
4704 { "Schedule ID", "gryphon.sched.rep_id", FT_UINT32, BASE_DEC, NULL, 0x0,
4705 NULL, HFILL }},
4706 { &hf_gryphon_sched_rep_message_index,
4707 { "Message index", "gryphon.sched.rep_message_index", FT_UINT8, BASE_DEC, NULL, 0x0,
4708 NULL, HFILL }},
4709 { &hf_gryphon_blm_data_time,
4710 { "Timestamp", "gryphon.blm_data.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
4711 NULL, HFILL }},
4712 { &hf_gryphon_blm_data_bus_load,
4713 { "Bus load average (%)", "gryphon.blm_data.bus_load", FT_UINT16, BASE_DEC, NULL, 0x0,
4714 NULL, HFILL }},
4715 { &hf_gryphon_blm_data_current_bus_load,
4716 { "Current bus load (%)", "gryphon.blm_data.current_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0,
4717 NULL, HFILL }},
4718 { &hf_gryphon_blm_data_peak_bus_load,
4719 { "Peak bus load (%)", "gryphon.blm_data.peak_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0,
4720 NULL, HFILL }},
4721 { &hf_gryphon_blm_data_historic_peak_bus_load,
4722 { "Historic peak bus load (%)", "gryphon.blm_data.historic_peak_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0,
4723 NULL, HFILL }},
4724 { &hf_gryphon_blm_stat_receive_frame_count,
4725 { "Receive frame count", "gryphon.blm_stat.receive_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0,
4726 NULL, HFILL }},
4727 { &hf_gryphon_blm_stat_transmit_frame_count,
4728 { "Transmit frame count", "gryphon.blm_stat.transmit_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0,
4729 NULL, HFILL }},
4730 { &hf_gryphon_blm_stat_receive_dropped_frame_count,
4731 { "Receive dropped frame count", "gryphon.blm_stat.receive_dropped_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0,
4732 NULL, HFILL }},
4733 { &hf_gryphon_blm_stat_transmit_dropped_frame_count,
4734 { "Transmit dropped frame count", "gryphon.blm_stat.transmit_dropped_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0,
4735 NULL, HFILL }},
4736 { &hf_gryphon_blm_stat_receive_error_count,
4737 { "Receive error count", "gryphon.blm_stat.receive_error_count", FT_UINT32, BASE_DEC, NULL, 0x0,
4738 NULL, HFILL }},
4739 { &hf_gryphon_blm_stat_transmit_error_count,
4740 { "Transmit error count", "gryphon.blm_stat.transmit_error_count", FT_UINT32, BASE_DEC, NULL, 0x0,
4741 NULL, HFILL }},
4742 { &hf_gryphon_addresp_flags,
4743 { "Flags", "gryphon.addresp.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
4744 NULL, HFILL }},
4745 /* 20171017 fixed display of filter flags */
4746 { &hf_gryphon_addresp_flags_active,
4747 { "Filter active flag", "gryphon.addresp.flags.active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG,
4748 NULL, HFILL }},
4749 { &hf_gryphon_addresp_blocks,
4750 { "Number of filter blocks", "gryphon.addresp.blocks", FT_UINT8, BASE_DEC, NULL, 0x0,
4751 NULL, HFILL }},
4752 { &hf_gryphon_ldf_number,
4753 { "Number of LDF names", "gryphon.ldf.number", FT_UINT8, BASE_DEC, NULL, 0x0,
4754 NULL, HFILL }},
4755 { &hf_gryphon_ldf_nodenumber,
4756 { "Number of nodes", "gryphon.ldf.nodenumber", FT_UINT8, BASE_DEC, NULL, 0x0,
4757 NULL, HFILL }},
4758 { &hf_gryphon_ldf_list,
4759 { "LDF block index", "gryphon.ldf.list", FT_UINT8, BASE_DEC, NULL, 0x0,
4760 NULL, HFILL }},
4761 { &hf_gryphon_ldf_remaining,
4762 { "Remaining LDF names", "gryphon.ldf.remaining", FT_UINT16, BASE_DEC, NULL, 0x0,
4763 NULL, HFILL }},
4764 { &hf_gryphon_ldf_name,
4765 { "File Name", "gryphon.ldf.name", FT_STRING, BASE_NONE, NULL, 0x0,
4766 NULL, HFILL }},
4767 { &hf_gryphon_ldf_info_pv,
4768 { "Protocol version", "gryphon.ldf.pv", FT_STRING, BASE_NONE, NULL, 0x0,
4769 NULL, HFILL }},
4770 { &hf_gryphon_ldf_info_lv,
4771 { "Language version", "gryphon.ldf.lv", FT_STRING, BASE_NONE, NULL, 0x0,
4772 NULL, HFILL }},
4773 { &hf_gryphon_ldf_ui,
4774 { "Unique identifier", "gryphon.ldf.ui", FT_BYTES, BASE_NONE, NULL, 0x0,
4775 NULL, HFILL }},
4776 { &hf_gryphon_lin_nodename,
4777 { "Node Name", "gryphon.lin.nodename", FT_STRING, BASE_NONE, NULL, 0x0,
4778 NULL, HFILL }},
4779 { &hf_gryphon_lin_data_length,
4780 { "Data length (bytes)", "gryphon.lin.data_length", FT_UINT8, BASE_DEC, NULL, 0x0,
4781 NULL, HFILL }},
4782 { &hf_gryphon_lin_slave_table_enable,
4783 { "Slave table entry", "gryphon.lin.slave_table_enable", FT_UINT8, BASE_DEC, VALS(lin_slave_table_enable), 0x0,
4784 NULL, HFILL }},
4785 { &hf_gryphon_lin_slave_table_cs,
4786 { "Slave table checksum", "gryphon.lin.slave_table_cs", FT_UINT8, BASE_DEC, VALS(lin_slave_table_cs), 0x0,
4787 NULL, HFILL }},
4788 { &hf_gryphon_lin_slave_table_data,
4789 { "Data", "gryphon.lin.slave_table_data", FT_BYTES, BASE_NONE, NULL, 0x0,
4790 NULL, HFILL }},
4791 { &hf_gryphon_lin_slave_table_datacs,
4792 { "Checksum", "gryphon.lin.slave_table_datacs", FT_UINT8, BASE_HEX, NULL, 0x0,
4793 NULL, HFILL }},
4794 { &hf_gryphon_lin_masterevent,
4795 { "Starting frame id", "gryphon.lin.masterevent", FT_UINT8, BASE_DEC, VALS(lin_ioctl_masterevent), 0x0,
4796 NULL, HFILL }},
4797 { &hf_gryphon_lin_numdata,
4798 { "Number of data bytes", "gryphon.lin.numdata", FT_UINT8, BASE_DEC, NULL, 0x0,
4799 NULL, HFILL }},
4800 { &hf_gryphon_lin_numextra,
4801 { "Number of extra bytes", "gryphon.lin.numextra", FT_UINT8, BASE_DEC, NULL, 0x0,
4802 NULL, HFILL }},
4803 { &hf_gryphon_ldf_description,
4804 { "Description", "gryphon.ldf.description", FT_STRING, BASE_NONE, NULL, 0x0,
4805 NULL, HFILL }},
4806 { &hf_gryphon_ldf_size,
4807 { "Size of LDF to be uploaded", "gryphon.ldf.size", FT_UINT32, BASE_DEC, NULL, 0x0,
4808 NULL, HFILL }},
4809 { &hf_gryphon_ldf_exists,
4810 { "LDF name existence check", "gryphon.ldf.exists", FT_UINT8, BASE_DEC, VALS(ldf_exists), 0x0,
4811 NULL, HFILL }},
4812 { &hf_gryphon_ldf_blockn,
4813 { "Block number", "gryphon.ldf.blockn", FT_UINT16, BASE_DEC, NULL, 0x0,
4814 NULL, HFILL }},
4815 { &hf_gryphon_ldf_file,
4816 { "Upload text block", "gryphon.ldf.file", FT_STRING, BASE_NONE, NULL, 0x0,
4817 NULL, HFILL }},
4818 { &hf_gryphon_ldf_desc_pad,
4819 { "Padding (TODO: need to fix response data length)", "gryphon.ldf.desc_pad", FT_BYTES, BASE_NONE, NULL, 0x0,
4820 NULL, HFILL }},
4821 { &hf_gryphon_ldf_restore_session,
4822 { "Session id", "gryphon.ldf.restore_session", FT_BYTES, BASE_NONE, NULL, 0x0,
4823 NULL, HFILL }},
4824 { &hf_gryphon_ldf_schedule_name,
4825 { "Schedule name", "gryphon.ldf.schedule_name", FT_STRING, BASE_NONE, NULL, 0x0,
4826 NULL, HFILL }},
4827 { &hf_gryphon_ldf_schedule_msg_dbytes,
4828 { "Data length (bytes)", "gryphon.ldf.schedule_msg_dbytes", FT_UINT8, BASE_DEC, NULL, 0x0,
4829 NULL, HFILL }},
4830 { &hf_gryphon_ldf_schedule_flags,
4831 { "Flags", "gryphon.ldf.schedule_flags", FT_UINT8, BASE_DEC, NULL, 0x0,
4832 NULL, HFILL }},
4833 { &hf_gryphon_ldf_schedule_event,
4834 { "Event driven", "gryphon.ldf.schedule_event_ev", FT_BOOLEAN, 8, TFS(&true_false), 0x80,
4835 NULL, HFILL }},
4836 { &hf_gryphon_ldf_schedule_sporadic,
4837 { "Sporadic", "gryphon.ldf.schedule_event_sp", FT_BOOLEAN, 8, TFS(&true_false), 0x40,
4838 NULL, HFILL }},
4839 { &hf_gryphon_ldf_ioctl_setflags,
4840 { "Starting frame id", "gryphon.ldf.ioctl_setflags", FT_UINT8, BASE_DEC, VALS(lin_ldf_ioctl_setflags), 0x0,
4841 NULL, HFILL }},
4842 { &hf_gryphon_ldf_ioctl_setflags_flags,
4843 { "Id", "gryphon.ldf.ioctl_setflags_flags", FT_UINT8, BASE_DEC, NULL, 0x0,
4844 NULL, HFILL }},
4845 { &hf_gryphon_ldf_numb_ids,
4846 { "Number of ids", "gryphon.ldf.numb_ids", FT_UINT8, BASE_DEC, NULL, 0x0,
4847 NULL, HFILL }},
4848 { &hf_gryphon_ldf_bitrate,
4849 { "Bitrate", "gryphon.ldf.bitrate", FT_FLOAT, BASE_NONE, NULL, 0x0,
4850 NULL, HFILL }},
4851 { &hf_gryphon_ldf_sched_size_place,
4852 { "Placeholder for schedule size (bytes)", "gryphon.ldf.schedsize", FT_UINT32, BASE_DEC, NULL, 0x0,
4853 NULL, HFILL }},
4854 { &hf_gryphon_ldf_sched_numb_place,
4855 { "Placeholder for number of schedules", "gryphon.ldf.numbsched", FT_UINT16, BASE_DEC, NULL, 0x0,
4856 NULL, HFILL }},
4857 { &hf_gryphon_ldf_sched_size,
4858 { "Schedule size (bytes)", "gryphon.ldf.schedsize", FT_UINT32, BASE_DEC, NULL, 0x0,
4859 NULL, HFILL }},
4860 { &hf_gryphon_ldf_num_node_names,
4861 { "Number of node names", "gryphon.ldf.num_node_names", FT_UINT16, BASE_DEC, NULL, 0x0,
4862 NULL, HFILL }},
4863 { &hf_gryphon_ldf_num_frames,
4864 { "Number of frames", "gryphon.ldf.num_frames", FT_UINT16, BASE_DEC, NULL, 0x0,
4865 NULL, HFILL }},
4866 { &hf_gryphon_ldf_get_frame,
4867 { "Frame", "gryphon.ldf.get_frame", FT_STRING, BASE_NONE, NULL, 0x0,
4868 NULL, HFILL }},
4869 { &hf_gryphon_ldf_get_frame_num,
4870 { "Number of data bytes in slave response", "gryphon.ldf.get_frame_num", FT_UINT8, BASE_DEC, NULL, 0x0,
4871 NULL, HFILL }},
4872 { &hf_gryphon_ldf_get_frame_pub,
4873 { "Publisher", "gryphon.ldf.get_frame_pub", FT_STRING, BASE_NONE, NULL, 0x0,
4874 NULL, HFILL }},
4875 { &hf_gryphon_ldf_get_frame_num_signals,
4876 { "Number of signals", "gryphon.ldf.get_frame_num_signals", FT_UINT8, BASE_DEC, NULL, 0x0,
4877 NULL, HFILL }},
4878 { &hf_gryphon_ldf_num_signal_names,
4879 { "Number of signal names", "gryphon.ldf.num_signal_names", FT_UINT16, BASE_DEC, NULL, 0x0,
4880 NULL, HFILL }},
4881 { &hf_gryphon_ldf_num_schedules,
4882 { "Number of schedules", "gryphon.ldf.num_schedules", FT_UINT16, BASE_DEC, NULL, 0x0,
4883 NULL, HFILL }},
4884 { &hf_gryphon_ldf_num_encodings,
4885 { "Number of encodings", "gryphon.ldf.num_encodings", FT_UINT16, BASE_DEC, NULL, 0x0,
4886 NULL, HFILL }},
4887 { &hf_gryphon_ldf_encoding_value,
4888 { "Encoding value", "gryphon.ldf.encoding_value", FT_UINT16, BASE_DEC, NULL, 0x0,
4889 NULL, HFILL }},
4890 { &hf_gryphon_ldf_encoding_min,
4891 { "Encoding min value", "gryphon.ldf.encoding_min", FT_UINT16, BASE_DEC, NULL, 0x0,
4892 NULL, HFILL }},
4893 { &hf_gryphon_ldf_encoding_max,
4894 { "Encoding max value", "gryphon.ldf.encoding_max", FT_UINT16, BASE_DEC, NULL, 0x0,
4895 NULL, HFILL }},
4896 { &hf_gryphon_ldf_master_node_name,
4897 { "Master node name", "gryphon.ldf.master", FT_STRING, BASE_NONE, NULL, 0x0,
4898 NULL, HFILL }},
4899 { &hf_gryphon_ldf_slave_node_name,
4900 { "Slave node name", "gryphon.ldf.slave", FT_STRING, BASE_NONE, NULL, 0x0,
4901 NULL, HFILL }},
4902 { &hf_gryphon_ldf_node_name,
4903 { "Node name", "gryphon.ldf.node_name", FT_STRING, BASE_NONE, NULL, 0x0,
4904 NULL, HFILL }},
4905 { &hf_gryphon_ldf_signal_name,
4906 { "Signal name", "gryphon.ldf.signal_name", FT_STRING, BASE_NONE, NULL, 0x0,
4907 NULL, HFILL }},
4908 { &hf_gryphon_ldf_signal_encoding_name,
4909 { "Signal encoding name", "gryphon.ldf.signal_encoding_name", FT_STRING, BASE_NONE, NULL, 0x0,
4910 NULL, HFILL }},
4911 { &hf_gryphon_ldf_signal_encoding_type,
4912 { "Signal encoding type", "gryphon.ldf.signal_encoding_type", FT_STRING, BASE_NONE, NULL, 0x0,
4913 NULL, HFILL }},
4914 { &hf_gryphon_ldf_signal_encoding_logical,
4915 { "Signal encoding string", "gryphon.ldf.signal_encoding_logical", FT_STRING, BASE_NONE, NULL, 0x0,
4916 NULL, HFILL }},
4917 { &hf_gryphon_ldf_signal_offset,
4918 { "Offset (bits)", "gryphon.ldf.signal_offset", FT_UINT8, BASE_DEC, NULL, 0x0,
4919 NULL, HFILL }},
4920 { &hf_gryphon_ldf_signal_length,
4921 { "Length (bits)", "gryphon.ldf.signal_length", FT_UINT8, BASE_DEC, NULL, 0x0,
4922 NULL, HFILL }},
4923 /* cnvt */
4924 { &hf_gryphon_cnvt_valuef,
4925 { "Float value", "gryphon.cnvt.valuef", FT_FLOAT, BASE_NONE, NULL, 0x0,
4926 NULL, HFILL }},
4927 { &hf_gryphon_cnvt_valuei,
4928 { "Int value", "gryphon.cnvt.valuei", FT_UINT32, BASE_DEC, NULL, 0x0,
4929 NULL, HFILL }},
4930 { &hf_gryphon_cnvt_values,
4931 { "String value", "gryphon.cnvt.values", FT_STRING, BASE_NONE, NULL, 0x0,
4932 NULL, HFILL }},
4933 { &hf_gryphon_cnvt_units,
4934 { "String units", "gryphon.cnvt.units", FT_STRING, BASE_NONE, NULL, 0x0,
4935 NULL, HFILL }},
4936 { &hf_gryphon_cnvt_flags_getvalues,
4937 { "Flags", "gryphon.cnvt.flags.getvalues", FT_UINT8, BASE_DEC, VALS(lin_cnvt_getflags), 0x0,
4938 NULL, HFILL }},
4939 /* delay driver */
4940 { &hf_gryphon_dd_stream,
4941 { "Stream number", "gryphon.dd.stream", FT_UINT16, BASE_DEC, NULL, 0x0,
4942 NULL, HFILL }},
4943 { &hf_gryphon_dd_value,
4944 { "Value (bytes)", "gryphon.dd.value", FT_UINT16, BASE_DEC, NULL, 0x0,
4945 NULL, HFILL }},
4946 { &hf_gryphon_dd_time,
4947 { "Time (msec)", "gryphon.dd.time", FT_UINT16, BASE_DEC, NULL, 0x0,
4948 NULL, HFILL }},
4949 { &hf_gryphon_addresp_responses,
4950 { "Number of response blocks", "gryphon.addresp.responses", FT_UINT8, BASE_DEC, NULL, 0x0,
4951 NULL, HFILL }},
4952 { &hf_gryphon_addresp_old_handle,
4953 { "Old handle", "gryphon.addresp.old_handle", FT_UINT8, BASE_DEC, NULL, 0x0,
4954 NULL, HFILL }},
4955 { &hf_gryphon_addresp_action,
4956 { "Action", "gryphon.addresp.action", FT_UINT8, BASE_DEC, VALS(action_vals), 0x07,
4957 NULL, HFILL }},
4958 { &hf_gryphon_addresp_action_period,
4959 { "Period", "gryphon.addresp.action_period", FT_BOOLEAN, 8, TFS(&frames_01seconds), FR_PERIOD_MSGS,
4960 NULL, HFILL }},
4961 { &hf_gryphon_addresp_action_deact_on_event,
4962 { "Deact on event", "gryphon.addresp.action.deact_on_event", FT_UINT8, BASE_DEC, VALS(deact_on_event_vals), FR_DELETE|FR_DEACT_ON_EVENT,
4963 NULL, HFILL }},
4964 { &hf_gryphon_addresp_action_deact_after_period,
4965 { "Deact on Period", "gryphon.addresp.action.deact_after_period", FT_UINT8, BASE_DEC, VALS(deact_after_per_vals), FR_DELETE|FR_DEACT_AFTER_PER,
4966 NULL, HFILL }},
4967 { &hf_gryphon_addresp_action_period_type,
4968 { "Period", "gryphon.addresp.action_period_type", FT_UINT16, BASE_DEC, NULL, 0x0,
4969 NULL, HFILL }},
4970 { &hf_gryphon_addresp_handle,
4971 { "Response handle", "gryphon.addresp.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
4972 NULL, HFILL }},
4973 { &hf_gryphon_modresp_handle,
4974 { "Response handle", "gryphon.modresp.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
4975 NULL, HFILL }},
4976 { &hf_gryphon_modresp_action,
4977 { "Action response", "gryphon.modresp.action", FT_UINT8, BASE_DEC, VALS(filtacts), 0x0,
4978 NULL, HFILL }},
4979 { &hf_gryphon_num_resphan,
4980 { "Number of response handles", "gryphon.num_resphan", FT_UINT8, BASE_DEC, NULL, 0x0,
4981 NULL, HFILL }},
4982 { &hf_gryphon_handle,
4983 { "Handle", "gryphon.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
4984 NULL, HFILL }},
4985 { &hf_gryphon_transmit_sched_id,
4986 { "Transmit schedule ID", "gryphon.transmit_sched_id", FT_UINT32, BASE_DEC, NULL, 0x0,
4987 NULL, HFILL }},
4988 { &hf_gryphon_desc_program_size,
4989 { "Program size", "gryphon.desc.program_size", FT_UINT32, BASE_DEC, NULL, 0x0,
4990 NULL, HFILL }},
4991 { &hf_gryphon_desc_program_name,
4992 { "Program name", "gryphon.desc.program_name", FT_STRING, BASE_NONE, NULL, 0x0,
4993 NULL, HFILL }},
4994 { &hf_gryphon_desc_program_description,
4995 { "Program description", "gryphon.desc.program_description", FT_STRING, BASE_NONE, NULL, 0x0,
4996 NULL, HFILL }},
4997 { &hf_gryphon_desc_flags,
4998 { "Flags", "gryphon.desc.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
4999 NULL, HFILL }},
5000 { &hf_gryphon_desc_flags_program,
5001 { "Period", "gryphon.desc.flags.program", FT_BOOLEAN, 8, TFS(&present_not_present), 0x01,
5002 NULL, HFILL }},
5003 { &hf_gryphon_desc_handle,
5004 { "Handle", "gryphon.desc.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
5005 NULL, HFILL }},
5006 { &hf_gryphon_upload_block_number,
5007 { "Block number", "gryphon.upload.block_number", FT_UINT16, BASE_DEC, NULL, 0x0,
5008 NULL, HFILL }},
5009 { &hf_gryphon_upload_handle,
5010 { "Handle", "gryphon.upload.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
5011 NULL, HFILL }},
5012 { &hf_gryphon_upload_data,
5013 { "Data", "gryphon.upload.data", FT_BYTES, BASE_NONE, NULL, 0x0,
5014 NULL, HFILL }},
5015 { &hf_gryphon_delete,
5016 { "Program name", "gryphon.delete", FT_STRING, BASE_NONE, NULL, 0x0,
5017 NULL, HFILL }},
5018 { &hf_gryphon_list_block_number,
5019 { "Block number", "gryphon.list.block_number", FT_UINT8, BASE_DEC, NULL, 0x0,
5020 NULL, HFILL }},
5021 { &hf_gryphon_list_num_programs,
5022 { "Number of programs in this response", "gryphon.list.num_programs", FT_UINT8, BASE_DEC, NULL, 0x0,
5023 NULL, HFILL }},
5024 { &hf_gryphon_list_num_remain_programs,
5025 { "Number of remaining programs", "gryphon.list.num_remain_programs", FT_UINT16, BASE_DEC, NULL, 0x0,
5026 NULL, HFILL }},
5027 { &hf_gryphon_list_name,
5028 { "Name", "gryphon.list.name", FT_STRING, BASE_NONE, NULL, 0x0,
5029 NULL, HFILL }},
5030 { &hf_gryphon_list_description,
5031 { "Description", "gryphon.list.description", FT_STRING, BASE_NONE, NULL, 0x0,
5032 NULL, HFILL }},
5033 { &hf_gryphon_start_arguments,
5034 { "Arguments", "gryphon.start.arguments", FT_STRINGZ, BASE_NONE, NULL, 0x0,
5035 NULL, HFILL }},
5036 { &hf_gryphon_start_channel,
5037 { "Channel (Client) number", "gryphon.start.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
5038 NULL, HFILL }},
5039 { &hf_gryphon_status_num_running_copies,
5040 { "Number of running copies", "gryphon.status.num_running_copies", FT_UINT8, BASE_DEC, NULL, 0x0,
5041 NULL, HFILL }},
5042 { &hf_gryphon_options_handle,
5043 { "Handle", "gryphon.options.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
5044 NULL, HFILL }},
5045 { &hf_gryphon_files,
5046 { "Directory", "gryphon.files", FT_STRING, BASE_NONE, NULL, 0x0,
5047 NULL, HFILL }},
5048 { &hf_gryphon_usdt_flags_register,
5049 { "USDT", "gryphon.usdt.flags_register", FT_UINT8, BASE_DEC, VALS(register_unregister), 0x01,
5050 NULL, HFILL }},
5051 { &hf_gryphon_usdt_action_flags,
5052 { "Action Flags", "gryphon.usdt.action_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
5053 NULL, HFILL }},
5055 /* 20171012 added non legacy USDT */
5056 { &hf_gryphon_usdt_action_flags_non_legacy,
5057 { "Action Flags", "gryphon.usdt.action_flags.non_legacy", FT_BOOLEAN, 8, TFS(&register_unregister_action_flags), 0x01,
5058 NULL, HFILL }},
5060 { &hf_gryphon_usdt_action_flags_register,
5061 { "Register", "gryphon.usdt.action_flags.register", FT_UINT8, BASE_DEC, VALS(register_unregister), 0x01,
5062 NULL, HFILL }},
5063 { &hf_gryphon_usdt_action_flags_action,
5064 { "Action", "gryphon.usdt.action_flags.action", FT_UINT8, BASE_DEC, VALS(usdt_action_vals), 0x06,
5065 NULL, HFILL }},
5066 { &hf_gryphon_usdt_transmit_options_flags,
5067 { "Transmit options", "gryphon.usdt.transmit_options_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
5068 NULL, HFILL }},
5069 /* 20171012 USDT tx options */
5070 /* bit 0*/
5071 { &hf_gryphon_usdt_transmit_options_flags_echo,
5072 { "Echo long", "gryphon.usdt.transmit_options_flags.echo_long", FT_UINT8, BASE_DEC, VALS(xmit_opt_echo_long), 0x01, NULL, HFILL }},
5073 /* bits 1 & 2 */
5074 { &hf_gryphon_usdt_transmit_options_action,
5075 { "Transmit Action", "gryphon.usdt.transmit_options_flags.action", FT_UINT8, BASE_DEC, VALS(xmit_opt_vals), 0x06,
5076 NULL, HFILL }},
5077 /* bit 3 */
5078 { &hf_gryphon_usdt_transmit_options_done_event,
5079 { "Done event", "gryphon.usdt.transmit_options_flags.done_event", FT_UINT8, BASE_DEC, VALS(xmit_opt_done), 0x08, NULL, HFILL }},
5080 /* bit 4 */
5081 { &hf_gryphon_usdt_transmit_options_echo_short,
5082 { "Echo short", "gryphon.usdt.transmit_options_flags.echo_log", FT_UINT8, BASE_DEC, VALS(xmit_opt_echo_short), 0x10, NULL, HFILL }},
5083 /* bit 5 */
5084 { &hf_gryphon_usdt_transmit_options_rx_nth_fc,
5085 { "Nth flowcontrol event", "gryphon.usdt.transmit_options_flags.nth_fc_event", FT_UINT8, BASE_DEC, VALS(xmit_opt_nth_fc_event), 0x20, NULL, HFILL }},
5087 /* bit 5 */
5088 { &hf_gryphon_usdt_transmit_options_send_done,
5089 { "Send a USDT_DONE event when the last frame of a multi-frame USDT message is transmitted",
5090 "gryphon.usdt.transmit_options_flags.send_done", FT_BOOLEAN, 8, TFS(&yes_no), 0x08, NULL, HFILL }},
5092 /* 20171012 USDT rx options */
5093 { &hf_gryphon_usdt_receive_options_flags,
5094 { "Receive options", "gryphon.usdt.receive_options_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
5095 NULL, HFILL }},
5096 /* bits 0 & 1 */
5097 { &hf_gryphon_usdt_receive_options_action, /* legacy */
5098 { "Receive Action", "gryphon.usdt.receive_options_flags.action", FT_UINT8, BASE_DEC, VALS(recv_opt_vals), 0x03, NULL, HFILL }},
5099 /* bit 2 */
5100 { &hf_gryphon_usdt_receive_options_firstframe_event,
5101 { "First frame event", "gryphon.usdt.receive_options_flags.firstframe_event", FT_UINT8, BASE_DEC, VALS(recv_opt_firstframe_event), 0x04, NULL, HFILL }},
5102 /* bit 3 */
5103 { &hf_gryphon_usdt_receive_options_lastframe_event,
5104 { "Last frame event", "gryphon.usdt.receive_options_flags.lastframe_event", FT_UINT8, BASE_DEC, VALS(recv_opt_lastframe_event), 0x08, NULL, HFILL }},
5105 /* bit 5 */
5106 { &hf_gryphon_usdt_receive_options_tx_nth_fc,
5107 { "Nth flowcontrol event", "gryphon.usdt.receive_options_flags.nth_fc_event", FT_UINT8, BASE_DEC, VALS(recv_opt_nth_fc_event), 0x20, NULL, HFILL }},
5109 /* J1939 options */
5110 { &hf_gryphon_usdt_length_options_flags,
5111 { "Length options", "gryphon.usdt.length_options_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
5112 NULL, HFILL }},
5113 /* bit 6 */
5114 { &hf_gryphon_usdt_length_control_j1939,
5115 { "Length control bit", "gryphon.usdt.length_options_flags.j1939", FT_UINT8, BASE_DEC, VALS(recv_opt_j1939), 0x40, NULL, HFILL }},
5117 /* 20171013 */
5118 { &hf_gryphon_usdt_stmin_fc,
5119 { "STMIN flow control time (milliseconds)", "gryphon.usdt.set_stmin_fc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
5120 { &hf_gryphon_usdt_set_stmin_mul,
5121 { "STMIN multiplier", "gryphon.usdt.set_stmin_mul", FT_FLOAT, BASE_NONE, NULL, 0x0,
5122 NULL, HFILL }},
5123 { &hf_gryphon_usdt_bsmax_fc,
5124 { "Block size max for flow control", "gryphon.usdt.set_bsmax_fc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
5125 { &hf_gryphon_usdt_stmin_override,
5126 { "STMIN override time (milliseconds)", "gryphon.usdt.set_stmin_override", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
5127 { &hf_gryphon_usdt_stmin_override_active,
5128 { "STMIN override active", "gryphon.usdt.stmin_active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG,
5129 NULL, HFILL }},
5130 { &hf_gryphon_usdt_stmin_override_activate,
5131 { "STMIN override activate", "gryphon.usdt.stmin_active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG,
5132 NULL, HFILL }},
5134 { &hf_gryphon_usdt_receive_options_firstframe,
5135 { "Send a USDT_FIRSTFRAME event when the first frame of a multi-frame USDT message is received",
5136 "gryphon.usdt.receive_options_flags.firstframe", FT_BOOLEAN, 8, TFS(&yes_no), 0x04, NULL, HFILL }},
5137 { &hf_gryphon_usdt_receive_options_lastframe,
5138 { "Send a USDT_LASTFRAME event when the first frame of a multi-frame USDT message is received",
5139 "gryphon.usdt.receive_options_flags.lastframe", FT_BOOLEAN, 8, TFS(&yes_no), 0x08, NULL, HFILL }},
5140 { &hf_gryphon_usdt_ext_address,
5141 { "Using extended addressing for", "gryphon.usdt.ext_address", FT_UINT8, BASE_DEC, NULL, 0x0,
5142 NULL, HFILL }},
5143 { &hf_gryphon_usdt_ext_address_id,
5144 { "ID", "gryphon.usdt.ext_address.id", FT_UINT32, BASE_HEX, NULL, 0x0,
5145 NULL, HFILL }},
5146 { &hf_gryphon_usdt_block_size,
5147 { "Number of IDs in the block", "gryphon.usdt.block_size", FT_UINT32, BASE_DEC, NULL, 0x0,
5148 NULL, HFILL }},
5149 { &hf_gryphon_bits_in_input1,
5150 { "Input 1", "gryphon.bits_in.input1", FT_BOOLEAN, 8, TFS(&set_not_set), 0x01,
5151 NULL, HFILL }},
5152 { &hf_gryphon_bits_in_input2,
5153 { "Input 2", "gryphon.bits_in.input2", FT_BOOLEAN, 8, TFS(&set_not_set), 0x02,
5154 NULL, HFILL }},
5155 { &hf_gryphon_bits_in_input3,
5156 { "Input 3", "gryphon.bits_in.input3", FT_BOOLEAN, 8, TFS(&set_not_set), 0x04,
5157 NULL, HFILL }},
5158 { &hf_gryphon_bits_in_pushbutton,
5159 { "Pushbutton", "gryphon.bits_in.pushbutton", FT_BOOLEAN, 8, TFS(&set_not_set), 0x08,
5160 NULL, HFILL }},
5161 { &hf_gryphon_bits_out_output1,
5162 { "Input 1", "gryphon.bits_out.output1", FT_BOOLEAN, 8, TFS(&set_not_set), 0x01,
5163 NULL, HFILL }},
5164 { &hf_gryphon_bits_out_output2,
5165 { "Input 2", "gryphon.bits_out.output2", FT_BOOLEAN, 8, TFS(&set_not_set), 0x02,
5166 NULL, HFILL }},
5167 { &hf_gryphon_init_strat_reset_limit,
5168 { "Reset Limit", "gryphon.init_strat.reset_limit", FT_UINT32, BASE_DEC, NULL, 0x0,
5169 NULL, HFILL }},
5170 { &hf_gryphon_init_strat_delay,
5171 { "Delay", "gryphon.init_strat.strat_delay", FT_FLOAT, BASE_NONE, NULL, 0x0,
5172 NULL, HFILL }},
5173 { &hf_gryphon_speed_baud_rate_index,
5174 { "Baud rate index", "gryphon.speed.baud_rate_index", FT_UINT8, BASE_DEC, NULL, 0x0,
5175 NULL, HFILL }},
5176 { &hf_gryphon_filter_block_filter_start,
5177 { "Filter field starts at byte", "gryphon.filter_block.filter_start", FT_UINT16, BASE_DEC, NULL, 0x0,
5178 NULL, HFILL }},
5179 { &hf_gryphon_filter_block_filter_length,
5180 { "Filter field length", "gryphon.filter_block.filter_length", FT_UINT16, BASE_DEC, NULL, 0x0,
5181 NULL, HFILL }},
5182 { &hf_gryphon_filter_block_filter_type,
5183 { "Filtering on", "gryphon.filter_block.filter_type", FT_UINT8, BASE_DEC, VALS(filter_data_types), 0x0,
5184 NULL, HFILL }},
5185 { &hf_gryphon_filter_block_filter_operator,
5186 { "Type of comparison", "gryphon.filter_block.filter_operator", FT_UINT8, BASE_DEC, VALS(operators), 0x0,
5187 NULL, HFILL }},
5188 { &hf_gryphon_filter_block_filter_value1,
5189 { "Value", "gryphon.filter_block.filter_value", FT_UINT8, BASE_DEC, NULL, 0x0,
5190 NULL, HFILL }},
5191 { &hf_gryphon_filter_block_filter_value2,
5192 { "Value", "gryphon.filter_block.filter_value", FT_UINT16, BASE_DEC, NULL, 0x0,
5193 NULL, HFILL }},
5194 { &hf_gryphon_filter_block_filter_value4,
5195 { "Value", "gryphon.filter_block.filter_value", FT_UINT32, BASE_DEC, NULL, 0x0,
5196 NULL, HFILL }},
5197 { &hf_gryphon_filter_block_filter_value_bytes,
5198 { "Value", "gryphon.filter_block.filter_value_bytes", FT_BYTES, BASE_NONE, NULL, 0x0,
5199 NULL, HFILL }},
5200 { &hf_gryphon_blm_mode,
5201 { "Mode", "gryphon.blm_mode", FT_UINT32, BASE_DEC, VALS(blm_mode_vals), 0x0,
5202 NULL, HFILL }},
5203 { &hf_gryphon_blm_mode_avg_period,
5204 { "Averaging period", "gryphon.blm_mode.avg_period", FT_UINT32, BASE_DEC, NULL, 0x0,
5205 NULL, HFILL }},
5206 { &hf_gryphon_blm_mode_avg_frames,
5207 { "Averaging period (frames)", "gryphon.blm_mode.avg_frames", FT_UINT32, BASE_DEC, NULL, 0x0,
5208 NULL, HFILL }},
5209 { &hf_gryphon_command,
5210 { "Command", "gryphon.command", FT_UINT32, BASE_HEX|BASE_EXT_STRING, &cmd_vals_ext, 0x0,
5211 NULL, HFILL }},
5212 { &hf_gryphon_cmd_mode,
5213 { "Mode", "gryphon.command.mode", FT_UINT8, BASE_DEC, NULL, 0x0,
5214 NULL, HFILL }},
5215 { &hf_gryphon_option,
5216 { "Option", "gryphon.option", FT_UINT32, BASE_DEC, NULL, 0x0,
5217 NULL, HFILL }},
5218 { &hf_gryphon_option_data,
5219 { "Option data", "gryphon.option_data", FT_BYTES, BASE_NONE, NULL, 0x0,
5220 NULL, HFILL }},
5221 { &hf_gryphon_cmd_file,
5222 { "File", "gryphon.command.file", FT_UINT8, BASE_DEC, NULL, 0x0,
5223 NULL, HFILL }},
5224 { &hf_gryphon_bit_in_digital_data,
5225 { "Digital values set", "gryphon.bit_in_digital_data", FT_UINT8, BASE_HEX, NULL, 0x0,
5226 NULL, HFILL }},
5227 { &hf_gryphon_bit_out_digital_data,
5228 { "Digital values set", "gryphon.bit_out_digital_data", FT_UINT8, BASE_HEX, NULL, 0x0,
5229 NULL, HFILL }},
5230 { &hf_gryphon_filter_block_pattern,
5231 { "Pattern", "gryphon.filter_block.pattern", FT_BYTES, BASE_NONE, NULL, 0x0,
5232 NULL, HFILL }},
5233 { &hf_gryphon_filter_block_mask,
5234 { "Mask", "gryphon.filter_block.mask", FT_BYTES, BASE_NONE, NULL, 0x0,
5235 NULL, HFILL }},
5236 /* 20171012 USDT */
5237 { &hf_gryphon_usdt_nids,
5238 { "Number of IDs in block", "gryphon.nids", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
5240 { &hf_gryphon_usdt_request,
5241 { "USDT request IDs", "gryphon.usdt_request", FT_UINT32, BASE_HEX, NULL, 0x0,
5242 NULL, HFILL }},
5243 { &hf_gryphon_usdt_request_ext,
5244 { "USDT request extended address", "gryphon.usdt_request_ext", FT_UINT8, BASE_HEX, NULL, 0x0,
5245 NULL, HFILL }},
5246 { &hf_gryphon_usdt_response,
5247 { "USDT response IDs", "gryphon.usdt_response", FT_UINT32, BASE_HEX, NULL, 0x0,
5248 NULL, HFILL }},
5249 { &hf_gryphon_usdt_response_ext,
5250 { "USDT response extended address", "gryphon.usdt_response_ext", FT_UINT8, BASE_HEX, NULL, 0x0,
5251 NULL, HFILL }},
5252 { &hf_gryphon_uudt_response,
5253 { "UUDT response IDs", "gryphon.uudt_response", FT_UINT32, BASE_HEX, NULL, 0x0,
5254 NULL, HFILL }},
5255 { &hf_gryphon_uudt_response_ext,
5256 { "UUDT response extended address", "gryphon.uudt_response_ext", FT_UINT8, BASE_HEX, NULL, 0x0,
5257 NULL, HFILL }},
5258 { &hf_gryphon_more_filenames,
5259 { "More filenames to return", "gryphon.more_filenames", FT_BOOLEAN, BASE_NONE, TFS(&yes_no), 0x0,
5260 NULL, HFILL }},
5261 { &hf_gryphon_filenames,
5262 { "File and directory names", "gryphon.filenames", FT_STRING, BASE_NONE, NULL, 0x0,
5263 NULL, HFILL }},
5264 { &hf_gryphon_program_channel_number,
5265 { "Program channel number", "gryphon.program_channel_number", FT_UINT8, BASE_DEC, NULL, 0x0,
5266 NULL, HFILL }},
5267 { &hf_gryphon_valid_header_length,
5268 { "Valid Header length", "gryphon.valid_header_length", FT_UINT32, BASE_HEX, NULL, 0x0,
5269 NULL, HFILL }},
5272 static int *ett[] = {
5273 &ett_gryphon,
5274 &ett_gryphon_header,
5275 &ett_gryphon_body,
5276 &ett_gryphon_command_data,
5277 &ett_gryphon_response_data,
5278 &ett_gryphon_data_header,
5279 &ett_gryphon_flags,
5280 &ett_gryphon_data_body,
5281 &ett_gryphon_cmd_filter_block,
5282 &ett_gryphon_cmd_events_data,
5283 &ett_gryphon_cmd_config_device,
5284 &ett_gryphon_cmd_sched_data,
5285 &ett_gryphon_cmd_sched_cmd,
5286 &ett_gryphon_cmd_response_block,
5287 &ett_gryphon_pgm_list,
5288 &ett_gryphon_pgm_status,
5289 &ett_gryphon_pgm_options,
5290 &ett_gryphon_valid_headers,
5291 &ett_gryphon_usdt_data,
5292 &ett_gryphon_usdt_action_flags,
5293 &ett_gryphon_usdt_tx_options_flags,
5294 &ett_gryphon_usdt_rx_options_flags,
5295 &ett_gryphon_usdt_len_options_flags,
5296 &ett_gryphon_usdt_data_block,
5297 &ett_gryphon_lin_emulate_node,
5298 &ett_gryphon_ldf_block,
5299 &ett_gryphon_ldf_schedule_name,
5300 &ett_gryphon_lin_schedule_msg,
5301 &ett_gryphon_cnvt_getflags,
5302 &ett_gryphon_digital_data,
5303 &ett_gryphon_blm_mode
5306 static ei_register_info ei[] = {
5307 { &ei_gryphon_type,{ "gryphon.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid frame type", EXPFILL } },
5310 module_t *gryphon_module;
5311 expert_module_t* expert_gryphon;
5313 proto_gryphon = proto_register_protocol("DG Gryphon Protocol", "Gryphon", "gryphon");
5314 proto_register_field_array(proto_gryphon, hf, array_length(hf));
5315 proto_register_subtree_array(ett, array_length(ett));
5316 expert_gryphon = expert_register_protocol(proto_gryphon);
5317 expert_register_field_array(expert_gryphon, ei, array_length(ei));
5318 gryphon_handle = register_dissector("gryphon", dissect_gryphon, proto_gryphon);
5320 gryphon_module = prefs_register_protocol(proto_gryphon, NULL);
5321 prefs_register_bool_preference(gryphon_module, "desegment",
5322 "Desegment all Gryphon messages spanning multiple TCP segments",
5323 "Whether the Gryphon dissector should desegment all messages spanning multiple TCP segments",
5324 &gryphon_desegment);
5328 void
5329 proto_reg_handoff_gryphon(void)
5331 dissector_add_uint_with_preference("tcp.port", GRYPHON_TCP_PORT, gryphon_handle);
5335 * Editor modelines - https://www.wireshark.org/tools/modelines.html
5337 * Local variables:
5338 * c-basic-offset: 4
5339 * tab-width: 8
5340 * indent-tabs-mode: nil
5341 * End:
5343 * vi: set shiftwidth=4 tabstop=8 expandtab:
5344 * :indentSize=4:tabSize=8:noTabs=true: