nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* packet-gryphon.c
2 * Routines for Gryphon protocol packet disassembly
3 * By Steve Limkemann <stevelim@dgtech.com>
4 * Copyright 1998 Steve Limkemann
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 */
24  
25 #include "config.h"
26  
27 #include <epan/packet.h>
28 #include <epan/prefs.h>
29 #include <epan/dissectors/packet-tcp.h>
30 #include "packet-gryphon.h"
31  
32 /*
33 * See
34 *
35 * http://www.dgtech.com/gryphon/sys/www/docs/html/
36 */
37  
38 void proto_register_gryphon(void);
39 void proto_reg_handoff_gryphon(void);
40  
41 static int proto_gryphon = -1;
42  
43 static int hf_gryphon_src = -1;
44 static int hf_gryphon_srcchan = -1;
45 static int hf_gryphon_dest = -1;
46 static int hf_gryphon_destchan= -1;
47 static int hf_gryphon_type = -1;
48 static int hf_gryphon_cmd = -1;
49 static int hf_gryphon_data = -1;
50 static int hf_gryphon_data_length = -1;
51 static int hf_gryphon_reserved = -1;
52 static int hf_gryphon_padding = -1;
53 static int hf_gryphon_ignored = -1;
54 static int hf_gryphon_wait_flags = -1;
55 static int hf_gryphon_wait_resp = -1;
56 static int hf_gryphon_wait_prev_resp = -1;
57 static int hf_gryphon_status = -1;
58 static int hf_gryphon_data_header_length = -1;
59 static int hf_gryphon_data_data_length = -1;
60 static int hf_gryphon_data_extra_data_length = -1;
61 static int hf_gryphon_data_mode = -1;
62 static int hf_gryphon_data_mode_transmitted = -1;
63 static int hf_gryphon_data_mode_receive = -1;
64 static int hf_gryphon_data_mode_local = -1;
65 static int hf_gryphon_data_mode_remote = -1;
66 static int hf_gryphon_data_mode_internal = -1;
67 static int hf_gryphon_data_priority = -1;
68 static int hf_gryphon_data_error_status = -1;
69 static int hf_gryphon_data_time = -1;
70 static int hf_gryphon_data_context = -1;
71 static int hf_gryphon_data_header_data = -1;
72 static int hf_gryphon_data_data = -1;
73 static int hf_gryphon_data_extra_data = -1;
74 static int hf_gryphon_data_padding = -1;
75 static int hf_gryphon_event_id = -1;
76 static int hf_gryphon_event_context = -1;
77 static int hf_gryphon_event_time = -1;
78 static int hf_gryphon_event_data = -1;
79 static int hf_gryphon_event_padding = -1;
80 static int hf_gryphon_misc_data = -1;
81 static int hf_gryphon_misc_padding = -1;
82 static int hf_gryphon_eventnum = -1;
83 static int hf_gryphon_resp_time = -1;
84 static int hf_gryphon_setfilt = -1;
85 static int hf_gryphon_setfilt_length = -1;
86 static int hf_gryphon_setfilt_discard_data = -1;
87 static int hf_gryphon_setfilt_padding = -1;
88 static int hf_gryphon_ioctl = -1;
89 static int hf_gryphon_ioctl_data = -1;
90 static int hf_gryphon_addfilt_pass = -1;
91 static int hf_gryphon_addfilt_active = -1;
92 static int hf_gryphon_addfilt_blocks = -1;
93 static int hf_gryphon_addfilt_handle = -1;
94 static int hf_gryphon_modfilt = -1;
95 static int hf_gryphon_modfilt_action = -1;
96 static int hf_gryphon_filthan = -1;
97 static int hf_gryphon_filthan_id = -1;
98 static int hf_gryphon_filthan_padding = -1;
99 static int hf_gryphon_dfiltmode = -1;
100 static int hf_gryphon_filtmode = -1;
101 static int hf_gryphon_event_name = -1;
102 static int hf_gryphon_register_username = -1;
103 static int hf_gryphon_register_password = -1;
104 static int hf_gryphon_register_client_id = -1;
105 static int hf_gryphon_register_privileges = -1;
106 static int hf_gryphon_getspeeds_set_ioctl = -1;
107 static int hf_gryphon_getspeeds_get_ioctl = -1;
108 static int hf_gryphon_getspeeds_size = -1;
109 static int hf_gryphon_getspeeds_preset = -1;
110 static int hf_gryphon_getspeeds_data = -1;
111 static int hf_gryphon_cmd_sort = -1;
112 static int hf_gryphon_cmd_optimize = -1;
113 static int hf_gryphon_config_device_name = -1;
114 static int hf_gryphon_config_device_version = -1;
115 static int hf_gryphon_config_device_serial_number = -1;
116 static int hf_gryphon_config_num_channels = -1;
117 static int hf_gryphon_config_name_version_ext = -1;
118 static int hf_gryphon_config_driver_name = -1;
119 static int hf_gryphon_config_driver_version = -1;
120 static int hf_gryphon_config_device_security = -1;
121 static int hf_gryphon_config_max_data_length = -1;
122 static int hf_gryphon_config_min_data_length = -1;
123 static int hf_gryphon_config_hardware_serial_number = -1;
124 static int hf_gryphon_config_protocol_type = -1;
125 static int hf_gryphon_config_channel_id = -1;
126 static int hf_gryphon_config_card_slot_number = -1;
127 static int hf_gryphon_config_max_extra_data = -1;
128 static int hf_gryphon_config_min_extra_data = -1;
129 static int hf_gryphon_sched_num_iterations = -1;
130 static int hf_gryphon_sched_flags = -1;
131 static int hf_gryphon_sched_flags_scheduler = -1;
132 static int hf_gryphon_sched_sleep = -1;
133 static int hf_gryphon_sched_transmit_count = -1;
134 static int hf_gryphon_sched_transmit_period = -1;
135 static int hf_gryphon_sched_transmit_flags = -1;
136 static int hf_gryphon_sched_skip_transmit_period = -1;
137 static int hf_gryphon_sched_skip_sleep = -1;
138 static int hf_gryphon_sched_channel = -1;
139 static int hf_gryphon_sched_rep_id = -1;
140 static int hf_gryphon_sched_rep_message_index = -1;
141 static int hf_gryphon_blm_data_time = -1;
142 static int hf_gryphon_blm_data_bus_load = -1;
143 static int hf_gryphon_blm_data_current_bus_load = -1;
144 static int hf_gryphon_blm_data_peak_bus_load = -1;
145 static int hf_gryphon_blm_data_historic_peak_bus_load = -1;
146 static int hf_gryphon_blm_stat_receive_frame_count = -1;
147 static int hf_gryphon_blm_stat_transmit_frame_count = -1;
148 static int hf_gryphon_blm_stat_receive_dropped_frame_count = -1;
149 static int hf_gryphon_blm_stat_transmit_dropped_frame_count = -1;
150 static int hf_gryphon_blm_stat_receive_error_count = -1;
151 static int hf_gryphon_blm_stat_transmit_error_count = -1;
152 static int hf_gryphon_addresp_flags = -1;
153 static int hf_gryphon_addresp_flags_active = -1;
154 static int hf_gryphon_addresp_blocks = -1;
155 static int hf_gryphon_addresp_responses = -1;
156 static int hf_gryphon_addresp_old_handle = -1;
157 static int hf_gryphon_addresp_action = -1;
158 static int hf_gryphon_addresp_action_period = -1;
159 static int hf_gryphon_addresp_action_deact_on_event = -1;
160 static int hf_gryphon_addresp_action_deact_after_period = -1;
161 static int hf_gryphon_addresp_action_period_type = -1;
162 static int hf_gryphon_addresp_handle = -1;
163 static int hf_gryphon_modresp_handle = -1;
164 static int hf_gryphon_modresp_action = -1;
165 static int hf_gryphon_num_resphan = -1;
166 static int hf_gryphon_handle = -1;
167 static int hf_gryphon_transmit_sched_id = -1;
168 static int hf_gryphon_desc_program_size = -1;
169 static int hf_gryphon_desc_program_name = -1;
170 static int hf_gryphon_desc_program_description = -1;
171 static int hf_gryphon_desc_flags = -1;
172 static int hf_gryphon_desc_flags_program = -1;
173 static int hf_gryphon_desc_handle = -1;
174 static int hf_gryphon_upload_block_number = -1;
175 static int hf_gryphon_upload_handle = -1;
176 static int hf_gryphon_upload_data = -1;
177 static int hf_gryphon_delete = -1;
178 static int hf_gryphon_list_block_number = -1;
179 static int hf_gryphon_list_num_programs = -1;
180 static int hf_gryphon_list_num_remain_programs = -1;
181 static int hf_gryphon_list_name = -1;
182 static int hf_gryphon_list_description = -1;
183 static int hf_gryphon_start_arguments = -1;
184 static int hf_gryphon_start_channel = -1;
185 static int hf_gryphon_status_num_running_copies = -1;
186 static int hf_gryphon_options_handle = -1;
187 static int hf_gryphon_files = -1;
188 static int hf_gryphon_usdt_flags_register = -1;
189 static int hf_gryphon_usdt_action_flags = -1;
190 static int hf_gryphon_usdt_action_flags_register = -1;
191 static int hf_gryphon_usdt_action_flags_action = -1;
192 static int hf_gryphon_usdt_transmit_options_flags = -1;
193 static int hf_gryphon_usdt_transmit_options_flags_echo = -1;
194 static int hf_gryphon_usdt_transmit_options_action = -1;
195 static int hf_gryphon_usdt_transmit_options_send_done = -1;
196 static int hf_gryphon_usdt_receive_options_flags = -1;
197 static int hf_gryphon_usdt_receive_options_action = -1;
198 static int hf_gryphon_usdt_receive_options_firstframe = -1;
199 static int hf_gryphon_usdt_receive_options_lastframe = -1;
200 static int hf_gryphon_usdt_ext_address = -1;
201 static int hf_gryphon_usdt_ext_address_id = -1;
202 static int hf_gryphon_usdt_block_size = -1;
203 static int hf_gryphon_bits_in_input1 = -1;
204 static int hf_gryphon_bits_in_input2 = -1;
205 static int hf_gryphon_bits_in_input3 = -1;
206 static int hf_gryphon_bits_in_pushbutton = -1;
207 static int hf_gryphon_bits_out_output1 = -1;
208 static int hf_gryphon_bits_out_output2 = -1;
209 static int hf_gryphon_init_strat_reset_limit = -1;
210 static int hf_gryphon_init_strat_delay = -1;
211 static int hf_gryphon_speed_baud_rate_index = -1;
212 static int hf_gryphon_filter_block_filter_start = -1;
213 static int hf_gryphon_filter_block_filter_length = -1;
214 static int hf_gryphon_filter_block_filter_type = -1;
215 static int hf_gryphon_filter_block_filter_operator = -1;
216 static int hf_gryphon_filter_block_filter_value1 = -1;
217 static int hf_gryphon_filter_block_filter_value2 = -1;
218 static int hf_gryphon_filter_block_filter_value4 = -1;
219 static int hf_gryphon_filter_block_filter_value_bytes = -1;
220 static int hf_gryphon_blm_mode = -1;
221 static int hf_gryphon_blm_mode_avg_period = -1;
222 static int hf_gryphon_blm_mode_avg_frames = -1;
223 static int hf_gryphon_command = -1;
224 static int hf_gryphon_cmd_mode = -1;
225 static int hf_gryphon_option = -1;
226 static int hf_gryphon_option_data = -1;
227 static int hf_gryphon_cmd_file = -1;
228 static int hf_gryphon_bit_in_digital_data = -1;
229 static int hf_gryphon_bit_out_digital_data = -1;
230 static int hf_gryphon_filter_block_pattern = -1;
231 static int hf_gryphon_filter_block_mask = -1;
232 static int hf_gryphon_usdt_request = -1;
233 static int hf_gryphon_usdt_response = -1;
234 static int hf_gryphon_uudt_response = -1;
235 static int hf_gryphon_more_filenames = -1;
236 static int hf_gryphon_filenames = -1;
237 static int hf_gryphon_program_channel_number = -1;
238 static int hf_gryphon_valid_header_length = -1;
239  
240 static gint ett_gryphon = -1;
241 static gint ett_gryphon_header = -1;
242 static gint ett_gryphon_body = -1;
243 static gint ett_gryphon_command_data = -1;
244 static gint ett_gryphon_response_data = -1;
245 static gint ett_gryphon_data_header = -1;
246 static gint ett_gryphon_flags = -1;
247 static gint ett_gryphon_data_body = -1;
248 static gint ett_gryphon_cmd_filter_block = -1;
249 static gint ett_gryphon_cmd_events_data = -1;
250 static gint ett_gryphon_cmd_config_device = -1;
251 static gint ett_gryphon_cmd_sched_data = -1;
252 static gint ett_gryphon_cmd_sched_cmd = -1;
253 static gint ett_gryphon_cmd_response_block = -1;
254 static gint ett_gryphon_pgm_list = -1;
255 static gint ett_gryphon_pgm_status = -1;
256 static gint ett_gryphon_pgm_options = -1;
257 static gint ett_gryphon_valid_headers = -1;
258 static gint ett_gryphon_usdt_data = -1;
259 static gint ett_gryphon_usdt_data_block = -1;
260 static gint ett_gryphon_digital_data = -1;
261 static gint ett_gryphon_blm_mode = -1;
262  
263 /* desegmentation of Gryphon */
264 static gboolean gryphon_desegment = TRUE;
265  
266 static void dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo,
267 proto_tree *tree, gboolean is_msgresp_add);
268 static int decode_command(tvbuff_t*, int, int, proto_tree*);
269 static int decode_response(tvbuff_t*, int, int, proto_tree*);
270 static int decode_data(tvbuff_t*, int, proto_tree*);
271 static int decode_event(tvbuff_t*, int, proto_tree*);
272 static int decode_misc(tvbuff_t*, int, proto_tree*);
273 static int cmd_init(tvbuff_t*, int, proto_tree*);
274 static int resp_time(tvbuff_t*, int, proto_tree*);
275 static int cmd_setfilt(tvbuff_t*, int, proto_tree*);
276 static int cmd_ioctl(tvbuff_t*, int, proto_tree*);
277 static int cmd_addfilt(tvbuff_t*, int, proto_tree*);
278 static int resp_addfilt(tvbuff_t*, int, proto_tree*);
279 static int cmd_modfilt(tvbuff_t*, int, proto_tree*);
280 static int resp_filthan(tvbuff_t*, int, proto_tree*);
281 static int dfiltmode(tvbuff_t*, int, proto_tree*);
282 static int filtmode(tvbuff_t*, int, proto_tree*);
283 static int resp_events(tvbuff_t*, int, proto_tree*);
284 static int cmd_register(tvbuff_t*, int, proto_tree*);
285 static int resp_register(tvbuff_t*, int, proto_tree*);
286 static int resp_getspeeds(tvbuff_t*, int, proto_tree*);
287 static int cmd_sort(tvbuff_t*, int, proto_tree*);
288 static int cmd_optimize(tvbuff_t*, int, proto_tree*);
289 static int resp_config(tvbuff_t*, int, proto_tree*);
290 static int cmd_sched(tvbuff_t*, int, proto_tree*);
291 static int cmd_sched_rep(tvbuff_t*, int, proto_tree*);
292 static int resp_blm_data(tvbuff_t*, int, proto_tree*);
293 static int resp_blm_stat(tvbuff_t*, int, proto_tree*);
294 static int cmd_addresp(tvbuff_t*, int, proto_tree*);
295 static int resp_addresp(tvbuff_t*, int, proto_tree*);
296 static int cmd_modresp(tvbuff_t*, int, proto_tree*);
297 static int resp_resphan(tvbuff_t*, int, proto_tree*);
298 static int resp_sched(tvbuff_t*, int, proto_tree*);
299 static int cmd_desc(tvbuff_t*, int, proto_tree*);
300 static int resp_desc(tvbuff_t*, int, proto_tree*);
301 static int cmd_upload(tvbuff_t*, int, proto_tree*);
302 static int cmd_delete(tvbuff_t*, int, proto_tree*);
303 static int cmd_list(tvbuff_t*, int, proto_tree*);
304 static int resp_list(tvbuff_t*, int, proto_tree*);
305 static int cmd_start(tvbuff_t*, int, proto_tree*);
306 static int resp_start(tvbuff_t*, int, proto_tree*);
307 static int resp_status(tvbuff_t*, int, proto_tree*);
308 static int cmd_options(tvbuff_t*, int, proto_tree*);
309 static int cmd_files(tvbuff_t*, int, proto_tree*);
310 static int resp_files(tvbuff_t*, int, proto_tree*);
311 static int eventnum(tvbuff_t*, int, proto_tree*);
312 static int speed(tvbuff_t*, int, proto_tree*);
313 static int filter_block(tvbuff_t*, int, proto_tree*);
314 static int blm_mode(tvbuff_t*, int, proto_tree*);
315 static int cmd_usdt(tvbuff_t*, int, proto_tree*);
316 static int cmd_bits_in(tvbuff_t*, int, proto_tree*);
317 static int cmd_bits_out(tvbuff_t*, int, proto_tree*);
318 static int cmd_init_strat(tvbuff_t*, int, proto_tree*);
319  
320  
321  
322 static const value_string action_vals[] = {
323 { FR_RESP_AFTER_EVENT,
324 "Send response(s) for each conforming message" },
325 { FR_RESP_AFTER_PERIOD,
326 "Send response(s) after the specified period expires following a conforming message" },
327 { FR_IGNORE_DURING_PER,
328 "Send response(s) for a conforming message and ignore further messages until the specified period expires" },
329 { 0,
330 NULL }
331 };
332  
333 static const value_string deact_on_event_vals[] = {
334 { FR_DEACT_ON_EVENT,
335 "Deactivate this response for a conforming message" },
336 { FR_DELETE|FR_DEACT_ON_EVENT,
337 "Delete this response for a conforming message" },
338 { 0,
339 NULL }
340 };
341  
342 static const value_string deact_after_per_vals[] = {
343 { FR_DEACT_AFTER_PER,
344 "Deactivate this response after the specified period following a conforming message" },
345 { FR_DELETE|FR_DEACT_AFTER_PER,
346 "Delete this response after the specified period following a conforming message" },
347 { 0,
348 NULL }
349 };
350  
351 static const value_string cmd_optimize_type[] = {
352 {0, "Optimize for throughput (Nagle algorithm enabled)"},
353 {1, "Optimize for latency (Nagle algorithm disabled)"},
354 {0, NULL}
355 };
356  
357 static const value_string usdt_action_vals[] = {
358 { 0, "Use 11 bit headers only" },
359 { 1, "Use 29 bit headers only" },
360 { 2, "Use both 11 & 29 bit headers" },
361 { 3, "undefined" },
362 { 0, NULL }
363 };
364  
365 static const value_string xmit_opt_vals[] = {
366 { 0, "Pad messages with less than 8 data bytes with 0x00's" },
367 { 1, "Pad messages with less than 8 data bytes with 0xFF's" },
368 { 2, "Do not pad messages with less than 8 data bytes" },
369 { 3, "undefined" },
370 { 0, NULL }
371 };
372  
373 static const value_string recv_opt_vals[] = {
374 { 0, "Do not verify the integrity of long received messages and do not send them to the client" },
375 { 1, "Verify the integrity of long received messages and send them to the client" },
376 { 2, "Verify the integrity of long received messages but do not send them to the client" },
377 { 3, "undefined" },
378 { 0, NULL }
379 };
380  
381 static const value_string register_unregister [] = {
382 { 0, "Unregister" },
383 { 1, "Register" },
384 { 0, NULL }
385 };
386  
387 static const value_string blm_mode_vals[] = {
388 { 0, "Off" },
389 { 1, "Average over time" },
390 { 2, "Average over frame count" },
391 { 0, NULL }
392 };
393  
394 static const value_string dmodes[] = {
395 {DEFAULT_FILTER_BLOCK, "Block"},
396 {DEFAULT_FILTER_PASS, "Pass"},
397 {0, NULL},
398 };
399  
400 static const value_string frame_type[] = {
401 {0, ""},
402 {1, "Command request"},
403 {2, "Command response"},
404 {3, "Network (vehicle) data"},
405 {4, "Event"},
406 {5, "Miscellaneous"},
407 {6, "Text string"},
408 {0, NULL}
409 };
410  
411 static const value_string src_dest[] = {
412 {SD_CARD, "Card"},
413 {SD_SERVER, "Server"},
414 {SD_CLIENT, "Client"},
415 {SD_SCHED, "Scheduler"},
416 {SD_SCRIPT, "Script Processor"},
417 {SD_PGM, "Program Loader"},
418 {SD_USDT, "USDT Server"},
419 {SD_BLM, "Bus Load Monitoring"},
420 {SD_FLIGHT, "Flight Recorder"},
421 {SD_RESP, "Message Responder"},
422 {SD_IOPWR, "I/O and power"},
423 {SD_UTIL, "Utility/Miscellaneous"},
424 {0, NULL}
425 };
426  
427  
428 static const val_str_dsp cmds[] = {
429 {CMD_INIT, "Initialize" , cmd_init , NULL},
430 {CMD_GET_STAT, "Get status" , NULL , NULL},
431 {CMD_GET_CONFIG, "Get configuration" , NULL , resp_config},
432 {CMD_EVENT_ENABLE, "Enable event" , eventnum , NULL},
433 {CMD_EVENT_DISABLE, "Disable event" , eventnum , NULL},
434 {CMD_GET_TIME, "Get time" , NULL , resp_time},
435 {CMD_SET_TIME, "Set time" , resp_time , NULL},
436 {CMD_GET_RXDROP, "Get number of dropped RX messages" , NULL , NULL},
437 {CMD_RESET_RXDROP, "Clear number of dropped RX messages" , NULL , NULL},
438 {CMD_BCAST_ON, "Set broadcasts on" , NULL , NULL},
439 {CMD_BCAST_OFF, "Set broadcasts off" , NULL , NULL},
440 {CMD_CARD_SET_SPEED, "Set channel baud rate" , speed , NULL},
441 {CMD_CARD_GET_SPEED, "Get channel baud rate" , NULL , speed},
442 {CMD_CARD_SET_FILTER, "Set filter (deprecated)" , cmd_setfilt , NULL},
443 {CMD_CARD_GET_FILTER, "Get filter" , resp_addfilt , cmd_addfilt},
444 {CMD_CARD_TX, "Transmit message" , decode_data , NULL},
445 {CMD_CARD_TX_LOOP_ON, "Set transmit loopback on" , NULL , NULL},
446 {CMD_CARD_TX_LOOP_OFF, "Set transmit loopback off" , NULL , NULL},
447 {CMD_CARD_IOCTL, "IOCTL pass-through" , cmd_ioctl , NULL},
448 {CMD_CARD_ADD_FILTER, "Add a filter" , cmd_addfilt , resp_addfilt},
449 {CMD_CARD_MODIFY_FILTER, "Modify a filter" , cmd_modfilt , NULL},
450 {CMD_CARD_GET_FILTER_HANDLES, "Get filter handles" , NULL , resp_filthan},
451 {CMD_CARD_SET_DEFAULT_FILTER, "Set default filter" , dfiltmode , NULL},
452 {CMD_CARD_GET_DEFAULT_FILTER, "Get default filter mode" , NULL , dfiltmode},
453 {CMD_CARD_SET_FILTER_MODE, "Set filter mode" , filtmode , NULL},
454 {CMD_CARD_GET_FILTER_MODE, "Get filter mode" , NULL , filtmode},
455 {CMD_CARD_GET_EVNAMES, "Get event names" , NULL , resp_events},
456 {CMD_CARD_GET_SPEEDS, "Get defined speeds" , NULL , resp_getspeeds},
457 {CMD_SERVER_REG, "Register with server" , cmd_register , resp_register},
458 {CMD_SERVER_SET_SORT, "Set the sorting behavior" , cmd_sort , NULL},
459 {CMD_SERVER_SET_OPT, "Set the type of optimization" , cmd_optimize , NULL},
460 {CMD_BLM_SET_MODE, "Set Bus Load Monitoring mode" , blm_mode , NULL},
461 {CMD_BLM_GET_MODE, "Get Bus Load Monitoring mode" , NULL , blm_mode},
462 {CMD_BLM_GET_DATA, "Get Bus Load data" , NULL , resp_blm_data},
463 {CMD_BLM_GET_STATS, "Get Bus Load statistics" , NULL , resp_blm_stat},
464 {CMD_FLIGHT_GET_CONFIG, "Get flight recorder channel info" , NULL , NULL},
465 {CMD_FLIGHT_START_MON, "Start flight recorder monitoring" , NULL , NULL},
466 {CMD_FLIGHT_STOP_MON, "Stop flight recorder monitoring" , NULL , NULL},
467 {CMD_MSGRESP_ADD, "Add response message" , cmd_addresp , resp_addresp},
468 {CMD_MSGRESP_GET, "Get response message" , resp_addresp , cmd_addresp},
469 {CMD_MSGRESP_MODIFY, "Modify response message state" , cmd_modresp , NULL},
470 {CMD_MSGRESP_GET_HANDLES, "Get response message handles" , NULL , resp_resphan},
471 {CMD_PGM_DESC, "Describe program to to uploaded" , cmd_desc , resp_desc},
472 {CMD_PGM_UPLOAD, "Upload a program to the Gryphon" , cmd_upload , NULL},
473 {CMD_PGM_DELETE, "Delete an uploaded program" , cmd_delete , NULL},
474 {CMD_PGM_LIST, "Get a list of uploaded programs" , cmd_list , resp_list},
475 {CMD_PGM_START, "Start an uploaded program" , cmd_start , resp_start},
476 {CMD_PGM_START2, "Start an uploaded program" , NULL , resp_start},
477 {CMD_PGM_STOP, "Stop an uploaded program" , resp_start , NULL},
478 {CMD_PGM_STATUS, "Get status of an uploaded program" , cmd_delete , resp_status},
479 {CMD_PGM_OPTIONS, "Set program upload options" , cmd_options , resp_status},
480 {CMD_PGM_FILES, "Get a list of files & directories" , cmd_files , resp_files},
481 {CMD_SCHED_TX, "Schedule transmission of messages" , cmd_sched , resp_sched},
482 {CMD_SCHED_KILL_TX, "Stop and destroy a message transmission" , resp_sched , NULL},
483 {CMD_SCHED_STOP_TX, "Kill a message transmission (deprecated)", resp_sched , NULL},
484 {CMD_SCHED_MSG_REPLACE, "Replace a scheduled message" , cmd_sched_rep , NULL},
485 {CMD_USDT_IOCTL, "Register/Unregister with USDT server" , cmd_usdt , NULL},
486 {CMD_USDT_REGISTER, "Register/Unregister with USDT server" , cmd_usdt , NULL},
487 {CMD_USDT_SET_FUNCTIONAL, "Set IDs to use extended addressing" , cmd_usdt , NULL},
488 {CMD_IOPWR_GETINP, "Read current digital inputs" , NULL , cmd_bits_in},
489 {CMD_IOPWR_GETLATCH, "Read latched digital inputs" , NULL , cmd_bits_in},
490 {CMD_IOPWR_CLRLATCH, "Read & clear latched digital inputs" , cmd_bits_in , cmd_bits_in},
491 {CMD_IOPWR_GETOUT, "Read digital outputs" , NULL , cmd_bits_out},
492 {CMD_IOPWR_SETOUT, "Write digital outputs" , cmd_bits_out , NULL},
493 {CMD_IOPWR_SETBIT, "Set indicated output bits" , cmd_bits_out , NULL},
494 {CMD_IOPWR_CLRBIT, "Clear indicated output bits" , cmd_bits_out , NULL},
495 {CMD_IOPWR_GETPOWER, "Read digital inputs at power on time" , NULL , cmd_bits_in},
496 {CMD_UTIL_SET_INIT_STRATEGY, "Set initialization strategy" , cmd_init_strat, NULL},
497 {CMD_UTIL_GET_INIT_STRATEGY, "Get initialization strategy" , NULL , cmd_init_strat},
498 {-1, "- unknown -" , NULL , NULL},
499 };
500  
501 static const value_string responses_vs[] = {
502 {RESP_OK, "OK - no error"},
503 {RESP_UNKNOWN_ERR, "Unknown error"},
504 {RESP_UNKNOWN_CMD, "Unrecognised command"},
505 {RESP_UNSUPPORTED, "Unsupported command"},
506 {RESP_INVAL_CHAN, "Invalid channel specified"},
507 {RESP_INVAL_DST, "Invalid destination"},
508 {RESP_INVAL_PARAM, "Invalid parameter(s)"},
509 {RESP_INVAL_MSG, "Invalid message"},
510 {RESP_INVAL_LEN, "Invalid length field"},
511 {RESP_TX_FAIL, "Transmit failed"},
512 {RESP_RX_FAIL, "Receive failed"},
513 {RESP_AUTH_FAIL, "Authorization failed"},
514 {RESP_MEM_ALLOC_ERR, "Memory allocation error"},
515 {RESP_TIMEOUT, "Command timed out"},
516 {RESP_UNAVAILABLE, "Unavailable"},
517 {RESP_BUF_FULL, "Buffer full"},
518 {RESP_NO_SUCH_JOB, "No such job"},
519 {0, NULL},
520 };
521  
522 static const value_string filter_data_types[] = {
523 {FILTER_DATA_TYPE_HEADER_FRAME, "frame header"},
524 {FILTER_DATA_TYPE_HEADER, "data message header"},
525 {FILTER_DATA_TYPE_DATA, "data message data"},
526 {FILTER_DATA_TYPE_EXTRA_DATA, "data message extra data"},
527 {FILTER_EVENT_TYPE_HEADER, "event message header"},
528 {FILTER_EVENT_TYPE_DATA, "event message"},
529 {0, NULL},
530 };
531  
532 static const value_string operators[] = {
533 {BIT_FIELD_CHECK, "Bit field check"},
534 {SVALUE_GT, "Greater than (signed)"},
535 {SVALUE_GE, "Greater than or equal to (signed)"},
536 {SVALUE_LT, "Less than (signed)"},
537 {SVALUE_LE, "Less than or equal to (signed)"},
538 {VALUE_EQ, "Equal to"},
539 {VALUE_NE, "Not equal to"},
540 {UVALUE_GT, "Greater than (unsigned)"},
541 {UVALUE_GE, "Greater than or equal to (unsigned)"},
542 {UVALUE_LT, "Less than (unsigned)"},
543 {UVALUE_LE, "Less than or equal to (unsigned)"},
544 {DIG_LOW_TO_HIGH, "Digital, low to high transistion"},
545 {DIG_HIGH_TO_LOW, "Digital, high to low transistion"},
546 {DIG_TRANSITION, "Digital, change of state"},
547 {0, NULL},
548 };
549  
550 static const value_string modes[] = {
551 {FILTER_OFF_PASS_ALL, "Filter off, pass all messages"},
552 {FILTER_OFF_BLOCK_ALL, "Filter off, block all messages"},
553 {FILTER_ON, "Filter on"},
554 {0, NULL},
555 };
556  
557 static const value_string filtacts[] = {
558 {DELETE_FILTER, "Delete"},
559 {ACTIVATE_FILTER, "Activate"},
560 {DEACTIVATE_FILTER, "Deactivate"},
561 {0, NULL},
562 };
563  
564 static const value_string ioctls[] = {
565 {GINIT, "GINIT: Initialize"},
566 {GLOOPON, "GLOOPON: Loop on"},
567 {GLOOPOFF, "GLOOPOFF: Loop off"},
568 {GGETHWTYPE, "GGETHWTYPE: Get hardware type"},
569 {GGETREG, "GGETREG: Get register"},
570 {GSETREG, "GSETREG: Set register"},
571 {GGETRXCOUNT, "GGETRXCOUNT: Get the receive message counter"},
572 {GSETRXCOUNT, "GSETRXCOUNT: Set the receive message counter"},
573 {GGETTXCOUNT, "GGETTXCOUNT: Get the transmit message counter"},
574 {GSETTXCOUNT, "GSETTXCOUNT: Set the transmit message counter"},
575 {GGETRXDROP, "GGETRXDROP: Get the number of dropped receive messages"},
576 {GSETRXDROP, "GSETRXDROP: Set the number of dropped receive messages"},
577 {GGETTXDROP, "GGETTXDROP: Get the number of dropped transmit messages"},
578 {GSETTXDROP, "GSETTXDROP: Set the number of dropped transmit messages"},
579 {GGETRXBAD, "GGETRXBAD: Get the number of bad receive messages"},
580 {GGETTXBAD, "GGETTXBAD: Get the number of bad transmit messages"},
581 {GGETCOUNTS, "GGETCOUNTS: Get total message counter"},
582 {GGETBLMON, "GGETBLMON: Get bus load monitoring status"},
583 {GSETBLMON, "GSETBLMON: Set bus load monitoring status (turn on/off)"},
584 {GGETERRLEV, "GGETERRLEV: Get error level"},
585 {GSETERRLEV, "GSETERRLEV: Set error level"},
586 {GGETBITRATE, "GGETBITRATE: Get bit rate"},
587 {GGETRAM, "GGETRAM: Read value from RAM"},
588 {GSETRAM, "GSETRAM: Write value to RAM"},
589 {GCANGETBTRS, "GCANGETBTRS: Read CAN bit timing registers"},
590 {GCANSETBTRS, "GCANSETBTRS: Write CAN bit timing registers"},
591 {GCANGETBC, "GCANGETBC: Read CAN bus configuration register"},
592 {GCANSETBC, "GCANSETBC: Write CAN bus configuration register"},
593 {GCANGETMODE, "GCANGETMODE"},
594 {GCANSETMODE, "GCANSETMODE"},
595 {GCANGETTRANS, "GCANGETTRANS"},
596 {GCANSETTRANS, "GCANSETTRANS"},
597 {GCANSENDERR, "GCANSENDERR"},
598 {GCANRGETOBJ, "GCANRGETOBJ"},
599 {GCANRSETSTDID, "GCANRSETSTDID"},
600 {GCANRSETEXTID, "GCANRSETEXTID"},
601 {GCANRSETDATA, "GCANRSETDATA"},
602 {GCANRENABLE, "GCANRENABLE"},
603 {GCANRDISABLE, "GCANRDISABLE"},
604 {GCANRGETMASKS, "GCANRGETMASKS"},
605 {GCANRSETMASKS, "GCANRSETMASKS"},
606 {GCANSWGETMODE, "GCANSWGETMODE"},
607 {GCANSWSETMODE, "GCANSWSETMODE"},
608 {GDLCGETFOURX, "GDLCGETFOURX"},
609 {GDLCSETFOURX, "GDLCSETFOURX"},
610 {GDLCGETLOAD, "GDLCGETLOAD"},
611 {GDLCSETLOAD, "GDLCSETLOAD"},
612 {GDLCSENDBREAK, "GDLCSENDBREAK"},
613 {GDLCABORTTX, "GDLCABORTTX"},
614 {GDLCGETHDRMODE, "DLCGETHDRMODE"},
615 {GDLCSETHDRMODE, "GDLCSETHDRMODE"},
616 {GHONSLEEP, "GHONSLEEP"},
617 {GHONSILENCE, "GHONSILENCE"},
618 {GKWPSETPTIMES, "GKWPSETPTIMES"},
619 {GKWPSETWTIMES, "GKWPSETWTIMES"},
620 {GKWPDOWAKEUP, "GKWPDOWAKEUP"},
621 {GKWPGETBITTIME, "GKWPGETBITTIME"},
622 {GKWPSETBITTIME, "GKWPSETBITTIME"},
623 {GKWPSETNODEADDR, "GKWPSETNODEADDR"},
624 {GKWPGETNODETYPE, "GKWPGETNODETYPE"},
625 {GKWPSETNODETYPE, "GKWPSETNODETYPE"},
626 {GKWPSETWAKETYPE, "GKWPSETWAKETYPE"},
627 {GKWPSETTARGADDR, "GKWPSETTARGADDR"},
628 {GKWPSETKEYBYTES, "GKWPSETKEYBYTES"},
629 {GKWPSETSTARTREQ, "GKWPSETSTARTREQ"},
630 {GKWPSETSTARTRESP, "GKWPSETSTARTRESP"},
631 {GKWPSETPROTOCOL, "GKWPSETPROTOCOL"},
632 {GKWPGETLASTKEYBYTES, "GKWPGETLASTKEYBYTES"},
633 {GKWPSETLASTKEYBYTES, "GKWPSETLASTKEYBYTES"},
634 {GSCPGETBBR, "GSCPGETBBR"},
635 {GSCPSETBBR, "GSCPSETBBR"},
636 {GSCPGETID, "GSCPGETID"},
637 {GSCPSETID, "GSCPSETID"},
638 {GSCPADDFUNCID, "GSCPADDFUNCID"},
639 {GSCPCLRFUNCID, "GSCPCLRFUNCID"},
640 {GUBPGETBITRATE, "GUBPGETBITRATE"},
641 {GUBPSETBITRATE, "GUBPSETBITRATE"},
642 {GUBPGETINTERBYTE, "GUBPGETINTERBYTE"},
643 {GUBPSETINTERBYTE, "GUBPSETINTERBYTE"},
644 {GUBPGETNACKMODE, "GUBPGETNACKMODE"},
645 {GUBPSETNACKMODE, "GUBPSETNACKMODE"},
646 {GUBPGETRETRYDELAY, "GUBPGETRETRYDELAY"},
647 {GUBPSETRETRYDELAY, "GUBPSETRETRYDELAY"},
648 {GRESETHC08, "GRESETHC08: Reset the HC08 processor"},
649 {GTESTHC08COP, "GTESTHC08COP: Stop updating the HC08 watchdog timer"},
650 {GSJAGETLISTEN, "GSJAGETLISTEN"},
651 {GSJASETLISTEN, "GSJASETLISTEN"},
652 {GSJAGETSELFTEST, "GSJAGETSELFTEST"},
653 {GSJASETSELFTEST, "GSJASETSELFTEST"},
654 {GSJAGETXMITONCE, "GSJAGETXMITONCE"},
655 {GSJASETXMITONCE, "GSJASETXMITONCE"},
656 {GSJAGETTRIGSTATE, "GSJAGETTRIGSTATE"},
657 {GSJASETTRIGCTRL, "GSJASETTRIGCTRL"},
658 {GSJAGETTRIGCTRL, "GSJAGETTRIGCTRL"},
659 {GSJAGETOUTSTATE, "GSJAGETOUTSTATE"},
660 {GSJASETOUTSTATE, "GSJASETOUTSTATE"},
661 {GSJAGETFILTER, "GSJAGETFILTER"},
662 {GSJASETFILTER, "GSJASETFILTER"},
663 {GSJAGETMASK, "GSJAGETMASK"},
664 {GSJASETMASK, "GSJASETMASK"},
665 {GSJAGETINTTERM, "GSJAGETINTTERM"},
666 {GSJASETINTTERM, "GSJASETINTTERM"},
667 {GSJAGETFTTRANS, "GSJAGETFTTRANS"},
668 {GSJASETFTTRANS, "GSJASETFTTRANS"},
669 {GSJAGETFTERROR, "GSJAGETFTERROR"},
670 {GLINGETBITRATE, "GLINGETBITRATE: Get the current bit rate"},
671 {GLINSETBITRATE, "GLINSETBITRATE: Set the bit rate"},
672 {GLINGETBRKSPACE, "GLINGETBRKSPACE"},
673 {GLINSETBRKSPACE, "GLINSETBRKSPACE"},
674 {GLINGETBRKMARK, "GLINGETBRKMARK"},
675 {GLINSETBRKMARK, "GLINSETBRKMARK"},
676 {GLINGETIDDELAY, "GLINGETIDDELAY"},
677 {GLINSETIDDELAY, "GLINSETIDDELAY"},
678 {GLINGETRESPDELAY, "GLINGETRESPDELAY"},
679 {GLINSETRESPDELAY, "GLINSETRESPDELAY"},
680 {GLINGETINTERBYTE, "GLINGETINTERBYTE"},
681 {GLINSETINTERBYTE, "GLINSETINTERBYTE"},
682 {GLINGETWAKEUPDELAY, "GLINGETWAKEUPDELAY"},
683 {GLINSETWAKEUPDELAY, "GLINSETWAKEUPDELAY"},
684 {GLINGETWAKEUPTIMEOUT, "GLINGETWAKEUPTIMEOUT"},
685 {GLINSETWAKEUPTIMEOUT, "GLINSETWAKEUPTIMEOUT"},
686 {GLINGETWUTIMOUT3BR, "GLINGETWUTIMOUT3BR"},
687 {GLINSETWUTIMOUT3BR, "GLINSETWUTIMOUT3BR"},
688 {GLINSENDWAKEUP, "GLINSENDWAKEUP"},
689 {GLINGETMODE, "GLINGETMODE"},
690 {GLINSETMODE, "GLINSETMODE"},
691 {GINPGETINP, "GINPGETINP: Read current digital inputs"},
692 {GINPGETLATCH, "GINPGETLATCH: Read latched digital inputs"},
693 {GINPCLRLATCH, "GINPCLRLATCH: Read and clear latched digital inputs"},
694 {GOUTGET, "GOUTGET: Read digital outputs"},
695 {GOUTSET, "GOUTSET: Write digital outputs"},
696 {GOUTSETBIT, "GOUTSETBIT: Set digital output bits"},
697 {GOUTCLEARBIT, "GOUTCLEARBIT"},
698 {GPWRGETWHICH, "GPWRGETWHICH"},
699 {GPWROFF, "GPWROFF"},
700 {GPWROFFRESET, "GPWROFFRESET"},
701 {GPWRRESET, "GPWRRESET"},
702 {0, NULL},
703 };
704  
705  
706 static const value_string cmd_sort_type[] = {
707 {0, "Do not sort messages"},
708 {1, "Sort into blocks of up to 16 messages"},
709 {0, NULL}
710 };
711  
712 static const value_string protocol_types[] = {
713 {GDUMMY * 256 + GDGDMARKONE, "Dummy device driver"},
714 {GCAN * 256 + G82527, "CAN, 82527 subtype"},
715 {GCAN * 256 + GSJA1000, "CAN, SJA1000 subtype"},
716 {GCAN * 256 + G82527SW, "CAN, 82527 single wire subtype"},
717 {GCAN * 256 + G82527ISO11992, "CAN, 82527 ISO11992 subtype"},
718 {GCAN * 256 + G82527_SINGLECHAN, "CAN, Fiber Optic 82527 subtype"},
719 {GCAN * 256 + G82527SW_SINGLECHAN, "CAN, Fiber Optic 82527 single wire subtype"},
720 {GCAN * 256 + G82527ISO11992_SINGLECHAN, "CAN, Fiber Optic ISO11992 subtype"},
721 {GCAN * 256 + GSJA1000FT, "CAN, SJA1000 Fault Tolerant subtype"},
722 {GCAN * 256 + GSJA1000C, "CAN, SJA1000 onboard subtype"},
723 {GCAN * 256 + GSJA1000FT_FO, "CAN, SJA1000 Fiber Optic Fault Tolerant subtype"},
724 {GJ1850 * 256 + GHBCCPAIR, "J1850, HBCC subtype"},
725 {GJ1850 * 256 + GDLC, "J1850, GM DLC subtype"},
726 {GJ1850 * 256 + GCHRYSLER, "J1850, Chrysler subtype"},
727 {GJ1850 * 256 + GDEHC12, "J1850, DE HC12 KWP/BDLC subtype"},
728 {GKWP2000 * 256 + GDEHC12KWP, "Keyword protocol 2000/ISO 9141"},
729 {GHONDA * 256 + GDGHC08, "Honda UART, DG HC08 subtype"},
730 {GFORDUBP * 256 + GDGUBP08, "Ford UBP, DG HC08 subtype"},
731 {GSCI * 256 + G16550SCI, "Chrysler SCI, UART subtype"},
732 {GCCD * 256 + G16550CDP68HC68, "Chrysler C2D, UART / CDP68HC68S1 subtype"},
733 {GLIN * 256 + GDGLIN08, "LIN, DG HC08 subtype"},
734 {0, NULL},
735 };
736  
737 static const true_false_string tfs_wait_response = { "Wait", "Don't Wait" };
738 static const true_false_string true_false = { "True", "False" };
739 static const true_false_string tfs_passed_blocked = { "Pass", "Block" };
740 static const true_false_string active_inactive = { "Active", "Inactive" };
741 static const true_false_string critical_normal = { "Critical", "Normal" };
742 static const true_false_string skip_not_skip = { "Skip", "Do not skip" };
743 static const true_false_string frames_01seconds = { "Frames", "0.01 seconds" };
744 static const true_false_string present_not_present = { "Present", "Not present" };
745 static const true_false_string yes_no = { "Yes", "No" };
746 static const true_false_string set_not_set = { "Set", "Not set" };
747  
748 /*
749 * Length of the frame header.
750 */
751 #define FRAME_HEADER_LEN 8
752  
753 static guint
754 get_gryphon_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
755 {
756 guint16 plen;
757 int padded_len;
758  
759 /*
760 * Get the length of the Gryphon packet, and then get the length as
761 * padded to a 4-byte boundary.
762 */
763 plen = tvb_get_ntohs(tvb, offset + 4);
764 padded_len = plen + 3 - (plen + 3) % 4;
765  
766 /*
767 * That length doesn't include the fixed-length part of the header;
768 * add that in.
769 */
770 return padded_len + FRAME_HEADER_LEN;
771 }
772  
773 static int
774 dissect_gryphon_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
775 {
776 dissect_gryphon_message(tvb, pinfo, tree, FALSE);
777 return tvb_reported_length(tvb);
778 }
779  
780 static int
781 dissect_gryphon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
782 {
783 tcp_dissect_pdus(tvb, pinfo, tree, gryphon_desegment, FRAME_HEADER_LEN,
784 get_gryphon_pdu_len, dissect_gryphon_pdu, data);
785 return tvb_reported_length(tvb);
786 }
787  
788 static void
789 dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
790 gboolean is_msgresp_add)
791 {
792 int offset = 0;
793 proto_tree *gryphon_tree;
794 proto_item *ti;
795 proto_tree *header_tree, *body_tree;
796 int msgend;
797 int msglen, msgpad;
798 unsigned int src, dest, i, frmtyp;
799 guint8 flags;
800  
801 if (!is_msgresp_add) {
802 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Gryphon");
803 col_clear(pinfo->cinfo, COL_INFO);
804 }
805  
806 if (!is_msgresp_add) {
807 ti = proto_tree_add_item(tree, proto_gryphon, tvb, 0, -1, ENC_NA);
808 gryphon_tree = proto_item_add_subtree(ti, ett_gryphon);
809 } else
810 gryphon_tree = tree;
811  
812 src = tvb_get_guint8(tvb, offset + 0);
813 dest = tvb_get_guint8(tvb, offset + 2);
814 msglen = tvb_get_ntohs(tvb, offset + 4);
815 flags = tvb_get_guint8(tvb, offset + 6);
816 frmtyp = flags & ~RESPONSE_FLAGS;
817  
818 if (!is_msgresp_add) {
819 /*
820 * This tvbuff includes padding to make its length a multiple
821 * of 4 bytes; set it to the actual length.
822 */
823 set_actual_length(tvb, msglen + FRAME_HEADER_LEN);
824  
825 /*
826 * Indicate what kind of message this is.
827 */
828 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(frmtyp, frame_type, "- Invalid -"));
829 }
830  
831 if (tree == NULL)
832 return;
833  
834 if (try_val_to_str(frmtyp, frame_type) == NULL) {
835 /*
836 * Unknown message type.
837 */
838 proto_tree_add_item(gryphon_tree, hf_gryphon_data, tvb, offset, msglen, ENC_NA);
839 return;
840 }
841  
842 header_tree = proto_tree_add_subtree(gryphon_tree, tvb, offset, MSG_HDR_SZ, ett_gryphon_header, NULL, "Header");
843  
844 proto_tree_add_item(header_tree, hf_gryphon_src, tvb, offset, 1, ENC_BIG_ENDIAN);
845 proto_tree_add_item(header_tree, hf_gryphon_srcchan, tvb, offset+1, 1, ENC_BIG_ENDIAN);
846  
847 proto_tree_add_item(header_tree, hf_gryphon_dest, tvb, offset+2, 1, ENC_BIG_ENDIAN);
848 proto_tree_add_item(header_tree, hf_gryphon_destchan, tvb, offset+3, 1, ENC_BIG_ENDIAN);
849  
850 proto_tree_add_item(header_tree, hf_gryphon_data_length, tvb, offset+4, 2, ENC_BIG_ENDIAN);
851 proto_tree_add_item(header_tree, hf_gryphon_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
852  
853 if (is_msgresp_add) {
854 static const int * wait_flags[] = {
855 &hf_gryphon_wait_resp,
856 &hf_gryphon_wait_prev_resp,
857 NULL
858 };
859  
860 proto_tree_add_bitmask(header_tree, tvb, offset+6, hf_gryphon_wait_flags, ett_gryphon_flags, wait_flags, ENC_NA);
861 }
862 proto_tree_add_item(header_tree, hf_gryphon_reserved, tvb, offset+7, 1, ENC_NA);
863  
864 msgpad = 3 - (msglen + 3) % 4;
865 msgend = offset + msglen + msgpad + MSG_HDR_SZ;
866  
867 body_tree = proto_tree_add_subtree(gryphon_tree, tvb, offset + MSG_HDR_SZ,
868 msglen + msgpad, ett_gryphon_body, NULL, "Body");
869  
870 offset += MSG_HDR_SZ;
871 switch (frmtyp) {
872 case GY_FT_CMD:
873 offset = decode_command(tvb, offset, dest, body_tree);
874 break;
875 case GY_FT_RESP:
876 offset = decode_response(tvb, offset, src, body_tree);
877 break;
878 case GY_FT_DATA:
879 offset = decode_data(tvb, offset, body_tree);
880 break;
881 case GY_FT_EVENT:
882 offset = decode_event(tvb, offset, body_tree);
883 break;
884 case GY_FT_MISC:
885 offset = decode_misc (tvb, offset, body_tree);
886 break;
887 case GY_FT_TEXT:
888 break;
889 default:
890 break;
891 }
892 if (offset < msgend - msgpad) {
893 i = msgend - msgpad - offset;
894 proto_tree_add_item(gryphon_tree, hf_gryphon_data, tvb, offset, i, ENC_NA);
895 offset += i;
896 }
897 if (offset < msgend) {
898 i = msgend - offset;
899 proto_tree_add_item(gryphon_tree, hf_gryphon_padding, tvb, offset, i, ENC_NA);
900 }
901 }
902  
903 static int
904 decode_command(tvbuff_t *tvb, int offset, int dst, proto_tree *pt)
905 {
906 int cmd, msglen;
907 unsigned int i;
908 proto_tree *ft;
909 proto_item *hi;
910  
911 msglen = tvb_reported_length_remaining(tvb, offset);
912 cmd = tvb_get_guint8(tvb, offset);
913 hi = proto_tree_add_uint(pt, hf_gryphon_cmd, tvb, offset, 1, cmd);
914 PROTO_ITEM_SET_HIDDEN(hi);
915 if (cmd > 0x3F)
916 cmd += dst * 256;
917  
918 for (i = 0; i < SIZEOF(cmds); i++) {
919 if (cmds[i].value == cmd)
920 break;
921 }
922 if (i >= SIZEOF(cmds) && dst >= SD_KNOWN) {
923 cmd = (cmd & 0xFF) + SD_CARD * 256;
924 for (i = 0; i < SIZEOF(cmds); i++) {
925 if (cmds[i].value == cmd)
926 break;
927 }
928 }
929 if (i >= SIZEOF(cmds))
930 i = SIZEOF(cmds) - 1;
931  
932 proto_tree_add_string(pt, hf_gryphon_command, tvb, offset, 4, cmds[i].strptr);
933 offset += 4;
934 msglen -= 4;
935  
936 if (cmds[i].cmd_fnct && msglen > 0) {
937 ft = proto_tree_add_subtree_format(pt, tvb, offset, -1, ett_gryphon_command_data, NULL,
938 "Data: (%d byte%s)", msglen, msglen == 1 ? "" : "s");
939 offset = (*(cmds[i].cmd_fnct)) (tvb, offset, ft);
940 }
941 return offset;
942 }
943  
944 static int
945 decode_response(tvbuff_t *tvb, int offset, int src, proto_tree *pt)
946 {
947 int cmd, msglen;
948 unsigned int i;
949 proto_tree *ft;
950  
951 msglen = tvb_reported_length_remaining(tvb, offset);
952 cmd = tvb_get_guint8(tvb, offset);
953 if (cmd > 0x3F)
954 cmd += src * 256;
955  
956 for (i = 0; i < SIZEOF(cmds); i++) {
957 if (cmds[i].value == cmd)
958 break;
959 }
960 if (i >= SIZEOF(cmds) && src >= SD_KNOWN) {
961 cmd = (cmd & 0xFF) + SD_CARD * 256;
962 for (i = 0; i < SIZEOF(cmds); i++) {
963 if (cmds[i].value == cmd)
964 break;
965 }
966 }
967 if (i >= SIZEOF(cmds))
968 i = SIZEOF(cmds) - 1;
969 proto_tree_add_string(pt, hf_gryphon_command, tvb, offset, 4, cmds[i].strptr);
970 offset += 4;
971 msglen -= 4;
972  
973 proto_tree_add_item(pt, hf_gryphon_status, tvb, offset, 4, ENC_BIG_ENDIAN);
974 offset += 4;
975 msglen -= 4;
976  
977 if (cmds[i].rsp_fnct && msglen > 0) {
978 ft = proto_tree_add_subtree_format(pt, tvb, offset, msglen, ett_gryphon_response_data, NULL,
979 "Data: (%d byte%s)", msglen, msglen == 1 ? "" : "s");
980 offset = (*(cmds[i].rsp_fnct)) (tvb, offset, ft);
981 }
982 return offset;
983 }
984  
985 static int
986 decode_data(tvbuff_t *tvb, int offset, proto_tree *pt)
987 {
988 proto_item *item1;
989 proto_tree *tree, *tree1;
990 int hdrsize, datasize, extrasize, /* hdrbits, */ msgsize, padding, mode;
991 nstime_t timestamp;
992  
993 hdrsize = tvb_get_guint8(tvb, offset+0);
994 /* hdrbits = tvb_get_guint8(tvb, offset+1); */
995 datasize = tvb_get_ntohs(tvb, offset+2);
996 extrasize = tvb_get_guint8(tvb, offset+4);
997 padding = 3 - (hdrsize + datasize + extrasize + 3) % 4;
998 msgsize = hdrsize + datasize + extrasize + padding + 16;
999  
1000 tree = proto_tree_add_subtree(pt, tvb, offset, 16, ett_gryphon_data_header, NULL, "Message header");
1001  
1002 proto_tree_add_item(tree, hf_gryphon_data_header_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1003 proto_tree_add_item(tree, hf_gryphon_data_data_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1004 proto_tree_add_item(tree, hf_gryphon_data_extra_data_length, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1005  
1006 mode = tvb_get_guint8(tvb, offset+5);
1007 item1 = proto_tree_add_item(tree, hf_gryphon_data_mode, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1008 if (mode) {
1009 tree1 = proto_item_add_subtree (item1, ett_gryphon_flags);
1010 proto_tree_add_item(tree1, hf_gryphon_data_mode_transmitted, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1011 proto_tree_add_item(tree1, hf_gryphon_data_mode_receive, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1012 proto_tree_add_item(tree1, hf_gryphon_data_mode_local, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1013 proto_tree_add_item(tree1, hf_gryphon_data_mode_remote, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1014 proto_tree_add_item(tree1, hf_gryphon_data_mode_internal, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1015 }
1016  
1017 proto_tree_add_item(tree, hf_gryphon_data_priority, tvb, offset+6, 1, ENC_BIG_ENDIAN);
1018 proto_tree_add_item(tree, hf_gryphon_data_error_status, tvb, offset+7, 1, ENC_BIG_ENDIAN);
1019  
1020 timestamp.secs = tvb_get_ntohl(tvb, offset+8)/100000;
1021 timestamp.nsecs = (tvb_get_ntohl(tvb, offset+8)%100000)*1000;
1022 proto_tree_add_time(tree, hf_gryphon_data_time, tvb, offset+8, 4, &timestamp);
1023  
1024 proto_tree_add_item(tree, hf_gryphon_data_context, tvb, offset+12, 1, ENC_BIG_ENDIAN);
1025 proto_tree_add_item(tree, hf_gryphon_reserved, tvb, offset+13, 3, ENC_NA);
1026 offset += 16;
1027  
1028 tree = proto_tree_add_subtree(pt, tvb, offset, msgsize-16-padding, ett_gryphon_data_body, NULL, "Message Body");
1029 if (hdrsize) {
1030 proto_tree_add_item(tree, hf_gryphon_data_header_data, tvb, offset, hdrsize, ENC_NA);
1031 offset += hdrsize;
1032 }
1033 if (datasize) {
1034 proto_tree_add_item(tree, hf_gryphon_data_data, tvb, offset, datasize, ENC_NA);
1035 offset += datasize;
1036 }
1037 if (extrasize) {
1038 proto_tree_add_item(tree, hf_gryphon_data_extra_data, tvb, offset, extrasize, ENC_NA);
1039 offset += extrasize;
1040 }
1041 if (padding) {
1042 proto_tree_add_item(tree, hf_gryphon_data_padding, tvb, offset, padding, ENC_NA);
1043 offset += padding;
1044 }
1045 return offset;
1046 }
1047  
1048 static int
1049 decode_event(tvbuff_t *tvb, int offset, proto_tree *pt)
1050 {
1051 int msglen, msgend, padding, length;
1052 nstime_t timestamp;
1053  
1054 msglen = tvb_reported_length_remaining(tvb, offset);
1055 padding = 3 - (msglen + 3) % 4;
1056 msgend = offset + msglen;
1057  
1058 proto_tree_add_item(pt, hf_gryphon_event_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1059 proto_tree_add_item(pt, hf_gryphon_event_context, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1060 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
1061 offset += 4;
1062  
1063 timestamp.secs = tvb_get_ntohl(tvb, offset)/100000;
1064 timestamp.nsecs = (tvb_get_ntohl(tvb, offset)%100000)*1000;
1065 proto_tree_add_time(pt, hf_gryphon_event_time, tvb, offset, 4, &timestamp);
1066 offset += 4;
1067  
1068 if (offset < msgend) {
1069 length = msgend - offset;
1070 proto_tree_add_item(pt, hf_gryphon_event_data, tvb, offset, length, ENC_NA);
1071 offset += length;
1072 }
1073 if (padding) {
1074 proto_tree_add_item(pt, hf_gryphon_event_padding, tvb, offset, padding, ENC_NA);
1075 offset += padding;
1076 }
1077 return offset;
1078 }
1079  
1080 static int
1081 decode_misc (tvbuff_t *tvb, int offset, proto_tree *pt)
1082 {
1083 int padding, msglen;
1084 gint length = 120;
1085  
1086 msglen = tvb_reported_length_remaining(tvb, offset);
1087 padding = 3 - (msglen + 3) % 4;
1088 proto_tree_add_item(pt, hf_gryphon_misc_data, tvb, offset, length, ENC_NA|ENC_ASCII);
1089 offset += msglen;
1090 if (padding) {
1091 proto_tree_add_item(pt, hf_gryphon_misc_padding, tvb, offset, padding, ENC_NA);
1092 offset += padding;
1093 }
1094 return offset;
1095 }
1096  
1097 static int
1098 cmd_init(tvbuff_t *tvb, int offset, proto_tree *pt)
1099 {
1100 guint8 mode = tvb_get_guint8(tvb, offset);
1101  
1102 if (mode == 0)
1103 proto_tree_add_uint_format_value(pt, hf_gryphon_cmd_mode, tvb, offset, 1, mode, "Always initialize");
1104 else
1105 proto_tree_add_uint_format_value(pt, hf_gryphon_cmd_mode, tvb, offset, 1, mode, "Initialize if not previously initialized");
1106 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1107 offset += 4;
1108 return offset;
1109 }
1110  
1111 static int
1112 eventnum(tvbuff_t *tvb, int offset, proto_tree *pt)
1113 {
1114 guint8 event = tvb_get_guint8(tvb, offset);
1115  
1116 if (event)
1117 proto_tree_add_item(pt, hf_gryphon_eventnum, tvb, offset, 1, ENC_BIG_ENDIAN);
1118 else
1119 proto_tree_add_uint_format_value(pt, hf_gryphon_eventnum, tvb, offset, 1,
1120 0, "All");
1121 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1122 offset += 4;
1123 return offset;
1124 }
1125  
1126 static int
1127 resp_time(tvbuff_t *tvb, int offset, proto_tree *pt)
1128 {
1129 guint64 val;
1130 nstime_t timestamp;
1131  
1132 val = tvb_get_ntoh64(tvb, offset);
1133 timestamp.secs = (time_t)(val/100000);
1134 timestamp.nsecs = (int)((val%100000)*1000);
1135  
1136 proto_tree_add_time(pt, hf_gryphon_resp_time, tvb, offset, 8, &timestamp);
1137 offset += 8;
1138  
1139 return offset;
1140 }
1141  
1142 static int
1143 cmd_setfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
1144 {
1145 int flag = tvb_get_ntohl(tvb, offset);
1146 int length, padding;
1147  
1148 length = tvb_get_guint8(tvb, offset+4) + tvb_get_guint8(tvb, offset+5)
1149 + tvb_get_ntohs(tvb, offset+6);
1150  
1151 proto_tree_add_uint_format_value(pt, hf_gryphon_setfilt, tvb, offset, 4,
1152 flag, "%s%s", ((flag) ? "Pass" : "Block"), ((length == 0) ? " all" : ""));
1153 proto_tree_add_uint(pt, hf_gryphon_setfilt_length, tvb, offset+4, 4, length);
1154 offset += 8;
1155 if (length) {
1156 proto_tree_add_item(pt, hf_gryphon_setfilt_discard_data, tvb, offset, length * 2, ENC_NA);
1157 offset += length * 2;
1158 }
1159 padding = 3 - (length * 2 + 3) % 4;
1160 if (padding) {
1161 proto_tree_add_item(pt, hf_gryphon_setfilt_padding, tvb, offset, padding, ENC_NA);
1162 offset += padding;
1163 }
1164 return offset;
1165 }
1166  
1167 static int
1168 cmd_ioctl(tvbuff_t *tvb, int offset, proto_tree *pt)
1169 {
1170 int msglen = tvb_reported_length_remaining(tvb, offset);
1171  
1172 proto_tree_add_item(pt, hf_gryphon_ioctl, tvb, offset, 4, ENC_BIG_ENDIAN);
1173  
1174 offset += 4;
1175 msglen -= 4;
1176 if (msglen > 0) {
1177 proto_tree_add_item(pt, hf_gryphon_ioctl_data, tvb, offset, msglen, ENC_NA);
1178 offset += msglen;
1179 }
1180 return offset;
1181 }
1182  
1183 static int
1184 cmd_addfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
1185 {
1186 proto_tree *tree;
1187 int blocks, i, length;
1188  
1189 tree = proto_tree_add_subtree(pt, tvb, offset, 1, ett_gryphon_flags, NULL, "Flags");
1190 proto_tree_add_item(tree, hf_gryphon_addfilt_pass, tvb, offset, 1, ENC_BIG_ENDIAN);
1191 proto_tree_add_item(tree, hf_gryphon_addfilt_active, tvb, offset, 1, ENC_BIG_ENDIAN);
1192 offset += 1;
1193  
1194 blocks = tvb_get_guint8(tvb, offset);
1195 proto_tree_add_item(pt, hf_gryphon_addfilt_blocks, tvb, offset, 1, ENC_BIG_ENDIAN);
1196 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 6, ENC_NA);
1197 offset += 7;
1198  
1199 for (i = 1; i <= blocks; i++) {
1200 length = tvb_get_ntohs(tvb, offset+2) * 2 + 8;
1201 length += 3 - (length + 3) % 4;
1202 tree = proto_tree_add_subtree_format(pt, tvb, offset, length, ett_gryphon_cmd_filter_block, NULL, "Filter block %d", i);
1203 offset = filter_block(tvb, offset, tree);
1204 }
1205 return offset;
1206 }
1207  
1208 static int
1209 resp_addfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
1210 {
1211 proto_tree_add_item(pt, hf_gryphon_addfilt_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
1212 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1213 offset += 4;
1214 return offset;
1215 }
1216  
1217 static int
1218 cmd_modfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
1219 {
1220 guint8 filter_handle = tvb_get_guint8(tvb, offset);
1221  
1222 if (filter_handle)
1223 proto_tree_add_item(pt, hf_gryphon_modfilt, tvb, offset, 1, ENC_BIG_ENDIAN);
1224 else
1225 proto_tree_add_uint_format_value(pt, hf_gryphon_modfilt, tvb, offset, 1,
1226 0, "Filter handles: all");
1227  
1228 proto_tree_add_item(pt, hf_gryphon_modfilt_action, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1229 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
1230 offset += 4;
1231 return offset;
1232 }
1233  
1234 static int
1235 resp_filthan(tvbuff_t *tvb, int offset, proto_tree *pt)
1236 {
1237 int handles = tvb_get_guint8(tvb, offset);
1238 int i, padding, handle;
1239  
1240 proto_tree_add_item(pt, hf_gryphon_filthan, tvb, offset, 1, ENC_BIG_ENDIAN);
1241 for (i = 1; i <= handles; i++){
1242 handle = tvb_get_guint8(tvb, offset+i);
1243 proto_tree_add_uint_format_value(pt, hf_gryphon_filthan_id, tvb, offset+i, 1,
1244 handle, "Handle %d: %u", i, handle);
1245 }
1246 padding = 3 - (handles + 1 + 3) % 4;
1247 if (padding)
1248 proto_tree_add_item(pt, hf_gryphon_filthan_padding, tvb, offset+1+handles, padding, ENC_NA);
1249 offset += 1+handles+padding;
1250 return offset;
1251 }
1252  
1253 static int
1254 dfiltmode(tvbuff_t *tvb, int offset, proto_tree *pt)
1255 {
1256 proto_tree_add_item(pt, hf_gryphon_dfiltmode, tvb, offset, 1, ENC_BIG_ENDIAN);
1257 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1258 offset += 4;
1259 return offset;
1260 }
1261  
1262 static int
1263 filtmode(tvbuff_t *tvb, int offset, proto_tree *pt)
1264 {
1265 proto_tree_add_item(pt, hf_gryphon_filtmode, tvb, offset, 1, ENC_BIG_ENDIAN);
1266 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1267 offset += 4;
1268 return offset;
1269 }
1270  
1271 static int
1272 resp_events(tvbuff_t *tvb, int offset, proto_tree *pt)
1273 {
1274 int msglen;
1275 unsigned int i;
1276 proto_tree *tree;
1277  
1278 msglen = tvb_reported_length_remaining(tvb, offset);
1279 i = 1;
1280 while (msglen != 0) {
1281 tree = proto_tree_add_subtree_format(pt, tvb, offset, 20, ett_gryphon_cmd_events_data, NULL, "Event %d:", i);
1282 proto_tree_add_item(tree, hf_gryphon_event_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1283 proto_tree_add_item(tree, hf_gryphon_event_name, tvb, offset+1, 19, ENC_NA|ENC_ASCII);
1284 offset += 20;
1285 msglen -= 20;
1286 i++;
1287 }
1288 return offset;
1289 }
1290  
1291 static int
1292 cmd_register(tvbuff_t *tvb, int offset, proto_tree *pt)
1293 {
1294 proto_tree_add_item(pt, hf_gryphon_register_username, tvb, offset, 16, ENC_NA|ENC_ASCII);
1295 offset += 16;
1296 proto_tree_add_item(pt, hf_gryphon_register_password, tvb, offset, 32, ENC_NA|ENC_ASCII);
1297 offset += 32;
1298 return offset;
1299 }
1300  
1301 static int
1302 resp_register(tvbuff_t *tvb, int offset, proto_tree *pt)
1303 {
1304 proto_tree_add_item(pt, hf_gryphon_register_client_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1305 proto_tree_add_item(pt, hf_gryphon_register_privileges, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1306 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
1307 offset += 4;
1308 return offset;
1309 }
1310  
1311  
1312 static int
1313 resp_getspeeds(tvbuff_t *tvb, int offset, proto_tree *pt)
1314 {
1315 int indx,
1316 size = tvb_get_guint8(tvb, offset+8),
1317 number = tvb_get_guint8(tvb, offset+9);
1318  
1319 proto_tree_add_item(pt, hf_gryphon_getspeeds_set_ioctl, tvb, offset, 4, ENC_BIG_ENDIAN);
1320 proto_tree_add_item(pt, hf_gryphon_getspeeds_get_ioctl, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1321 proto_tree_add_item(pt, hf_gryphon_getspeeds_size, tvb, offset+8, 1, ENC_BIG_ENDIAN);
1322 proto_tree_add_item(pt, hf_gryphon_getspeeds_preset, tvb, offset+9, 1, ENC_BIG_ENDIAN);
1323 offset += 10;
1324  
1325 for (indx = 1; indx <= number; indx++) {
1326 proto_tree_add_bytes_format(pt, hf_gryphon_getspeeds_data, tvb, offset, size,
1327 tvb_get_ptr(tvb, offset, size), "Data for preset %d", indx);
1328 offset += size;
1329 }
1330 return offset;
1331 }
1332  
1333 static int
1334 cmd_sort(tvbuff_t *tvb, int offset, proto_tree *pt)
1335 {
1336 proto_tree_add_item(pt, hf_gryphon_cmd_sort, tvb, offset, 1, ENC_BIG_ENDIAN);
1337 return (offset+1);
1338 }
1339  
1340 static int
1341 cmd_optimize(tvbuff_t *tvb, int offset, proto_tree *pt)
1342 {
1343 proto_tree_add_item(pt, hf_gryphon_cmd_optimize, tvb, offset, 1, ENC_BIG_ENDIAN);
1344 return (offset+1);
1345 }
1346  
1347 static int
1348 resp_config(tvbuff_t *tvb, int offset, proto_tree *pt)
1349 {
1350 proto_tree *ft, *tree;
1351 int devices;
1352 int i;
1353 unsigned int j, x;
1354  
1355 proto_tree_add_item(pt, hf_gryphon_config_device_name, tvb, offset, 20, ENC_NA|ENC_ASCII);
1356 offset += 20;
1357  
1358 proto_tree_add_item(pt, hf_gryphon_config_device_version, tvb, offset, 8, ENC_NA|ENC_ASCII);
1359 offset += 8;
1360  
1361 proto_tree_add_item(pt, hf_gryphon_config_device_serial_number, tvb, offset, 20, ENC_NA|ENC_ASCII);
1362 offset += 20;
1363  
1364 devices = tvb_get_guint8(tvb, offset);
1365  
1366 proto_tree_add_item(pt, hf_gryphon_config_num_channels, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1367 proto_tree_add_item(pt, hf_gryphon_config_name_version_ext, tvb, offset+1, 11, ENC_NA|ENC_ASCII);
1368 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+12, 4, ENC_NA);
1369 offset += 16;
1370  
1371 for (i = 1; i <= devices; i++) {
1372 ft = proto_tree_add_subtree_format(pt, tvb, offset, 80, ett_gryphon_cmd_config_device, NULL, "Channel %d:", i);
1373  
1374 proto_tree_add_item(ft, hf_gryphon_config_driver_name, tvb, offset, 20, ENC_NA|ENC_ASCII);
1375 offset += 20;
1376  
1377 proto_tree_add_item(ft, hf_gryphon_config_driver_version, tvb, offset, 8, ENC_NA|ENC_ASCII);
1378 offset += 8;
1379  
1380 proto_tree_add_item(ft, hf_gryphon_config_device_security, tvb, offset, 16, ENC_NA|ENC_ASCII);
1381 offset += 16;
1382  
1383 x = tvb_get_ntohl (tvb, offset);
1384 if (x) {
1385 tree = proto_tree_add_subtree(ft, tvb, offset, 4, ett_gryphon_valid_headers, NULL, "Valid Header lengths");
1386 for (j = 0; ; j++) {
1387 if (x & 1) {
1388 proto_tree_add_uint_format(tree, hf_gryphon_valid_header_length, tvb, offset, 4, j, "%d byte%s", j,
1389 j == 1 ? "" : "s");
1390 }
1391 if ((x >>= 1) == 0)
1392 break;
1393 }
1394 }
1395 offset += 4;
1396  
1397 proto_tree_add_item(ft, hf_gryphon_config_max_data_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1398 offset += 2;
1399  
1400 proto_tree_add_item(ft, hf_gryphon_config_min_data_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1401 offset += 2;
1402  
1403 proto_tree_add_item(ft, hf_gryphon_config_hardware_serial_number, tvb, offset, 20, ENC_NA|ENC_ASCII);
1404 offset += 20;
1405  
1406 proto_tree_add_item(ft, hf_gryphon_config_protocol_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1407 offset += 2;
1408  
1409 proto_tree_add_item(ft, hf_gryphon_config_channel_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1410 offset++;
1411  
1412 proto_tree_add_item(ft, hf_gryphon_config_card_slot_number, tvb, offset, 1, ENC_BIG_ENDIAN);
1413 offset ++;
1414  
1415 proto_tree_add_item(ft, hf_gryphon_config_max_extra_data, tvb, offset, 2, ENC_BIG_ENDIAN);
1416 offset += 2;
1417  
1418 proto_tree_add_item(ft, hf_gryphon_config_min_extra_data, tvb, offset, 2, ENC_BIG_ENDIAN);
1419 offset += 2;
1420  
1421 }
1422 return offset;
1423 }
1424  
1425 static int
1426 cmd_sched(tvbuff_t *tvb, int offset, proto_tree *pt)
1427 {
1428 int msglen;
1429 proto_item *item, *item1;
1430 proto_tree *tree, *tree1;
1431 int save_offset;
1432 unsigned int i, x, length;
1433 unsigned char def_chan = tvb_get_guint8(tvb, offset-9);
1434  
1435 msglen = tvb_reported_length_remaining(tvb, offset);
1436  
1437 if (tvb_get_ntohl(tvb, offset) == 0xFFFFFFFF)
1438 proto_tree_add_uint_format_value(pt, hf_gryphon_sched_num_iterations, tvb, offset, 4,
1439 0, "Number of iterations: \"infinite\"");
1440 else
1441 proto_tree_add_item(pt, hf_gryphon_sched_num_iterations, tvb, offset, 4, ENC_BIG_ENDIAN);
1442 offset += 4;
1443 msglen -= 4;
1444  
1445 item = proto_tree_add_item(pt, hf_gryphon_sched_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
1446 tree = proto_item_add_subtree (item, ett_gryphon_flags);
1447 proto_tree_add_item(tree, hf_gryphon_sched_flags_scheduler, tvb, offset, 4, ENC_BIG_ENDIAN);
1448 offset += 4;
1449 msglen -= 4;
1450  
1451 i = 1;
1452 while (msglen > 0) {
1453 length = 16 + tvb_get_guint8(tvb, offset+16) +
1454 tvb_get_ntohs(tvb, offset+18) + tvb_get_guint8(tvb, offset+20) + 16;
1455 length += 3 - (length + 3) % 4;
1456 tree = proto_tree_add_subtree_format(pt, tvb, offset, length, ett_gryphon_cmd_sched_data, NULL, "Message %d", i);
1457 proto_tree_add_item(tree, hf_gryphon_sched_sleep, tvb, offset, 4, ENC_BIG_ENDIAN);
1458 offset += 4;
1459 msglen -= 4;
1460  
1461 proto_tree_add_item(tree, hf_gryphon_sched_transmit_count, tvb, offset, 4, ENC_BIG_ENDIAN);
1462 offset += 4;
1463 msglen -= 4;
1464  
1465 proto_tree_add_item(tree, hf_gryphon_sched_transmit_period, tvb, offset, 4, ENC_BIG_ENDIAN);
1466 offset += 4;
1467 msglen -= 4;
1468  
1469 item1 = proto_tree_add_item(tree, hf_gryphon_sched_transmit_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
1470 tree1 = proto_item_add_subtree (item1, ett_gryphon_flags);
1471 proto_tree_add_item(tree1, hf_gryphon_sched_skip_transmit_period, tvb, offset, 2, ENC_BIG_ENDIAN);
1472 if (i == 1) {
1473 proto_tree_add_item(tree1, hf_gryphon_sched_skip_sleep, tvb, offset, 2, ENC_BIG_ENDIAN);
1474 }
1475  
1476 x = tvb_get_guint8(tvb, offset+2);
1477 if (x == 0)
1478 x = def_chan;
1479  
1480 proto_tree_add_uint(tree, hf_gryphon_sched_channel, tvb, offset+2, 1, x);
1481 proto_tree_add_item(tree, hf_gryphon_reserved, tvb, offset+3, 1, ENC_NA);
1482 offset += 4;
1483 msglen -= 4;
1484  
1485 tree1 = proto_tree_add_subtree(tree, tvb, offset, length, ett_gryphon_cmd_sched_cmd, NULL, "Message");
1486 save_offset = offset;
1487 offset = decode_data(tvb, offset, tree1);
1488 msglen -= offset - save_offset;
1489 i++;
1490 }
1491 return offset;
1492 }
1493  
1494 static int
1495 cmd_sched_rep(tvbuff_t *tvb, int offset, proto_tree *pt)
1496 {
1497 unsigned int x;
1498 const char *type;
1499  
1500 x = tvb_get_ntohl(tvb, offset);
1501 if (x & 0x80000000)
1502 type = "Critical";
1503 else
1504 type = "Normal";
1505 proto_tree_add_uint_format_value(pt, hf_gryphon_sched_rep_id, tvb,
1506 offset, 4, x, "%s schedule ID: %u", type, x);
1507 offset += 4;
1508  
1509 proto_tree_add_item(pt, hf_gryphon_sched_rep_message_index, tvb, offset, 1, ENC_BIG_ENDIAN);
1510 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1511 offset += 4;
1512 offset = decode_data(tvb, offset, pt);
1513 return offset;
1514 }
1515  
1516 static int
1517 resp_blm_data(tvbuff_t *tvb, int offset, proto_tree *pt)
1518 {
1519 int x;
1520  
1521 nstime_t timestamp;
1522  
1523 timestamp.secs = tvb_get_ntohl(tvb, offset)/100000;
1524 timestamp.nsecs = (tvb_get_ntohl(tvb, offset)%100000)*1000;
1525 proto_tree_add_time(pt, hf_gryphon_blm_data_time, tvb, offset, 4, &timestamp);
1526 offset += 4;
1527  
1528 x = tvb_get_ntohs(tvb, offset);
1529 proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_bus_load, tvb,
1530 offset, 2, x, "%d.%02d%%", x / 100, x % 100);
1531 offset += 2;
1532 x = tvb_get_ntohs(tvb, offset);
1533 proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_current_bus_load, tvb,
1534 offset, 2, x, "%d.%02d%%", x / 100, x % 100);
1535 offset += 2;
1536 x = tvb_get_ntohs(tvb, offset);
1537 proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_peak_bus_load, tvb,
1538 offset, 2, x, "%d.%02d%%", x / 100, x % 100);
1539 offset += 2;
1540 x = tvb_get_ntohs(tvb, offset);
1541 proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_historic_peak_bus_load, tvb,
1542 offset, 2, x, "%d.%02d%%", x / 100, x % 100);
1543 offset += 2;
1544  
1545 return offset;
1546 }
1547  
1548 static int
1549 resp_blm_stat(tvbuff_t *tvb, int offset, proto_tree *pt)
1550 {
1551 offset = resp_blm_data(tvb, offset, pt);
1552  
1553 proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN);
1554 offset += 4;
1555 proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN);
1556 offset += 4;
1557 proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_dropped_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN);
1558 offset += 4;
1559 proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_dropped_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN);
1560 offset += 4;
1561 proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_error_count, tvb, offset, 4, ENC_BIG_ENDIAN);
1562 offset += 4;
1563 proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_error_count, tvb, offset, 4, ENC_BIG_ENDIAN);
1564 offset += 4;
1565 return offset;
1566 }
1567  
1568 static int
1569 cmd_addresp(tvbuff_t *tvb, int offset, proto_tree *pt)
1570 {
1571 proto_item *item;
1572 proto_tree *tree;
1573 int blocks, responses, i, msglen, length;
1574 int action, actionType, actionValue;
1575 tvbuff_t *next_tvb;
1576  
1577 actionType = 0;
1578 item = proto_tree_add_item(pt, hf_gryphon_addresp_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
1579 tree = proto_item_add_subtree (item, ett_gryphon_flags);
1580 proto_tree_add_item(tree, hf_gryphon_addresp_flags_active, tvb, offset, 1, ENC_BIG_ENDIAN);
1581 offset += 1;
1582  
1583 blocks = tvb_get_guint8(tvb, offset);
1584 proto_tree_add_item(tree, hf_gryphon_addresp_blocks, tvb, offset, 1, ENC_BIG_ENDIAN);
1585 offset += 1;
1586  
1587 responses = tvb_get_guint8(tvb, offset);
1588 proto_tree_add_item(tree, hf_gryphon_addresp_responses, tvb, offset, 1, ENC_BIG_ENDIAN);
1589 offset += 1;
1590  
1591 proto_tree_add_item(tree, hf_gryphon_addresp_old_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
1592 offset += 1;
1593  
1594 action = tvb_get_guint8(tvb, offset);
1595 item = proto_tree_add_item(tree, hf_gryphon_addresp_action, tvb, offset, 1, ENC_BIG_ENDIAN);
1596 tree = proto_item_add_subtree (item, ett_gryphon_flags);
1597 actionValue = tvb_get_ntohs(tvb, offset+2);
1598 if (actionValue) {
1599 if (action & FR_PERIOD_MSGS) {
1600 actionType = 1;
1601 } else {
1602 actionType = 0;
1603 }
1604  
1605 proto_tree_add_item(tree, hf_gryphon_addresp_action_period, tvb, offset, 1, ENC_BIG_ENDIAN);
1606 }
1607  
1608 proto_tree_add_item(tree, hf_gryphon_addresp_action_deact_on_event, tvb, offset, 1, ENC_BIG_ENDIAN);
1609 proto_tree_add_item(tree, hf_gryphon_addresp_action_deact_after_period, tvb, offset, 1, ENC_BIG_ENDIAN);
1610 offset += 1;
1611  
1612 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 1, ENC_NA);
1613 offset += 1;
1614 if (actionValue) {
1615 if (actionType == 1) {
1616 proto_tree_add_uint_format_value(tree, hf_gryphon_addresp_action_period_type, tvb,
1617 offset, 2, actionValue, "Period: %d messages", actionValue);
1618 } else {
1619 proto_tree_add_uint_format_value(tree, hf_gryphon_addresp_action_period_type, tvb,
1620 offset, 2, actionValue, "Period: %d.%02d seconds", actionValue/100, actionValue%100);
1621 }
1622 }
1623 offset += 2;
1624  
1625 for (i = 1; i <= blocks; i++) {
1626 length = tvb_get_ntohs(tvb, offset+2) * 2 + 8;
1627 length += 3 - (length + 3) % 4;
1628 tree = proto_tree_add_subtree_format(pt, tvb, offset, length, ett_gryphon_cmd_filter_block, NULL, "Filter block %d", i);
1629 offset = filter_block(tvb, offset, tree);
1630 }
1631 for (i = 1; i <= responses; i++) {
1632 msglen = tvb_get_ntohs(tvb, offset+4) + 8;
1633 length = msglen + 3 - (msglen + 3) % 4;
1634 tree = proto_tree_add_subtree_format(pt, tvb, offset, length, ett_gryphon_cmd_response_block, NULL, "Response block %d", i);
1635 next_tvb = tvb_new_subset_length(tvb, offset, msglen);
1636 dissect_gryphon_message(next_tvb, NULL, tree, TRUE);
1637 offset += length;
1638 }
1639 return offset;
1640 }
1641  
1642 static int
1643 resp_addresp(tvbuff_t *tvb, int offset, proto_tree *pt)
1644 {
1645 proto_tree_add_item(pt, hf_gryphon_addresp_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
1646 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1647 offset += 4;
1648 return offset;
1649 }
1650  
1651 static int
1652 cmd_modresp(tvbuff_t *tvb, int offset, proto_tree *pt)
1653 {
1654 guint8 dest = tvb_get_guint8(tvb, offset-5),
1655 resp_handle = tvb_get_guint8(tvb, offset);
1656  
1657 if (resp_handle)
1658 proto_tree_add_item(pt, hf_gryphon_modresp_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
1659 else if (dest)
1660 proto_tree_add_uint_format_value(pt, hf_gryphon_modresp_handle, tvb,
1661 offset, 1, dest, "Response handles: all on channel %c", dest);
1662 else
1663 proto_tree_add_uint_format_value(pt, hf_gryphon_modresp_handle, tvb, offset, 1,
1664 0, "Response handles: all");
1665  
1666 proto_tree_add_item(pt, hf_gryphon_modresp_action, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1667 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
1668 offset += 4;
1669 return offset;
1670 }
1671  
1672 static int
1673 resp_resphan(tvbuff_t *tvb, int offset, proto_tree *pt)
1674 {
1675 int handles = tvb_get_guint8(tvb, offset);
1676 int i, padding, handle;
1677  
1678 proto_tree_add_item(pt, hf_gryphon_num_resphan, tvb, offset, 1, ENC_BIG_ENDIAN);
1679 for (i = 1; i <= handles; i++){
1680 handle = tvb_get_guint8(tvb, offset+i);
1681 proto_tree_add_uint_format(pt, hf_gryphon_handle, tvb, offset+i, 1, handle, "Handle %d: %u", i,
1682 handle);
1683 }
1684 padding = 3 - (handles + 1 + 3) % 4;
1685 if (padding)
1686 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset+1+handles, padding, ENC_NA);
1687 offset += 1+handles+padding;
1688 return offset;
1689 }
1690  
1691 static int
1692 resp_sched(tvbuff_t *tvb, int offset, proto_tree *pt)
1693 {
1694 proto_tree_add_item(pt, hf_gryphon_transmit_sched_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1695 offset += 4;
1696 return offset;
1697 }
1698  
1699 static int
1700 cmd_desc(tvbuff_t *tvb, int offset, proto_tree *pt)
1701 {
1702 proto_tree_add_item(pt, hf_gryphon_desc_program_size, tvb, offset, 4, ENC_BIG_ENDIAN);
1703 offset += 4;
1704  
1705 proto_tree_add_item(pt, hf_gryphon_desc_program_name, tvb, offset, 32, ENC_NA|ENC_ASCII);
1706 offset += 32;
1707  
1708 proto_tree_add_item(pt, hf_gryphon_desc_program_description, tvb, offset, 80, ENC_NA|ENC_ASCII);
1709 offset += 80;
1710  
1711 return offset;
1712 }
1713  
1714 static int
1715 resp_desc(tvbuff_t *tvb, int offset, proto_tree *pt)
1716 {
1717 proto_item *item;
1718 proto_tree *tree;
1719  
1720 item = proto_tree_add_item(pt, hf_gryphon_desc_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
1721 tree = proto_item_add_subtree (item, ett_gryphon_flags);
1722 proto_tree_add_item(tree, hf_gryphon_desc_flags_program, tvb, offset, 1, ENC_BIG_ENDIAN);
1723 proto_tree_add_item(pt, hf_gryphon_desc_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
1724 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA);
1725 offset += 4;
1726 return offset;
1727 }
1728  
1729 static int
1730 cmd_upload(tvbuff_t *tvb, int offset, proto_tree *pt)
1731 {
1732 int msglen;
1733 unsigned int length;
1734  
1735 msglen = tvb_reported_length_remaining(tvb, offset);
1736 proto_tree_add_item(pt, hf_gryphon_upload_block_number, tvb, offset, 2, ENC_BIG_ENDIAN);
1737 proto_tree_add_item(pt, hf_gryphon_upload_handle, tvb, offset+2, 1, ENC_BIG_ENDIAN);
1738 offset += 3;
1739 msglen -= 3;
1740  
1741 length = msglen;
1742 proto_tree_add_item(pt, hf_gryphon_upload_data, tvb, offset, length, ENC_NA);
1743 offset += length;
1744  
1745 length = 3 - (length + 3) % 4;
1746 if (length) {
1747 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA);
1748 offset += length;
1749 }
1750 return offset;
1751 }
1752  
1753 static int
1754 cmd_delete(tvbuff_t *tvb, int offset, proto_tree *pt)
1755 {
1756 proto_tree_add_item(pt, hf_gryphon_delete, tvb, offset, 32, ENC_NA|ENC_ASCII);
1757 offset += 32;
1758 return offset;
1759 }
1760  
1761 static int
1762 cmd_list(tvbuff_t *tvb, int offset, proto_tree *pt)
1763 {
1764 proto_tree_add_item(pt, hf_gryphon_list_block_number, tvb, offset, 1, ENC_BIG_ENDIAN);
1765 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1766 offset += 4;
1767 return offset;
1768 }
1769  
1770 static int
1771 resp_list(tvbuff_t *tvb, int offset, proto_tree *pt)
1772 {
1773 proto_tree *tree;
1774 unsigned int i, count;
1775  
1776 count = tvb_get_guint8(tvb, offset);
1777 proto_tree_add_item(pt, hf_gryphon_list_num_programs, tvb, offset, 1, ENC_BIG_ENDIAN);
1778 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 1, ENC_NA);
1779 offset += 2;
1780  
1781 proto_tree_add_item(pt, hf_gryphon_list_num_remain_programs, tvb, offset, 2, ENC_BIG_ENDIAN);
1782 offset += 2;
1783  
1784 for (i = 1; i <= count; i++) {
1785 tree = proto_tree_add_subtree_format(pt, tvb, offset, 112, ett_gryphon_pgm_list, NULL, "Program %u", i);
1786 proto_tree_add_item(tree, hf_gryphon_list_name, tvb, offset, 32, ENC_NA|ENC_ASCII);
1787 offset += 32;
1788  
1789 proto_tree_add_item(tree, hf_gryphon_list_description, tvb, offset, 80, ENC_NA|ENC_ASCII);
1790 offset += 80;
1791 }
1792 return offset;
1793 }
1794  
1795 static int
1796 cmd_start(tvbuff_t *tvb, int offset, proto_tree *pt)
1797 {
1798 char *string;
1799 gint length;
1800 int msglen;
1801 int hdr_stuff = offset;
1802  
1803 msglen = tvb_reported_length_remaining(tvb, offset);
1804 offset = cmd_delete(tvb, offset, pt); /* decode the name */
1805 if (offset < msglen + hdr_stuff) {
1806 string = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &length, ENC_ASCII);
1807 if (length > 1) {
1808 proto_tree_add_string(pt, hf_gryphon_start_arguments, tvb, offset,
1809 length, string);
1810 offset += length;
1811  
1812 length = 3 - (length + 3) % 4;
1813 if (length) {
1814 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA);
1815 offset += length;
1816 }
1817 }
1818 }
1819 return offset;
1820 }
1821  
1822 static int
1823 resp_start(tvbuff_t *tvb, int offset, proto_tree *pt)
1824 {
1825 int msglen;
1826  
1827 msglen = tvb_reported_length_remaining(tvb, offset);
1828 if (msglen > 0) {
1829 proto_tree_add_item(pt, hf_gryphon_start_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
1830 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1831 offset += 4;
1832 }
1833 return offset;
1834 }
1835  
1836 static int
1837 resp_status(tvbuff_t *tvb, int offset, proto_tree *pt)
1838 {
1839 proto_item *item;
1840 proto_tree *tree;
1841 unsigned int i, copies, length, channel;
1842  
1843 copies = tvb_get_guint8(tvb, offset);
1844 item = proto_tree_add_item(pt, hf_gryphon_status_num_running_copies, tvb, offset, 1, ENC_BIG_ENDIAN);
1845 tree = proto_item_add_subtree (item, ett_gryphon_pgm_status);
1846 offset += 1;
1847 if (copies) {
1848 for (i = 1; i <= copies; i++) {
1849 channel = tvb_get_guint8(tvb, offset);
1850 proto_tree_add_uint_format(tree, hf_gryphon_program_channel_number, tvb, offset, 1, channel,
1851 "Program %u channel (client) number %u", i, channel);
1852 offset += 1;
1853 }
1854 }
1855 length = 3 - (copies + 1 + 3) % 4;
1856 if (length) {
1857 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA);
1858 offset += length;
1859 }
1860 return offset;
1861 }
1862  
1863 static int
1864 cmd_options(tvbuff_t *tvb, int offset, proto_tree *pt)
1865 {
1866 int msglen;
1867 proto_tree *tree;
1868 unsigned int i, size, padding, option, option_length, option_value;
1869 const char *string, *string1;
1870  
1871 msglen = tvb_reported_length_remaining(tvb, offset);
1872 proto_tree_add_item(pt, hf_gryphon_options_handle, tvb, offset, 1, ENC_BIG_ENDIAN);
1873 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
1874 offset += 4;
1875 msglen -= 4;
1876  
1877 for (i = 1; msglen > 0; i++) {
1878 option_length = tvb_get_guint8(tvb, offset+1);
1879 size = option_length + 2;
1880 padding = 3 - ((size + 3) %4);
1881 tree = proto_tree_add_subtree_format(pt, tvb, offset, size + padding, ett_gryphon_pgm_options, NULL, "Option number %u", i);
1882 option = tvb_get_guint8(tvb, offset);
1883 switch (option_length) {
1884 case 1:
1885 option_value = tvb_get_guint8(tvb, offset+2);
1886 break;
1887 case 2:
1888 option_value = tvb_get_ntohs(tvb, offset+2);
1889 break;
1890 case 4:
1891 option_value = tvb_get_ntohl(tvb, offset+2);
1892 break;
1893 default:
1894 option_value = 0;
1895 }
1896 string = "unknown option";
1897 string1 = "unknown option data";
1898 switch (option) {
1899 case PGM_CONV:
1900 string = "Type of data in the file";
1901 switch (option_value) {
1902 case PGM_BIN:
1903 string1 = "Binary - Don't modify";
1904 break;
1905 case PGM_ASCII:
1906 string1 = "ASCII - Remove CR's";
1907 break;
1908 }
1909 break;
1910 case PGM_TYPE:
1911 string = "Type of file";
1912 switch (option_value) {
1913 case PGM_PGM:
1914 string1 = "Executable";
1915 break;
1916 case PGM_DATA:
1917 string1 = "Data";
1918 break;
1919 }
1920 break;
1921 }
1922 proto_tree_add_uint_format_value(tree, hf_gryphon_option, tvb, offset, 1, option, "%s", string);
1923 proto_tree_add_bytes_format_value(tree, hf_gryphon_option_data, tvb, offset+2, option_length, NULL, "%s", string1);
1924 if (padding)
1925 proto_tree_add_item(tree, hf_gryphon_padding, tvb, offset+option_length+2, padding, ENC_NA);
1926 offset += size + padding;
1927 msglen -= size + padding;
1928 }
1929 return offset;
1930 }
1931  
1932 static int
1933 cmd_files(tvbuff_t *tvb, int offset, proto_tree *pt)
1934 {
1935 int msglen;
1936 guint8 file;
1937  
1938 msglen = tvb_reported_length_remaining(tvb, offset);
1939 file = tvb_get_guint8(tvb, offset);
1940 if (file == 0)
1941 proto_tree_add_uint_format(pt, hf_gryphon_cmd_file, tvb, offset, 1, file, "First group of names");
1942 else
1943 proto_tree_add_uint_format(pt, hf_gryphon_cmd_file, tvb, offset, 1, file, "Subsequent group of names");
1944  
1945 proto_tree_add_item(pt, hf_gryphon_files, tvb, offset+1, msglen-1, ENC_NA|ENC_ASCII);
1946 offset += msglen;
1947 return offset;
1948 }
1949  
1950 static int
1951 resp_files(tvbuff_t *tvb, int offset, proto_tree *pt)
1952 {
1953 int msglen;
1954 guint8 flag;
1955  
1956 msglen = tvb_reported_length_remaining(tvb, offset);
1957 flag = tvb_get_guint8(tvb, offset);
1958 proto_tree_add_uint_format_value(pt, hf_gryphon_more_filenames, tvb, offset, 1, flag, "%s", flag ? "Yes": "No");
1959 proto_tree_add_item(pt, hf_gryphon_filenames, tvb, offset+1, msglen-1, ENC_ASCII|ENC_NA);
1960 offset += msglen;
1961 return offset;
1962 }
1963  
1964 static int
1965 cmd_usdt(tvbuff_t *tvb, int offset, proto_tree *pt)
1966 {
1967 int ids, id, remain, size, i, bytes;
1968 guint8 flags;
1969 proto_tree *localTree;
1970 proto_item *localItem;
1971  
1972 flags = tvb_get_guint8(tvb, offset);
1973 proto_tree_add_item(pt, hf_gryphon_usdt_flags_register, tvb, offset, 1, ENC_BIG_ENDIAN);
1974  
1975 if (flags & 1) {
1976 static const int * action_flags[] = {
1977 &hf_gryphon_usdt_action_flags_register,
1978 &hf_gryphon_usdt_action_flags_action,
1979 NULL
1980 };
1981  
1982 static const int * transmit_option_flags[] = {
1983 &hf_gryphon_usdt_transmit_options_flags_echo,
1984 &hf_gryphon_usdt_transmit_options_action,
1985 &hf_gryphon_usdt_transmit_options_send_done,
1986 NULL
1987 };
1988  
1989 static const int * receive_option_flags[] = {
1990 &hf_gryphon_usdt_receive_options_action,
1991 &hf_gryphon_usdt_receive_options_firstframe,
1992 &hf_gryphon_usdt_receive_options_lastframe,
1993 NULL
1994 };
1995  
1996 proto_tree_add_bitmask(pt, tvb, offset, hf_gryphon_usdt_action_flags, ett_gryphon_flags, action_flags, ENC_BIG_ENDIAN);
1997 proto_tree_add_bitmask(pt, tvb, offset+1, hf_gryphon_usdt_transmit_options_flags, ett_gryphon_flags, transmit_option_flags, ENC_BIG_ENDIAN);
1998 proto_tree_add_bitmask(pt, tvb, offset+2, hf_gryphon_usdt_receive_options_flags, ett_gryphon_flags, receive_option_flags, ENC_BIG_ENDIAN);
1999  
2000 if ((ids = tvb_get_guint8(tvb, offset+3))) {
2001 localItem = proto_tree_add_item(pt, hf_gryphon_usdt_ext_address, tvb, offset+3, 1, ENC_BIG_ENDIAN);
2002 offset += 4;
2003  
2004 localTree = proto_item_add_subtree (localItem, ett_gryphon_usdt_data);
2005 while (ids) {
2006 proto_tree_add_item(localTree, hf_gryphon_usdt_ext_address_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2007 offset += 4;
2008 ids--;
2009 }
2010 } else {
2011 proto_tree_add_uint_format_value(pt, hf_gryphon_usdt_ext_address, tvb, offset+3, 1,
2012 0, "Using extended addressing for the single, internally defined, ID");
2013 offset += 4;
2014 }
2015 for (i = 0; i < 2; i++) {
2016 bytes = tvb_reported_length_remaining (tvb, offset);
2017 if (bytes <= 0)
2018 break;
2019 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");
2020  
2021 size = tvb_get_ntohl (tvb, offset);
2022 localItem = proto_tree_add_item(localTree, hf_gryphon_usdt_block_size, tvb, offset, 4, ENC_BIG_ENDIAN);
2023 localTree = proto_item_add_subtree (localItem, ett_gryphon_usdt_data_block);
2024 if (size == 0) {
2025 proto_item_set_len(localItem, 16);
2026 } else {
2027 offset += 4;
2028 id = tvb_get_ntohl (tvb, offset);
2029 proto_tree_add_uint_format_value(localTree, hf_gryphon_usdt_request, tvb, offset, 4, id, "%04X through %04X", id, id+size-1);
2030 offset += 4;
2031  
2032 id = tvb_get_ntohl (tvb, offset);
2033 proto_tree_add_uint_format_value(localTree, hf_gryphon_usdt_response, tvb, offset, 4, id, "%04X through %04X", id, id+size-1);
2034 offset += 4;
2035  
2036 id = tvb_get_ntohl (tvb, offset);
2037 proto_tree_add_uint_format_value(localTree, hf_gryphon_uudt_response, tvb, offset, 4, id, "%04X through %04X", id, id+size-1);
2038 offset += 4;
2039 }
2040 }
2041 } else {
2042 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
2043 offset += 4;
2044 }
2045  
2046 if ((remain = tvb_reported_length_remaining(tvb, offset))) {
2047 proto_tree_add_item(pt, hf_gryphon_ignored, tvb, offset, remain, ENC_NA);
2048 offset += remain;
2049 }
2050  
2051 return offset;
2052 }
2053  
2054 static int
2055 cmd_bits_in (tvbuff_t *tvb, int offset, proto_tree *pt)
2056 {
2057 int msglen, value;
2058  
2059 msglen = tvb_reported_length_remaining(tvb, offset);
2060 value = tvb_get_guint8(tvb, offset);
2061 if (value) {
2062 static const int * digital_values[] = {
2063 &hf_gryphon_bits_in_input1,
2064 &hf_gryphon_bits_in_input2,
2065 &hf_gryphon_bits_in_input3,
2066 &hf_gryphon_bits_in_pushbutton,
2067 NULL
2068 };
2069 proto_tree_add_bitmask(pt, tvb, 1, hf_gryphon_bit_in_digital_data, ett_gryphon_digital_data, digital_values, ENC_NA);
2070 } else {
2071 proto_tree_add_uint_format(pt, hf_gryphon_bit_in_digital_data, tvb, offset, 1, value, "No digital values are set");
2072 }
2073  
2074 offset++;
2075 msglen--;
2076 return offset;
2077 }
2078  
2079 static int
2080 cmd_bits_out (tvbuff_t *tvb, int offset, proto_tree *pt)
2081 {
2082 int msglen, value;
2083  
2084 msglen = tvb_reported_length_remaining(tvb, offset);
2085 value = tvb_get_guint8(tvb, offset);
2086 if (value) {
2087 static const int * digital_values[] = {
2088 &hf_gryphon_bits_out_output1,
2089 &hf_gryphon_bits_out_output2,
2090 NULL
2091 };
2092 proto_tree_add_bitmask(pt, tvb, 1, hf_gryphon_bit_out_digital_data, ett_gryphon_digital_data, digital_values, ENC_NA);
2093 } else {
2094 proto_tree_add_uint_format(pt, hf_gryphon_bit_out_digital_data, tvb, offset, 1, value, "No digital values are set");
2095 }
2096  
2097 offset++;
2098 msglen--;
2099 return offset;
2100 }
2101  
2102 static int
2103 cmd_init_strat (tvbuff_t *tvb, int offset, proto_tree *pt)
2104 {
2105 guint32 reset_limit;
2106 int msglen, indx;
2107 float value;
2108  
2109 msglen = tvb_reported_length_remaining(tvb, offset);
2110 reset_limit = tvb_get_ntohl(tvb, offset);
2111 proto_tree_add_uint_format_value(pt, hf_gryphon_init_strat_reset_limit, tvb, offset, 4,
2112 reset_limit, "Reset Limit = %u messages", reset_limit);
2113 offset += 4;
2114 msglen -= 4;
2115 for (indx = 1; msglen; indx++, offset++, msglen--) {
2116 value = tvb_get_guint8(tvb, offset);
2117 if (value)
2118 proto_tree_add_float_format_value(pt, hf_gryphon_init_strat_delay, tvb, offset, 1,
2119 value/4, "Delay %d = %.2f seconds", indx, value/4);
2120 else
2121 proto_tree_add_float_format_value(pt, hf_gryphon_init_strat_delay, tvb, offset, 1,
2122 0, "Delay %d = infinite", indx);
2123 }
2124  
2125 return offset;
2126 }
2127  
2128 static int
2129 speed(tvbuff_t *tvb, int offset, proto_tree *pt)
2130 {
2131 proto_tree_add_item(pt, hf_gryphon_speed_baud_rate_index, tvb, offset, 1, ENC_BIG_ENDIAN);
2132 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA);
2133 offset += 4;
2134 return offset;
2135 }
2136  
2137 static int
2138 filter_block(tvbuff_t *tvb, int offset, proto_tree *pt)
2139 {
2140 unsigned int op;
2141 int length, padding;
2142  
2143 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_start, tvb, offset, 2, ENC_BIG_ENDIAN);
2144 length = tvb_get_ntohs(tvb, offset+2);
2145  
2146 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
2147 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_type, tvb, offset+4, 1, ENC_BIG_ENDIAN);
2148 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_operator, tvb, offset+5, 1, ENC_BIG_ENDIAN);
2149 op = tvb_get_guint8(tvb, offset+5);
2150 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+6, 2, ENC_NA);
2151 offset += 8;
2152  
2153 if (op == BIT_FIELD_CHECK) {
2154 proto_tree_add_item(pt, hf_gryphon_filter_block_pattern, tvb, offset, length, ENC_NA);
2155 proto_tree_add_item(pt, hf_gryphon_filter_block_mask, tvb, offset+length, length, ENC_NA);
2156 } else {
2157 switch (length) {
2158 case 1:
2159 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value1, tvb, offset, 1, ENC_BIG_ENDIAN);
2160 break;
2161 case 2:
2162 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value2, tvb, offset, 2, ENC_BIG_ENDIAN);
2163 break;
2164 case 4:
2165 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value4, tvb, offset, 4, ENC_BIG_ENDIAN);
2166 break;
2167 default:
2168 proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value_bytes, tvb, offset, length, ENC_NA);
2169 }
2170 }
2171 offset += length * 2;
2172 padding = 3 - (length * 2 + 3) % 4;
2173 if (padding) {
2174 proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, padding, ENC_NA);
2175 offset += padding;
2176 }
2177 return offset;
2178 }
2179  
2180 static int
2181 blm_mode(tvbuff_t *tvb, int offset, proto_tree *pt)
2182 {
2183 proto_item *item;
2184 proto_tree *tree;
2185 int mode, milliseconds;
2186  
2187 mode = tvb_get_ntohl(tvb, offset);
2188 item = proto_tree_add_item(pt, hf_gryphon_blm_mode, tvb, offset, 4, ENC_BIG_ENDIAN);
2189 offset += 4;
2190 switch (mode) {
2191 case 1:
2192 tree = proto_item_add_subtree (item, ett_gryphon_blm_mode);
2193 milliseconds = tvb_get_ntohl(tvb, offset);
2194  
2195 proto_tree_add_uint_format_value(tree, hf_gryphon_blm_mode_avg_period, tvb, offset, 4,
2196 milliseconds, "Averaging period: %d.%03d seconds", milliseconds/1000, milliseconds%1000);
2197 break;
2198 case 2:
2199 tree = proto_item_add_subtree (item, ett_gryphon_blm_mode);
2200 proto_tree_add_item(tree, hf_gryphon_blm_mode_avg_frames, tvb, offset, 4, ENC_BIG_ENDIAN);
2201 break;
2202 default:
2203 proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 4, ENC_NA);
2204 break;
2205 }
2206  
2207 offset += 4;
2208 return offset;
2209 }
2210  
2211 void
2212 proto_register_gryphon(void)
2213 {
2214 static hf_register_info hf[] = {
2215 { &hf_gryphon_src,
2216 { "Source", "gryphon.src", FT_UINT8, BASE_HEX, VALS(src_dest), 0x0,
2217 NULL, HFILL }},
2218 { &hf_gryphon_srcchan,
2219 { "Source channel", "gryphon.srcchan", FT_UINT8, BASE_DEC, NULL, 0x0,
2220 NULL, HFILL }},
2221 { &hf_gryphon_dest,
2222 { "Destination", "gryphon.dest", FT_UINT8, BASE_HEX, VALS(src_dest), 0x0,
2223 NULL, HFILL }},
2224 { &hf_gryphon_destchan,
2225 { "Destination channel", "gryphon.destchan", FT_UINT8, BASE_DEC, NULL, 0x0,
2226 NULL, HFILL }},
2227 { &hf_gryphon_type,
2228 { "Frame type", "gryphon.type", FT_UINT8, BASE_DEC, VALS(frame_type), 0x0,
2229 NULL, HFILL }},
2230 { &hf_gryphon_cmd,
2231 { "Command", "gryphon.cmd", FT_UINT8, BASE_DEC, NULL, 0x0,
2232 NULL, HFILL }},
2233 { &hf_gryphon_data,
2234 { "Data", "gryphon.data", FT_BYTES, BASE_NONE, NULL, 0x0,
2235 NULL, HFILL }},
2236 { &hf_gryphon_padding,
2237 { "Padding", "gryphon.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
2238 NULL, HFILL }},
2239 { &hf_gryphon_ignored,
2240 { "Ignored", "gryphon.ignored", FT_BYTES, BASE_NONE, NULL, 0x0,
2241 NULL, HFILL }},
2242 { &hf_gryphon_data_length,
2243 { "Data length (bytes)", "gryphon.data_length", FT_UINT16, BASE_DEC, NULL, 0x0,
2244 NULL, HFILL }},
2245 { &hf_gryphon_reserved,
2246 { "Reserved", "gryphon.reserved", FT_BYTES, BASE_NONE, NULL, 0x0,
2247 NULL, HFILL }},
2248 { &hf_gryphon_wait_flags,
2249 { "Flags", "gryphon.wait_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
2250 NULL, HFILL }},
2251 { &hf_gryphon_wait_resp,
2252 { "Wait for response", "gryphon.wait_resp", FT_BOOLEAN, 8, TFS(&tfs_wait_response), DONT_WAIT_FOR_RESP,
2253 NULL, HFILL }},
2254 { &hf_gryphon_wait_prev_resp,
2255 { "Wait for previous response", "gryphon.wait_prev_resp", FT_BOOLEAN, 8, TFS(&tfs_wait_response), WAIT_FOR_PREV_RESP,
2256 NULL, HFILL }},
2257 { &hf_gryphon_status,
2258 { "Status", "gryphon.status", FT_UINT32, BASE_HEX, VALS(responses_vs), 0x0,
2259 NULL, HFILL }},
2260 { &hf_gryphon_data_header_length,
2261 { "Header length (bytes)", "gryphon.data.header_length", FT_UINT16, BASE_DEC, NULL, 0x0,
2262 NULL, HFILL }},
2263 { &hf_gryphon_data_data_length,
2264 { "Data length (bytes)", "gryphon.data.data_length", FT_UINT16, BASE_DEC, NULL, 0x0,
2265 NULL, HFILL }},
2266 { &hf_gryphon_data_extra_data_length,
2267 { "Extra data length (bytes)", "gryphon.data.extra_length", FT_UINT8, BASE_DEC, NULL, 0x0,
2268 NULL, HFILL }},
2269 { &hf_gryphon_data_mode,
2270 { "Mode", "gryphon.data.mode", FT_UINT8, BASE_DEC, NULL, 0x0,
2271 NULL, HFILL }},
2272 { &hf_gryphon_data_mode_transmitted,
2273 { "Transmitted message", "gryphon.data.mode.transmitted", FT_BOOLEAN, 8, TFS(&true_false), 0x80,
2274 NULL, HFILL }},
2275 { &hf_gryphon_data_mode_receive,
2276 { "Received message", "gryphon.data.mode.receive", FT_BOOLEAN, 8, TFS(&true_false), 0x40,
2277 NULL, HFILL }},
2278 { &hf_gryphon_data_mode_local,
2279 { "Local message", "gryphon.data.mode.local", FT_BOOLEAN, 8, TFS(&true_false), 0x20,
2280 NULL, HFILL }},
2281 { &hf_gryphon_data_mode_remote,
2282 { "Remote message", "gryphon.data.mode.remote", FT_BOOLEAN, 8, TFS(&true_false), 0x10,
2283 NULL, HFILL }},
2284 { &hf_gryphon_data_mode_internal,
2285 { "Internal message", "gryphon.data.mode.internal", FT_BOOLEAN, 8, TFS(&true_false), 0x01,
2286 NULL, HFILL }},
2287 { &hf_gryphon_data_priority,
2288 { "Priority", "gryphon.data.priority", FT_UINT8, BASE_DEC, NULL, 0x0,
2289 NULL, HFILL }},
2290 { &hf_gryphon_data_error_status,
2291 { "Error status", "gryphon.data.error_status", FT_UINT8, BASE_DEC, NULL, 0x0,
2292 NULL, HFILL }},
2293 { &hf_gryphon_data_time,
2294 { "Timestamp", "gryphon.data.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
2295 NULL, HFILL }},
2296 { &hf_gryphon_data_context,
2297 { "Context", "gryphon.data.context", FT_UINT8, BASE_DEC, NULL, 0x0,
2298 NULL, HFILL }},
2299 { &hf_gryphon_data_header_data,
2300 { "Header", "gryphon.data.header_data", FT_BYTES, BASE_NONE, NULL, 0x0,
2301 NULL, HFILL }},
2302 { &hf_gryphon_data_data,
2303 { "Data", "gryphon.data.data", FT_BYTES, BASE_NONE, NULL, 0x0,
2304 NULL, HFILL }},
2305 { &hf_gryphon_data_extra_data,
2306 { "Extra data", "gryphon.data.extra_data", FT_BYTES, BASE_NONE, NULL, 0x0,
2307 NULL, HFILL }},
2308 { &hf_gryphon_data_padding,
2309 { "Padding", "gryphon.data.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
2310 NULL, HFILL }},
2311 { &hf_gryphon_event_id,
2312 { "Event ID", "gryphon.event.id", FT_UINT8, BASE_DEC, NULL, 0x0,
2313 NULL, HFILL }},
2314 { &hf_gryphon_event_name,
2315 { "Event name", "gryphon.event.name", FT_STRING, BASE_NONE, NULL, 0x0,
2316 NULL, HFILL }},
2317 { &hf_gryphon_event_context,
2318 { "Event context", "gryphon.event.context", FT_UINT8, BASE_DEC, NULL, 0x0,
2319 NULL, HFILL }},
2320 { &hf_gryphon_event_time,
2321 { "Timestamp", "gryphon.event.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
2322 NULL, HFILL }},
2323 { &hf_gryphon_event_data,
2324 { "Data", "gryphon.event.data", FT_BYTES, BASE_NONE, NULL, 0x0,
2325 NULL, HFILL }},
2326 { &hf_gryphon_event_padding,
2327 { "Padding", "gryphon.event.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
2328 NULL, HFILL }},
2329 { &hf_gryphon_misc_data,
2330 { "Data", "gryphon.misc.data", FT_STRING, BASE_NONE, NULL, 0x0,
2331 NULL, HFILL }},
2332 { &hf_gryphon_misc_padding,
2333 { "Padding", "gryphon.misc.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
2334 NULL, HFILL }},
2335 { &hf_gryphon_eventnum,
2336 { "Event numbers", "gryphon.eventnum", FT_UINT8, BASE_DEC, NULL, 0x0,
2337 NULL, HFILL }},
2338 { &hf_gryphon_resp_time,
2339 { "Date/Time", "gryphon.resp_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
2340 NULL, HFILL }},
2341 { &hf_gryphon_setfilt,
2342 { "Pass/Block flag", "gryphon.setfilt.flag", FT_UINT32, BASE_DEC, NULL, 0x0,
2343 NULL, HFILL }},
2344 { &hf_gryphon_setfilt_length,
2345 { "Length of Pattern & Mask", "gryphon.setfilt.length", FT_UINT32, BASE_DEC, NULL, 0x0,
2346 NULL, HFILL }},
2347 { &hf_gryphon_setfilt_discard_data,
2348 { "Discarded data", "gryphon.setfilt.discard_data", FT_BYTES, BASE_NONE, NULL, 0x0,
2349 NULL, HFILL }},
2350 { &hf_gryphon_setfilt_padding,
2351 { "Padding", "gryphon.setfilt.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
2352 NULL, HFILL }},
2353 { &hf_gryphon_ioctl,
2354 { "IOCTL", "gryphon.ioctl", FT_UINT32, BASE_HEX, VALS(ioctls), 0x0,
2355 NULL, HFILL }},
2356 { &hf_gryphon_ioctl_data,
2357 { "Data", "gryphon.ioctl.data", FT_BYTES, BASE_NONE, NULL, 0x0,
2358 NULL, HFILL }},
2359 { &hf_gryphon_addfilt_pass,
2360 { "Conforming messages", "gryphon.addfilt.pass", FT_BOOLEAN, 8, TFS(&tfs_passed_blocked), FILTER_PASS_FLAG,
2361 NULL, HFILL }},
2362 { &hf_gryphon_addfilt_active,
2363 { "Filter", "gryphon.addfilt.active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG,
2364 NULL, HFILL }},
2365 { &hf_gryphon_addfilt_blocks,
2366 { "Number of filter blocks", "gryphon.addfilt.blocks", FT_UINT8, BASE_DEC, NULL, 0x0,
2367 NULL, HFILL }},
2368 { &hf_gryphon_addfilt_handle,
2369 { "Filter handle", "gryphon.addfilt.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
2370 NULL, HFILL }},
2371 { &hf_gryphon_modfilt,
2372 { "Filter handle", "gryphon.modfilt", FT_UINT8, BASE_DEC, NULL, 0x0,
2373 NULL, HFILL }},
2374 { &hf_gryphon_modfilt_action,
2375 { "Action", "gryphon.modfilt.action", FT_UINT8, BASE_DEC, VALS(filtacts), 0x0,
2376 NULL, HFILL }},
2377 { &hf_gryphon_filthan,
2378 { "Number of filter handles", "gryphon.filthan", FT_UINT8, BASE_DEC, NULL, 0x0,
2379 NULL, HFILL }},
2380 { &hf_gryphon_filthan_id,
2381 { "Filter handle ID", "gryphon.filthan.id", FT_UINT8, BASE_DEC, NULL, 0x0,
2382 NULL, HFILL }},
2383 { &hf_gryphon_filthan_padding,
2384 { "Padding", "gryphon.filthan.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
2385 NULL, HFILL }},
2386 { &hf_gryphon_dfiltmode,
2387 { "Filter mode", "gryphon.dfiltmode", FT_UINT8, BASE_DEC, VALS(dmodes), 0x0,
2388 NULL, HFILL }},
2389 { &hf_gryphon_filtmode,
2390 { "Filter mode", "gryphon.filtmode", FT_UINT8, BASE_DEC, VALS(modes), 0x0,
2391 NULL, HFILL }},
2392 { &hf_gryphon_register_username,
2393 { "Username", "gryphon.register.username", FT_STRING, BASE_NONE, NULL, 0x0,
2394 NULL, HFILL }},
2395 { &hf_gryphon_register_password,
2396 { "Password", "gryphon.register.password", FT_STRING, BASE_NONE, NULL, 0x0,
2397 NULL, HFILL }},
2398 { &hf_gryphon_register_client_id,
2399 { "Client ID", "gryphon.register.client_id", FT_UINT8, BASE_DEC, NULL, 0x0,
2400 NULL, HFILL }},
2401 { &hf_gryphon_register_privileges,
2402 { "Privileges", "gryphon.register.privileges", FT_UINT8, BASE_DEC, NULL, 0x0,
2403 NULL, HFILL }},
2404 { &hf_gryphon_getspeeds_set_ioctl,
2405 { "Set Speed IOCTL", "gryphon.getspeeds.set_ioctl", FT_UINT32, BASE_DEC, NULL, 0x0,
2406 NULL, HFILL }},
2407 { &hf_gryphon_getspeeds_get_ioctl,
2408 { "Get Speed IOCTL", "gryphon.getspeeds.get_ioctl", FT_UINT32, BASE_DEC, NULL, 0x0,
2409 NULL, HFILL }},
2410 { &hf_gryphon_getspeeds_size,
2411 { "Speed data size (bytes)", "gryphon.getspeeds.size", FT_UINT8, BASE_DEC, NULL, 0x0,
2412 NULL, HFILL }},
2413 { &hf_gryphon_getspeeds_preset,
2414 { "Preset speed numbers", "gryphon.getspeeds.preset", FT_UINT8, BASE_DEC, NULL, 0x0,
2415 NULL, HFILL }},
2416 { &hf_gryphon_getspeeds_data,
2417 { "Data for preset", "gryphon.getspeeds.data", FT_BYTES, BASE_NONE, NULL, 0x0,
2418 NULL, HFILL }},
2419 { &hf_gryphon_cmd_sort,
2420 { "Set sorting", "gryphon.cmd_sort", FT_UINT8, BASE_DEC, VALS(cmd_sort_type), 0x0,
2421 NULL, HFILL }},
2422 { &hf_gryphon_cmd_optimize,
2423 { "Set optimization", "gryphon.cmd_optimize", FT_UINT8, BASE_DEC, VALS(cmd_optimize_type), 0x0,
2424 NULL, HFILL }},
2425 { &hf_gryphon_config_device_name,
2426 { "Device name", "gryphon.config.device_name", FT_STRING, BASE_NONE, NULL, 0x0,
2427 NULL, HFILL }},
2428 { &hf_gryphon_config_device_version,
2429 { "Device version", "gryphon.config.device_version", FT_STRING, BASE_NONE, NULL, 0x0,
2430 NULL, HFILL }},
2431 { &hf_gryphon_config_device_serial_number,
2432 { "Device serial number", "gryphon.config.device_serial_number", FT_STRING, BASE_NONE, NULL, 0x0,
2433 NULL, HFILL }},
2434 { &hf_gryphon_config_num_channels,
2435 { "Number of channels", "gryphon.config.num_channels", FT_UINT8, BASE_DEC, NULL, 0x0,
2436 NULL, HFILL }},
2437 { &hf_gryphon_config_name_version_ext,
2438 { "Name & version extension", "gryphon.config.name_version_ext", FT_STRING, BASE_NONE, NULL, 0x0,
2439 NULL, HFILL }},
2440 { &hf_gryphon_config_driver_name,
2441 { "Driver name", "gryphon.config.driver_name", FT_STRING, BASE_NONE, NULL, 0x0,
2442 NULL, HFILL }},
2443 { &hf_gryphon_config_driver_version,
2444 { "Driver version", "gryphon.config.driver_version", FT_STRING, BASE_NONE, NULL, 0x0,
2445 NULL, HFILL }},
2446 { &hf_gryphon_config_device_security,
2447 { "Device security string", "gryphon.config.device_security", FT_STRING, BASE_NONE, NULL, 0x0,
2448 NULL, HFILL }},
2449 { &hf_gryphon_config_max_data_length,
2450 { "Maximum data length (bytes)", "gryphon.config.max_data_length", FT_UINT16, BASE_DEC, NULL, 0x0,
2451 NULL, HFILL }},
2452 { &hf_gryphon_config_min_data_length,
2453 { "Minimum data length (bytes)", "gryphon.config.min_data_length", FT_UINT16, BASE_DEC, NULL, 0x0,
2454 NULL, HFILL }},
2455 { &hf_gryphon_config_hardware_serial_number,
2456 { "Hardware serial number", "gryphon.config.hardware_serial_number", FT_STRING, BASE_NONE, NULL, 0x0,
2457 NULL, HFILL }},
2458 { &hf_gryphon_config_protocol_type,
2459 { "Protocol type & subtype", "gryphon.config.protocol_type", FT_UINT16, BASE_HEX, VALS(protocol_types), 0x0,
2460 NULL, HFILL }},
2461 { &hf_gryphon_config_channel_id,
2462 { "Channel ID", "gryphon.config.channel_id", FT_UINT8, BASE_DEC, NULL, 0x0,
2463 NULL, HFILL }},
2464 { &hf_gryphon_config_card_slot_number,
2465 { "Card slot number", "gryphon.config.card_slot_number", FT_UINT8, BASE_DEC, NULL, 0x0,
2466 NULL, HFILL }},
2467 { &hf_gryphon_config_max_extra_data,
2468 { "Maximum extra data (bytes)", "gryphon.config.max_extra_data", FT_UINT16, BASE_DEC, NULL, 0x0,
2469 NULL, HFILL }},
2470 { &hf_gryphon_config_min_extra_data,
2471 { "Minimum extra data (bytes)", "gryphon.config.min_extra_data", FT_UINT16, BASE_DEC, NULL, 0x0,
2472 NULL, HFILL }},
2473 { &hf_gryphon_sched_num_iterations,
2474 { "Number of iterations", "gryphon.sched.num_iterations", FT_UINT32, BASE_DEC, NULL, 0x0,
2475 NULL, HFILL }},
2476 { &hf_gryphon_sched_flags,
2477 { "Flags", "gryphon.sched.flags", FT_UINT32, BASE_HEX, NULL, 0x0,
2478 NULL, HFILL }},
2479 { &hf_gryphon_sched_flags_scheduler,
2480 { "Scheduler", "gryphon.sched.flags.scheduler", FT_BOOLEAN, 32, TFS(&critical_normal), 0x01,
2481 NULL, HFILL }},
2482 { &hf_gryphon_sched_sleep,
2483 { "Sleep (milliseconds)", "gryphon.sched.sleep", FT_UINT32, BASE_DEC, NULL, 0x0,
2484 NULL, HFILL }},
2485 { &hf_gryphon_sched_transmit_count,
2486 { "Transmit count", "gryphon.sched.transmit_count", FT_UINT32, BASE_DEC, NULL, 0x0,
2487 NULL, HFILL }},
2488 { &hf_gryphon_sched_transmit_period,
2489 { "Transmit period (milliseconds)", "gryphon.sched.transmit_period", FT_UINT32, BASE_DEC, NULL, 0x0,
2490 NULL, HFILL }},
2491 { &hf_gryphon_sched_transmit_flags,
2492 { "Flags", "gryphon.sched.transmit_flags", FT_UINT16, BASE_HEX, NULL, 0x0,
2493 NULL, HFILL }},
2494 { &hf_gryphon_sched_skip_transmit_period,
2495 { "Last transmit period", "gryphon.sched.skip_transmit_period", FT_BOOLEAN, 16, TFS(&skip_not_skip), 0x01,
2496 NULL, HFILL }},
2497 { &hf_gryphon_sched_skip_sleep,
2498 { "Last transmit period", "gryphon.sched.skip_transmit_period", FT_BOOLEAN, 16, TFS(&skip_not_skip), 0x01,
2499 NULL, HFILL }},
2500 { &hf_gryphon_sched_channel,
2501 { "Channel", "gryphon.sched.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
2502 NULL, HFILL }},
2503 { &hf_gryphon_sched_rep_id,
2504 { "Schedule ID", "gryphon.sched.rep_id", FT_UINT32, BASE_DEC, NULL, 0x0,
2505 NULL, HFILL }},
2506 { &hf_gryphon_sched_rep_message_index,
2507 { "Message index", "gryphon.sched.rep_message_index", FT_UINT8, BASE_DEC, NULL, 0x0,
2508 NULL, HFILL }},
2509 { &hf_gryphon_blm_data_time,
2510 { "Timestamp", "gryphon.blm_data.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
2511 NULL, HFILL }},
2512 { &hf_gryphon_blm_data_bus_load,
2513 { "Bus load average (%)", "gryphon.blm_data.bus_load", FT_UINT16, BASE_DEC, NULL, 0x0,
2514 NULL, HFILL }},
2515 { &hf_gryphon_blm_data_current_bus_load,
2516 { "Current bus load (%)", "gryphon.blm_data.current_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0,
2517 NULL, HFILL }},
2518 { &hf_gryphon_blm_data_peak_bus_load,
2519 { "Peak bus load (%)", "gryphon.blm_data.peak_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0,
2520 NULL, HFILL }},
2521 { &hf_gryphon_blm_data_historic_peak_bus_load,
2522 { "Historic peak bus load (%)", "gryphon.blm_data.historic_peak_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0,
2523 NULL, HFILL }},
2524 { &hf_gryphon_blm_stat_receive_frame_count,
2525 { "Receive frame count", "gryphon.blm_stat.receive_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0,
2526 NULL, HFILL }},
2527 { &hf_gryphon_blm_stat_transmit_frame_count,
2528 { "Transmit frame count", "gryphon.blm_stat.transmit_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0,
2529 NULL, HFILL }},
2530 { &hf_gryphon_blm_stat_receive_dropped_frame_count,
2531 { "Receive dropped frame count", "gryphon.blm_stat.receive_dropped_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0,
2532 NULL, HFILL }},
2533 { &hf_gryphon_blm_stat_transmit_dropped_frame_count,
2534 { "Transmit dropped frame count", "gryphon.blm_stat.transmit_dropped_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0,
2535 NULL, HFILL }},
2536 { &hf_gryphon_blm_stat_receive_error_count,
2537 { "Receive error count", "gryphon.blm_stat.receive_error_count", FT_UINT32, BASE_DEC, NULL, 0x0,
2538 NULL, HFILL }},
2539 { &hf_gryphon_blm_stat_transmit_error_count,
2540 { "Transmit error count", "gryphon.blm_stat.transmit_error_count", FT_UINT32, BASE_DEC, NULL, 0x0,
2541 NULL, HFILL }},
2542 { &hf_gryphon_addresp_flags,
2543 { "Flags", "gryphon.addresp.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
2544 NULL, HFILL }},
2545 { &hf_gryphon_addresp_flags_active,
2546 { "Response", "gryphon.addresp.flags.active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG,
2547 NULL, HFILL }},
2548 { &hf_gryphon_addresp_blocks,
2549 { "Number of filter blocks", "gryphon.addresp.blocks", FT_UINT8, BASE_DEC, NULL, 0x0,
2550 NULL, HFILL }},
2551 { &hf_gryphon_addresp_responses,
2552 { "Number of response blocks", "gryphon.addresp.responses", FT_UINT8, BASE_DEC, NULL, 0x0,
2553 NULL, HFILL }},
2554 { &hf_gryphon_addresp_old_handle,
2555 { "Old handle", "gryphon.addresp.old_handle", FT_UINT8, BASE_DEC, NULL, 0x0,
2556 NULL, HFILL }},
2557 { &hf_gryphon_addresp_action,
2558 { "Old handle", "gryphon.addresp.action", FT_UINT8, BASE_DEC, VALS(action_vals), 0x07,
2559 NULL, HFILL }},
2560 { &hf_gryphon_addresp_action_period,
2561 { "Period", "gryphon.addresp.action_period", FT_BOOLEAN, 8, TFS(&frames_01seconds), FR_PERIOD_MSGS,
2562 NULL, HFILL }},
2563 { &hf_gryphon_addresp_action_deact_on_event,
2564 { "Deact on event", "gryphon.addresp.action.deact_on_event", FT_UINT8, BASE_DEC, VALS(deact_on_event_vals), FR_DELETE|FR_DEACT_ON_EVENT,
2565 NULL, HFILL }},
2566 { &hf_gryphon_addresp_action_deact_after_period,
2567 { "Deact on Period", "gryphon.addresp.action.deact_after_period", FT_UINT8, BASE_DEC, VALS(deact_after_per_vals), FR_DELETE|FR_DEACT_AFTER_PER,
2568 NULL, HFILL }},
2569 { &hf_gryphon_addresp_action_period_type,
2570 { "Period", "gryphon.addresp.action_period_type", FT_UINT16, BASE_DEC, NULL, 0x0,
2571 NULL, HFILL }},
2572 { &hf_gryphon_addresp_handle,
2573 { "Response handle", "gryphon.addresp.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
2574 NULL, HFILL }},
2575 { &hf_gryphon_modresp_handle,
2576 { "Response handle", "gryphon.modresp.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
2577 NULL, HFILL }},
2578 { &hf_gryphon_modresp_action,
2579 { "Action response", "gryphon.modresp.action", FT_UINT8, BASE_DEC, VALS(filtacts), 0x0,
2580 NULL, HFILL }},
2581 { &hf_gryphon_num_resphan,
2582 { "Number of response handles", "gryphon.num_resphan", FT_UINT8, BASE_DEC, NULL, 0x0,
2583 NULL, HFILL }},
2584 { &hf_gryphon_handle,
2585 { "Handle", "gryphon.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
2586 NULL, HFILL }},
2587 { &hf_gryphon_transmit_sched_id,
2588 { "Transmit schedule ID", "gryphon.transmit_sched_id", FT_UINT32, BASE_DEC, NULL, 0x0,
2589 NULL, HFILL }},
2590 { &hf_gryphon_desc_program_size,
2591 { "Program size", "gryphon.desc.program_size", FT_UINT32, BASE_DEC, NULL, 0x0,
2592 NULL, HFILL }},
2593 { &hf_gryphon_desc_program_name,
2594 { "Program name", "gryphon.desc.program_name", FT_STRING, BASE_NONE, NULL, 0x0,
2595 NULL, HFILL }},
2596 { &hf_gryphon_desc_program_description,
2597 { "Program description", "gryphon.desc.program_description", FT_STRING, BASE_NONE, NULL, 0x0,
2598 NULL, HFILL }},
2599 { &hf_gryphon_desc_flags,
2600 { "Flags", "gryphon.desc.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
2601 NULL, HFILL }},
2602 { &hf_gryphon_desc_flags_program,
2603 { "Period", "gryphon.desc.flags.program", FT_BOOLEAN, 8, TFS(&present_not_present), 0x01,
2604 NULL, HFILL }},
2605 { &hf_gryphon_desc_handle,
2606 { "Handle", "gryphon.desc.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
2607 NULL, HFILL }},
2608 { &hf_gryphon_upload_block_number,
2609 { "Block number", "gryphon.upload.block_number", FT_UINT16, BASE_DEC, NULL, 0x0,
2610 NULL, HFILL }},
2611 { &hf_gryphon_upload_handle,
2612 { "Handle", "gryphon.upload.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
2613 NULL, HFILL }},
2614 { &hf_gryphon_upload_data,
2615 { "Data", "gryphon.upload.data", FT_BYTES, BASE_NONE, NULL, 0x0,
2616 NULL, HFILL }},
2617 { &hf_gryphon_delete,
2618 { "Program name", "gryphon.delete", FT_STRING, BASE_NONE, NULL, 0x0,
2619 NULL, HFILL }},
2620 { &hf_gryphon_list_block_number,
2621 { "Block number", "gryphon.list.block_number", FT_UINT8, BASE_DEC, NULL, 0x0,
2622 NULL, HFILL }},
2623 { &hf_gryphon_list_num_programs,
2624 { "Number of programs in this response", "gryphon.list.num_programs", FT_UINT8, BASE_DEC, NULL, 0x0,
2625 NULL, HFILL }},
2626 { &hf_gryphon_list_num_remain_programs,
2627 { "Number of remaining programs", "gryphon.list.num_remain_programs", FT_UINT16, BASE_DEC, NULL, 0x0,
2628 NULL, HFILL }},
2629 { &hf_gryphon_list_name,
2630 { "Name", "gryphon.list.name", FT_STRING, BASE_NONE, NULL, 0x0,
2631 NULL, HFILL }},
2632 { &hf_gryphon_list_description,
2633 { "Description", "gryphon.list.description", FT_STRING, BASE_NONE, NULL, 0x0,
2634 NULL, HFILL }},
2635 { &hf_gryphon_start_arguments,
2636 { "Arguments", "gryphon.start.arguments", FT_STRINGZ, BASE_NONE, NULL, 0x0,
2637 NULL, HFILL }},
2638 { &hf_gryphon_start_channel,
2639 { "Channel (Client) number", "gryphon.start.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
2640 NULL, HFILL }},
2641 { &hf_gryphon_status_num_running_copies,
2642 { "Number of running copies", "gryphon.status.num_running_copies", FT_UINT8, BASE_DEC, NULL, 0x0,
2643 NULL, HFILL }},
2644 { &hf_gryphon_options_handle,
2645 { "Handle", "gryphon.options.handle", FT_UINT8, BASE_DEC, NULL, 0x0,
2646 NULL, HFILL }},
2647 { &hf_gryphon_files,
2648 { "Directory", "gryphon.files", FT_STRING, BASE_NONE, NULL, 0x0,
2649 NULL, HFILL }},
2650 { &hf_gryphon_usdt_flags_register,
2651 { "USDT", "gryphon.usdt.flags_register", FT_UINT8, BASE_DEC, VALS(register_unregister), 0x01,
2652 NULL, HFILL }},
2653 { &hf_gryphon_usdt_action_flags,
2654 { "Action Flags", "gryphon.usdt.action_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
2655 NULL, HFILL }},
2656 { &hf_gryphon_usdt_action_flags_register,
2657 { "Register", "gryphon.usdt.action_flags.register", FT_UINT8, BASE_DEC, VALS(register_unregister), 0x01,
2658 NULL, HFILL }},
2659 { &hf_gryphon_usdt_action_flags_action,
2660 { "Action", "gryphon.usdt.action_flags.action", FT_UINT8, BASE_DEC, VALS(usdt_action_vals), 0x06,
2661 NULL, HFILL }},
2662 { &hf_gryphon_usdt_transmit_options_flags,
2663 { "Transmit options", "gryphon.usdt.transmit_options_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
2664 NULL, HFILL }},
2665 { &hf_gryphon_usdt_transmit_options_flags_echo,
2666 { "Echo long transmit messages back to the client", "gryphon.usdt.transmit_options_flags.echo",
2667 FT_BOOLEAN, 8, TFS(&yes_no), 0x01, NULL, HFILL }},
2668 { &hf_gryphon_usdt_transmit_options_action,
2669 { "Transmit Action", "gryphon.usdt.transmit_options_flags.action", FT_UINT8, BASE_DEC, VALS(xmit_opt_vals), 0x06,
2670 NULL, HFILL }},
2671 { &hf_gryphon_usdt_transmit_options_send_done,
2672 { "Send a USDT_DONE event when the last frame of a multi-frame USDT message is transmitted",
2673 "gryphon.usdt.transmit_options_flags.send_done", FT_BOOLEAN, 8, TFS(&yes_no), 0x08, NULL, HFILL }},
2674 { &hf_gryphon_usdt_receive_options_flags,
2675 { "Receive options", "gryphon.usdt.receive_options_flags", FT_UINT8, BASE_HEX, NULL, 0x0,
2676 NULL, HFILL }},
2677 { &hf_gryphon_usdt_receive_options_action,
2678 { "Receive Action", "gryphon.usdt.receive_options_flags.action", FT_UINT8, BASE_DEC, VALS(recv_opt_vals), 0x03,
2679 NULL, HFILL }},
2680 { &hf_gryphon_usdt_receive_options_firstframe,
2681 { "Send a USDT_FIRSTFRAME event when the first frame of a multi-frame USDT message is received",
2682 "gryphon.usdt.receive_options_flags.firstframe", FT_BOOLEAN, 8, TFS(&yes_no), 0x04, NULL, HFILL }},
2683 { &hf_gryphon_usdt_receive_options_lastframe,
2684 { "Send a USDT_LASTFRAME event when the first frame of a multi-frame USDT message is received",
2685 "gryphon.usdt.receive_options_flags.lastframe", FT_BOOLEAN, 8, TFS(&yes_no), 0x08, NULL, HFILL }},
2686 { &hf_gryphon_usdt_ext_address,
2687 { "Using extended addressing for", "gryphon.usdt.ext_address", FT_UINT8, BASE_DEC, NULL, 0x0,
2688 NULL, HFILL }},
2689 { &hf_gryphon_usdt_ext_address_id,
2690 { "ID", "gryphon.usdt.ext_address.id", FT_UINT32, BASE_HEX, NULL, 0x0,
2691 NULL, HFILL }},
2692 { &hf_gryphon_usdt_block_size,
2693 { "Number of IDs in the block", "gryphon.usdt.block_size", FT_UINT32, BASE_DEC, NULL, 0x0,
2694 NULL, HFILL }},
2695 { &hf_gryphon_bits_in_input1,
2696 { "Input 1", "gryphon.bits_in.input1", FT_BOOLEAN, 8, TFS(&set_not_set), 0x01,
2697 NULL, HFILL }},
2698 { &hf_gryphon_bits_in_input2,
2699 { "Input 2", "gryphon.bits_in.input2", FT_BOOLEAN, 8, TFS(&set_not_set), 0x02,
2700 NULL, HFILL }},
2701 { &hf_gryphon_bits_in_input3,
2702 { "Input 3", "gryphon.bits_in.input3", FT_BOOLEAN, 8, TFS(&set_not_set), 0x04,
2703 NULL, HFILL }},
2704 { &hf_gryphon_bits_in_pushbutton,
2705 { "Pushbutton", "gryphon.bits_in.pushbutton", FT_BOOLEAN, 8, TFS(&set_not_set), 0x08,
2706 NULL, HFILL }},
2707 { &hf_gryphon_bits_out_output1,
2708 { "Input 1", "gryphon.bits_out.output1", FT_BOOLEAN, 8, TFS(&set_not_set), 0x01,
2709 NULL, HFILL }},
2710 { &hf_gryphon_bits_out_output2,
2711 { "Input 2", "gryphon.bits_out.output2", FT_BOOLEAN, 8, TFS(&set_not_set), 0x02,
2712 NULL, HFILL }},
2713 { &hf_gryphon_init_strat_reset_limit,
2714 { "Reset Limit", "gryphon.init_strat.reset_limit", FT_UINT32, BASE_DEC, NULL, 0x0,
2715 NULL, HFILL }},
2716 { &hf_gryphon_init_strat_delay,
2717 { "Delay", "gryphon.init_strat.strat_delay", FT_FLOAT, BASE_NONE, NULL, 0x0,
2718 NULL, HFILL }},
2719 { &hf_gryphon_speed_baud_rate_index,
2720 { "Baud rate index", "gryphon.speed.baud_rate_index", FT_UINT8, BASE_DEC, NULL, 0x0,
2721 NULL, HFILL }},
2722 { &hf_gryphon_filter_block_filter_start,
2723 { "Filter field starts at byte", "gryphon.filter_block.filter_start", FT_UINT16, BASE_DEC, NULL, 0x0,
2724 NULL, HFILL }},
2725 { &hf_gryphon_filter_block_filter_length,
2726 { "Filter field length", "gryphon.filter_block.filter_length", FT_UINT16, BASE_DEC, NULL, 0x0,
2727 NULL, HFILL }},
2728 { &hf_gryphon_filter_block_filter_type,
2729 { "Filtering on", "gryphon.filter_block.filter_type", FT_UINT8, BASE_DEC, VALS(filter_data_types), 0x0,
2730 NULL, HFILL }},
2731 { &hf_gryphon_filter_block_filter_operator,
2732 { "Type of comparison", "gryphon.filter_block.filter_operator", FT_UINT8, BASE_DEC, VALS(operators), 0x0,
2733 NULL, HFILL }},
2734 { &hf_gryphon_filter_block_filter_value1,
2735 { "Value", "gryphon.filter_block.filter_value", FT_UINT8, BASE_DEC, NULL, 0x0,
2736 NULL, HFILL }},
2737 { &hf_gryphon_filter_block_filter_value2,
2738 { "Value", "gryphon.filter_block.filter_value", FT_UINT16, BASE_DEC, NULL, 0x0,
2739 NULL, HFILL }},
2740 { &hf_gryphon_filter_block_filter_value4,
2741 { "Value", "gryphon.filter_block.filter_value", FT_UINT32, BASE_DEC, NULL, 0x0,
2742 NULL, HFILL }},
2743 { &hf_gryphon_filter_block_filter_value_bytes,
2744 { "Value", "gryphon.filter_block.filter_value_bytes", FT_BYTES, BASE_NONE, NULL, 0x0,
2745 NULL, HFILL }},
2746 { &hf_gryphon_blm_mode,
2747 { "Mode", "gryphon.blm_mode", FT_UINT32, BASE_DEC, VALS(blm_mode_vals), 0x0,
2748 NULL, HFILL }},
2749 { &hf_gryphon_blm_mode_avg_period,
2750 { "Averaging period (seconds)", "gryphon.blm_mode.avg_period", FT_UINT32, BASE_DEC, NULL, 0x0,
2751 NULL, HFILL }},
2752 { &hf_gryphon_blm_mode_avg_frames,
2753 { "Averaging period (frames)", "gryphon.blm_mode.avg_frames", FT_UINT32, BASE_DEC, NULL, 0x0,
2754 NULL, HFILL }},
2755 { &hf_gryphon_command,
2756 { "Command", "gryphon.command", FT_STRING, BASE_NONE, NULL, 0x0,
2757 NULL, HFILL }},
2758 { &hf_gryphon_cmd_mode,
2759 { "Mode", "gryphon.command.mode", FT_UINT8, BASE_DEC, NULL, 0x0,
2760 NULL, HFILL }},
2761 { &hf_gryphon_option,
2762 { "Option", "gryphon.option", FT_UINT32, BASE_DEC, NULL, 0x0,
2763 NULL, HFILL }},
2764 { &hf_gryphon_option_data,
2765 { "Option data", "gryphon.option_data", FT_BYTES, BASE_NONE, NULL, 0x0,
2766 NULL, HFILL }},
2767 { &hf_gryphon_cmd_file,
2768 { "File", "gryphon.command.file", FT_UINT8, BASE_DEC, NULL, 0x0,
2769 NULL, HFILL }},
2770 { &hf_gryphon_bit_in_digital_data,
2771 { "Digital values set", "gryphon.bit_in_digital_data", FT_UINT8, BASE_HEX, NULL, 0x0,
2772 NULL, HFILL }},
2773 { &hf_gryphon_bit_out_digital_data,
2774 { "Digital values set", "gryphon.bit_out_digital_data", FT_UINT8, BASE_HEX, NULL, 0x0,
2775 NULL, HFILL }},
2776 { &hf_gryphon_filter_block_pattern,
2777 { "Pattern", "gryphon.filter_block.pattern", FT_BYTES, BASE_NONE, NULL, 0x0,
2778 NULL, HFILL }},
2779 { &hf_gryphon_filter_block_mask,
2780 { "Mask", "gryphon.filter_block.mask", FT_BYTES, BASE_NONE, NULL, 0x0,
2781 NULL, HFILL }},
2782 { &hf_gryphon_usdt_request,
2783 { "USDT request IDs", "gryphon.usdt_request", FT_UINT32, BASE_HEX, NULL, 0x0,
2784 NULL, HFILL }},
2785 { &hf_gryphon_usdt_response,
2786 { "USDT response IDs", "gryphon.usdt_response", FT_UINT32, BASE_HEX, NULL, 0x0,
2787 NULL, HFILL }},
2788 { &hf_gryphon_uudt_response,
2789 { "UUDT response IDs", "gryphon.uudt_response", FT_UINT32, BASE_HEX, NULL, 0x0,
2790 NULL, HFILL }},
2791 { &hf_gryphon_more_filenames,
2792 { "More filenames to return", "gryphon.more_filenames", FT_UINT8, BASE_DEC, NULL, 0x0,
2793 NULL, HFILL }},
2794 { &hf_gryphon_filenames,
2795 { "File and directory names", "gryphon.filenames", FT_STRING, BASE_NONE, NULL, 0x0,
2796 NULL, HFILL }},
2797 { &hf_gryphon_program_channel_number,
2798 { "Program channel number", "gryphon.program_channel_number", FT_UINT8, BASE_DEC, NULL, 0x0,
2799 NULL, HFILL }},
2800 { &hf_gryphon_valid_header_length,
2801 { "Valid Header length", "gryphon.valid_header_length", FT_UINT32, BASE_HEX, NULL, 0x0,
2802 NULL, HFILL }},
2803 };
2804  
2805 static gint *ett[] = {
2806 &ett_gryphon,
2807 &ett_gryphon_header,
2808 &ett_gryphon_body,
2809 &ett_gryphon_command_data,
2810 &ett_gryphon_response_data,
2811 &ett_gryphon_data_header,
2812 &ett_gryphon_flags,
2813 &ett_gryphon_data_body,
2814 &ett_gryphon_cmd_filter_block,
2815 &ett_gryphon_cmd_events_data,
2816 &ett_gryphon_cmd_config_device,
2817 &ett_gryphon_cmd_sched_data,
2818 &ett_gryphon_cmd_sched_cmd,
2819 &ett_gryphon_cmd_response_block,
2820 &ett_gryphon_pgm_list,
2821 &ett_gryphon_pgm_status,
2822 &ett_gryphon_pgm_options,
2823 &ett_gryphon_valid_headers,
2824 &ett_gryphon_usdt_data,
2825 &ett_gryphon_usdt_data_block,
2826 &ett_gryphon_digital_data,
2827 &ett_gryphon_blm_mode
2828 };
2829 module_t *gryphon_module;
2830  
2831 proto_gryphon = proto_register_protocol("DG Gryphon Protocol",
2832 "Gryphon",
2833 "gryphon");
2834 proto_register_field_array(proto_gryphon, hf, array_length(hf));
2835 proto_register_subtree_array(ett, array_length(ett));
2836  
2837 gryphon_module = prefs_register_protocol(proto_gryphon, NULL);
2838 prefs_register_bool_preference(gryphon_module, "desegment",
2839 "Desegment all Gryphon messages spanning multiple TCP segments",
2840 "Whether the Gryphon dissector should desegment all messages spanning multiple TCP segments",
2841 &gryphon_desegment);
2842 }
2843  
2844 void
2845 proto_reg_handoff_gryphon(void)
2846 {
2847 dissector_handle_t gryphon_handle;
2848  
2849 gryphon_handle = create_dissector_handle(dissect_gryphon, proto_gryphon);
2850 dissector_add_uint("tcp.port", 7000, gryphon_handle);
2851 }
2852  
2853 /*
2854 * Editor modelines - http://www.wireshark.org/tools/modelines.html
2855 *
2856 * Local variables:
2857 * c-basic-offset: 4
2858 * tab-width: 8
2859 * indent-tabs-mode: nil
2860 * End:
2861 *
2862 * vi: set shiftwidth=4 tabstop=8 expandtab:
2863 * :indentSize=4:tabSize=8:noTabs=true:
2864 */