diff options
Diffstat (limited to 'plugins/gryphon/packet-gryphon.h')
-rw-r--r-- | plugins/gryphon/packet-gryphon.h | 398 |
1 files changed, 398 insertions, 0 deletions
diff --git a/plugins/gryphon/packet-gryphon.h b/plugins/gryphon/packet-gryphon.h new file mode 100644 index 0000000000..4e15bc77d2 --- /dev/null +++ b/plugins/gryphon/packet-gryphon.h @@ -0,0 +1,398 @@ +/* packet-gryphon.c + * Definitions for Gryphon packet disassembly structures and routines + * + * $Id: packet-gryphon.h,v 1.1 1999/12/15 06:53:36 gram Exp $ + * + * Ethereal - Network traffic analyzer + * By Steve Limkemann <stevelim@dgtech.com> + * Copyright 1998 Steve Limkemann + * + * + * 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. + * + * 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. + * + * 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. + * + * + */ + +#define MSG_HDR_SZ 8 + +/* source/destinations: */ + +#define SD_CARD 0x01 /* (vehicle) network interface */ +#define SD_SERVER 0x02 +#define SD_CLIENT 0x03 +#define SD_KNOWN 0x10 /* Client ID >= are well known */ +#define SD_SCHED 0x10 /* scheduler */ +#define SD_SCRIPT 0x20 /* script processor */ +#define SD_PGM 0x21 /* Program loader */ +#define SD_USDT 0x22 /* USDT (Unacknowledged Segmented Data Transfer) */ +#define SD_BLM 0x23 /* Bus Load Monitoring */ +#define SD_FLIGHT 0x25 /* Flight Recorder */ +#define SD_RESP 0x26 /* Message Response */ + + + +/* frame types: */ +#define GY_FT_CMD 0x01 /* command to initiate some action */ +#define GY_FT_RESP 0x02 /* response to a command */ +#define GY_FT_DATA 0x03 /* (vehicle) network data */ +#define GY_FT_EVENT 0x04 /* notification of an event */ +#define GY_FT_MISC 0x05 /* misc data */ +#define GY_FT_TEXT 0x06 /* null-terminated ASCII strings */ + + + +/* generic (all SD type) commands: values 0x00 to 0x3f */ + +#define CMD_INIT 0x01 /* initialize target */ +#define CMD_GET_STAT 0x02 /* request status */ +#define CMD_GET_CONFIG 0x03 /* request configuration info */ +#define CMD_EVENT_ENABLE 0x04 /* Enable event type */ +#define CMD_EVENT_DISABLE 0x05 /* Disable event type */ +#define CMD_GET_TIME 0x06 /* Get current value of timestamp */ +#define CMD_GET_RXDROP 0x07 /* Get count of Rx msgs dropped */ +#define CMD_RESET_RXDROP 0x08 /* Set count of Rx msgs dropped to zero */ +#define CMD_BCAST_ON 0x09 /* broadcasts on */ +#define CMD_BCAST_OFF 0x0a /* broadcasts off */ + +/* SD-type specific commands: should start at 0x40, global uniqueness */ +/* is prefered, but not mandatory. */ + +/* SD_CARD command types: */ + +#define CMD_CARD_SET_SPEED (SD_CARD * 256 + 0x40) /* set peripheral speed */ +#define CMD_CARD_GET_SPEED (SD_CARD * 256 + 0x41) /* get peripheral speed */ +#define CMD_CARD_SET_FILTER (SD_CARD * 256 + 0x42) /* set filter to pass or block all */ +#define CMD_CARD_GET_FILTER (SD_CARD * 256 + 0x43) /* get a pass/block filter */ +#define CMD_CARD_TX (SD_CARD * 256 + 0x44) /* transmit message */ +#define CMD_CARD_TX_LOOP_ON (SD_CARD * 256 + 0x45) /* set transmit loopback on */ +#define CMD_CARD_TX_LOOP_OFF (SD_CARD * 256 + 0x46) /* set transmit loopback off */ +#define CMD_CARD_IOCTL (SD_CARD * 256 + 0x47) /* device driver ioctl pass-through */ +#define CMD_CARD_ADD_FILTER (SD_CARD * 256 + 0x48) /* add a pass/block filter */ +#define CMD_CARD_MODIFY_FILTER (SD_CARD * 256 + 0x49) /* modify a pass/block filter */ +#define CMD_CARD_GET_FILTER_HANDLES (SD_CARD * 256 + 0x4A)/* get a list of filters */ +#define CMD_CARD_SET_DEFAULT_FILTER (SD_CARD * 256 + 0x4B)/* set the default action */ +#define CMD_CARD_GET_DEFAULT_FILTER (SD_CARD * 256 + 0x4C)/* get the defautl action */ +#define CMD_CARD_SET_FILTER_MODE (SD_CARD * 256 + 0x4D) /* set the client data mode */ +#define CMD_CARD_GET_FILTER_MODE (SD_CARD * 256 + 0x4E) /* get the client data mode */ +#define CMD_CARD_GET_EVNAMES (SD_CARD * 256 + 0x4f) /* get event names */ +#define CMD_CARD_GET_SPEEDS (SD_CARD * 256 + 0x50) /* get speed definitions */ + +/* SD_SERVER command types: */ + +#define CMD_SERVER_REG (SD_SERVER * 256 + 0x50) /* register connection */ + +/* SD_CLIENT command types: */ + +#define CMD_CLIENT_GET_ID (SD_CLIENT * 256 + 0x60) /* get the ID (channel field) of this client? */ +#define CMD_CLIENT_SET_ID (SD_CLIENT * 256 + 0x61) /* set the ID (channel field) of this client? */ +#define CMD_CLIENT_SHUTDOWN (SD_CLIENT * 256 + 0x62) /* tell client to die ? */ + +/* Bus load monitor (SD_BLM) commands: */ + +#define CMD_BLM_SET_MODE (SD_BLM * 256 + 0xA0) +#define CMD_BLM_GET_MODE (SD_BLM * 256 + 0xA1) +#define CMD_BLM_GET_DATA (SD_BLM * 256 + 0xA2) +#define CMD_BLM_GET_STATS (SD_BLM * 256 + 0xA3) + +/* Flight recorder (SD_FLIGHT) commands */ + +#define CMD_FLIGHT_GET_CONFIG (SD_FLIGHT * 256 + 0x50) /* get flight recorder channel info */ +#define CMD_FLIGHT_START_MON (SD_FLIGHT * 256 + 0x51) /* start flight recorder monitoring */ +#define CMD_FLIGHT_STOP_MON (SD_FLIGHT * 256 + 0x52) /* stop flight recorder monitoring */ + +/* Message responder (SD_RESP) commands: */ +#define CMD_MSGRESP_ADD (SD_RESP * 256 + 0xB0) +#define CMD_MSGRESP_GET (SD_RESP * 256 + 0xB1) +#define CMD_MSGRESP_MODIFY (SD_RESP * 256 + 0xB2) +#define CMD_MSGRESP_GET_HANDLES (SD_RESP * 256 + 0xB3) + +/* Program loader (SD_PGM) commands: */ + +#define CMD_PGM_DESC (SD_PGM * 256 + 0x90) /* Describe a program to to uploaded */ +#define CMD_PGM_UPLOAD (SD_PGM * 256 + 0x91) /* Upload a program to the Gryphon */ +#define CMD_PGM_DELETE (SD_PGM * 256 + 0x92) /* Delete an uploaded program */ +#define CMD_PGM_LIST (SD_PGM * 256 + 0x93) /* Get a list of uploaded programs */ +#define CMD_PGM_START (SD_PGM * 256 + 0x94) /* Start an uploaded program */ +#define CMD_PGM_STOP (SD_PGM * 256 + 0x95) /* Stop an uploaded program */ +#define CMD_PGM_STATUS (SD_PGM * 256 + 0x96) /* Get the status of an uploaded program */ +#define CMD_PGM_OPTIONS (SD_PGM * 256 + 0x97) /* Set the upload options */ + +/* Scheduler (SD_SCHED) target commands: */ + +#define CMD_SCHED_TX (SD_SCHED * 256 + 0x70) /* schedule transmission list */ +#define CMD_SCHED_KILL_TX (SD_SCHED * 256 + 0x71) /* stop and destroy job */ +#define CMD_SCHED_STOP_TX (SD_SCHED * 256 + 0x71) /* deprecated */ + +/* response frame (FT_RESP) response field definitions: */ + +#define RESP_OK 0x00 /* no error */ +#define RESP_UNKNOWN_ERR 0x01 /* unknown error */ +#define RESP_UNKNOWN_CMD 0x02 /* unrecognised command */ +#define RESP_UNSUPPORTED 0x03 /* unsupported command */ +#define RESP_INVAL_CHAN 0x04 /* invalid channel specified */ +#define RESP_INVAL_DST 0x05 /* invalid destination */ +#define RESP_INVAL_PARAM 0x06 /* invalid parameters */ +#define RESP_INVAL_MSG 0x07 /* invalid message */ +#define RESP_INVAL_LEN 0x08 /* invalid length field */ +#define RESP_TX_FAIL 0x09 /* transmit failed */ +#define RESP_RX_FAIL 0x0a /* receive failed */ +#define RESP_AUTH_FAIL 0x0b +#define RESP_MEM_ALLOC_ERR 0x0c /* memory allocation error */ +#define RESP_TIMEOUT 0x0d /* command timed out */ +#define RESP_UNAVAILABLE 0x0e +#define RESP_BUF_FULL 0x0f /* buffer full */ +#define RESP_NO_SUCH_JOB 0x10 + +/* Flight recorder (SD_FLIGHT) target definitions */ + +#define FR_RESP_AFTER_EVENT 0 +#define FR_RESP_AFTER_PERIOD 1 +#define FR_IGNORE_DURING_PER 2 +#define FR_DEACT_AFTER_PER 128 +#define FR_DEACT_ON_EVENT 64 +#define FR_DELETE 32 +#define FR_PERIOD_MSGS 16 + +/* Filter data types */ + +#define FILTER_DATA_TYPE_HEADER_FRAME 0x00 +#define FILTER_DATA_TYPE_HEADER 0x01 +#define FILTER_DATA_TYPE_DATA 0x02 +#define FILTER_DATA_TYPE_EXTRA_DATA 0x03 + +/* filter flags */ + +#define FILTER_PASS_FLAG 0x01 +#define FILTER_ACTIVE_FLAG 0x02 + +/* Filter and Frame Responder Condition operators */ + +#define BIT_FIELD_CHECK 0 +#define SVALUE_GT 1 +#define SVALUE_GE 2 +#define SVALUE_LT 3 +#define SVALUE_LE 4 +#define VALUE_EQ 5 +#define VALUE_NE 6 +#define UVALUE_GT 7 +#define UVALUE_GE 8 +#define UVALUE_LT 9 +#define UVALUE_LE 10 +#define DIG_LOW_TO_HIGH 11 +#define DIG_HIGH_TO_LOW 12 +#define DIG_TRANSITION 13 + +/* Modes available via CMD_CARD_SET_FILTERING_MODE */ +#define FILTER_OFF_PASS_ALL 3 +#define FILTER_OFF_BLOCK_ALL 4 +#define FILTER_ON 5 + +/* Modes available via CMD_CARD_SET_DEFAULT_FILTER */ +#define DEFAULT_FILTER_BLOCK 0 +#define DEFAULT_FILTER_PASS 1 + +/* Actions available via CMD_CARD_MODIFY_FILTER */ +#define DELETE_FILTER 0 +#define ACTIVATE_FILTER 1 +#define DEACTIVATE_FILTER 2 + +/* Program loader options */ +#define PGM_CONV 1 /* Type of data conversion to perform */ +#define PGM_TYPE 2 /* Type of file */ +#define PGM_BIN 11 /* Binary, no conversion */ +#define PGM_ASCII 12 /* ASCII, convert CR LF to LF */ +#define PGM_PGM 21 /* Executable */ +#define PGM_DATA 22 /* Data */ + + + + +/* IOCTL definitions - comments indicate data size */ + +#define GINIT 0x11100001 +#define GLOOPON 0x11100002 +#define GLOOPOFF 0x11100003 +#define GGETHWTYPE 0x11100004 +#define GGETREG 0x11100005 +#define GSETREG 0x11100006 +#define GGETRXCOUNT 0x11100007 +#define GSETRXCOUNT 0x11100008 +#define GGETTXCOUNT 0x11100009 +#define GSETTXCOUNT 0x1110000a +#define GGETRXDROP 0x1110000b +#define GSETRXDROP 0x1110000c +#define GGETTXDROP 0x1110000d +#define GSETTXDROP 0x1110000e +#define GGETRXBAD 0x1110000f +#define GGETTXBAD 0x11100011 +#define GGETCOUNTS 0x11100013 +#define GGETBLMON 0x11100014 +#define GSETBLMON 0x11100015 +#define GGETERRLEV 0x11100016 +#define GSETERRLEV 0x11100017 +#define GGETBITRATE 0x11100018 +#define GGETRAM 0x11100019 +#define GSETRAM 0x1110001a + +#define GCANGETBTRS 0x11200001 +#define GCANSETBTRS 0x11200002 +#define GCANGETBC 0x11200003 +#define GCANSETBC 0x11200004 +#define GCANGETMODE 0x11200005 +#define GCANSETMODE 0x11200006 +#define GCANGETTRANS 0x11200009 +#define GCANSETTRANS 0x1120000a +#define GCANSENDERR 0x1120000b +#define GCANRGETOBJ 0x11210001 +#define GCANRSETSTDID 0x11210002 +#define GCANRSETEXTID 0x11210003 +#define GCANRSETDATA 0x11210004 +#define GCANRENABLE 0x11210005 +#define GCANRDISABLE 0x11210006 +#define GCANRGETMASKS 0x11210007 +#define GCANRSETMASKS 0x11210008 +#define GCANSWGETMODE 0x11220001 +#define GCANSWSETMODE 0x11220002 + +#define GDLCGETFOURX 0x11400001 +#define GDLCSETFOURX 0x11400002 +#define GDLCGETLOAD 0x11400003 +#define GDLCSETLOAD 0x11400004 +#define GDLCSENDBREAK 0x11400005 +#define GDLCABORTTX 0x11400006 +#define GDLCGETHDRMODE 0x11400007 +#define GDLCSETHDRMODE 0x11400008 + +#define GHONSLEEP 0x11600001 +#define GHONSILENCE 0x11600002 + +#define GKWPSETPTIMES 0x11700011 +#define GKWPSETWTIMES 0x11700010 +#define GKWPDOWAKEUP 0x11700008 +#define GKWPGETBITTIME 0x11700101 +#define GKWPSETBITTIME 0x11700102 +#define GKWPSETNODEADDR 0x11700104 +#define GKWPGETNODETYPE 0x11700105 +#define GKWPSETNODETYPE 0x11700106 +#define GKWPSETWAKETYPE 0x11700108 +#define GKWPSETTARGADDR 0x1170010a +#define GKWPSETKEYBYTES 0x1170010c +#define GKWPSETSTARTREQ 0x1170010e +#define GKWPSETSTARTRESP 0x11700110 +#define GKWPSETPROTOCOL 0x11700112 +#define GKWPGETLASTKEYBYTES 0x11700201 +#define GKWPSETLASTKEYBYTES 0x11700202 + +#define GSCPGETBBR 0x11300001 +#define GSCPSETBBR 0x11300002 +#define GSCPGETID 0x11300003 +#define GSCPSETID 0x11300004 +#define GSCPADDFUNCID 0x11300005 +#define GSCPCLRFUNCID 0x11300006 + +#define GUBPGETBITRATE 0x11800001 +#define GUBPSETBITRATE 0x11800002 +#define GUBPGETINTERBYTE 0x11800003 +#define GUBPSETINTERBYTE 0x11800004 +#define GUBPGETNACKMODE 0x11800005 +#define GUBPSETNACKMODE 0x11800006 + + + + +/* Hardware / driver TYPE and SUBTYPE definitions */ + +#define GDUMMY 0x01 /* Dummy device driver TYPE */ +#define GDGDMARKONE 0x01 /* Dummy device driver SUBTYPE */ + +#define GCAN 0x02 /* CAN TYPE */ +#define G82527 0x01 /* 82527 SUBTYPE */ +#define GSJA1000 0x02 /* SJA1000 SUBTYPE */ +#define G82527SW 0x03 /* 82527 single wire subtype */ + +#define GJ1850 0x03 /* 1850 TYPE */ +#define GHBCCPAIR 0x01 /* HBCC SUBTYPE */ +#define GDLC 0x02 /* GM DLC SUBTYPE */ +#define GCHRYSLER 0x03 /* Chrysler SUBTYPE */ +#define GDEHC12 0x04 /* DE HC12 KWP/BDLC SUBTYPE */ + +#define GKWP2000 0x04 /* Keyword protocol 2000 TYPE */ + +#define GHONDA 0x05 /* Honda UART TYPE */ +#define GDGHC08 0x01 /* DG HC08 SUBTYPE */ + +#define GFORDUBP 0x06 /* FORD UBP TYPE */ +#define GDGUBP08 0x01 /* DG HC08 SUBTYPE */ + + +#define SIZEOF(x) (sizeof(x)/sizeof(x[0])) + +#define MEMCPY(dest, src, size) \ + memcpy (dest, src, size); \ + *((dest)+size) = 0; + +#define BUMP(ptr1, ptr2, size) \ + ptr1 += size; \ + ptr2 += size; + + + +typedef struct val_str_dsp { + int value; + char *strptr; + void (*cmd_fnct) (int, const u_char**, const u_char*, int*, int, proto_tree*); + void (*rsp_fnct) (int, const u_char**, const u_char*, int*, int, proto_tree*); +} val_str_dsp; + +void decode_command (int, const u_char**, const u_char*, int*, int, proto_tree*); +void decode_response (int, const u_char**, const u_char*, int*, int, proto_tree*); +void decode_data (int, const u_char**, const u_char*, int*, int, proto_tree*); +void decode_event (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_init (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_time (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_setfilt (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_ioctl (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_addfilt (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_addfilt (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_modfilt (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_filthan (int, const u_char**, const u_char*, int*, int, proto_tree*); +void dfiltmode (int, const u_char**, const u_char*, int*, int, proto_tree*); +void filtmode (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_events (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_register (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_register (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_config (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_sched (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_blm_data (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_blm_stat (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_addresp (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_addresp (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_modresp (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_resphan (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_sched (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_desc (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_desc (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_upload (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_delete (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_list (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_list (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_start (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_start (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_status (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_options (int, const u_char**, const u_char*, int*, int, proto_tree*); +void eventnum (int, const u_char**, const u_char*, int*, int, proto_tree*); +void speed (int, const u_char**, const u_char*, int*, int, proto_tree*); +void filter_block (int, const u_char**, const u_char*, int*, int, proto_tree*); +void blm_mode (int, const u_char**, const u_char*, int*, int, proto_tree*); |