diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-11-01 00:16:18 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-11-01 00:16:18 +0000 |
commit | b2929352b655990162018e8f73e8983baf03694c (patch) | |
tree | 9450676eda9e46c9bb00c5446ee44ceffaee3ad4 /plugins | |
parent | 67a70df328a02990722519c871c421873d2c1a31 (diff) | |
download | wireshark-b2929352b655990162018e8f73e8983baf03694c.tar.gz wireshark-b2929352b655990162018e8f73e8983baf03694c.tar.bz2 wireshark-b2929352b655990162018e8f73e8983baf03694c.zip |
Updates from Steve Limkemann.
svn path=/trunk/; revision=2545
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gryphon/packet-gryphon.c | 168 | ||||
-rw-r--r-- | plugins/gryphon/packet-gryphon.h | 28 |
2 files changed, 180 insertions, 16 deletions
diff --git a/plugins/gryphon/packet-gryphon.c b/plugins/gryphon/packet-gryphon.c index 227cd4514e..a69dca64bc 100644 --- a/plugins/gryphon/packet-gryphon.c +++ b/plugins/gryphon/packet-gryphon.c @@ -1,7 +1,7 @@ /* packet-gryphon.c * Routines for Gryphon protocol packet disassembly * - * $Id: packet-gryphon.c,v 1.11 2000/08/18 13:47:59 deniel Exp $ + * $Id: packet-gryphon.c,v 1.12 2000/11/01 00:16:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Steve Limkemann <stevelim@dgtech.com> @@ -91,8 +91,8 @@ DLLEXPORT void dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { - proto_tree *gryphon_tree, *header_tree, *body_tree; - proto_item *ti, *header_item, *body_item; + proto_tree *gryphon_tree, *header_tree, *body_tree, *localTree; + proto_item *ti, *header_item, *body_item, *localItem; const u_char *data, *dataend, *msgend; int src, msglen, msgpad, dest, frmtyp, i, end_of_frame; static const u_char *frame_type[] = {"", @@ -114,7 +114,7 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {SD_FLIGHT, "Flight Recorder"}, {SD_RESP, "Message Responder"}, {-1, "- unknown -"}, - }; + }; data = &pd[offset]; if (fd) { @@ -136,7 +136,11 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* * Indicate what kind of message this is. */ - col_add_str (fd, COL_INFO, frame_type[data[6]]); + frmtyp = data[6] & ~RESPONSE_FLAGS; + if (frmtyp >= SIZEOF (frame_type)) + col_add_str (fd, COL_INFO, "- Invalid -"); + else + col_add_str (fd, COL_INFO, frame_type[frmtyp]); } if (tree) { if (fd) { @@ -149,7 +153,13 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) while (data < dataend) { src = data[0]; dest = data[2]; - frmtyp = data[6]; + frmtyp = data[6] & ~RESPONSE_FLAGS; + if (frmtyp >= SIZEOF (frame_type)) { + i = dataend - data; + proto_tree_add_text(gryphon_tree, NullTVB, offset, i, "Data"); + BUMP (offset, data, i); + continue; + } msglen = pntohs ((unsigned short *)&data[4]); header_item = proto_tree_add_text(gryphon_tree, NullTVB, offset, @@ -182,6 +192,24 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "Data length: %d bytes", msglen); proto_tree_add_text(header_tree, NullTVB, offset+6, 1, "Frame type: %s", frame_type[frmtyp]); + if (!fd) { + localItem = proto_tree_add_text(header_tree, NullTVB, offset+6, 1, "Flags"); + localTree = proto_item_add_subtree (localItem, ett_gryphon_flags); + if (data[6] & DONT_WAIT_FOR_RESP) { + proto_tree_add_text(localTree, NullTVB, offset+6, 1, + "1... .... = Don't wait for response"); + } else { + proto_tree_add_text(localTree, NullTVB, offset+6, 1, + "0... .... = Wait for response"); + } + if (data[6] & WAIT_FOR_PREV_RESP) { + proto_tree_add_text(localTree, NullTVB, offset+6, 1, + ".1.. .... = Wait for previous responses"); + } else { + proto_tree_add_text(localTree, NullTVB, offset+6, 1, + ".0.. .... = Don't wait for previous responses"); + } + } proto_tree_add_text(header_tree, NullTVB, offset+7, 1, "reserved"); proto_tree_add_uint_hidden(header_tree, hf_gryph_type, NullTVB, offset+6, 1, frmtyp); @@ -224,7 +252,6 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_text(gryphon_tree, NullTVB, offset, i, "padding"); BUMP (offset, data, i); } -/* data = dataend;*/ } } @@ -258,8 +285,10 @@ static const val_str_dsp cmds[] = { {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, NULL}, + {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}, @@ -279,9 +308,11 @@ static const val_str_dsp cmds[] = { {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", NULL, NULL}, {CMD_SCHED_STOP_TX, "Kill a message transmission (deprecated)", NULL, NULL}, + {CMD_USDT_IOCTL, "Register/Unregister with USDT server", cmd_usdt, NULL}, {-1, "- unknown -", NULL, NULL}, }; @@ -311,6 +342,8 @@ static const value_string filter_data_types[] = { {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"}, {-1, "- unknown -"}, }; @@ -441,7 +474,7 @@ static const value_string ioctls[] = { void decode_command (int dst, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - int cmd, i; + int cmd, i, padding; proto_tree *ft; proto_item *ti; @@ -467,8 +500,10 @@ decode_command (int dst, const u_char **data, const u_char *dataend, int *offset proto_tree_add_text (pt, NullTVB, *offset, 4, "Command: %s", cmds[i].strptr); BUMP (*offset, *data, 4); - if (cmds[i].cmd_fnct && dataend - *data) { - ti = proto_tree_add_text(pt, NullTVB, *offset, dataend - *data, "Data: (%d bytes)", dataend - *data); +/* if (cmds[i].cmd_fnct && dataend - *data) { */ + if (cmds[i].cmd_fnct && msglen > 4) { + padding = 3 - (msglen + 3) % 4; + ti = proto_tree_add_text(pt, NullTVB, *offset, msglen-4, "Data: (%d bytes)", msglen-4); ft = proto_item_add_subtree(ti, ett_gryphon_command_data); (*(cmds[i].cmd_fnct)) (dst, data, dataend, offset, msglen, ft); } @@ -512,7 +547,7 @@ decode_response (int src, const u_char **data, const u_char *dataend, int *offse BUMP (*offset, *data, 4); if (cmds[i].rsp_fnct) { - ti = proto_tree_add_text(pt, NullTVB, *offset, dataend - *data, "Data: (%d bytes)", dataend - *data); + ti = proto_tree_add_text(pt, NullTVB, *offset, msglen-8, "Data: (%d bytes)", msglen-8); ft = proto_item_add_subtree(ti, ett_gryphon_response_data); (*(cmds[i].rsp_fnct)) (src, data, dataend, offset, msglen, ft); } @@ -714,8 +749,10 @@ cmd_ioctl (int src, const u_char **data, const u_char *dataend, int *offset, int i = SIZEOF(ioctls) - 1; proto_tree_add_text(pt, NullTVB, *offset, 4, "IOCTL: %s", ioctls[i].strptr); BUMP (*offset, *data, 4); - proto_tree_add_text(pt, NullTVB, *offset, dataend - *data, "Data"); - BUMP (*offset, *data, dataend - *data); + if (msglen > 8) { + proto_tree_add_text(pt, NullTVB, *offset, msglen-8, "Data"); + BUMP (*offset, *data, msglen-8); + } } void @@ -875,6 +912,49 @@ resp_register (int src, const u_char **data, const u_char *dataend, int *offset, BUMP (*offset, *data, 4); } + +void +resp_getspeeds (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { + int number = (*data)[9]; + int size = (*data)[8]; + int index; + + proto_tree_add_text(pt, NullTVB, *offset, 4, "Set Speed IOCTL"); + proto_tree_add_text(pt, NullTVB, *offset+4, 4, "Get Speed IOCTL"); + proto_tree_add_text(pt, NullTVB, *offset+8, 1, "Speed data size is %d bytes", size); + proto_tree_add_text(pt, NullTVB, *offset+9, 1, "There are %d preset speeds", number); + BUMP (*offset, *data, 10); + for (index = 0; index < number; index++) { + proto_tree_add_text(pt, NullTVB, *offset, size, "Data for preset %d", index+1); + BUMP (*offset, *data, size); + } +} + + + +void +cmd_sort (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) +{ + char *which; + + which = (*data)[0] ? "Sort into blocks of up to 16 messages" : + "Do not sort messages"; + proto_tree_add_text(pt, NullTVB, *offset, 1, "Set sorting: %s", which); + BUMP (*offset, *data, 1); +} + +void + +cmd_optimize (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) +{ + char *which; + + which = (*data)[0] ? "Optimize for latency (Nagle algorithm disabled)" : + "Optimize for throughput (Nagle algorithm enabled)"; + proto_tree_add_text(pt, NullTVB, *offset, 1, "Set optimization: %s", which); + BUMP (*offset, *data, 1); +} + void resp_config (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { proto_item *ti; @@ -892,7 +972,7 @@ resp_config (int src, const u_char **data, const u_char *dataend, int *offset, i {GJ1850 * 256 + GDLC, "J1850, GM DLC subtype"}, {GJ1850 * 256 + GCHRYSLER, "J1850, Chrysler subtype"}, {GJ1850 * 256 + GDEHC12, "J1850, DE HC12 KWP/BDLC subtype"}, - {GKWP2000, "Keyword protocol 2000"}, + {GKWP2000 * 256 + GDEHC12KWP, "Keyword protocol 2000"}, {GHONDA * 256 + GDGHC08, "Honda UART, DG HC08 subtype"}, {GFORDUBP * 256 + GDGUBP08, "Ford UBP, DG HC08 subtype"}, {-1, "- unknown -"}, @@ -1427,6 +1507,64 @@ cmd_options (int src, const u_char **data, const u_char *dataend, int *offset, i } void +cmd_files (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { + u_char *which, dir[256]; + int len; + + if ((*data)[0] == 0) + which = "First group of names"; + else + which = "Subsequent group of names"; + + msglen -= 4; + len = msglen > 255 ? 255: msglen; + memset (dir, 0, 256); + strncpy (dir, (*data)+1, len); + proto_tree_add_text(pt, NullTVB, *offset, 1, "%s", which); + proto_tree_add_text(pt, NullTVB, *offset+1, msglen-1, "Directory: %s", dir); + BUMP (*offset, *data, msglen); +} + +void +resp_files (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { + u_char *flag; + + msglen -= 8; + flag = (*data)[0] ? "Yes": "No"; + proto_tree_add_text(pt, NullTVB, *offset, 1, "More filenames to return: %s", flag); + proto_tree_add_text(pt, NullTVB, *offset+1, msglen-1, "File and directory names"); + BUMP (*offset, *data, msglen); +} + +void +cmd_usdt (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) +{ + u_char *desc; + + if ((*data)[0]) + desc = "Register with gusdt"; + else + desc = "Unregister with gusdt"; + proto_tree_add_text(pt, NullTVB, *offset, 1, "%s", desc); + + if ((*data)[1]) + desc = "Echo long transmit messages back to the client"; + else + desc = "Do not echo long transmit messages back to the client"; + proto_tree_add_text(pt, NullTVB, (*offset)+1, 1, "%s", desc); + + if ((*data)[2] == 2) + desc = "Assemble long received messages but do not send them to the client"; + else if ((*data)[2]) + desc = "Assemble long received messages and send them to the client"; + else + desc = "Do not assemble long received messages on behalf of the client"; + proto_tree_add_text(pt, NullTVB, (*offset)+2, 1, "%s", desc); + + BUMP (*offset, *data, 4); +} + +void speed (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { proto_tree_add_text(pt, NullTVB, *offset, 1, "Baud rate index: %hd", (*data)[0]); diff --git a/plugins/gryphon/packet-gryphon.h b/plugins/gryphon/packet-gryphon.h index 4e15bc77d2..a935bbd5db 100644 --- a/plugins/gryphon/packet-gryphon.h +++ b/plugins/gryphon/packet-gryphon.h @@ -1,7 +1,7 @@ /* 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 $ + * $Id: packet-gryphon.h,v 1.2 2000/11/01 00:16:18 guy Exp $ * * Ethereal - Network traffic analyzer * By Steve Limkemann <stevelim@dgtech.com> @@ -26,6 +26,7 @@ */ #define MSG_HDR_SZ 8 +#define CMD_HDR_SZ 4 /* source/destinations: */ @@ -92,6 +93,8 @@ /* SD_SERVER command types: */ #define CMD_SERVER_REG (SD_SERVER * 256 + 0x50) /* register connection */ +#define CMD_SERVER_SET_SORT (SD_SERVER * 256 + 0x51) /* set sorting behavior */ +#define CMD_SERVER_SET_OPT (SD_SERVER * 256 + 0x52) /* set type of optimization */ /* SD_CLIENT command types: */ @@ -128,6 +131,7 @@ #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 */ +#define CMD_PGM_FILES (SD_PGM * 256 + 0x98) /* Get a list of files & directories */ /* Scheduler (SD_SCHED) target commands: */ @@ -135,6 +139,11 @@ #define CMD_SCHED_KILL_TX (SD_SCHED * 256 + 0x71) /* stop and destroy job */ #define CMD_SCHED_STOP_TX (SD_SCHED * 256 + 0x71) /* deprecated */ +/* USDT (SD_USDT) target commands: */ + +#define CMD_USDT_IOCTL (SD_USDT * 256 + 0x47) /* Register/Unregister with USDT */ + + /* response frame (FT_RESP) response field definitions: */ #define RESP_OK 0x00 /* no error */ @@ -171,6 +180,8 @@ #define FILTER_DATA_TYPE_HEADER 0x01 #define FILTER_DATA_TYPE_DATA 0x02 #define FILTER_DATA_TYPE_EXTRA_DATA 0x03 +#define FILTER_EVENT_TYPE_HEADER 0x04 +#define FILTER_EVENT_TYPE_DATA 0x05 /* filter flags */ @@ -208,6 +219,14 @@ #define ACTIVATE_FILTER 1 #define DEACTIVATE_FILTER 2 +/* Flags to modify how FT_CMD (command) messages are handled */ +/* These values are ORed with FT_CMD and stored in the Frame Header's */ +/* Frame Type field for each response. */ +#define DONT_WAIT_FOR_RESP 0x80 +#define WAIT_FOR_PREV_RESP 0x40 +#define RESPONSE_FLAGS (DONT_WAIT_FOR_RESP | WAIT_FOR_PREV_RESP) + + /* Program loader options */ #define PGM_CONV 1 /* Type of data conversion to perform */ #define PGM_TYPE 2 /* Type of file */ @@ -329,6 +348,7 @@ #define GDEHC12 0x04 /* DE HC12 KWP/BDLC SUBTYPE */ #define GKWP2000 0x04 /* Keyword protocol 2000 TYPE */ +#define GDEHC12KWP 0x01 /* DE HC12 KWP/BDLC card SUBTYPE */ #define GHONDA 0x05 /* Honda UART TYPE */ #define GDGHC08 0x01 /* DG HC08 SUBTYPE */ @@ -373,6 +393,9 @@ 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_getspeeds (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_sort (int, const u_char**, const u_char*, int*, int, proto_tree*); +void cmd_optimize (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*); @@ -392,7 +415,10 @@ 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 cmd_files (int, const u_char**, const u_char*, int*, int, proto_tree*); +void resp_files (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*); +void cmd_usdt (int, const u_char**, const u_char*, int*, int, proto_tree*); |