1999-12-15 06:53:36 +00:00
|
|
|
/* packet-gryphon.c
|
|
|
|
* Routines for Gryphon protocol packet disassembly
|
|
|
|
* By Steve Limkemann <stevelim@dgtech.com>
|
|
|
|
* Copyright 1998 Steve Limkemann
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2001-12-03 04:00:26 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2009-02-18 07:20:26 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
1999-12-15 06:53:36 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
1999-12-15 06:53:36 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
1999-12-15 06:53:36 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2006-04-22 20:26:16 +00:00
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2004-07-18 18:06:47 +00:00
|
|
|
#include <epan/dissectors/packet-tcp.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2011-04-12 14:33:30 +00:00
|
|
|
#include "packet-gryphon.h"
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
/*
|
|
|
|
* See
|
|
|
|
*
|
2011-04-12 14:33:30 +00:00
|
|
|
* http://www.dgtech.com/gryphon/sys/www/docs/html/
|
2001-04-25 06:14:53 +00:00
|
|
|
*/
|
|
|
|
|
1999-12-15 06:53:36 +00:00
|
|
|
static int proto_gryphon = -1;
|
|
|
|
|
2008-01-10 16:35:54 +00:00
|
|
|
static int hf_gryphon_src = -1;
|
|
|
|
static int hf_gryphon_srcchan = -1;
|
|
|
|
static int hf_gryphon_dest = -1;
|
|
|
|
static int hf_gryphon_destchan= -1;
|
|
|
|
static int hf_gryphon_type = -1;
|
|
|
|
static int hf_gryphon_cmd = -1;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
static gint ett_gryphon = -1;
|
|
|
|
static gint ett_gryphon_header = -1;
|
|
|
|
static gint ett_gryphon_body = -1;
|
|
|
|
static gint ett_gryphon_command_data = -1;
|
|
|
|
static gint ett_gryphon_response_data = -1;
|
|
|
|
static gint ett_gryphon_data_header = -1;
|
|
|
|
static gint ett_gryphon_flags = -1;
|
|
|
|
static gint ett_gryphon_data_body = -1;
|
|
|
|
static gint ett_gryphon_cmd_filter_block = -1;
|
|
|
|
static gint ett_gryphon_cmd_events_data = -1;
|
|
|
|
static gint ett_gryphon_cmd_config_device = -1;
|
|
|
|
static gint ett_gryphon_cmd_sched_data = -1;
|
|
|
|
static gint ett_gryphon_cmd_sched_cmd = -1;
|
|
|
|
static gint ett_gryphon_cmd_response_block = -1;
|
|
|
|
static gint ett_gryphon_pgm_list = -1;
|
|
|
|
static gint ett_gryphon_pgm_status = -1;
|
|
|
|
static gint ett_gryphon_pgm_options = -1;
|
2003-10-03 23:22:12 +00:00
|
|
|
static gint ett_gryphon_valid_headers = -1;
|
|
|
|
static gint ett_gryphon_usdt_data = -1;
|
|
|
|
static gint ett_gryphon_digital_data = -1;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
/* desegmentation of Gryphon */
|
|
|
|
static gboolean gryphon_desegment = TRUE;
|
|
|
|
|
|
|
|
static void dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo,
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree *tree, gboolean is_msgresp_add);
|
2002-05-01 05:24:42 +00:00
|
|
|
static int decode_command(tvbuff_t*, int, int, proto_tree*);
|
|
|
|
static int decode_response(tvbuff_t*, int, int, proto_tree*);
|
2002-05-01 06:56:16 +00:00
|
|
|
static int decode_data(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int decode_event(tvbuff_t*, int, proto_tree*);
|
2003-10-03 23:22:12 +00:00
|
|
|
static int decode_misc(tvbuff_t*, int, proto_tree*);
|
2002-05-01 06:56:16 +00:00
|
|
|
static int cmd_init(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_time(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_setfilt(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_ioctl(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_addfilt(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_addfilt(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_modfilt(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_filthan(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int dfiltmode(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int filtmode(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_events(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_register(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_register(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_getspeeds(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_sort(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_optimize(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_config(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_sched(tvbuff_t*, int, proto_tree*);
|
2003-10-03 23:22:12 +00:00
|
|
|
static int cmd_sched_rep(tvbuff_t*, int, proto_tree*);
|
2002-05-01 06:56:16 +00:00
|
|
|
static int resp_blm_data(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_blm_stat(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_addresp(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_addresp(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_modresp(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_resphan(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_sched(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_desc(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_desc(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_upload(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_delete(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_list(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_list(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_start(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_start(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_status(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_options(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_files(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int resp_files(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int eventnum(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int speed(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int filter_block(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int blm_mode(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_usdt(tvbuff_t*, int, proto_tree*);
|
2003-10-03 23:22:12 +00:00
|
|
|
static int cmd_bits_in(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_bits_out(tvbuff_t*, int, proto_tree*);
|
|
|
|
static int cmd_init_strat(tvbuff_t*, int, proto_tree*);
|
2001-04-25 06:14:53 +00:00
|
|
|
|
2005-07-23 11:41:25 +00:00
|
|
|
static const char *frame_type[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
"",
|
|
|
|
"Command request",
|
|
|
|
"Command response",
|
|
|
|
"Network (vehicle) data",
|
|
|
|
"Event",
|
|
|
|
"Miscellaneous",
|
|
|
|
"Text string"
|
2001-04-25 06:14:53 +00:00
|
|
|
};
|
2000-02-07 17:08:27 +00:00
|
|
|
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
/*
|
|
|
|
* Length of the frame header.
|
|
|
|
*/
|
2011-04-12 14:33:30 +00:00
|
|
|
#define FRAME_HEADER_LEN 8
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
|
|
|
|
static guint
|
2006-10-31 09:29:07 +00:00
|
|
|
get_gryphon_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2002-05-01 05:24:42 +00:00
|
|
|
guint16 plen;
|
|
|
|
int padded_len;
|
2001-04-25 06:14:53 +00:00
|
|
|
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
/*
|
|
|
|
* Get the length of the Gryphon packet, and then get the length as
|
|
|
|
* padded to a 4-byte boundary.
|
|
|
|
*/
|
|
|
|
plen = tvb_get_ntohs(tvb, offset + 4);
|
|
|
|
padded_len = plen + 3 - (plen + 3) % 4;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* That length doesn't include the fixed-length part of the header;
|
|
|
|
* add that in.
|
|
|
|
*/
|
|
|
|
return padded_len + FRAME_HEADER_LEN;
|
|
|
|
}
|
2002-05-01 05:24:42 +00:00
|
|
|
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
static void
|
|
|
|
dissect_gryphon_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
dissect_gryphon_message(tvb, pinfo, tree, FALSE);
|
|
|
|
}
|
2002-05-01 05:24:42 +00:00
|
|
|
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
static void
|
|
|
|
dissect_gryphon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
tcp_dissect_pdus(tvb, pinfo, tree, gryphon_desegment, FRAME_HEADER_LEN,
|
2011-04-12 14:33:30 +00:00
|
|
|
get_gryphon_pdu_len, dissect_gryphon_pdu);
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2002-05-01 06:46:52 +00:00
|
|
|
static const value_string src_dest[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{SD_CARD, "Card"},
|
|
|
|
{SD_SERVER, "Server"},
|
|
|
|
{SD_CLIENT, "Client"},
|
|
|
|
{SD_SCHED, "Scheduler"},
|
|
|
|
{SD_SCRIPT, "Script Processor"},
|
|
|
|
{SD_PGM, "Program Loader"},
|
|
|
|
{SD_USDT, "USDT Server"},
|
|
|
|
{SD_BLM, "Bus Load Monitoring"},
|
|
|
|
{SD_FLIGHT, "Flight Recorder"},
|
|
|
|
{SD_RESP, "Message Responder"},
|
|
|
|
{SD_IOPWR, "I/O and power"},
|
|
|
|
{SD_UTIL, "Utility/Miscellaneous"},
|
|
|
|
{0, NULL}
|
2002-05-01 06:46:52 +00:00
|
|
|
};
|
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
static void
|
|
|
|
dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
2011-04-12 14:33:30 +00:00
|
|
|
gboolean is_msgresp_add)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int offset = 0;
|
|
|
|
proto_tree *gryphon_tree;
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *header_tree, *body_tree, *localTree;
|
|
|
|
proto_item *header_item, *body_item, *localItem, *hiddenItem;
|
2011-07-21 19:10:10 +00:00
|
|
|
int msgend;
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen, msgpad;
|
2001-04-23 23:45:35 +00:00
|
|
|
unsigned int src, dest, i, frmtyp;
|
2011-04-12 14:33:30 +00:00
|
|
|
guint8 flags;
|
2001-04-25 06:14:53 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
if (!is_msgresp_add) {
|
2011-04-12 14:33:30 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Gryphon");
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2002-05-01 05:24:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!is_msgresp_add) {
|
2011-04-12 14:33:30 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_gryphon, tvb, 0, -1, FALSE);
|
|
|
|
gryphon_tree = proto_item_add_subtree(ti, ett_gryphon);
|
2002-05-01 05:24:42 +00:00
|
|
|
} else
|
2011-04-12 14:33:30 +00:00
|
|
|
gryphon_tree = tree;
|
2002-05-01 05:24:42 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
src = tvb_get_guint8(tvb, offset + 0);
|
|
|
|
dest = tvb_get_guint8(tvb, offset + 2);
|
|
|
|
msglen = tvb_get_ntohs(tvb, offset + 4);
|
|
|
|
flags = tvb_get_guint8(tvb, offset + 6);
|
|
|
|
frmtyp = flags & ~RESPONSE_FLAGS;
|
2002-05-01 05:24:42 +00:00
|
|
|
|
|
|
|
if (!is_msgresp_add) {
|
2011-04-12 14:33:30 +00:00
|
|
|
/*
|
|
|
|
* This tvbuff includes padding to make its length a multiple
|
|
|
|
* of 4 bytes; set it to the actual length.
|
|
|
|
*/
|
|
|
|
set_actual_length(tvb, msglen + FRAME_HEADER_LEN);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Indicate what kind of message this is.
|
|
|
|
*/
|
|
|
|
if (frmtyp >= SIZEOF (frame_type))
|
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "- Invalid -");
|
|
|
|
else
|
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, frame_type[frmtyp]);
|
2002-05-01 05:24:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tree == NULL)
|
2011-04-12 14:33:30 +00:00
|
|
|
return;
|
2002-05-01 05:24:42 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
if (frmtyp >= SIZEOF (frame_type)) {
|
2011-04-12 14:33:30 +00:00
|
|
|
/*
|
|
|
|
* Unknown message type.
|
|
|
|
*/
|
|
|
|
proto_tree_add_text(gryphon_tree, tvb, offset, msglen, "Data");
|
|
|
|
return;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
header_item = proto_tree_add_text(gryphon_tree, tvb, offset, MSG_HDR_SZ, "Header");
|
2001-04-25 06:14:53 +00:00
|
|
|
header_tree = proto_item_add_subtree(header_item, ett_gryphon_header);
|
|
|
|
proto_tree_add_text(header_tree, tvb, offset, 2,
|
2011-04-12 14:33:30 +00:00
|
|
|
"Source: %s, channel %u",
|
|
|
|
val_to_str(src, src_dest, "Unknown (0x%02x)"),
|
|
|
|
tvb_get_guint8(tvb, offset + 1));
|
2009-09-20 08:40:01 +00:00
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_src, tvb,
|
|
|
|
offset, 1, src);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hiddenItem);
|
2009-09-20 08:40:01 +00:00
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_srcchan, tvb,
|
|
|
|
offset+1, 1, tvb_get_guint8(tvb, offset + 1));
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hiddenItem);
|
2001-04-25 06:14:53 +00:00
|
|
|
|
|
|
|
proto_tree_add_text(header_tree, tvb, offset+2, 2,
|
2011-04-12 14:33:30 +00:00
|
|
|
"Destination: %s, channel %u",
|
|
|
|
val_to_str(dest, src_dest, "Unknown (0x%02x)"),
|
|
|
|
tvb_get_guint8(tvb, offset + 3));
|
2009-09-20 08:40:01 +00:00
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_dest, tvb,
|
|
|
|
offset+2, 1, dest);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hiddenItem);
|
2008-05-09 07:07:50 +00:00
|
|
|
|
|
|
|
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_destchan, tvb,
|
2011-04-12 14:33:30 +00:00
|
|
|
offset+3, 1, tvb_get_guint8(tvb, offset + 3));
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hiddenItem);
|
2001-04-25 06:14:53 +00:00
|
|
|
|
|
|
|
proto_tree_add_text(header_tree, tvb, offset+4, 2,
|
2011-04-12 14:33:30 +00:00
|
|
|
"Data length: %u byte%s", msglen, msglen == 1 ? "" : "s");
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(header_tree, tvb, offset+6, 1,
|
2011-04-12 14:33:30 +00:00
|
|
|
"Frame type: %s", frame_type[frmtyp]);
|
|
|
|
|
|
|
|
if (is_msgresp_add) {
|
|
|
|
localItem = proto_tree_add_text(header_tree, tvb, offset+6, 1, "Flags");
|
|
|
|
localTree = proto_item_add_subtree (localItem, ett_gryphon_flags);
|
|
|
|
proto_tree_add_text(localTree, tvb, offset+6, 1, "%s",
|
|
|
|
decode_boolean_bitfield(flags, DONT_WAIT_FOR_RESP, 8,
|
|
|
|
"Don't wait for response",
|
|
|
|
"Wait for response"));
|
|
|
|
proto_tree_add_text(localTree, tvb, offset+6, 1, "%s",
|
|
|
|
decode_boolean_bitfield(flags, WAIT_FOR_PREV_RESP, 8,
|
|
|
|
"Wait for previous responses",
|
|
|
|
"Don't wait for previous responses"));
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
|
|
|
proto_tree_add_text(header_tree, tvb, offset+7, 1, "reserved");
|
|
|
|
|
2008-05-09 07:07:50 +00:00
|
|
|
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_type, tvb,
|
2011-04-12 14:33:30 +00:00
|
|
|
offset+6, 1, frmtyp);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hiddenItem);
|
2008-05-09 07:07:50 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
msgpad = 3 - (msglen + 3) % 4;
|
|
|
|
msgend = offset + msglen + msgpad + MSG_HDR_SZ;
|
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
body_item = proto_tree_add_text(gryphon_tree, tvb, offset + MSG_HDR_SZ,
|
2011-04-12 14:33:30 +00:00
|
|
|
msglen + msgpad, "Body");
|
2001-04-25 06:14:53 +00:00
|
|
|
body_tree = proto_item_add_subtree(body_item, ett_gryphon_body);
|
|
|
|
|
|
|
|
offset += MSG_HDR_SZ;
|
|
|
|
switch (frmtyp) {
|
|
|
|
case GY_FT_CMD:
|
2011-04-12 14:33:30 +00:00
|
|
|
offset = decode_command(tvb, offset, dest, body_tree);
|
|
|
|
break;
|
2001-04-25 06:14:53 +00:00
|
|
|
case GY_FT_RESP:
|
2011-04-12 14:33:30 +00:00
|
|
|
offset = decode_response(tvb, offset, src, body_tree);
|
|
|
|
break;
|
2001-04-25 06:14:53 +00:00
|
|
|
case GY_FT_DATA:
|
2011-04-12 14:33:30 +00:00
|
|
|
offset = decode_data(tvb, offset, body_tree);
|
|
|
|
break;
|
2001-04-25 06:14:53 +00:00
|
|
|
case GY_FT_EVENT:
|
2011-04-12 14:33:30 +00:00
|
|
|
offset = decode_event(tvb, offset, body_tree);
|
|
|
|
break;
|
2001-04-25 06:14:53 +00:00
|
|
|
case GY_FT_MISC:
|
2011-04-12 14:33:30 +00:00
|
|
|
offset = decode_misc (tvb, offset, body_tree);
|
|
|
|
break;
|
2001-04-25 06:14:53 +00:00
|
|
|
case GY_FT_TEXT:
|
2011-04-12 14:33:30 +00:00
|
|
|
break;
|
2001-04-25 06:14:53 +00:00
|
|
|
default:
|
2011-04-12 14:33:30 +00:00
|
|
|
break;
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
|
|
|
if (offset < msgend - msgpad) {
|
2011-04-12 14:33:30 +00:00
|
|
|
i = msgend - msgpad - offset;
|
|
|
|
proto_tree_add_text(gryphon_tree, tvb, offset, i, "Data");
|
|
|
|
offset += i;
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
|
|
|
if (offset < msgend) {
|
2011-04-12 14:33:30 +00:00
|
|
|
i = msgend - offset;
|
|
|
|
proto_tree_add_text(gryphon_tree, tvb, offset, i, "padding");
|
|
|
|
offset += i;
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const val_str_dsp cmds[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{CMD_INIT, "Initialize" , cmd_init , NULL},
|
|
|
|
{CMD_GET_STAT, "Get status" , NULL , NULL},
|
|
|
|
{CMD_GET_CONFIG, "Get configuration" , NULL , resp_config},
|
|
|
|
{CMD_EVENT_ENABLE, "Enable event" , eventnum , NULL},
|
|
|
|
{CMD_EVENT_DISABLE, "Disable event" , eventnum , NULL},
|
|
|
|
{CMD_GET_TIME, "Get time" , NULL , resp_time},
|
|
|
|
{CMD_SET_TIME, "Set time" , resp_time , NULL},
|
|
|
|
{CMD_GET_RXDROP, "Get number of dropped RX messages" , NULL , NULL},
|
|
|
|
{CMD_RESET_RXDROP, "Clear number of dropped RX messages" , NULL , NULL},
|
|
|
|
{CMD_BCAST_ON, "Set broadcasts on" , NULL , NULL},
|
|
|
|
{CMD_BCAST_OFF, "Set broadcasts off" , NULL , NULL},
|
|
|
|
{CMD_CARD_SET_SPEED, "Set channel baud rate" , speed , NULL},
|
|
|
|
{CMD_CARD_GET_SPEED, "Get channel baud rate" , NULL , speed},
|
|
|
|
{CMD_CARD_SET_FILTER, "Set filter (deprecated)" , cmd_setfilt , NULL},
|
|
|
|
{CMD_CARD_GET_FILTER, "Get filter" , resp_addfilt , cmd_addfilt},
|
|
|
|
{CMD_CARD_TX, "Transmit message" , decode_data , NULL},
|
|
|
|
{CMD_CARD_TX_LOOP_ON, "Set transmit loopback on" , NULL , NULL},
|
|
|
|
{CMD_CARD_TX_LOOP_OFF, "Set transmit loopback off" , NULL , NULL},
|
|
|
|
{CMD_CARD_IOCTL, "IOCTL pass-through" , cmd_ioctl , NULL},
|
|
|
|
{CMD_CARD_ADD_FILTER, "Add a filter" , cmd_addfilt , resp_addfilt},
|
|
|
|
{CMD_CARD_MODIFY_FILTER, "Modify a filter" , cmd_modfilt , NULL},
|
|
|
|
{CMD_CARD_GET_FILTER_HANDLES, "Get filter handles" , NULL , resp_filthan},
|
|
|
|
{CMD_CARD_SET_DEFAULT_FILTER, "Set default filter" , dfiltmode , NULL},
|
|
|
|
{CMD_CARD_GET_DEFAULT_FILTER, "Get default filter mode" , NULL , dfiltmode},
|
|
|
|
{CMD_CARD_SET_FILTER_MODE, "Set filter mode" , filtmode , NULL},
|
|
|
|
{CMD_CARD_GET_FILTER_MODE, "Get filter mode" , NULL , filtmode},
|
|
|
|
{CMD_CARD_GET_EVNAMES, "Get event names" , NULL , resp_events},
|
|
|
|
{CMD_CARD_GET_SPEEDS, "Get defined speeds" , NULL , resp_getspeeds},
|
|
|
|
{CMD_SERVER_REG, "Register with server" , cmd_register , resp_register},
|
|
|
|
{CMD_SERVER_SET_SORT, "Set the sorting behavior" , cmd_sort , NULL},
|
|
|
|
{CMD_SERVER_SET_OPT, "Set the type of optimization" , cmd_optimize , NULL},
|
|
|
|
{CMD_BLM_SET_MODE, "Set Bus Load Monitoring mode" , blm_mode , NULL},
|
|
|
|
{CMD_BLM_GET_MODE, "Get Bus Load Monitoring mode" , NULL , blm_mode},
|
|
|
|
{CMD_BLM_GET_DATA, "Get Bus Load data" , NULL , resp_blm_data},
|
|
|
|
{CMD_BLM_GET_STATS, "Get Bus Load statistics" , NULL , resp_blm_stat},
|
|
|
|
{CMD_FLIGHT_GET_CONFIG, "Get flight recorder channel info" , NULL , NULL},
|
|
|
|
{CMD_FLIGHT_START_MON, "Start flight recorder monitoring" , NULL , NULL},
|
|
|
|
{CMD_FLIGHT_STOP_MON, "Stop flight recorder monitoring" , NULL , NULL},
|
|
|
|
{CMD_MSGRESP_ADD, "Add response message" , cmd_addresp , resp_addresp},
|
|
|
|
{CMD_MSGRESP_GET, "Get response message" , resp_addresp , cmd_addresp},
|
|
|
|
{CMD_MSGRESP_MODIFY, "Modify response message state" , cmd_modresp , NULL},
|
|
|
|
{CMD_MSGRESP_GET_HANDLES, "Get response message handles" , NULL , resp_resphan},
|
|
|
|
{CMD_PGM_DESC, "Describe program to to uploaded" , cmd_desc , resp_desc},
|
|
|
|
{CMD_PGM_UPLOAD, "Upload a program to the Gryphon" , cmd_upload , NULL},
|
|
|
|
{CMD_PGM_DELETE, "Delete an uploaded program" , cmd_delete , NULL},
|
|
|
|
{CMD_PGM_LIST, "Get a list of uploaded programs" , cmd_list , resp_list},
|
|
|
|
{CMD_PGM_START, "Start an uploaded program" , cmd_start , resp_start},
|
|
|
|
{CMD_PGM_START2, "Start an uploaded program" , NULL , resp_start},
|
|
|
|
{CMD_PGM_STOP, "Stop an uploaded program" , resp_start , NULL},
|
|
|
|
{CMD_PGM_STATUS, "Get status of an uploaded program" , cmd_delete , resp_status},
|
|
|
|
{CMD_PGM_OPTIONS, "Set program upload options" , cmd_options , resp_status},
|
|
|
|
{CMD_PGM_FILES, "Get a list of files & directories" , cmd_files , resp_files},
|
|
|
|
{CMD_SCHED_TX, "Schedule transmission of messages" , cmd_sched , resp_sched},
|
|
|
|
{CMD_SCHED_KILL_TX, "Stop and destroy a message transmission" , resp_sched , NULL},
|
|
|
|
{CMD_SCHED_STOP_TX, "Kill a message transmission (deprecated)", resp_sched , NULL},
|
|
|
|
{CMD_SCHED_MSG_REPLACE, "Replace a scheduled message" , cmd_sched_rep , NULL},
|
|
|
|
{CMD_USDT_IOCTL, "Register/Unregister with USDT server" , cmd_usdt , NULL},
|
|
|
|
{CMD_USDT_REGISTER, "Register/Unregister with USDT server" , cmd_usdt , NULL},
|
|
|
|
{CMD_USDT_SET_FUNCTIONAL, "Set IDs to use extended addressing" , cmd_usdt , NULL},
|
|
|
|
{CMD_IOPWR_GETINP, "Read current digital inputs" , NULL , cmd_bits_in},
|
|
|
|
{CMD_IOPWR_GETLATCH, "Read latched digital inputs" , NULL , cmd_bits_in},
|
|
|
|
{CMD_IOPWR_CLRLATCH, "Read & clear latched digital inputs" , cmd_bits_in , cmd_bits_in},
|
|
|
|
{CMD_IOPWR_GETOUT, "Read digital outputs" , NULL , cmd_bits_out},
|
|
|
|
{CMD_IOPWR_SETOUT, "Write digital outputs" , cmd_bits_out , NULL},
|
|
|
|
{CMD_IOPWR_SETBIT, "Set indicated output bits" , cmd_bits_out , NULL},
|
|
|
|
{CMD_IOPWR_CLRBIT, "Clear indicated output bits" , cmd_bits_out , NULL},
|
|
|
|
{CMD_IOPWR_GETPOWER, "Read digital inputs at power on time" , NULL , cmd_bits_in},
|
|
|
|
{CMD_UTIL_SET_INIT_STRATEGY, "Set initialization strategy" , cmd_init_strat, NULL},
|
|
|
|
{CMD_UTIL_GET_INIT_STRATEGY, "Get initialization strategy" , NULL , cmd_init_strat},
|
|
|
|
{-1, "- unknown -" , NULL , NULL},
|
|
|
|
};
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2010-01-28 21:49:30 +00:00
|
|
|
static const value_string responses_vs[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{RESP_OK, "OK - no error"},
|
|
|
|
{RESP_UNKNOWN_ERR, "Unknown error"},
|
|
|
|
{RESP_UNKNOWN_CMD, "Unrecognised command"},
|
|
|
|
{RESP_UNSUPPORTED, "Unsupported command"},
|
|
|
|
{RESP_INVAL_CHAN, "Invalid channel specified"},
|
|
|
|
{RESP_INVAL_DST, "Invalid destination"},
|
|
|
|
{RESP_INVAL_PARAM, "Invalid parameter(s)"},
|
|
|
|
{RESP_INVAL_MSG, "Invalid message"},
|
|
|
|
{RESP_INVAL_LEN, "Invalid length field"},
|
|
|
|
{RESP_TX_FAIL, "Transmit failed"},
|
|
|
|
{RESP_RX_FAIL, "Receive failed"},
|
|
|
|
{RESP_AUTH_FAIL, "Authorization failed"},
|
|
|
|
{RESP_MEM_ALLOC_ERR, "Memory allocation error"},
|
|
|
|
{RESP_TIMEOUT, "Command timed out"},
|
|
|
|
{RESP_UNAVAILABLE, "Unavailable"},
|
|
|
|
{RESP_BUF_FULL, "Buffer full"},
|
|
|
|
{RESP_NO_SUCH_JOB, "No such job"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
2002-08-28 20:41:00 +00:00
|
|
|
|
1999-12-15 06:53:36 +00:00
|
|
|
static const value_string filter_data_types[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{FILTER_DATA_TYPE_HEADER_FRAME, "frame header"},
|
|
|
|
{FILTER_DATA_TYPE_HEADER, "data message header"},
|
|
|
|
{FILTER_DATA_TYPE_DATA, "data message data"},
|
|
|
|
{FILTER_DATA_TYPE_EXTRA_DATA, "data message extra data"},
|
|
|
|
{FILTER_EVENT_TYPE_HEADER, "event message header"},
|
|
|
|
{FILTER_EVENT_TYPE_DATA, "event message"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
static const value_string operators[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{BIT_FIELD_CHECK, "Bit field check"},
|
|
|
|
{SVALUE_GT, "Greater than (signed)"},
|
|
|
|
{SVALUE_GE, "Greater than or equal to (signed)"},
|
|
|
|
{SVALUE_LT, "Less than (signed)"},
|
|
|
|
{SVALUE_LE, "Less than or equal to (signed)"},
|
|
|
|
{VALUE_EQ, "Equal to"},
|
|
|
|
{VALUE_NE, "Not equal to"},
|
|
|
|
{UVALUE_GT, "Greater than (unsigned)"},
|
|
|
|
{UVALUE_GE, "Greater than or equal to (unsigned)"},
|
|
|
|
{UVALUE_LT, "Less than (unsigned)"},
|
|
|
|
{UVALUE_LE, "Less than or equal to (unsigned)"},
|
|
|
|
{DIG_LOW_TO_HIGH, "Digital, low to high transistion"},
|
|
|
|
{DIG_HIGH_TO_LOW, "Digital, high to low transistion"},
|
|
|
|
{DIG_TRANSITION, "Digital, change of state"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
static const value_string modes[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{FILTER_OFF_PASS_ALL, "Filter off, pass all messages"},
|
|
|
|
{FILTER_OFF_BLOCK_ALL, "Filter off, block all messages"},
|
|
|
|
{FILTER_ON, "Filter on"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
static const value_string dmodes[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{DEFAULT_FILTER_BLOCK, "Block"},
|
|
|
|
{DEFAULT_FILTER_PASS, "Pass"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
static const value_string filtacts[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{DELETE_FILTER, "Delete"},
|
|
|
|
{ACTIVATE_FILTER, "Activate"},
|
|
|
|
{DEACTIVATE_FILTER, "Deactivate"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
static const value_string ioctls[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{GINIT, "GINIT: Initialize"},
|
|
|
|
{GLOOPON, "GLOOPON: Loop on"},
|
|
|
|
{GLOOPOFF, "GLOOPOFF: Loop off"},
|
|
|
|
{GGETHWTYPE, "GGETHWTYPE: Get hardware type"},
|
|
|
|
{GGETREG, "GGETREG: Get register"},
|
|
|
|
{GSETREG, "GSETREG: Set register"},
|
|
|
|
{GGETRXCOUNT, "GGETRXCOUNT: Get the receive message counter"},
|
|
|
|
{GSETRXCOUNT, "GSETRXCOUNT: Set the receive message counter"},
|
|
|
|
{GGETTXCOUNT, "GGETTXCOUNT: Get the transmit message counter"},
|
|
|
|
{GSETTXCOUNT, "GSETTXCOUNT: Set the transmit message counter"},
|
|
|
|
{GGETRXDROP, "GGETRXDROP: Get the number of dropped receive messages"},
|
|
|
|
{GSETRXDROP, "GSETRXDROP: Set the number of dropped receive messages"},
|
|
|
|
{GGETTXDROP, "GGETTXDROP: Get the number of dropped transmit messages"},
|
|
|
|
{GSETTXDROP, "GSETTXDROP: Set the number of dropped transmit messages"},
|
|
|
|
{GGETRXBAD, "GGETRXBAD: Get the number of bad receive messages"},
|
|
|
|
{GGETTXBAD, "GGETTXBAD: Get the number of bad transmit messages"},
|
|
|
|
{GGETCOUNTS, "GGETCOUNTS: Get total message counter"},
|
|
|
|
{GGETBLMON, "GGETBLMON: Get bus load monitoring status"},
|
|
|
|
{GSETBLMON, "GSETBLMON: Set bus load monitoring status (turn on/off)"},
|
|
|
|
{GGETERRLEV, "GGETERRLEV: Get error level"},
|
|
|
|
{GSETERRLEV, "GSETERRLEV: Set error level"},
|
|
|
|
{GGETBITRATE, "GGETBITRATE: Get bit rate"},
|
|
|
|
{GGETRAM, "GGETRAM: Read value from RAM"},
|
|
|
|
{GSETRAM, "GSETRAM: Write value to RAM"},
|
|
|
|
{GCANGETBTRS, "GCANGETBTRS: Read CAN bit timing registers"},
|
|
|
|
{GCANSETBTRS, "GCANSETBTRS: Write CAN bit timing registers"},
|
|
|
|
{GCANGETBC, "GCANGETBC: Read CAN bus configuration register"},
|
|
|
|
{GCANSETBC, "GCANSETBC: Write CAN bus configuration register"},
|
|
|
|
{GCANGETMODE, "GCANGETMODE"},
|
|
|
|
{GCANSETMODE, "GCANSETMODE"},
|
|
|
|
{GCANGETTRANS, "GCANGETTRANS"},
|
|
|
|
{GCANSETTRANS, "GCANSETTRANS"},
|
|
|
|
{GCANSENDERR, "GCANSENDERR"},
|
|
|
|
{GCANRGETOBJ, "GCANRGETOBJ"},
|
|
|
|
{GCANRSETSTDID, "GCANRSETSTDID"},
|
|
|
|
{GCANRSETEXTID, "GCANRSETEXTID"},
|
|
|
|
{GCANRSETDATA, "GCANRSETDATA"},
|
|
|
|
{GCANRENABLE, "GCANRENABLE"},
|
|
|
|
{GCANRDISABLE, "GCANRDISABLE"},
|
|
|
|
{GCANRGETMASKS, "GCANRGETMASKS"},
|
|
|
|
{GCANRSETMASKS, "GCANRSETMASKS"},
|
|
|
|
{GCANSWGETMODE, "GCANSWGETMODE"},
|
|
|
|
{GCANSWSETMODE, "GCANSWSETMODE"},
|
|
|
|
{GDLCGETFOURX, "GDLCGETFOURX"},
|
|
|
|
{GDLCSETFOURX, "GDLCSETFOURX"},
|
|
|
|
{GDLCGETLOAD, "GDLCGETLOAD"},
|
|
|
|
{GDLCSETLOAD, "GDLCSETLOAD"},
|
|
|
|
{GDLCSENDBREAK, "GDLCSENDBREAK"},
|
|
|
|
{GDLCABORTTX, "GDLCABORTTX"},
|
|
|
|
{GDLCGETHDRMODE, "DLCGETHDRMODE"},
|
|
|
|
{GDLCSETHDRMODE, "GDLCSETHDRMODE"},
|
|
|
|
{GHONSLEEP, "GHONSLEEP"},
|
|
|
|
{GHONSILENCE, "GHONSILENCE"},
|
|
|
|
{GKWPSETPTIMES, "GKWPSETPTIMES"},
|
|
|
|
{GKWPSETWTIMES, "GKWPSETWTIMES"},
|
|
|
|
{GKWPDOWAKEUP, "GKWPDOWAKEUP"},
|
|
|
|
{GKWPGETBITTIME, "GKWPGETBITTIME"},
|
|
|
|
{GKWPSETBITTIME, "GKWPSETBITTIME"},
|
|
|
|
{GKWPSETNODEADDR, "GKWPSETNODEADDR"},
|
|
|
|
{GKWPGETNODETYPE, "GKWPGETNODETYPE"},
|
|
|
|
{GKWPSETNODETYPE, "GKWPSETNODETYPE"},
|
|
|
|
{GKWPSETWAKETYPE, "GKWPSETWAKETYPE"},
|
|
|
|
{GKWPSETTARGADDR, "GKWPSETTARGADDR"},
|
|
|
|
{GKWPSETKEYBYTES, "GKWPSETKEYBYTES"},
|
|
|
|
{GKWPSETSTARTREQ, "GKWPSETSTARTREQ"},
|
|
|
|
{GKWPSETSTARTRESP, "GKWPSETSTARTRESP"},
|
|
|
|
{GKWPSETPROTOCOL, "GKWPSETPROTOCOL"},
|
|
|
|
{GKWPGETLASTKEYBYTES, "GKWPGETLASTKEYBYTES"},
|
|
|
|
{GKWPSETLASTKEYBYTES, "GKWPSETLASTKEYBYTES"},
|
|
|
|
{GSCPGETBBR, "GSCPGETBBR"},
|
|
|
|
{GSCPSETBBR, "GSCPSETBBR"},
|
|
|
|
{GSCPGETID, "GSCPGETID"},
|
|
|
|
{GSCPSETID, "GSCPSETID"},
|
|
|
|
{GSCPADDFUNCID, "GSCPADDFUNCID"},
|
|
|
|
{GSCPCLRFUNCID, "GSCPCLRFUNCID"},
|
|
|
|
{GUBPGETBITRATE, "GUBPGETBITRATE"},
|
|
|
|
{GUBPSETBITRATE, "GUBPSETBITRATE"},
|
|
|
|
{GUBPGETINTERBYTE, "GUBPGETINTERBYTE"},
|
|
|
|
{GUBPSETINTERBYTE, "GUBPSETINTERBYTE"},
|
|
|
|
{GUBPGETNACKMODE, "GUBPGETNACKMODE"},
|
|
|
|
{GUBPSETNACKMODE, "GUBPSETNACKMODE"},
|
|
|
|
{GUBPGETRETRYDELAY, "GUBPGETRETRYDELAY"},
|
|
|
|
{GUBPSETRETRYDELAY, "GUBPSETRETRYDELAY"},
|
|
|
|
{GRESETHC08, "GRESETHC08: Reset the HC08 processor"},
|
|
|
|
{GTESTHC08COP, "GTESTHC08COP: Stop updating the HC08 watchdog timer"},
|
|
|
|
{GSJAGETLISTEN, "GSJAGETLISTEN"},
|
|
|
|
{GSJASETLISTEN, "GSJASETLISTEN"},
|
|
|
|
{GSJAGETSELFTEST, "GSJAGETSELFTEST"},
|
|
|
|
{GSJASETSELFTEST, "GSJASETSELFTEST"},
|
|
|
|
{GSJAGETXMITONCE, "GSJAGETXMITONCE"},
|
|
|
|
{GSJASETXMITONCE, "GSJASETXMITONCE"},
|
|
|
|
{GSJAGETTRIGSTATE, "GSJAGETTRIGSTATE"},
|
|
|
|
{GSJASETTRIGCTRL, "GSJASETTRIGCTRL"},
|
|
|
|
{GSJAGETTRIGCTRL, "GSJAGETTRIGCTRL"},
|
|
|
|
{GSJAGETOUTSTATE, "GSJAGETOUTSTATE"},
|
|
|
|
{GSJASETOUTSTATE, "GSJASETOUTSTATE"},
|
|
|
|
{GSJAGETFILTER, "GSJAGETFILTER"},
|
|
|
|
{GSJASETFILTER, "GSJASETFILTER"},
|
|
|
|
{GSJAGETMASK, "GSJAGETMASK"},
|
|
|
|
{GSJASETMASK, "GSJASETMASK"},
|
|
|
|
{GSJAGETINTTERM, "GSJAGETINTTERM"},
|
|
|
|
{GSJASETINTTERM, "GSJASETINTTERM"},
|
|
|
|
{GSJAGETFTTRANS, "GSJAGETFTTRANS"},
|
|
|
|
{GSJASETFTTRANS, "GSJASETFTTRANS"},
|
|
|
|
{GSJAGETFTERROR, "GSJAGETFTERROR"},
|
|
|
|
{GLINGETBITRATE, "GLINGETBITRATE: Get the current bit rate"},
|
|
|
|
{GLINSETBITRATE, "GLINSETBITRATE: Set the bit rate"},
|
|
|
|
{GLINGETBRKSPACE, "GLINGETBRKSPACE"},
|
|
|
|
{GLINSETBRKSPACE, "GLINSETBRKSPACE"},
|
|
|
|
{GLINGETBRKMARK, "GLINGETBRKMARK"},
|
|
|
|
{GLINSETBRKMARK, "GLINSETBRKMARK"},
|
|
|
|
{GLINGETIDDELAY, "GLINGETIDDELAY"},
|
|
|
|
{GLINSETIDDELAY, "GLINSETIDDELAY"},
|
|
|
|
{GLINGETRESPDELAY, "GLINGETRESPDELAY"},
|
|
|
|
{GLINSETRESPDELAY, "GLINSETRESPDELAY"},
|
|
|
|
{GLINGETINTERBYTE, "GLINGETINTERBYTE"},
|
|
|
|
{GLINSETINTERBYTE, "GLINSETINTERBYTE"},
|
|
|
|
{GLINGETWAKEUPDELAY, "GLINGETWAKEUPDELAY"},
|
|
|
|
{GLINSETWAKEUPDELAY, "GLINSETWAKEUPDELAY"},
|
|
|
|
{GLINGETWAKEUPTIMEOUT, "GLINGETWAKEUPTIMEOUT"},
|
|
|
|
{GLINSETWAKEUPTIMEOUT, "GLINSETWAKEUPTIMEOUT"},
|
|
|
|
{GLINGETWUTIMOUT3BR, "GLINGETWUTIMOUT3BR"},
|
|
|
|
{GLINSETWUTIMOUT3BR, "GLINSETWUTIMOUT3BR"},
|
|
|
|
{GLINSENDWAKEUP, "GLINSENDWAKEUP"},
|
|
|
|
{GLINGETMODE, "GLINGETMODE"},
|
|
|
|
{GLINSETMODE, "GLINSETMODE"},
|
|
|
|
{GINPGETINP, "GINPGETINP: Read current digital inputs"},
|
|
|
|
{GINPGETLATCH, "GINPGETLATCH: Read latched digital inputs"},
|
|
|
|
{GINPCLRLATCH, "GINPCLRLATCH: Read and clear latched digital inputs"},
|
|
|
|
{GOUTGET, "GOUTGET: Read digital outputs"},
|
|
|
|
{GOUTSET, "GOUTSET: Write digital outputs"},
|
|
|
|
{GOUTSETBIT, "GOUTSETBIT: Set digital output bits"},
|
|
|
|
{GOUTCLEARBIT, "GOUTCLEARBIT"},
|
|
|
|
{GPWRGETWHICH, "GPWRGETWHICH"},
|
|
|
|
{GPWROFF, "GPWROFF"},
|
|
|
|
{GPWROFFRESET, "GPWROFFRESET"},
|
|
|
|
{GPWRRESET, "GPWRRESET"},
|
|
|
|
{0, NULL},
|
|
|
|
};
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 05:24:42 +00:00
|
|
|
decode_command(tvbuff_t *tvb, int offset, int dst, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-07-21 19:10:10 +00:00
|
|
|
int cmd, msglen;
|
2001-04-23 23:45:35 +00:00
|
|
|
unsigned int i;
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree *ft;
|
|
|
|
proto_item *ti;
|
|
|
|
proto_item *hi;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2001-04-25 06:14:53 +00:00
|
|
|
cmd = tvb_get_guint8(tvb, offset);
|
2008-05-09 07:07:50 +00:00
|
|
|
hi = proto_tree_add_uint(pt, hf_gryphon_cmd, tvb, offset, 1, cmd);
|
2011-04-12 14:33:30 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hi);
|
1999-12-15 06:53:36 +00:00
|
|
|
if (cmd > 0x3F)
|
2011-04-12 14:33:30 +00:00
|
|
|
cmd += dst * 256;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
for (i = 0; i < SIZEOF(cmds); i++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
if (cmds[i].value == cmd)
|
|
|
|
break;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
if (i >= SIZEOF(cmds) && dst >= SD_KNOWN) {
|
2011-04-12 14:33:30 +00:00
|
|
|
cmd = (cmd & 0xFF) + SD_CARD * 256;
|
|
|
|
for (i = 0; i < SIZEOF(cmds); i++) {
|
|
|
|
if (cmds[i].value == cmd)
|
|
|
|
break;
|
|
|
|
}
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
if (i >= SIZEOF(cmds))
|
2011-04-12 14:33:30 +00:00
|
|
|
i = SIZEOF(cmds) - 1;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text (pt, tvb, offset, 4, "Command: %s", cmds[i].strptr);
|
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
if (cmds[i].cmd_fnct && msglen > 0) {
|
2011-04-12 14:33:30 +00:00
|
|
|
ti = proto_tree_add_text(pt, tvb, offset, -1, "Data: (%d byte%s)",
|
2003-10-03 23:22:12 +00:00
|
|
|
msglen, msglen == 1 ? "" : "s");
|
2011-04-12 14:33:30 +00:00
|
|
|
ft = proto_item_add_subtree(ti, ett_gryphon_command_data);
|
|
|
|
offset = (*(cmds[i].cmd_fnct)) (tvb, offset, ft);
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 05:24:42 +00:00
|
|
|
decode_response(tvbuff_t *tvb, int offset, int src, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int cmd, msglen;
|
2002-05-01 06:46:52 +00:00
|
|
|
unsigned int i, resp;
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree *ft;
|
|
|
|
proto_item *ti;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2001-04-25 06:14:53 +00:00
|
|
|
cmd = tvb_get_guint8(tvb, offset);
|
1999-12-15 06:53:36 +00:00
|
|
|
if (cmd > 0x3F)
|
2011-04-12 14:33:30 +00:00
|
|
|
cmd += src * 256;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
for (i = 0; i < SIZEOF(cmds); i++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
if (cmds[i].value == cmd)
|
|
|
|
break;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
if (i >= SIZEOF(cmds) && src >= SD_KNOWN) {
|
2011-04-12 14:33:30 +00:00
|
|
|
cmd = (cmd & 0xFF) + SD_CARD * 256;
|
|
|
|
for (i = 0; i < SIZEOF(cmds); i++) {
|
|
|
|
if (cmds[i].value == cmd)
|
|
|
|
break;
|
|
|
|
}
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
if (i >= SIZEOF(cmds))
|
2011-04-12 14:33:30 +00:00
|
|
|
i = SIZEOF(cmds) - 1;
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text (pt, tvb, offset, 4, "Command: %s", cmds[i].strptr);
|
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
resp = tvb_get_ntohl (tvb, offset);
|
2002-05-01 06:46:52 +00:00
|
|
|
proto_tree_add_text (pt, tvb, offset, 4, "Status: %s",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(resp, responses_vs, "Unknown (0x%08x)"));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
if (cmds[i].rsp_fnct && msglen > 0) {
|
2011-04-12 14:33:30 +00:00
|
|
|
ti = proto_tree_add_text(pt, tvb, offset, msglen, "Data: (%d byte%s)",
|
2003-10-03 23:22:12 +00:00
|
|
|
msglen, msglen == 1 ? "" : "s");
|
2011-04-12 14:33:30 +00:00
|
|
|
ft = proto_item_add_subtree(ti, ett_gryphon_response_data);
|
|
|
|
offset = (*(cmds[i].rsp_fnct)) (tvb, offset, ft);
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
decode_data(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *item, *item1;
|
|
|
|
proto_tree *tree, *tree1;
|
|
|
|
int hdrsize, datasize, extrasize, hdrbits, msgsize, padding, mode;
|
|
|
|
int hours, minutes, seconds, fraction;
|
|
|
|
unsigned long timestamp;
|
|
|
|
|
|
|
|
hdrsize = tvb_get_guint8(tvb, offset+0);
|
|
|
|
hdrbits = tvb_get_guint8(tvb, offset+1);
|
|
|
|
datasize = tvb_get_ntohs(tvb, offset+2);
|
2001-04-25 06:14:53 +00:00
|
|
|
extrasize = tvb_get_guint8(tvb, offset+4);
|
2011-04-12 14:33:30 +00:00
|
|
|
padding = 3 - (hdrsize + datasize + extrasize + 3) % 4;
|
|
|
|
msgsize = hdrsize + datasize + extrasize + padding + 16;
|
2001-04-25 06:14:53 +00:00
|
|
|
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 16, "Message header");
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_data_header);
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 2, "Header length: %d byte%s, %d bits",
|
|
|
|
hdrsize, plurality(hdrsize, "", "s"), hdrbits);
|
|
|
|
proto_tree_add_text(tree, tvb, offset+2, 2, "Data length: %d byte%s",
|
|
|
|
datasize, plurality(datasize, "", "s"));
|
|
|
|
proto_tree_add_text(tree, tvb, offset+4, 1, "Extra data length: %d byte%s",
|
|
|
|
extrasize, plurality(extrasize, "", "s"));
|
2001-04-25 06:14:53 +00:00
|
|
|
mode = tvb_get_guint8(tvb, offset+5);
|
|
|
|
item1 = proto_tree_add_text(tree, tvb, offset+5, 1, "Mode: %d", mode);
|
|
|
|
if (mode) {
|
2011-04-12 14:33:30 +00:00
|
|
|
tree1 = proto_item_add_subtree (item1, ett_gryphon_flags);
|
|
|
|
if (mode & 0x80) {
|
|
|
|
proto_tree_add_text(tree1, tvb, offset+5, 1, "%s",
|
|
|
|
decode_boolean_bitfield(mode, 0x80, 8,
|
|
|
|
"Transmitted message", NULL));
|
|
|
|
}
|
|
|
|
if (mode & 0x40) {
|
|
|
|
proto_tree_add_text(tree1, tvb, offset+5, 1, "%s",
|
|
|
|
decode_boolean_bitfield(mode, 0x40, 8,
|
|
|
|
"Received message", NULL));
|
|
|
|
}
|
|
|
|
if (mode & 0x20) {
|
|
|
|
proto_tree_add_text(tree1, tvb, offset+5, 1, "%s",
|
|
|
|
decode_boolean_bitfield(mode, 0x20, 8,
|
|
|
|
"Local message", NULL));
|
|
|
|
}
|
|
|
|
if (mode & 0x10) {
|
|
|
|
proto_tree_add_text(tree1, tvb, offset+5, 1, "%s",
|
|
|
|
decode_boolean_bitfield(mode, 0x10, 8,
|
|
|
|
"Remote message", NULL));
|
|
|
|
}
|
|
|
|
if (mode & 0x01) {
|
|
|
|
proto_tree_add_text(tree1, tvb, offset+5, 1, "%s",
|
|
|
|
decode_boolean_bitfield(mode, 0x01, 8,
|
|
|
|
"Internal message", NULL));
|
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
|
|
|
proto_tree_add_text(tree, tvb, offset+6, 1, "Priority: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset+6));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset+7, 1, "Error status: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset+7));
|
2001-04-25 06:14:53 +00:00
|
|
|
timestamp = tvb_get_ntohl(tvb, offset+8);
|
2011-04-12 14:33:30 +00:00
|
|
|
hours = timestamp /(100000 * 60 *60);
|
|
|
|
minutes = (timestamp / (100000 * 60)) % 60;
|
|
|
|
seconds = (timestamp / 100000) % 60;
|
2001-04-25 06:14:53 +00:00
|
|
|
fraction = timestamp % 100000;
|
|
|
|
proto_tree_add_text(tree, tvb, offset+8, 4, "Timestamp: %d:%02d:%02d.%05d", hours, minutes, seconds, fraction);
|
|
|
|
proto_tree_add_text(tree, tvb, offset+12, 1, "Context: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset+12));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset+13, 3, "reserved:");
|
|
|
|
offset += 16;
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, msgsize-16-padding, "Message Body");
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_data_body);
|
|
|
|
if (hdrsize) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, hdrsize, "Header");
|
|
|
|
offset += hdrsize;
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
|
|
|
if (datasize) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, datasize, "Data");
|
|
|
|
offset += datasize;
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
|
|
|
if (extrasize) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, extrasize, "Extra data");
|
|
|
|
offset += extrasize;
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
|
|
|
if (padding) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, padding, "padding");
|
|
|
|
offset += padding;
|
2001-04-25 06:14:53 +00:00
|
|
|
}
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
decode_event(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
|
|
|
int hours, minutes, seconds, fraction, padding, length;
|
1999-12-15 06:53:36 +00:00
|
|
|
unsigned long timestamp;
|
2011-04-12 14:33:30 +00:00
|
|
|
int msgend;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
1999-12-15 06:53:36 +00:00
|
|
|
padding = 3 - (msglen + 3) % 4;
|
2001-04-25 06:14:53 +00:00
|
|
|
msgend = offset + msglen;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Event ID: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 1, "Event context: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset+1));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+2, 2, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
timestamp = tvb_get_ntohl(tvb, offset);
|
1999-12-15 06:53:36 +00:00
|
|
|
hours = timestamp /(100000 * 60 *60);
|
|
|
|
minutes = (timestamp / (100000 * 60)) % 60;
|
|
|
|
seconds = (timestamp / 100000) % 60;
|
|
|
|
fraction = timestamp % 100000;
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Timestamp: %d:%02d:%02d.%05d", hours, minutes, seconds, fraction);
|
|
|
|
offset += 4;
|
|
|
|
if (offset < msgend) {
|
2011-04-12 14:33:30 +00:00
|
|
|
length = msgend - offset;
|
|
|
|
proto_tree_add_text (pt, tvb, offset, length, "Data (%d byte%s)",
|
2003-10-03 23:22:12 +00:00
|
|
|
length, length == 1 ? "" : "s");
|
2011-04-12 14:33:30 +00:00
|
|
|
offset += length;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
if (padding) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, padding, "padding");
|
|
|
|
offset += padding;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2003-10-03 23:22:12 +00:00
|
|
|
static int
|
|
|
|
decode_misc (tvbuff_t *tvb, int offset, proto_tree *pt)
|
|
|
|
{
|
|
|
|
#define LENGTH 120
|
2011-04-12 14:33:30 +00:00
|
|
|
int padding, msglen;
|
2011-07-21 19:10:10 +00:00
|
|
|
/*gint length;*/
|
2003-10-03 23:22:12 +00:00
|
|
|
unsigned char local_data[LENGTH+1];
|
|
|
|
|
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
|
|
|
padding = 3 - (msglen + 3) % 4;
|
2011-07-21 19:10:10 +00:00
|
|
|
/*length =*/ tvb_get_nstringz0(tvb, offset, LENGTH, local_data);
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, msglen, "Data: %s", local_data);
|
|
|
|
offset += msglen;
|
|
|
|
if (padding) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text (pt, tvb, offset, padding, "padding");
|
|
|
|
offset += padding;
|
2003-10-03 23:22:12 +00:00
|
|
|
}
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_init(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
const char *ptr;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
if (tvb_get_guint8(tvb, offset) == 0)
|
2011-04-12 14:33:30 +00:00
|
|
|
ptr = "Always initialize";
|
1999-12-15 06:53:36 +00:00
|
|
|
else
|
2011-04-12 14:33:30 +00:00
|
|
|
ptr = "Initialize if not previously initialized";
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Mode: %s", ptr);
|
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
eventnum(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
guint8 event = tvb_get_guint8(tvb, offset);
|
2002-08-28 20:41:00 +00:00
|
|
|
|
1999-12-15 06:53:36 +00:00
|
|
|
if (event)
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Event number: %u", event);
|
1999-12-15 06:53:36 +00:00
|
|
|
else
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Event numbers: All");
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "padding");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_time(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2004-08-22 02:42:27 +00:00
|
|
|
guint64 ts;
|
|
|
|
time_t timestamp;
|
|
|
|
struct tm *tmp;
|
|
|
|
static const char *mon_names[12] = {
|
|
|
|
"Jan",
|
|
|
|
"Feb",
|
|
|
|
"Mar",
|
|
|
|
"Apr",
|
|
|
|
"May",
|
|
|
|
"Jun",
|
|
|
|
"Jul",
|
|
|
|
"Aug",
|
|
|
|
"Sep",
|
|
|
|
"Oct",
|
|
|
|
"Nov",
|
|
|
|
"Dec"
|
|
|
|
};
|
|
|
|
|
|
|
|
ts = tvb_get_ntoh64(tvb, offset);
|
|
|
|
timestamp = (time_t) (ts / 100000);
|
|
|
|
tmp = localtime(×tamp);
|
2011-04-12 13:21:32 +00:00
|
|
|
|
|
|
|
if (tmp) {
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 8,
|
|
|
|
"Date/Time: %s %d, %d %02d:%02d:%02d.%05u",
|
|
|
|
mon_names[tmp->tm_mon],
|
|
|
|
tmp->tm_mday,
|
|
|
|
tmp->tm_year + 1900,
|
|
|
|
tmp->tm_hour,
|
|
|
|
tmp->tm_min,
|
|
|
|
tmp->tm_sec,
|
|
|
|
(guint) (ts % 100000));
|
|
|
|
} else {
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 8,
|
|
|
|
"Date/Time: [Invalid]");
|
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 8;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_setfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int flag = tvb_get_ntohl(tvb, offset);
|
|
|
|
int length, padding;
|
2004-01-24 02:07:05 +00:00
|
|
|
char mode[30];
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
length = tvb_get_guint8(tvb, offset+4) + tvb_get_guint8(tvb, offset+5)
|
2011-04-12 14:33:30 +00:00
|
|
|
+ tvb_get_ntohs(tvb, offset+6);
|
1999-12-15 06:53:36 +00:00
|
|
|
if (flag)
|
2011-04-12 14:33:30 +00:00
|
|
|
g_strlcpy (mode, "Pass", 30);
|
1999-12-15 06:53:36 +00:00
|
|
|
else
|
2011-04-12 14:33:30 +00:00
|
|
|
g_strlcpy (mode, "Block", 30);
|
1999-12-15 06:53:36 +00:00
|
|
|
if (length == 0)
|
2011-04-12 14:33:30 +00:00
|
|
|
g_strlcat (mode, " all", 30);
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Pass/Block flag: %s", mode);
|
|
|
|
proto_tree_add_text(pt, tvb, offset+4, 4, "Length of Pattern & Mask: %d", length);
|
|
|
|
offset += 8;
|
1999-12-15 06:53:36 +00:00
|
|
|
if (length) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, length * 2, "discarded data");
|
|
|
|
offset += length * 2;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
padding = 3 - (length * 2 + 3) % 4;
|
|
|
|
if (padding) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "padding");
|
|
|
|
offset += padding;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_ioctl(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
|
|
|
unsigned int ioctl;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2001-04-25 06:14:53 +00:00
|
|
|
ioctl = tvb_get_ntohl(tvb, offset);
|
2002-05-01 06:46:52 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "IOCTL: %s",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(ioctl, ioctls, "Unknown (0x%08x)"));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
|
|
|
if (msglen > 0) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, msglen, "Data");
|
|
|
|
offset += msglen;
|
2000-11-01 00:16:18 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_addfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
|
|
|
guint8 flags;
|
|
|
|
int blocks, i, length;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 1, "Flags");
|
1999-12-15 06:53:36 +00:00
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_flags);
|
2001-04-25 06:14:53 +00:00
|
|
|
flags = tvb_get_guint8(tvb, offset);
|
2002-05-01 06:15:44 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode_boolean_bitfield(flags, FILTER_PASS_FLAG, 8,
|
|
|
|
"Conforming messages are passed",
|
|
|
|
"Conforming messages are blocked"));
|
2002-05-01 06:15:44 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode_boolean_bitfield(flags, FILTER_ACTIVE_FLAG, 8,
|
|
|
|
"The filter is active", "The filter is inactive"));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 1;
|
|
|
|
blocks = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Number of filter blocks = %d", blocks);
|
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 6, "reserved");
|
|
|
|
offset += 7;
|
1999-12-15 06:53:36 +00:00
|
|
|
for (i = 1; i <= blocks; i++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
length = tvb_get_ntohs(tvb, offset+2) * 2 + 8;
|
|
|
|
length += 3 - (length + 3) % 4;
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, length, "Filter block %d", i);
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_cmd_filter_block);
|
|
|
|
offset = filter_block(tvb, offset, tree);
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_addfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Filter handle: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_modfilt(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
guint8 filter_handle;
|
2002-05-01 06:46:52 +00:00
|
|
|
unsigned char action;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
filter_handle = tvb_get_guint8(tvb, offset);
|
|
|
|
if (filter_handle)
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Filter handle: %u",
|
|
|
|
filter_handle);
|
1999-12-15 06:53:36 +00:00
|
|
|
else
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Filter handles: all");
|
2001-04-25 06:14:53 +00:00
|
|
|
action = tvb_get_guint8(tvb, offset + 1);
|
2002-05-01 06:46:52 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 1, "Action: %s filter",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(action, filtacts, "Unknown (%u)"));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+2, 2, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_filthan(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int handles = tvb_get_guint8(tvb, offset);
|
|
|
|
int i, padding;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Number of filter handles: %d", handles);
|
1999-12-15 06:53:36 +00:00
|
|
|
for (i = 1; i <= handles; i++){
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+i, 1, "Handle %d: %u", i,
|
|
|
|
tvb_get_guint8(tvb, offset+i));
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
padding = 3 - (handles + 1 + 3) % 4;
|
|
|
|
if (padding)
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1+handles, padding, "padding");
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 1+handles+padding;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
dfiltmode(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
1999-12-15 06:53:36 +00:00
|
|
|
unsigned char mode;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
mode = tvb_get_guint8(tvb, offset);
|
2002-05-01 06:46:52 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Filter mode: %s",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(mode, dmodes, "Unknown (%u)"));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
filtmode(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
1999-12-15 06:53:36 +00:00
|
|
|
unsigned char mode;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
mode = tvb_get_guint8(tvb, offset);
|
2002-05-01 06:46:52 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Filter mode: %s",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(mode, modes, "Unknown (%u)"));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_events(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
2001-04-23 23:45:35 +00:00
|
|
|
unsigned int i;
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree *tree;
|
|
|
|
proto_item *item;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
1999-12-15 06:53:36 +00:00
|
|
|
i = 1;
|
2001-04-25 06:14:53 +00:00
|
|
|
while (msglen != 0) {
|
2011-04-12 14:33:30 +00:00
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 20, "Event %d:", i);
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_cmd_events_data);
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "Event ID: %u",
|
|
|
|
tvb_get_guint8(tvb, offset));
|
|
|
|
proto_tree_add_text(tree, tvb, offset+1, 19, "Event name: %.19s",
|
|
|
|
tvb_get_ephemeral_string(tvb, offset+1, 19));
|
|
|
|
offset += 20;
|
|
|
|
msglen -= 20;
|
|
|
|
i++;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_register(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 16, "Username: %.16s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, 16));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 16;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 32, "Password: %.32s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, 32));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 32;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_register(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Client ID: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 1, "Privileges: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset+1));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+2, 2, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2000-11-01 00:16:18 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_getspeeds(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
|
|
|
int size;
|
|
|
|
int number;
|
2000-11-01 00:16:18 +00:00
|
|
|
int index;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Set Speed IOCTL");
|
|
|
|
proto_tree_add_text(pt, tvb, offset+4, 4, "Get Speed IOCTL");
|
|
|
|
size = tvb_get_guint8(tvb, offset+8);
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+8, 1, "Speed data size is %d byte%s",
|
|
|
|
size, size == 1 ? "" : "s");
|
2001-04-25 06:14:53 +00:00
|
|
|
number = tvb_get_guint8(tvb, offset+9);
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+9, 1, "There %s %d preset speed%s",
|
|
|
|
number == 1 ? "is" : "are", number, number == 1 ? "" : "s");
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 10;
|
2000-11-01 00:16:18 +00:00
|
|
|
for (index = 0; index < number; index++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, size, "Data for preset %d",
|
|
|
|
index+1);
|
|
|
|
offset += size;
|
2000-11-01 00:16:18 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
2000-11-01 00:16:18 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_sort(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2000-11-01 00:16:18 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
const char *which;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
which = tvb_get_guint8(tvb, offset) ?
|
2011-04-12 14:33:30 +00:00
|
|
|
"Sort into blocks of up to 16 messages" :
|
|
|
|
"Do not sort messages";
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Set sorting: %s", which);
|
|
|
|
offset += 1;
|
|
|
|
return offset;
|
2000-11-01 00:16:18 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_optimize(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2000-11-01 00:16:18 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
const char *which;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
|
|
|
which = tvb_get_guint8(tvb, offset) ?
|
2011-04-12 14:33:30 +00:00
|
|
|
"Optimize for latency (Nagle algorithm disabled)" :
|
|
|
|
"Optimize for throughput (Nagle algorithm enabled)";
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Set optimization: %s", which);
|
|
|
|
offset += 1;
|
|
|
|
return offset;
|
2000-11-01 00:16:18 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_config(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *ti, *item;
|
|
|
|
proto_tree *ft, *tree;
|
|
|
|
int devices;
|
|
|
|
int i;
|
2003-10-03 23:22:12 +00:00
|
|
|
unsigned int j, x;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
1999-12-15 06:53:36 +00:00
|
|
|
static const value_string protocol_types[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{GDUMMY * 256 + GDGDMARKONE, "Dummy device driver"},
|
|
|
|
{GCAN * 256 + G82527, "CAN, 82527 subtype"},
|
|
|
|
{GCAN * 256 + GSJA1000, "CAN, SJA1000 subtype"},
|
|
|
|
{GCAN * 256 + G82527SW, "CAN, 82527 single wire subtype"},
|
|
|
|
{GCAN * 256 + G82527ISO11992, "CAN, 82527 ISO11992 subtype"},
|
|
|
|
{GCAN * 256 + G82527_SINGLECHAN, "CAN, Fiber Optic 82527 subtype"},
|
|
|
|
{GCAN * 256 + G82527SW_SINGLECHAN, "CAN, Fiber Optic 82527 single wire subtype"},
|
|
|
|
{GCAN * 256 + G82527ISO11992_SINGLECHAN, "CAN, Fiber Optic ISO11992 subtype"},
|
|
|
|
{GCAN * 256 + GSJA1000FT, "CAN, SJA1000 Fault Tolerant subtype"},
|
|
|
|
{GCAN * 256 + GSJA1000C, "CAN, SJA1000 onboard subtype"},
|
|
|
|
{GCAN * 256 + GSJA1000FT_FO, "CAN, SJA1000 Fiber Optic Fault Tolerant subtype"},
|
|
|
|
{GJ1850 * 256 + GHBCCPAIR, "J1850, HBCC subtype"},
|
|
|
|
{GJ1850 * 256 + GDLC, "J1850, GM DLC subtype"},
|
|
|
|
{GJ1850 * 256 + GCHRYSLER, "J1850, Chrysler subtype"},
|
|
|
|
{GJ1850 * 256 + GDEHC12, "J1850, DE HC12 KWP/BDLC subtype"},
|
|
|
|
{GKWP2000 * 256 + GDEHC12KWP, "Keyword protocol 2000/ISO 9141"},
|
|
|
|
{GHONDA * 256 + GDGHC08, "Honda UART, DG HC08 subtype"},
|
|
|
|
{GFORDUBP * 256 + GDGUBP08, "Ford UBP, DG HC08 subtype"},
|
|
|
|
{GSCI * 256 + G16550SCI, "Chrysler SCI, UART subtype"},
|
|
|
|
{GCCD * 256 + G16550CDP68HC68, "Chrysler C2D, UART / CDP68HC68S1 subtype"},
|
|
|
|
{GLIN * 256 + GDGLIN08, "LIN, DG HC08 subtype"},
|
|
|
|
{0, NULL},
|
1999-12-15 06:53:36 +00:00
|
|
|
};
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 20, "Device name: %.20s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, 20));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 20;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 8, "Device version: %.8s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, 8));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 8;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 20, "Device serial number: %.20s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, 20));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 20;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
devices = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Number of channels: %d", devices);
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 11, "Name & version extension: %.11s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset+1, 11));
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+12, 4, "reserved");
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 16;
|
1999-12-15 06:53:36 +00:00
|
|
|
for (i = 1; i <= devices; i++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
ti = proto_tree_add_text(pt, tvb, offset, 80, "Channel %d:", i);
|
|
|
|
ft = proto_item_add_subtree(ti, ett_gryphon_cmd_config_device);
|
|
|
|
proto_tree_add_text(ft, tvb, offset, 20, "Driver name: %.20s",
|
|
|
|
tvb_get_ephemeral_string(tvb, offset, 20));
|
|
|
|
offset += 20;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 8, "Driver version: %.8s",
|
|
|
|
tvb_get_ephemeral_string(tvb, offset, 8));
|
|
|
|
offset += 8;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 16, "Device security string: %.16s",
|
|
|
|
tvb_get_ephemeral_string(tvb, offset, 16));
|
|
|
|
offset += 16;
|
2003-10-03 23:22:12 +00:00
|
|
|
|
|
|
|
x = tvb_get_ntohl (tvb, offset);
|
|
|
|
if (x) {
|
|
|
|
item = proto_tree_add_text(ft, tvb, offset, 4, "Valid Header lengths");
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_valid_headers);
|
|
|
|
for (j = 0; ; j++) {
|
|
|
|
if (x & 1) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 4, "%d byte%s", j,
|
2003-10-03 23:22:12 +00:00
|
|
|
j == 1 ? "" : "s");
|
|
|
|
}
|
|
|
|
if ((x >>= 1) == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-04-12 14:33:30 +00:00
|
|
|
offset += 4;
|
2003-10-03 23:22:12 +00:00
|
|
|
|
|
|
|
x = tvb_get_ntohs (tvb, offset);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 2, "Maximum data length = %d byte%s",
|
2003-10-03 23:22:12 +00:00
|
|
|
x, x == 1 ? "" : "s");
|
2011-04-12 14:33:30 +00:00
|
|
|
offset += 2;
|
2003-10-03 23:22:12 +00:00
|
|
|
|
|
|
|
x = tvb_get_ntohs (tvb, offset);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 2, "Minimum data length = %d byte%s",
|
2003-10-03 23:22:12 +00:00
|
|
|
x, x == 1 ? "" : "s");
|
2011-04-12 14:33:30 +00:00
|
|
|
offset += 2;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 20, "Hardware serial number: %.20s",
|
|
|
|
tvb_get_ephemeral_string(tvb, offset, 20));
|
|
|
|
offset += 20;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
x = tvb_get_ntohs(tvb, offset);
|
|
|
|
proto_tree_add_text(ft, tvb, offset, 2, "Protocol type & subtype: %s",
|
|
|
|
val_to_str(x, protocol_types, "Unknown (0x%04x)"));
|
|
|
|
offset += 2;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 1, "Channel ID: %u",
|
|
|
|
tvb_get_guint8(tvb, offset));
|
2003-10-03 23:22:12 +00:00
|
|
|
offset++;
|
|
|
|
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 1, "Card slot number: %u",
|
|
|
|
tvb_get_guint8(tvb, offset));
|
2003-10-03 23:22:12 +00:00
|
|
|
offset ++;
|
|
|
|
|
|
|
|
x = tvb_get_ntohs (tvb, offset);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 2, "Maximum extra data = %d byte%s",
|
2003-10-03 23:22:12 +00:00
|
|
|
x, x == 1 ? "" : "s");
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
x = tvb_get_ntohs (tvb, offset);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(ft, tvb, offset, 2, "Minimum extra data = %d byte%s",
|
2003-10-03 23:22:12 +00:00
|
|
|
x, x == 1 ? "" : "s");
|
|
|
|
offset += 2;
|
|
|
|
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_sched(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
|
|
|
proto_item *item, *item1;
|
|
|
|
proto_tree *tree, *tree1;
|
|
|
|
int save_offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
unsigned int i, x, length;
|
2001-04-25 06:14:53 +00:00
|
|
|
unsigned char def_chan = tvb_get_guint8(tvb, offset-9);
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2001-04-25 06:14:53 +00:00
|
|
|
x = tvb_get_ntohl(tvb, offset);
|
1999-12-15 06:53:36 +00:00
|
|
|
if (x == 0xFFFFFFFF)
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Number of iterations: \"infinite\"");
|
1999-12-15 06:53:36 +00:00
|
|
|
else
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Number of iterations: %u", x);
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
|
|
|
x = tvb_get_ntohl(tvb, offset);
|
2002-05-01 06:15:44 +00:00
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 4, "Flags: 0x%08x", x);
|
1999-12-15 06:53:36 +00:00
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_flags);
|
2002-05-01 06:15:44 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 4, "%s",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode_boolean_bitfield(x, 0x01, 32,
|
|
|
|
"Critical scheduler", "Normal scheduler"));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
1999-12-15 06:53:36 +00:00
|
|
|
i = 1;
|
2001-04-25 06:14:53 +00:00
|
|
|
while (msglen > 0) {
|
2011-04-12 14:33:30 +00:00
|
|
|
length = 16 + tvb_get_guint8(tvb, offset+16) +
|
|
|
|
tvb_get_ntohs(tvb, offset+18) + tvb_get_guint8(tvb, offset+20) + 16;
|
|
|
|
length += 3 - (length + 3) % 4;
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, length, "Message %d", i);
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_cmd_sched_data);
|
|
|
|
x = tvb_get_ntohl(tvb, offset);
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 4, "Sleep: %u milliseconds", x);
|
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
|
|
|
x = tvb_get_ntohl(tvb, offset);
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 4, "Transmit count: %u", x);
|
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
|
|
|
x = tvb_get_ntohl(tvb, offset);
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 4, "Transmit period: %u milliseconds", x);
|
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
2003-10-03 23:22:12 +00:00
|
|
|
x = tvb_get_ntohs(tvb, offset);
|
2011-04-12 14:33:30 +00:00
|
|
|
item1 = proto_tree_add_text(tree, tvb, offset, 2, "Flags");
|
2003-10-03 23:22:12 +00:00
|
|
|
tree1 = proto_item_add_subtree (item1, ett_gryphon_flags);
|
|
|
|
proto_tree_add_text(tree1, tvb, offset, 2, "%s%s",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode_boolean_bitfield(x, 1, 16, "S", "Do not s"),
|
2003-10-03 23:22:12 +00:00
|
|
|
"kip the last \"Transmit period\"");
|
|
|
|
if (i == 1) {
|
|
|
|
proto_tree_add_text(tree1, tvb, offset, 2, "%s%s",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode_boolean_bitfield(x, 2, 16, "S", "Do not s"),
|
2003-10-03 23:22:12 +00:00
|
|
|
"kip the first \"Sleep\" value");
|
|
|
|
}
|
2011-04-12 14:33:30 +00:00
|
|
|
x = tvb_get_guint8(tvb, offset+2);
|
|
|
|
if (x == 0)
|
|
|
|
x = def_chan;
|
|
|
|
proto_tree_add_text(tree, tvb, offset+2, 1, "Channel: %u", x);
|
|
|
|
proto_tree_add_text(tree, tvb, offset+3, 1, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
|
|
|
item1 = proto_tree_add_text(tree, tvb, offset, length, "Message");
|
|
|
|
tree1 = proto_item_add_subtree (item1, ett_gryphon_cmd_sched_cmd);
|
|
|
|
save_offset = offset;
|
|
|
|
offset = decode_data(tvb, offset, tree1);
|
|
|
|
msglen -= offset - save_offset;
|
|
|
|
i++;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2003-10-03 23:22:12 +00:00
|
|
|
static int
|
|
|
|
cmd_sched_rep(tvbuff_t *tvb, int offset, proto_tree *pt)
|
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
|
|
|
int save_offset;
|
2003-10-03 23:22:12 +00:00
|
|
|
unsigned int x;
|
2005-07-23 11:41:25 +00:00
|
|
|
const char *type;
|
2003-10-03 23:22:12 +00:00
|
|
|
|
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
|
|
|
x = tvb_get_ntohl(tvb, offset);
|
|
|
|
if (x & 0x80000000)
|
|
|
|
type = "Critical";
|
|
|
|
else
|
|
|
|
type = "Normal";
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "%s schedule ID: %u", type, x);
|
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
|
|
|
x= tvb_get_guint8(tvb, offset);
|
2011-04-12 13:27:08 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Message index: %d", x);
|
|
|
|
proto_tree_add_text(pt, tvb, offset + 1, 3, "reserved");
|
2003-10-03 23:22:12 +00:00
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
|
|
|
save_offset = offset;
|
|
|
|
offset = decode_data(tvb, offset, pt);
|
|
|
|
msglen -= offset - save_offset;
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_blm_data(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2005-07-23 11:41:25 +00:00
|
|
|
unsigned int i;
|
|
|
|
int hours, minutes, seconds, fraction, x, fract;
|
|
|
|
unsigned long timestamp;
|
|
|
|
static const char *fields[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
"Bus load average: %d.%02d%%",
|
|
|
|
"Current bus load: %d.%02d%%",
|
|
|
|
"Peak bus load: %d.%02d%%",
|
|
|
|
"Historic peak bus load: %d.%02d%%"
|
1999-12-15 06:53:36 +00:00
|
|
|
};
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
timestamp = tvb_get_ntohl(tvb, offset);
|
1999-12-15 06:53:36 +00:00
|
|
|
hours = timestamp /(100000 * 60 *60);
|
|
|
|
minutes = (timestamp / (100000 * 60)) % 60;
|
|
|
|
seconds = (timestamp / 100000) % 60;
|
|
|
|
fraction = timestamp % 100000;
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Timestamp: %d:%02d:%02d.%05d", hours, minutes, seconds, fraction);
|
|
|
|
offset += 4;
|
1999-12-15 06:53:36 +00:00
|
|
|
for (i = 0; i < SIZEOF(fields); i++){
|
2011-04-12 14:33:30 +00:00
|
|
|
x = tvb_get_ntohs(tvb, offset);
|
|
|
|
fract = x % 100;
|
|
|
|
x /= 100;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 2, fields[i], x, fract);
|
|
|
|
offset += 2;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_blm_stat(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
|
|
|
unsigned int x, i;
|
2011-04-12 14:33:30 +00:00
|
|
|
const char *fields[] = {
|
|
|
|
"Receive frame count: %u",
|
|
|
|
"Transmit frame count: %u",
|
|
|
|
"Receive dropped frame count: %u",
|
|
|
|
"Transmit dropped frame count: %u",
|
|
|
|
"Receive error count: %u",
|
|
|
|
"Transmit error count: %u",
|
1999-12-15 06:53:36 +00:00
|
|
|
};
|
|
|
|
|
2002-05-01 06:56:16 +00:00
|
|
|
offset = resp_blm_data(tvb, offset, pt);
|
1999-12-15 06:53:36 +00:00
|
|
|
for (i = 0; i < SIZEOF(fields); i++){
|
2011-04-12 14:33:30 +00:00
|
|
|
x = tvb_get_ntohl(tvb, offset);
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, fields[i], x);
|
|
|
|
offset += 4;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2002-05-01 06:15:44 +00:00
|
|
|
static const value_string action_vals[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{ FR_RESP_AFTER_EVENT,
|
|
|
|
"Send response(s) for each conforming message" },
|
|
|
|
{ FR_RESP_AFTER_PERIOD,
|
|
|
|
"Send response(s) after the specified period expires following a conforming message" },
|
|
|
|
{ FR_IGNORE_DURING_PER,
|
|
|
|
"Send response(s) for a conforming message and ignore\nfurther messages until the specified period expires" },
|
|
|
|
{ 0,
|
|
|
|
NULL }
|
2002-05-01 06:15:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string deact_on_event_vals[] = {
|
|
|
|
{ FR_DEACT_ON_EVENT,
|
2011-04-12 14:33:30 +00:00
|
|
|
"Deactivate this response for a conforming message" },
|
2002-05-01 06:15:44 +00:00
|
|
|
{ FR_DELETE|FR_DEACT_ON_EVENT,
|
2011-04-12 14:33:30 +00:00
|
|
|
"Delete this response for a conforming message" },
|
2002-05-01 06:15:44 +00:00
|
|
|
{ 0,
|
2011-04-12 14:33:30 +00:00
|
|
|
NULL }
|
2002-05-01 06:15:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string deact_after_per_vals[] = {
|
|
|
|
{ FR_DEACT_AFTER_PER,
|
2011-04-12 14:33:30 +00:00
|
|
|
"Deactivate this response after the specified period following a conforming message" },
|
2002-05-01 06:15:44 +00:00
|
|
|
{ FR_DELETE|FR_DEACT_AFTER_PER,
|
2011-04-12 14:33:30 +00:00
|
|
|
"Delete this response after the specified period following a conforming message" },
|
2002-05-01 06:15:44 +00:00
|
|
|
{ 0,
|
2011-04-12 14:33:30 +00:00
|
|
|
NULL }
|
2002-05-01 06:15:44 +00:00
|
|
|
};
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_addresp(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
|
|
|
guint8 flags;
|
|
|
|
int blocks, responses, old_handle, i, msglen, length;
|
|
|
|
int action, actionType, actionValue;
|
|
|
|
tvbuff_t *next_tvb;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
|
|
|
actionType = 0;
|
2002-05-01 06:15:44 +00:00
|
|
|
flags = tvb_get_guint8(tvb, offset);
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 1, "Flags: 0x%02x", flags);
|
1999-12-15 06:53:36 +00:00
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_flags);
|
2002-05-01 06:15:44 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode_boolean_bitfield(flags, FILTER_ACTIVE_FLAG, 8,
|
|
|
|
"The response is active", "The response is inactive"));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 1;
|
|
|
|
blocks = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Number of filter blocks = %d", blocks);
|
|
|
|
offset += 1;
|
|
|
|
responses = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Number of response blocks = %d", responses);
|
|
|
|
offset += 1;
|
|
|
|
old_handle = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Old handle = %d", old_handle);
|
|
|
|
offset += 1;
|
|
|
|
action = tvb_get_guint8(tvb, offset);
|
2002-05-01 06:15:44 +00:00
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 1, "Action: %s",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(action & 0x07, action_vals, "Unknown (%u)"));
|
1999-12-15 06:53:36 +00:00
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_flags);
|
2002-05-01 06:15:44 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode_enumerated_bitfield(action, 0x07, 8, action_vals, "%s"));
|
2001-04-25 06:14:53 +00:00
|
|
|
actionValue = tvb_get_ntohs(tvb, offset+2);
|
1999-12-15 06:53:36 +00:00
|
|
|
if (actionValue) {
|
2011-04-12 14:33:30 +00:00
|
|
|
if (action & FR_PERIOD_MSGS) {
|
|
|
|
actionType = 1;
|
|
|
|
} else {
|
|
|
|
actionType = 0;
|
|
|
|
}
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s",
|
|
|
|
decode_boolean_bitfield(action, FR_PERIOD_MSGS, 8,
|
|
|
|
"The period is in frames", "The period is in 0.01 seconds"));
|
2002-05-01 06:15:44 +00:00
|
|
|
}
|
|
|
|
if (action & FR_DEACT_ON_EVENT) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s",
|
|
|
|
decode_enumerated_bitfield(action, FR_DELETE|FR_DEACT_ON_EVENT, 8,
|
|
|
|
deact_on_event_vals, "%s"));
|
2002-05-01 06:15:44 +00:00
|
|
|
}
|
|
|
|
if (action & FR_DEACT_AFTER_PER) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s",
|
|
|
|
decode_enumerated_bitfield(action, FR_DELETE|FR_DEACT_AFTER_PER, 8,
|
|
|
|
deact_after_per_vals, "%s"));
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 1;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "reserved");
|
|
|
|
offset += 1;
|
1999-12-15 06:53:36 +00:00
|
|
|
if (actionValue) {
|
2011-04-12 14:33:30 +00:00
|
|
|
if (actionType == 1) {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 2, "Period: %d messages", actionValue);
|
|
|
|
} else {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 2, "Period: %d.%02d seconds", actionValue/100, actionValue%100);
|
|
|
|
}
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 2;
|
1999-12-15 06:53:36 +00:00
|
|
|
for (i = 1; i <= blocks; i++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
length = tvb_get_ntohs(tvb, offset+2) * 2 + 8;
|
|
|
|
length += 3 - (length + 3) % 4;
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, length, "Filter block %d", i);
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_cmd_filter_block);
|
|
|
|
offset = filter_block(tvb, offset, tree);
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
for (i = 1; i <= responses; i++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
msglen = tvb_get_ntohs(tvb, offset+4) + 8;
|
|
|
|
length = msglen + 3 - (msglen + 3) % 4;
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, length, "Response block %d", i);
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_cmd_response_block);
|
|
|
|
next_tvb = tvb_new_subset(tvb, offset, msglen, msglen);
|
|
|
|
dissect_gryphon_message(next_tvb, NULL, tree, TRUE);
|
|
|
|
offset += length;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_addresp(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Response handle: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_modresp(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
|
|
|
unsigned char action;
|
2001-04-25 06:14:53 +00:00
|
|
|
unsigned char dest = tvb_get_guint8(tvb, offset-5);
|
2011-04-12 14:33:30 +00:00
|
|
|
guint8 resp_handle;
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
resp_handle = tvb_get_guint8(tvb, offset);
|
|
|
|
if (resp_handle)
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Response handle: %u",
|
|
|
|
resp_handle);
|
1999-12-15 06:53:36 +00:00
|
|
|
else if (dest)
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Response handles: all on channel %c", dest);
|
1999-12-15 06:53:36 +00:00
|
|
|
else
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Response handles: all");
|
2001-04-25 06:14:53 +00:00
|
|
|
action = tvb_get_guint8(tvb, offset+1);
|
2002-05-01 06:46:52 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 1, "Action: %s response",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(action, filtacts, "Unknown (%u)"));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+2, 2, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_resphan(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int handles = tvb_get_guint8(tvb, offset);
|
|
|
|
int i, padding;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Number of response handles: %d", handles);
|
1999-12-15 06:53:36 +00:00
|
|
|
for (i = 1; i <= handles; i++){
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+i, 1, "Handle %d: %u", i,
|
|
|
|
tvb_get_guint8(tvb, offset+i));
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
padding = 3 - (handles + 1 + 3) % 4;
|
|
|
|
if (padding)
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1+handles, padding, "padding");
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 1+handles+padding;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_sched(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2001-04-25 06:14:53 +00:00
|
|
|
unsigned int id = tvb_get_ntohl(tvb, offset);
|
|
|
|
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Transmit schedule ID: %u", id);
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_desc(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Program size: %u bytes",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ntohl(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 4;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 32, "Program name: %.32s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, 32));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 32;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 80, "Program description: %.80s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, 80));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 80;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_desc(tvbuff_t *tvb, int offset, proto_tree *pt)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
|
|
|
guint8 flags;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-05-01 06:15:44 +00:00
|
|
|
flags = tvb_get_guint8(tvb, offset);
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 1, "Flags: 0x%02x", flags);
|
1999-12-15 06:53:36 +00:00
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_flags);
|
2002-05-01 06:15:44 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode_boolean_bitfield(flags, 0x01, 8,
|
|
|
|
"The program is already present",
|
|
|
|
"The program is not present"));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 1, "Handle: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset+1));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+2, 2, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_upload(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
1999-12-15 06:53:36 +00:00
|
|
|
unsigned int length;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 2, "Block number: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ntohs(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+2, 1, "Handle: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset+2));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 3;
|
|
|
|
msglen -= 3;
|
|
|
|
length = msglen;
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, length, "Data (%u byte%s)",
|
2011-04-12 14:33:30 +00:00
|
|
|
length, length == 1 ? "" : "s");
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += length;
|
1999-12-15 06:53:36 +00:00
|
|
|
length = 3 - (length + 3) % 4;
|
|
|
|
if (length) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, length, "padding");
|
|
|
|
offset += length;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_delete(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 32, "Program name: %.32s",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, 32));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 32;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_list(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Block number: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_list(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
1999-12-15 06:53:36 +00:00
|
|
|
unsigned int i, count;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
count = tvb_get_guint8(tvb, offset);
|
2002-05-01 06:15:44 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Number of programs in this response: %u", count);
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 1, "reserved");
|
|
|
|
offset += 2;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 2, "Number of remaining programs: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ntohs(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 2;
|
1999-12-15 06:53:36 +00:00
|
|
|
for (i = 1; i <= count; i++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 112, "Program %u", i);
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_pgm_list);
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 32, "Name: %.32s",
|
|
|
|
tvb_get_ephemeral_string(tvb, offset, 32));
|
|
|
|
offset += 32;
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 80, "Description: %.80s",
|
|
|
|
tvb_get_ephemeral_string(tvb, offset, 80));
|
|
|
|
offset += 80;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_start(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
guint8 *string;
|
|
|
|
gint length;
|
2003-10-03 23:22:12 +00:00
|
|
|
int msglen;
|
|
|
|
int hdr_stuff = offset;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2003-10-03 23:22:12 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2011-04-12 14:33:30 +00:00
|
|
|
offset = cmd_delete(tvb, offset, pt); /* decode the name */
|
2003-10-03 23:22:12 +00:00
|
|
|
if (offset < msglen + hdr_stuff) {
|
2009-09-20 08:40:01 +00:00
|
|
|
string = tvb_get_ephemeral_stringz(tvb, offset, &length);
|
2003-10-03 23:22:12 +00:00
|
|
|
if (length > 1) {
|
|
|
|
proto_tree_add_text(pt, tvb, offset, length, "Arguments: %s", string);
|
|
|
|
offset += length;
|
|
|
|
length = 3 - (length + 3) % 4;
|
|
|
|
if (length) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, length, "padding");
|
|
|
|
offset += length;
|
2003-10-03 23:22:12 +00:00
|
|
|
}
|
|
|
|
}
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_start(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2003-10-03 23:22:12 +00:00
|
|
|
int msglen;
|
|
|
|
|
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
|
|
|
if (msglen > 0) {
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Channel (Client) number: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_status(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
1999-12-15 06:53:36 +00:00
|
|
|
unsigned int i, copies, length;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
copies = tvb_get_guint8(tvb, offset);
|
2002-05-01 06:15:44 +00:00
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 1, "Number of running copies: %u", copies);
|
1999-12-15 06:53:36 +00:00
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_pgm_status);
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 1;
|
1999-12-15 06:53:36 +00:00
|
|
|
if (copies) {
|
2011-04-12 14:33:30 +00:00
|
|
|
for (i = 1; i <= copies; i++) {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "Program %u channel (client) number %u",
|
|
|
|
i, tvb_get_guint8(tvb, offset));
|
|
|
|
offset += 1;
|
|
|
|
}
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
length = 3 - (copies + 1 + 3) % 4;
|
|
|
|
if (length) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, length, "padding");
|
|
|
|
offset += length;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_options(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
1999-12-15 06:53:36 +00:00
|
|
|
unsigned int i, size, padding, option, option_length, option_value;
|
2011-04-12 14:33:30 +00:00
|
|
|
const char *string, *string1;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2011-04-12 13:27:08 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Handle: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2011-04-12 13:27:08 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 4;
|
|
|
|
msglen -= 4;
|
|
|
|
for (i = 1; msglen > 0; i++) {
|
2011-04-12 14:33:30 +00:00
|
|
|
option_length = tvb_get_guint8(tvb, offset+1);
|
|
|
|
size = option_length + 2;
|
|
|
|
padding = 3 - ((size + 3) %4);
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, size + padding, "Option number %u", i);
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_pgm_options);
|
|
|
|
option = tvb_get_guint8(tvb, offset);
|
|
|
|
switch (option_length) {
|
|
|
|
case 1:
|
|
|
|
option_value = tvb_get_guint8(tvb, offset+2);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
option_value = tvb_get_ntohs(tvb, offset+2);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
option_value = tvb_get_ntohl(tvb, offset+2);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
option_value = 0;
|
|
|
|
}
|
|
|
|
string = "unknown option";
|
|
|
|
string1 = "unknown option data";
|
|
|
|
switch (option) {
|
|
|
|
case PGM_CONV:
|
|
|
|
string = "Type of data in the file";
|
|
|
|
switch (option_value) {
|
|
|
|
case PGM_BIN:
|
|
|
|
string1 = "Binary - Don't modify";
|
|
|
|
break;
|
|
|
|
case PGM_ASCII:
|
|
|
|
string1 = "ASCII - Remove CR's";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PGM_TYPE:
|
|
|
|
string = "Type of file";
|
|
|
|
switch (option_value) {
|
|
|
|
case PGM_PGM:
|
|
|
|
string1 = "Executable";
|
|
|
|
break;
|
|
|
|
case PGM_DATA:
|
|
|
|
string1 = "Data";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s", string);
|
|
|
|
proto_tree_add_text(tree, tvb, offset+2, option_length, "%s", string1);
|
|
|
|
if (padding)
|
|
|
|
proto_tree_add_text(tree, tvb, offset+option_length+2, padding, "padding");
|
|
|
|
offset += size + padding;
|
|
|
|
msglen -= size + padding;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_files(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
2005-07-23 11:41:25 +00:00
|
|
|
const gchar *which;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2001-04-25 06:14:53 +00:00
|
|
|
if (tvb_get_guint8(tvb, offset) == 0)
|
2011-04-12 14:33:30 +00:00
|
|
|
which = "First group of names";
|
2000-11-01 00:16:18 +00:00
|
|
|
else
|
2011-04-12 14:33:30 +00:00
|
|
|
which = "Subsequent group of names";
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "%s", which);
|
|
|
|
proto_tree_add_text(pt, tvb, offset+1, msglen-1, "Directory: %.*s",
|
2011-04-12 14:33:30 +00:00
|
|
|
msglen-1, tvb_get_ephemeral_string(tvb, offset+1, msglen-1));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += msglen;
|
|
|
|
return offset;
|
2000-11-01 00:16:18 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
resp_files(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen;
|
|
|
|
const gchar *flag;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-05-01 05:24:42 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
2001-04-25 06:14:53 +00:00
|
|
|
flag = tvb_get_guint8(tvb, offset) ? "Yes": "No";
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "More filenames to return: %s", flag);
|
|
|
|
proto_tree_add_text(pt, tvb, offset+1, msglen-1, "File and directory names");
|
|
|
|
offset += msglen;
|
|
|
|
return offset;
|
2000-11-01 00:16:18 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
cmd_usdt(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2000-11-01 00:16:18 +00:00
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int ids, id, remain, size, i, j, bytes;
|
|
|
|
const gchar *desc;
|
|
|
|
guint8 flags;
|
|
|
|
proto_tree *localTree;
|
|
|
|
proto_item *localItem;
|
|
|
|
const gchar *actions[] = {
|
|
|
|
"Use 11 bit headers only",
|
|
|
|
"Use 29 bit headers only",
|
|
|
|
"Use both 11 & 29 bit headers",
|
|
|
|
"undefined"
|
2005-07-23 11:41:25 +00:00
|
|
|
};
|
|
|
|
const gchar *xmit_opts[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
"Pad messages with less than 8 data bytes with 0x00's",
|
|
|
|
"Pad messages with less than 8 data bytes with 0xFF's",
|
|
|
|
"Do not pad messages with less than 8 data bytes",
|
|
|
|
"undefined"
|
2005-07-23 11:41:25 +00:00
|
|
|
};
|
|
|
|
const gchar *recv_opts[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
"Do not verify the integrity of long received messages and do not send them to the client",
|
|
|
|
"Verify the integrity of long received messages and send them to the client",
|
|
|
|
"Verify the integrity of long received messages but do not send them to the client",
|
|
|
|
"undefined"
|
2005-07-23 11:41:25 +00:00
|
|
|
};
|
|
|
|
const gchar *block_desc[] = {"USDT request", "USDT response", "UUDT response"};
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2003-10-03 23:22:12 +00:00
|
|
|
flags = tvb_get_guint8(tvb, offset);
|
|
|
|
if (flags & 1)
|
2011-04-12 14:33:30 +00:00
|
|
|
desc = "R";
|
2000-11-01 00:16:18 +00:00
|
|
|
else
|
2011-04-12 14:33:30 +00:00
|
|
|
desc = "Unr";
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "%segister with gusdt", desc);
|
|
|
|
|
|
|
|
if (flags & 1) {
|
|
|
|
localItem = proto_tree_add_text(pt, tvb, offset, 1, "Action flags");
|
|
|
|
localTree = proto_item_add_subtree (localItem, ett_gryphon_flags);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(localTree, tvb, offset, 1, "%s%s",
|
|
|
|
decode_boolean_bitfield (flags, 1, 8,
|
|
|
|
"R", "Unr"), "egister with gusdt");
|
|
|
|
proto_tree_add_text(localTree, tvb, offset, 1, "%s = %s",
|
2003-10-03 23:22:12 +00:00
|
|
|
decode_numeric_bitfield (flags, 6, 8, "%d"),
|
|
|
|
actions[(flags >> 1) & 3]);
|
|
|
|
|
|
|
|
flags = tvb_get_guint8(tvb, offset+1);
|
|
|
|
localItem = proto_tree_add_text(pt, tvb, offset+1, 1, "Transmit options");
|
|
|
|
localTree = proto_item_add_subtree (localItem, ett_gryphon_flags);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(localTree, tvb, offset+1, 1, "%s%s",
|
|
|
|
decode_boolean_bitfield (flags, 1, 8,
|
|
|
|
"E", "Do not e"),
|
2003-10-03 23:22:12 +00:00
|
|
|
"cho long transmit messages back to the client");
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(localTree, tvb, offset+1, 1, "%s = %s",
|
2003-10-03 23:22:12 +00:00
|
|
|
decode_numeric_bitfield (flags, 6, 8, "%d"),
|
|
|
|
xmit_opts[(flags >> 1) & 3]);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(localTree, tvb, offset+1, 1, "%s%s",
|
|
|
|
decode_boolean_bitfield (flags, 8, 8,
|
|
|
|
"S", "Do not s"),
|
2003-10-03 23:22:12 +00:00
|
|
|
"end a USDT_DONE event when the last frame of a multi-frame USDT message is transmitted");
|
|
|
|
|
|
|
|
flags = tvb_get_guint8(tvb, offset+2);
|
|
|
|
localItem = proto_tree_add_text(pt, tvb, offset+2, 1, "Receive options");
|
|
|
|
localTree = proto_item_add_subtree (localItem, ett_gryphon_flags);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(localTree, tvb, offset+2, 1, "%s = %s",
|
2003-10-03 23:22:12 +00:00
|
|
|
decode_numeric_bitfield (flags, 3, 8, "%d"),
|
|
|
|
recv_opts[flags & 3]);
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(localTree, tvb, offset+2, 1, "%s%s",
|
|
|
|
decode_boolean_bitfield (flags, 4, 8,
|
|
|
|
"S", "Do not s"),
|
2003-10-03 23:22:12 +00:00
|
|
|
"end a USDT_FIRSTFRAME event when the first frame of a multi-frame USDT message is received");
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(localTree, tvb, offset+2, 1, "%s%s",
|
|
|
|
decode_boolean_bitfield (flags, 8, 8,
|
|
|
|
"S", "Do not s"),
|
2003-10-03 23:22:12 +00:00
|
|
|
"end a USDT_LASTFRAME event when the last frame of a multi-frame USDT message is received");
|
|
|
|
|
|
|
|
if ((ids = tvb_get_guint8(tvb, offset+3))) {
|
|
|
|
localItem = proto_tree_add_text(pt, tvb, offset+3, 1, "Using extended addressing for %d ID%s",
|
|
|
|
ids, ids == 1?"":"s");
|
|
|
|
offset += 4;
|
|
|
|
localTree = proto_item_add_subtree (localItem, ett_gryphon_usdt_data);
|
|
|
|
while (ids) {
|
|
|
|
id = tvb_get_ntohl (tvb, offset);
|
|
|
|
proto_tree_add_text (localTree, tvb, offset, 4, "%04X", id);
|
|
|
|
offset += 4;
|
|
|
|
ids--;
|
|
|
|
}
|
|
|
|
} else {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+3, 1,
|
|
|
|
"Using extended addressing for the single, internally defined, ID");
|
2003-10-03 23:22:12 +00:00
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
bytes = tvb_reported_length_remaining (tvb, offset);
|
|
|
|
if (bytes <= 0)
|
|
|
|
break;
|
|
|
|
localItem = proto_tree_add_text(pt, tvb, offset, 16, "%s block of USDT/UUDT IDs", i==0?"First":"Second");
|
|
|
|
localTree = proto_item_add_subtree (localItem, ett_gryphon_usdt_data);
|
|
|
|
size = tvb_get_ntohl (tvb, offset);
|
|
|
|
if (size == 0) {
|
|
|
|
proto_tree_add_text (localTree, tvb, offset, 16, "No IDs in the block");
|
|
|
|
offset += 16;
|
|
|
|
} else if (size == 1) {
|
|
|
|
proto_tree_add_text (localTree, tvb, offset, 4, "1 ID in the block");
|
|
|
|
offset += 4;
|
|
|
|
for (j = 0; j < 3; j++){
|
|
|
|
id = tvb_get_ntohl (tvb, offset);
|
|
|
|
proto_tree_add_text (localTree, tvb, offset, 4,
|
|
|
|
"%s ID: %04X", block_desc[j], id);
|
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
proto_tree_add_text (localTree, tvb, offset, 4, "%d IDs in the block", size);
|
|
|
|
offset += 4;
|
|
|
|
for (j = 0; j < 3; j++){
|
|
|
|
id = tvb_get_ntohl (tvb, offset);
|
|
|
|
proto_tree_add_text (localTree, tvb, offset, 4,
|
|
|
|
"%s IDs from %04X through %04X", block_desc[j], id, id+size-1);
|
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
}
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2003-10-03 23:22:12 +00:00
|
|
|
if ((remain = tvb_reported_length_remaining(tvb, offset))) {
|
|
|
|
proto_tree_add_text(pt, tvb, offset, remain, "%d ignored byte%s",
|
|
|
|
remain, remain == 1 ? "" : "s");
|
|
|
|
offset += remain;
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
cmd_bits_in (tvbuff_t *tvb, int offset, proto_tree *pt)
|
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
2003-10-03 23:22:12 +00:00
|
|
|
unsigned int i;
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen, mask, value;
|
|
|
|
const char *decode[] = {"Input 1", "Input 2", "Input 3", "Pushbutton"};
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2003-10-03 23:22:12 +00:00
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
|
|
|
value = tvb_get_guint8(tvb, offset);
|
|
|
|
if (value) {
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 1, "Digital values set");
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_digital_data);
|
|
|
|
for (i = 0, mask = 1; i < SIZEOF (decode); mask <<= 1, i++) {
|
|
|
|
if (value & mask) {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s is set",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode[i]);
|
2003-10-03 23:22:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "No digital values are set");
|
|
|
|
}
|
2009-09-20 08:40:01 +00:00
|
|
|
|
2003-10-03 23:22:12 +00:00
|
|
|
offset++;
|
|
|
|
msglen--;
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
cmd_bits_out (tvbuff_t *tvb, int offset, proto_tree *pt)
|
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
2003-10-03 23:22:12 +00:00
|
|
|
unsigned int i;
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen, mask, value;
|
|
|
|
const char *decode[] = {"Output 1", "Output 2"};
|
2003-10-03 23:22:12 +00:00
|
|
|
|
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
|
|
|
value = tvb_get_guint8(tvb, offset);
|
|
|
|
if (value) {
|
|
|
|
item = proto_tree_add_text(pt, tvb, offset, 1, "Digital values set");
|
|
|
|
tree = proto_item_add_subtree (item, ett_gryphon_digital_data);
|
|
|
|
for (i = 0, mask = 1; i < SIZEOF (decode); mask <<= 1, i++) {
|
|
|
|
if (value & mask) {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 1, "%s is set",
|
2011-04-12 14:33:30 +00:00
|
|
|
decode[i]);
|
2003-10-03 23:22:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "No digital values are set");
|
|
|
|
}
|
2009-09-20 08:40:01 +00:00
|
|
|
|
2003-10-03 23:22:12 +00:00
|
|
|
offset++;
|
|
|
|
msglen--;
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
cmd_init_strat (tvbuff_t *tvb, int offset, proto_tree *pt)
|
|
|
|
{
|
2011-04-12 14:33:30 +00:00
|
|
|
int msglen, index;
|
2003-10-03 23:22:12 +00:00
|
|
|
float value;
|
|
|
|
|
|
|
|
msglen = tvb_reported_length_remaining(tvb, offset);
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Reset Limit = %u messages",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ntohl(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += 4;
|
2003-10-03 23:22:12 +00:00
|
|
|
msglen -= 4;
|
|
|
|
for (index = 1; msglen; index++, offset++, msglen--) {
|
|
|
|
value = tvb_get_guint8(tvb, offset);
|
|
|
|
if (value) {
|
|
|
|
value /= 4;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Delay %d = %.2f seconds",
|
2011-04-12 14:33:30 +00:00
|
|
|
index, value);
|
2003-10-03 23:22:12 +00:00
|
|
|
} else {
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Delay %d = infinite",
|
2011-04-12 14:33:30 +00:00
|
|
|
index);
|
2003-10-03 23:22:12 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
2000-11-01 00:16:18 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
speed(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Baud rate index: %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+1, 3, "reserved");
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
filter_block(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2002-05-01 06:46:52 +00:00
|
|
|
unsigned int type, operator;
|
2001-04-23 23:45:35 +00:00
|
|
|
int length, padding;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-05-01 06:15:44 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 2, "Filter field starts at byte %u",
|
2011-04-12 14:33:30 +00:00
|
|
|
tvb_get_ntohs(tvb, offset));
|
2001-04-25 06:14:53 +00:00
|
|
|
length = tvb_get_ntohs(tvb, offset+2);
|
2003-10-03 23:22:12 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+2, 2, "Filter field is %d byte%s long",
|
|
|
|
length, length == 1 ? "" : "s");
|
2001-04-25 06:14:53 +00:00
|
|
|
type = tvb_get_guint8(tvb, offset+4);
|
2002-05-01 06:46:52 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+4, 1, "Filtering on %s",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(type, filter_data_types, "Unknown (0x%02x)"));
|
1999-12-15 06:53:36 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
operator = tvb_get_guint8(tvb, offset+5);
|
2002-05-01 06:46:52 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+5, 1, "Type of comparison: %s",
|
2011-04-12 14:33:30 +00:00
|
|
|
val_to_str(operator, operators, "Unknown (%u)"));
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset+6, 2, "reserved");
|
|
|
|
offset += 8;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
1999-12-15 06:53:36 +00:00
|
|
|
if (operator == BIT_FIELD_CHECK) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, length, "Pattern");
|
|
|
|
proto_tree_add_text(pt, tvb, offset+length, length, "Mask");
|
1999-12-15 06:53:36 +00:00
|
|
|
} else {
|
2011-04-12 14:33:30 +00:00
|
|
|
switch (length) {
|
|
|
|
case 1:
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 1, "Value: %u",
|
|
|
|
tvb_get_guint8(tvb, offset));
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 2, "Value: %u",
|
|
|
|
tvb_get_ntohs(tvb, offset));
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Value: %u",
|
|
|
|
tvb_get_ntohl(tvb, offset));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
proto_tree_add_text(pt, tvb, offset, length, "Value");
|
|
|
|
}
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
offset += length * 2;
|
1999-12-15 06:53:36 +00:00
|
|
|
padding = 3 - (length * 2 + 3) % 4;
|
|
|
|
if (padding) {
|
2011-04-12 14:33:30 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, padding, "padding");
|
|
|
|
offset += padding;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
static int
|
2002-05-01 06:56:16 +00:00
|
|
|
blm_mode(tvbuff_t *tvb, int offset, proto_tree *pt)
|
2001-04-25 06:14:53 +00:00
|
|
|
{
|
2005-07-23 11:41:25 +00:00
|
|
|
const char *mode;
|
|
|
|
char line[50];
|
1999-12-15 06:53:36 +00:00
|
|
|
int x, y, seconds;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-25 06:14:53 +00:00
|
|
|
x = tvb_get_ntohl(tvb, offset);
|
|
|
|
y = tvb_get_ntohl(tvb, offset+4);
|
1999-12-15 06:53:36 +00:00
|
|
|
switch (x) {
|
|
|
|
case 0:
|
2011-04-12 14:33:30 +00:00
|
|
|
mode = "Off";
|
|
|
|
g_snprintf (line, 50, "reserved");
|
|
|
|
break;
|
1999-12-15 06:53:36 +00:00
|
|
|
case 1:
|
2011-04-12 14:33:30 +00:00
|
|
|
mode = "Average over time";
|
|
|
|
seconds = y / 1000;
|
|
|
|
y = y % 1000;
|
|
|
|
g_snprintf (line, 50, "Averaging period: %d.%03d seconds", seconds, y);
|
|
|
|
break;
|
1999-12-15 06:53:36 +00:00
|
|
|
case 2:
|
2011-04-12 14:33:30 +00:00
|
|
|
mode = "Average over frame count";
|
|
|
|
g_snprintf (line, 50, "Averaging period: %d frames", y);
|
|
|
|
break;
|
1999-12-15 06:53:36 +00:00
|
|
|
default:
|
2011-04-12 14:33:30 +00:00
|
|
|
mode = "- unknown -";
|
|
|
|
g_snprintf (line, 50, "reserved");
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
2001-04-25 06:14:53 +00:00
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, "Mode: %s", mode);
|
|
|
|
offset += 4;
|
|
|
|
proto_tree_add_text(pt, tvb, offset, 4, line, NULL);
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|
|
|
|
|
2001-07-08 21:51:34 +00:00
|
|
|
void
|
|
|
|
proto_register_gryphon(void)
|
1999-12-15 06:53:36 +00:00
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
{ &hf_gryphon_src,
|
|
|
|
{ "Source", "gryphon.src", FT_UINT8, BASE_HEX, VALS(src_dest), 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
{ &hf_gryphon_srcchan,
|
|
|
|
{ "Source channel", "gryphon.srcchan", FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
{ &hf_gryphon_dest,
|
|
|
|
{ "Destination", "gryphon.dest", FT_UINT8, BASE_HEX, VALS(src_dest), 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
{ &hf_gryphon_destchan,
|
|
|
|
{ "Destination channel", "gryphon.destchan", FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
{ &hf_gryphon_type,
|
|
|
|
{ "Frame type", "gryphon.type", FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
{ &hf_gryphon_cmd,
|
|
|
|
{ "Command", "gryphon.cmd", FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
1999-12-15 06:53:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
2011-04-12 14:33:30 +00:00
|
|
|
&ett_gryphon,
|
|
|
|
&ett_gryphon_header,
|
|
|
|
&ett_gryphon_body,
|
|
|
|
&ett_gryphon_command_data,
|
|
|
|
&ett_gryphon_response_data,
|
|
|
|
&ett_gryphon_data_header,
|
|
|
|
&ett_gryphon_flags,
|
|
|
|
&ett_gryphon_data_body,
|
|
|
|
&ett_gryphon_cmd_filter_block,
|
|
|
|
&ett_gryphon_cmd_events_data,
|
|
|
|
&ett_gryphon_cmd_config_device,
|
|
|
|
&ett_gryphon_cmd_sched_data,
|
|
|
|
&ett_gryphon_cmd_sched_cmd,
|
|
|
|
&ett_gryphon_cmd_response_block,
|
|
|
|
&ett_gryphon_pgm_list,
|
|
|
|
&ett_gryphon_pgm_status,
|
|
|
|
&ett_gryphon_pgm_options,
|
2003-10-03 23:22:12 +00:00
|
|
|
&ett_gryphon_valid_headers,
|
|
|
|
&ett_gryphon_usdt_data,
|
|
|
|
&ett_gryphon_digital_data,
|
1999-12-15 06:53:36 +00:00
|
|
|
};
|
2002-05-01 05:24:42 +00:00
|
|
|
module_t *gryphon_module;
|
|
|
|
|
2001-07-08 21:51:34 +00:00
|
|
|
proto_gryphon = proto_register_protocol("DG Gryphon Protocol",
|
2011-04-12 14:33:30 +00:00
|
|
|
"Gryphon",
|
|
|
|
"gryphon");
|
2001-07-08 21:51:34 +00:00
|
|
|
proto_register_field_array(proto_gryphon, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2002-05-01 05:24:42 +00:00
|
|
|
|
|
|
|
gryphon_module = prefs_register_protocol(proto_gryphon, NULL);
|
|
|
|
prefs_register_bool_preference(gryphon_module, "desegment",
|
2011-04-12 14:33:30 +00:00
|
|
|
"Desegment all Gryphon messages spanning multiple TCP segments",
|
|
|
|
"Whether the Gryphon dissector should desegment all messages spanning multiple TCP segments",
|
|
|
|
&gryphon_desegment);
|
Allow plugins to have, instead of "protocol" and "filter_string"
variables and a "dissector" routine, a "plugin_reg_handoff()" routine,
which will act just like the "reg_handoff()" routine of a non-plugin
dissector, registering the dissector with handoff tables.
This lets them plug into both TCP and UDP, or plug into protocols other
than TCP or UDP.
Those new-style plugin are enabled and disabled using the standard
"Edit->Protocols" mechanism (and thus should use
"OLD_CHECK_DISPLAY_AS_DATA()" or "CHECK_DISPLAY_AS_DATA()"); they don't
show up in the list of plugins, aren't enabled or disabled from that
list, and, as they don't have a filter, can't have the filter changed
from that list - instead, they should register preferences for port
numbers and the like if they should be configurable to use different
ports.
Make the Gryphon protocol a new-style plugin.
svn path=/trunk/; revision=2565
2000-11-05 09:05:00 +00:00
|
|
|
}
|
|
|
|
|
2001-07-08 21:51:34 +00:00
|
|
|
void
|
|
|
|
proto_reg_handoff_gryphon(void)
|
Allow plugins to have, instead of "protocol" and "filter_string"
variables and a "dissector" routine, a "plugin_reg_handoff()" routine,
which will act just like the "reg_handoff()" routine of a non-plugin
dissector, registering the dissector with handoff tables.
This lets them plug into both TCP and UDP, or plug into protocols other
than TCP or UDP.
Those new-style plugin are enabled and disabled using the standard
"Edit->Protocols" mechanism (and thus should use
"OLD_CHECK_DISPLAY_AS_DATA()" or "CHECK_DISPLAY_AS_DATA()"); they don't
show up in the list of plugins, aren't enabled or disabled from that
list, and, as they don't have a filter, can't have the filter changed
from that list - instead, they should register preferences for port
numbers and the like if they should be configurable to use different
ports.
Make the Gryphon protocol a new-style plugin.
svn path=/trunk/; revision=2565
2000-11-05 09:05:00 +00:00
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t gryphon_handle;
|
|
|
|
|
|
|
|
gryphon_handle = create_dissector_handle(dissect_gryphon, proto_gryphon);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("tcp.port", 7000, gryphon_handle);
|
1999-12-15 06:53:36 +00:00
|
|
|
}
|