2001-05-24 20:25:25 +00:00
|
|
|
/* packet-dsi.c
|
|
|
|
* Routines for dsi packet dissection
|
|
|
|
* Copyright 2001, Randy McEoin <rmceoin@pe.com>
|
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-05-24 20:25:25 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-pop.c
|
|
|
|
*
|
|
|
|
* 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 21:04:11 +00:00
|
|
|
*
|
2001-05-24 20:25:25 +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 21:04:11 +00:00
|
|
|
*
|
2001-05-24 20:25:25 +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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-05-24 20:25:25 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2001-05-24 20:25:25 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2002-04-22 08:50:49 +00:00
|
|
|
|
2013-12-21 17:23:17 +00:00
|
|
|
#include <epan/packet.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2013-12-21 17:23:17 +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
|
|
|
#include "packet-tcp.h"
|
2002-04-25 23:58:02 +00:00
|
|
|
#include "packet-afp.h"
|
|
|
|
|
2001-05-24 20:25:25 +00:00
|
|
|
/* The information in this module (DSI) comes from:
|
|
|
|
|
2008-03-14 03:28:12 +00:00
|
|
|
AFP 2.1 & 2.2 documentation, in PDF form, at
|
|
|
|
|
|
|
|
http://developer.apple.com/DOCUMENTATION/macos8/pdf/ASAppleTalkFiling2.1_2.2.pdf
|
2001-05-24 20:25:25 +00:00
|
|
|
|
|
|
|
The netatalk source code by Wesley Craig & Adrian Sun
|
|
|
|
|
2005-03-31 22:04:59 +00:00
|
|
|
The Data Stream Interface description from
|
|
|
|
http://developer.apple.com/documentation/Networking/Conceptual/AFPClient/AFPClient-6.html
|
|
|
|
|
2008-03-14 03:28:12 +00:00
|
|
|
(no longer available, apparently)
|
2010-11-08 21:59:39 +00:00
|
|
|
|
|
|
|
Also, AFP 3.3 documents parts of DSI at:
|
2009-09-10 06:07:31 +00:00
|
|
|
http://developer.apple.com/mac/library/documentation/Networking/Conceptual/AFP/Introduction/Introduction.html
|
2008-03-14 03:28:12 +00:00
|
|
|
|
2001-05-24 20:25:25 +00:00
|
|
|
* What a Data Stream Interface packet looks like:
|
|
|
|
* 0 32
|
|
|
|
* |-------------------------------|
|
|
|
|
* |flags |command| requestID |
|
|
|
|
* |-------------------------------|
|
|
|
|
* |error code/enclosed data offset|
|
|
|
|
* |-------------------------------|
|
|
|
|
* |total data length |
|
|
|
|
* |-------------------------------|
|
|
|
|
* |reserved field |
|
|
|
|
* |-------------------------------|
|
2002-04-22 08:50:49 +00:00
|
|
|
*/
|
2001-05-24 20:25:25 +00:00
|
|
|
|
2013-03-16 16:25:41 +00:00
|
|
|
void proto_register_dsi(void);
|
|
|
|
void proto_reg_handoff_dsi(void);
|
|
|
|
|
2001-05-24 20:25:25 +00:00
|
|
|
static int proto_dsi = -1;
|
|
|
|
static int hf_dsi_flags = -1;
|
|
|
|
static int hf_dsi_command = -1;
|
|
|
|
static int hf_dsi_requestid = -1;
|
2002-04-28 22:10:00 +00:00
|
|
|
static int hf_dsi_offset = -1;
|
2002-04-28 19:21:39 +00:00
|
|
|
static int hf_dsi_error = -1;
|
2001-05-24 20:25:25 +00:00
|
|
|
static int hf_dsi_length = -1;
|
|
|
|
static int hf_dsi_reserved = -1;
|
|
|
|
|
|
|
|
static gint ett_dsi = -1;
|
|
|
|
|
2010-11-08 21:59:39 +00:00
|
|
|
static int hf_dsi_open_type = -1;
|
|
|
|
static int hf_dsi_open_len = -1;
|
|
|
|
static int hf_dsi_open_quantum = -1;
|
2009-09-10 06:07:31 +00:00
|
|
|
static int hf_dsi_replay_cache_size = -1;
|
2010-11-08 21:59:39 +00:00
|
|
|
static int hf_dsi_open_option = -1;
|
2002-05-08 23:46:34 +00:00
|
|
|
|
2010-11-08 21:59:39 +00:00
|
|
|
static int hf_dsi_attn_flag = -1;
|
|
|
|
static int hf_dsi_attn_flag_shutdown = -1;
|
|
|
|
static int hf_dsi_attn_flag_crash = -1;
|
|
|
|
static int hf_dsi_attn_flag_msg = -1;
|
|
|
|
static int hf_dsi_attn_flag_reconnect = -1;
|
|
|
|
static int hf_dsi_attn_flag_time = -1;
|
|
|
|
static int hf_dsi_attn_flag_bitmap = -1;
|
2002-05-08 23:46:34 +00:00
|
|
|
|
2010-11-08 21:59:39 +00:00
|
|
|
static gint ett_dsi_open = -1;
|
|
|
|
static gint ett_dsi_attn = -1;
|
|
|
|
static gint ett_dsi_attn_flag = -1;
|
2002-05-08 23:46:34 +00:00
|
|
|
|
2002-05-10 23:20:38 +00:00
|
|
|
static const value_string dsi_attn_flag_vals[] = {
|
2010-11-08 21:59:39 +00:00
|
|
|
{0x0, "Reserved" }, /* 0000 */
|
|
|
|
{0x1, "Reserved" }, /* 0001 */
|
|
|
|
{0x2, "Server message" }, /* 0010 */
|
|
|
|
{0x3, "Server notification, cf. extended bitmap" }, /* 0011 */
|
|
|
|
{0x4, "Server is shutting down, internal error" }, /* 0100 */
|
|
|
|
{0x8, "Server is shutting down" }, /* 1000 */
|
|
|
|
{0x9, "Server disconnects user" }, /* 1001 */
|
|
|
|
{0x10,"Server is shutting down, message" }, /* 1010 */
|
|
|
|
{0x11,"Server is shutting down, message,no reconnect"}, /* 1011 */
|
|
|
|
{0, NULL } };
|
|
|
|
static value_string_ext dsi_attn_flag_vals_ext = VALUE_STRING_EXT_INIT(dsi_attn_flag_vals);
|
2002-05-08 23:46:34 +00:00
|
|
|
|
2002-05-10 23:20:38 +00:00
|
|
|
static const value_string dsi_open_type_vals[] = {
|
2010-11-08 21:59:39 +00:00
|
|
|
{0, "Server quantum" },
|
|
|
|
{1, "Attention quantum" },
|
|
|
|
{2, "Replay cache size" },
|
|
|
|
{0, NULL } };
|
2002-05-08 23:46:34 +00:00
|
|
|
|
2002-04-22 08:50:49 +00:00
|
|
|
/* desegmentation of DSI */
|
|
|
|
static gboolean dsi_desegment = TRUE;
|
|
|
|
|
2001-11-26 04:52:51 +00:00
|
|
|
static dissector_handle_t data_handle;
|
2002-04-25 23:58:02 +00:00
|
|
|
static dissector_handle_t afp_handle;
|
2014-04-06 19:12:59 +00:00
|
|
|
static dissector_handle_t afp_server_status_handle;
|
2001-11-26 04:52:51 +00:00
|
|
|
|
2010-11-08 21:59:39 +00:00
|
|
|
#define TCP_PORT_DSI 548
|
2001-05-24 20:25:25 +00:00
|
|
|
|
2010-11-08 21:59:39 +00:00
|
|
|
#define DSI_BLOCKSIZ 16
|
2002-04-25 23:58:02 +00:00
|
|
|
|
2001-05-24 20:25:25 +00:00
|
|
|
/* DSI flags */
|
|
|
|
#define DSIFL_REQUEST 0x00
|
|
|
|
#define DSIFL_REPLY 0x01
|
|
|
|
#define DSIFL_MAX 0x01
|
|
|
|
|
|
|
|
/* DSI Commands */
|
|
|
|
#define DSIFUNC_CLOSE 1 /* DSICloseSession */
|
|
|
|
#define DSIFUNC_CMD 2 /* DSICommand */
|
|
|
|
#define DSIFUNC_STAT 3 /* DSIGetStatus */
|
|
|
|
#define DSIFUNC_OPEN 4 /* DSIOpenSession */
|
|
|
|
#define DSIFUNC_TICKLE 5 /* DSITickle */
|
|
|
|
#define DSIFUNC_WRITE 6 /* DSIWrite */
|
|
|
|
#define DSIFUNC_ATTN 8 /* DSIAttention */
|
|
|
|
#define DSIFUNC_MAX 8 /* largest command */
|
|
|
|
|
|
|
|
static const value_string flag_vals[] = {
|
2010-11-08 21:59:39 +00:00
|
|
|
{DSIFL_REQUEST, "Request" },
|
|
|
|
{DSIFL_REPLY, "Reply" },
|
|
|
|
{0, NULL } };
|
2001-05-24 20:25:25 +00:00
|
|
|
|
|
|
|
static const value_string func_vals[] = {
|
2010-11-08 21:59:39 +00:00
|
|
|
{DSIFUNC_CLOSE, "CloseSession" },
|
|
|
|
{DSIFUNC_CMD, "Command" },
|
|
|
|
{DSIFUNC_STAT, "GetStatus" },
|
|
|
|
{DSIFUNC_OPEN, "OpenSession" },
|
|
|
|
{DSIFUNC_TICKLE, "Tickle" },
|
|
|
|
{DSIFUNC_WRITE, "Write" },
|
2010-11-15 21:32:27 +00:00
|
|
|
{ 7, "Unknown" },
|
2010-11-08 21:59:39 +00:00
|
|
|
{DSIFUNC_ATTN, "Attention" },
|
|
|
|
{0, NULL } };
|
|
|
|
static value_string_ext func_vals_ext = VALUE_STRING_EXT_INIT(func_vals);
|
2001-05-24 20:25:25 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
static gint
|
2009-09-10 06:07:31 +00:00
|
|
|
dissect_dsi_open_session(tvbuff_t *tvb, proto_tree *dsi_tree, gint offset, gint dsi_length)
|
2002-05-08 23:46:34 +00:00
|
|
|
{
|
2010-11-08 21:59:39 +00:00
|
|
|
proto_tree *tree;
|
2002-05-08 23:46:34 +00:00
|
|
|
proto_item *ti;
|
|
|
|
guint8 type;
|
|
|
|
guint8 len;
|
|
|
|
|
|
|
|
ti = proto_tree_add_text(dsi_tree, tvb, offset, -1, "Open Session");
|
|
|
|
tree = proto_item_add_subtree(ti, ett_dsi_open);
|
2010-11-08 21:59:39 +00:00
|
|
|
|
2009-09-10 06:07:31 +00:00
|
|
|
while( dsi_length >2 ) {
|
2010-11-08 21:59:39 +00:00
|
|
|
|
2009-09-10 06:07:31 +00:00
|
|
|
type = tvb_get_guint8(tvb, offset);
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_open_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-09-10 06:07:31 +00:00
|
|
|
offset++;
|
|
|
|
len = tvb_get_guint8(tvb, offset);
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_open_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-09-10 06:07:31 +00:00
|
|
|
offset++;
|
|
|
|
switch (type) {
|
|
|
|
case 0:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_open_quantum, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2010-11-08 21:59:39 +00:00
|
|
|
break;
|
2009-09-10 06:07:31 +00:00
|
|
|
case 1:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_open_quantum, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2010-11-08 21:59:39 +00:00
|
|
|
break;
|
2009-09-10 06:07:31 +00:00
|
|
|
case 2:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_replay_cache_size, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2009-09-10 06:07:31 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_open_option, tvb, offset, len, ENC_NA);
|
2009-09-10 06:07:31 +00:00
|
|
|
}
|
2010-11-08 21:59:39 +00:00
|
|
|
|
2009-09-10 06:07:31 +00:00
|
|
|
dsi_length -= len + 2;
|
2010-11-08 21:59:39 +00:00
|
|
|
|
2009-09-10 06:07:31 +00:00
|
|
|
offset += len;
|
2002-05-08 23:46:34 +00:00
|
|
|
}
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
static gint
|
2002-05-08 23:46:34 +00:00
|
|
|
dissect_dsi_attention(tvbuff_t *tvb, proto_tree *dsi_tree, gint offset)
|
|
|
|
{
|
2010-11-08 21:59:39 +00:00
|
|
|
proto_tree *tree;
|
2002-05-08 23:46:34 +00:00
|
|
|
proto_item *ti;
|
|
|
|
guint16 flag;
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-05-08 23:46:34 +00:00
|
|
|
if (!tvb_reported_length_remaining(tvb,offset))
|
|
|
|
return offset;
|
|
|
|
|
|
|
|
flag = tvb_get_ntohs(tvb, offset);
|
|
|
|
ti = proto_tree_add_text(dsi_tree, tvb, offset, -1, "Attention");
|
|
|
|
tree = proto_item_add_subtree(ti, ett_dsi_attn);
|
|
|
|
|
2011-10-06 03:35:44 +00:00
|
|
|
ti = proto_tree_add_item(tree, hf_dsi_attn_flag, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2002-05-08 23:46:34 +00:00
|
|
|
tree = proto_item_add_subtree(ti, ett_dsi_attn_flag);
|
2011-10-16 23:38:49 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_attn_flag_shutdown, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(tree, hf_dsi_attn_flag_crash, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(tree, hf_dsi_attn_flag_msg, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(tree, hf_dsi_attn_flag_reconnect, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2002-05-08 23:46:34 +00:00
|
|
|
/* FIXME */
|
2002-08-28 21:04:11 +00:00
|
|
|
if ((flag & 0xf000) != 0x3000)
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_attn_flag_time, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2002-05-08 23:46:34 +00:00
|
|
|
else
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tree, hf_dsi_attn_flag_bitmap, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2002-05-08 23:46:34 +00:00
|
|
|
offset += 2;
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2013-11-09 17:46:28 +00:00
|
|
|
static int
|
|
|
|
dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2001-05-24 20:25:25 +00:00
|
|
|
{
|
2010-11-08 21:59:39 +00:00
|
|
|
proto_tree *dsi_tree;
|
2001-05-24 20:25:25 +00:00
|
|
|
proto_item *ti;
|
2002-04-22 08:50:49 +00:00
|
|
|
guint8 dsi_flags,dsi_command;
|
|
|
|
guint16 dsi_requestid;
|
|
|
|
gint32 dsi_code;
|
|
|
|
guint32 dsi_length;
|
|
|
|
guint32 dsi_reserved;
|
2002-04-25 23:58:02 +00:00
|
|
|
struct aspinfo aspinfo;
|
2010-11-08 21:59:39 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DSI");
|
2013-06-14 01:02:11 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-05-24 20:25:25 +00:00
|
|
|
|
2002-04-22 08:50:49 +00:00
|
|
|
dsi_flags = tvb_get_guint8(tvb, 0);
|
|
|
|
dsi_command = tvb_get_guint8(tvb, 1);
|
|
|
|
dsi_requestid = tvb_get_ntohs(tvb, 2);
|
|
|
|
dsi_code = tvb_get_ntohl(tvb, 4);
|
|
|
|
dsi_length = tvb_get_ntohl(tvb, 8);
|
|
|
|
dsi_reserved = tvb_get_ntohl(tvb, 12);
|
|
|
|
|
2013-06-14 01:02:11 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s (%u)",
|
2002-04-22 08:50:49 +00:00
|
|
|
val_to_str(dsi_flags, flag_vals,
|
|
|
|
"Unknown flag (0x%02x)"),
|
2010-11-08 21:59:39 +00:00
|
|
|
val_to_str_ext(dsi_command, &func_vals_ext,
|
2002-04-22 08:50:49 +00:00
|
|
|
"Unknown function (0x%02x)"),
|
|
|
|
dsi_requestid);
|
|
|
|
|
2013-10-21 00:27:36 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_dsi, tvb, 0, -1, ENC_NA);
|
|
|
|
dsi_tree = proto_item_add_subtree(ti, ett_dsi);
|
2002-04-22 08:50:49 +00:00
|
|
|
|
2013-10-21 00:27:36 +00:00
|
|
|
if (tree) {
|
2002-04-22 08:50:49 +00:00
|
|
|
proto_tree_add_uint(dsi_tree, hf_dsi_flags, tvb,
|
|
|
|
0, 1, dsi_flags);
|
|
|
|
proto_tree_add_uint(dsi_tree, hf_dsi_command, tvb,
|
|
|
|
1, 1, dsi_command);
|
|
|
|
proto_tree_add_uint(dsi_tree, hf_dsi_requestid, tvb,
|
|
|
|
2, 2, dsi_requestid);
|
2002-04-28 22:10:00 +00:00
|
|
|
switch (dsi_flags) {
|
|
|
|
|
|
|
|
case DSIFL_REQUEST:
|
|
|
|
proto_tree_add_int(dsi_tree, hf_dsi_offset, tvb,
|
2002-04-28 19:21:39 +00:00
|
|
|
4, 4, dsi_code);
|
2002-04-28 22:10:00 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DSIFL_REPLY:
|
|
|
|
proto_tree_add_int(dsi_tree, hf_dsi_error, tvb,
|
2002-04-28 19:21:39 +00:00
|
|
|
4, 4, dsi_code);
|
2002-04-28 22:10:00 +00:00
|
|
|
break;
|
2002-04-28 19:21:39 +00:00
|
|
|
}
|
2013-09-15 01:48:30 +00:00
|
|
|
proto_tree_add_uint_format_value(dsi_tree, hf_dsi_length, tvb,
|
2002-04-22 08:50:49 +00:00
|
|
|
8, 4, dsi_length,
|
2013-09-15 01:48:30 +00:00
|
|
|
"%u bytes", dsi_length);
|
2002-04-22 08:50:49 +00:00
|
|
|
proto_tree_add_uint(dsi_tree, hf_dsi_reserved, tvb,
|
|
|
|
12, 4, dsi_reserved);
|
2002-04-25 23:58:02 +00:00
|
|
|
}
|
2013-10-21 00:27:36 +00:00
|
|
|
|
2002-04-30 22:05:33 +00:00
|
|
|
switch (dsi_command) {
|
2002-05-08 23:46:34 +00:00
|
|
|
case DSIFUNC_OPEN:
|
|
|
|
if (tree) {
|
2009-09-10 06:07:31 +00:00
|
|
|
dissect_dsi_open_session(tvb, dsi_tree, DSI_BLOCKSIZ, dsi_length);
|
2002-05-08 23:46:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DSIFUNC_ATTN:
|
|
|
|
if (tree) {
|
|
|
|
dissect_dsi_attention(tvb, dsi_tree, DSI_BLOCKSIZ);
|
|
|
|
}
|
|
|
|
break;
|
2002-04-30 22:05:33 +00:00
|
|
|
case DSIFUNC_STAT:
|
|
|
|
if (tree && (dsi_flags == DSIFL_REPLY)) {
|
2014-04-06 19:12:59 +00:00
|
|
|
tvbuff_t *new_tvb;
|
|
|
|
|
|
|
|
/* XXX - assumes only AFP runs atop DSI */
|
|
|
|
new_tvb = tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ);
|
|
|
|
call_dissector(afp_server_status_handle, new_tvb, pinfo, dsi_tree);
|
2002-04-30 22:05:33 +00:00
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
break;
|
2002-04-30 22:05:33 +00:00
|
|
|
case DSIFUNC_CMD:
|
|
|
|
case DSIFUNC_WRITE:
|
|
|
|
{
|
2010-11-08 21:59:39 +00:00
|
|
|
tvbuff_t *new_tvb;
|
2002-04-30 22:05:33 +00:00
|
|
|
|
|
|
|
aspinfo.reply = (dsi_flags == DSIFL_REPLY);
|
|
|
|
aspinfo.command = dsi_command;
|
|
|
|
aspinfo.seq = dsi_requestid;
|
|
|
|
aspinfo.code = dsi_code;
|
2013-10-21 00:27:36 +00:00
|
|
|
proto_item_set_len(dsi_tree, DSI_BLOCKSIZ);
|
2002-04-30 22:05:33 +00:00
|
|
|
|
2014-04-06 19:12:59 +00:00
|
|
|
new_tvb = tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ);
|
2013-10-21 00:27:36 +00:00
|
|
|
call_dissector_with_data(afp_handle, new_tvb, pinfo, tree, &aspinfo);
|
2002-04-30 22:05:33 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-11-08 21:59:39 +00:00
|
|
|
default:
|
2013-10-21 00:27:36 +00:00
|
|
|
call_dissector(data_handle,
|
|
|
|
tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ),
|
|
|
|
pinfo, dsi_tree);
|
2002-04-30 22:05:33 +00:00
|
|
|
break;
|
2001-05-24 20:25:25 +00:00
|
|
|
}
|
2013-11-09 17:46:28 +00:00
|
|
|
|
2014-06-19 17:18:16 +00:00
|
|
|
return tvb_length(tvb);
|
2002-04-22 08:50:49 +00:00
|
|
|
}
|
2001-05-24 20:25:25 +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 guint
|
2006-10-31 09:29:07 +00:00
|
|
|
get_dsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
|
2002-04-22 08:50:49 +00:00
|
|
|
{
|
|
|
|
guint32 plen;
|
2003-12-08 20:36:59 +00:00
|
|
|
guint8 dsi_flags,dsi_command;
|
|
|
|
|
|
|
|
dsi_flags = tvb_get_guint8(tvb, offset);
|
|
|
|
dsi_command = tvb_get_guint8(tvb, offset+ 1);
|
2010-11-08 21:59:39 +00:00
|
|
|
if ( dsi_flags > DSIFL_MAX || !dsi_command || dsi_command > DSIFUNC_MAX)
|
2003-12-08 20:36:59 +00:00
|
|
|
{
|
|
|
|
/* it's not a known dsi pdu start sequence */
|
2014-06-19 17:18:16 +00:00
|
|
|
return tvb_length_remaining(tvb, offset);
|
2003-12-08 20:36:59 +00:00
|
|
|
}
|
2001-05-24 20:25:25 +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 DSI packet.
|
|
|
|
*/
|
|
|
|
plen = tvb_get_ntohl(tvb, offset+8);
|
2001-05-24 20:25:25 +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
|
|
|
/*
|
|
|
|
* That length doesn't include the length of the header itself;
|
|
|
|
* add that in.
|
|
|
|
*/
|
|
|
|
return plen + 16;
|
|
|
|
}
|
2001-05-24 20:25:25 +00:00
|
|
|
|
2013-11-09 17:46:28 +00:00
|
|
|
static int
|
|
|
|
dissect_dsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
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
|
|
|
{
|
|
|
|
tcp_dissect_pdus(tvb, pinfo, tree, dsi_desegment, 12,
|
2013-11-09 17:46:28 +00:00
|
|
|
get_dsi_pdu_len, dissect_dsi_packet, data);
|
|
|
|
|
2014-06-19 17:18:16 +00:00
|
|
|
return tvb_length(tvb);
|
2001-05-24 20:25:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_dsi(void)
|
|
|
|
{
|
|
|
|
|
2010-11-08 21:59:39 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_dsi_flags,
|
|
|
|
{ "Flags", "dsi.flags",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(flag_vals), 0x0,
|
|
|
|
"Indicates request or reply.", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_command,
|
|
|
|
{ "Command", "dsi.command",
|
|
|
|
FT_UINT8, BASE_DEC|BASE_EXT_STRING, &func_vals_ext, 0x0,
|
|
|
|
"Represents a DSI command.", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_requestid,
|
|
|
|
{ "Request ID", "dsi.requestid",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
|
|
|
"Keeps track of which request this is. Replies must match a Request. IDs must be generated in sequential order.", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_offset,
|
|
|
|
{ "Data offset", "dsi.data_offset",
|
|
|
|
FT_INT32, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_error,
|
|
|
|
{ "Error code", "dsi.error_code",
|
|
|
|
FT_INT32, BASE_DEC|BASE_EXT_STRING, &asp_error_vals_ext, 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_length,
|
|
|
|
{ "Length", "dsi.length",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Total length of the data that follows the DSI header.", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_reserved,
|
|
|
|
{ "Reserved", "dsi.reserved",
|
|
|
|
FT_UINT32, BASE_HEX, NULL, 0x0,
|
|
|
|
"Reserved for future use. Should be set to zero.", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_open_type,
|
|
|
|
{ "Option", "dsi.open_type",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(dsi_open_type_vals), 0x0,
|
|
|
|
"Open session option type.", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_open_len,
|
|
|
|
{ "Length", "dsi.open_len",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Open session option len", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_open_quantum,
|
|
|
|
{ "Quantum", "dsi.open_quantum",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Server/Attention quantum", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_replay_cache_size,
|
|
|
|
{ "Replay", "dsi.replay_cache",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Replay cache size", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_open_option,
|
|
|
|
{ "Option", "dsi.open_option",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
"Open session options (undecoded)", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_dsi_attn_flag,
|
|
|
|
{ "Flags", "dsi.attn_flag",
|
|
|
|
FT_UINT16, BASE_HEX|BASE_EXT_STRING, &dsi_attn_flag_vals_ext, 0xf000,
|
|
|
|
"Server attention flag", HFILL }},
|
|
|
|
{ &hf_dsi_attn_flag_shutdown,
|
|
|
|
{ "Shutdown", "dsi.attn_flag.shutdown",
|
|
|
|
FT_BOOLEAN, 16, NULL, 1<<15,
|
|
|
|
"Attention flag, server is shutting down", HFILL }},
|
|
|
|
{ &hf_dsi_attn_flag_crash,
|
|
|
|
{ "Crash", "dsi.attn_flag.crash",
|
|
|
|
FT_BOOLEAN, 16, NULL, 1<<14,
|
|
|
|
"Attention flag, server crash bit", HFILL }},
|
|
|
|
{ &hf_dsi_attn_flag_msg,
|
|
|
|
{ "Message", "dsi.attn_flag.msg",
|
|
|
|
FT_BOOLEAN, 16, NULL, 1<<13,
|
|
|
|
"Attention flag, server message bit", HFILL }},
|
|
|
|
{ &hf_dsi_attn_flag_reconnect,
|
|
|
|
{ "Don't reconnect", "dsi.attn_flag.reconnect",
|
|
|
|
FT_BOOLEAN, 16, NULL, 1<<12,
|
|
|
|
"Attention flag, don't reconnect bit", HFILL }},
|
|
|
|
{ &hf_dsi_attn_flag_time,
|
|
|
|
{ "Minutes", "dsi.attn_flag.time",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0xfff,
|
|
|
|
"Number of minutes", HFILL }},
|
|
|
|
{ &hf_dsi_attn_flag_bitmap,
|
2012-01-19 20:19:28 +00:00
|
|
|
{ "Bitmap", "dsi.attn_flag.bitmap",
|
2010-11-08 21:59:39 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0xfff,
|
|
|
|
"Attention extended bitmap", HFILL }},
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_dsi,
|
|
|
|
&ett_dsi_open,
|
|
|
|
&ett_dsi_attn,
|
2014-04-06 19:12:59 +00:00
|
|
|
&ett_dsi_attn_flag
|
2010-11-08 21:59:39 +00:00
|
|
|
};
|
|
|
|
module_t *dsi_module;
|
|
|
|
|
|
|
|
proto_dsi = proto_register_protocol("Data Stream Interface", "DSI", "dsi");
|
|
|
|
proto_register_field_array(proto_dsi, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
dsi_module = prefs_register_protocol(proto_dsi, NULL);
|
|
|
|
prefs_register_bool_preference(dsi_module, "desegment",
|
|
|
|
"Reassemble DSI messages spanning multiple TCP segments",
|
|
|
|
"Whether the DSI dissector should reassemble messages spanning multiple TCP segments."
|
|
|
|
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
|
|
|
|
&dsi_desegment);
|
2001-05-24 20:25:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_dsi(void)
|
|
|
|
{
|
2010-11-08 21:59:39 +00:00
|
|
|
dissector_handle_t dsi_handle;
|
2002-04-22 08:50:49 +00:00
|
|
|
|
2013-11-09 17:46:28 +00:00
|
|
|
dsi_handle = new_create_dissector_handle(dissect_dsi, proto_dsi);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("tcp.port", TCP_PORT_DSI, dsi_handle);
|
2002-04-22 08:50:49 +00:00
|
|
|
|
2010-11-08 21:59:39 +00:00
|
|
|
data_handle = find_dissector("data");
|
|
|
|
afp_handle = find_dissector("afp");
|
2014-04-06 19:12:59 +00:00
|
|
|
afp_server_status_handle = find_dissector("afp_server_status");
|
2001-05-24 20:25:25 +00:00
|
|
|
}
|