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