From Thomas Dreibholz via bug 4989:
Extend the SSP dissector to support the SSP Environment message type. svn path=/trunk/; revision=33476
This commit is contained in:
parent
7f90713b6e
commit
e64762a0d8
|
@ -3,7 +3,7 @@
|
|||
* of the rsplib RSerPool implementation
|
||||
* http://tdrwww.iem.uni-due.de/dreibholz/rserpool/
|
||||
*
|
||||
* Copyright 2008 by Thomas Dreibholz <dreibh [AT] iem.uni-due.de>
|
||||
* Copyright 2008-2010 by Thomas Dreibholz <dreibh [AT] iem.uni-due.de>
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
@ -37,17 +37,20 @@
|
|||
|
||||
|
||||
/* Initialize the protocol and registered fields */
|
||||
static int proto_ssprotocol = -1;
|
||||
static int hf_message_type = -1;
|
||||
static int hf_message_flags = -1;
|
||||
static int hf_message_length = -1;
|
||||
static int hf_message_status = -1;
|
||||
static int hf_message_data = -1;
|
||||
static int hf_message_reason = -1;
|
||||
static int hf_message_info = -1;
|
||||
static int proto_ssprotocol = -1;
|
||||
static int hf_message_type = -1;
|
||||
static int hf_message_flags = -1;
|
||||
static int hf_message_length = -1;
|
||||
static int hf_message_status = -1;
|
||||
static int hf_message_data = -1;
|
||||
static int hf_message_reason = -1;
|
||||
static int hf_message_info = -1;
|
||||
static int hf_message_hash = -1;
|
||||
static int hf_environment_u_bit = -1;
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_ssprotocol = -1;
|
||||
static gint ett_ssprotocol = -1;
|
||||
static gint ett_environment_flags = -1;
|
||||
|
||||
static guint
|
||||
dissect_ssprotocol_message(tvbuff_t *, packet_info *, proto_tree *);
|
||||
|
@ -59,6 +62,7 @@ dissect_ssprotocol_message(tvbuff_t *, packet_info *, proto_tree *);
|
|||
#define MESSAGE_LENGTH_LENGTH 2
|
||||
#define MESSAGE_STATUS_LENGTH 4
|
||||
#define MESSAGE_NOTRDY_REASON_LENGTH 4
|
||||
#define MESSAGE_ENVIRON_HASH_LENGTH 20
|
||||
|
||||
#define MESSAGE_TYPE_OFFSET 0
|
||||
#define MESSAGE_FLAGS_OFFSET (MESSAGE_TYPE_OFFSET + MESSAGE_TYPE_LENGTH)
|
||||
|
@ -68,6 +72,7 @@ dissect_ssprotocol_message(tvbuff_t *, packet_info *, proto_tree *);
|
|||
#define MESSAGE_RDY_INFO_OFFSET (MESSAGE_LENGTH_OFFSET + MESSAGE_LENGTH_LENGTH)
|
||||
#define MESSAGE_NOTRDY_REASON_OFFSET (MESSAGE_LENGTH_OFFSET + MESSAGE_LENGTH_LENGTH)
|
||||
#define MESSAGE_NOTRDY_INFO_OFFSET (MESSAGE_NOTRDY_REASON_OFFSET + MESSAGE_NOTRDY_REASON_LENGTH)
|
||||
#define MESSAGE_ENVIRON_HASH_OFFSET (MESSAGE_LENGTH_OFFSET + MESSAGE_LENGTH_LENGTH)
|
||||
|
||||
|
||||
#define SS_NOTREADY_TYPE 0
|
||||
|
@ -77,6 +82,7 @@ dissect_ssprotocol_message(tvbuff_t *, packet_info *, proto_tree *);
|
|||
#define SS_KEEPALIVE_TYPE 4
|
||||
#define SS_KEEPALIVE_ACK_TYPE 5
|
||||
#define SS_STATUS_TYPE 6
|
||||
#define SS_ENVIRONMENT_TYPE 7
|
||||
|
||||
|
||||
static const value_string message_type_values[] = {
|
||||
|
@ -87,6 +93,7 @@ static const value_string message_type_values[] = {
|
|||
{ SS_KEEPALIVE_TYPE, "Keep-Alive" },
|
||||
{ SS_KEEPALIVE_ACK_TYPE, "Keep-Alive Ack" },
|
||||
{ SS_STATUS_TYPE, "Status" },
|
||||
{ SS_ENVIRONMENT_TYPE, "Environment" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
@ -98,20 +105,29 @@ static const value_string notrdy_reason_values[] = {
|
|||
};
|
||||
|
||||
|
||||
#define SSP_ENVIRONMENT_U_BIT 0x01
|
||||
static const true_false_string environment_u_bit = {
|
||||
"Upload needed",
|
||||
"Upload not needed"
|
||||
};
|
||||
|
||||
|
||||
static guint
|
||||
dissect_ssprotocol_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *ssprotocol_tree)
|
||||
{
|
||||
guint8 type;
|
||||
guint16 data_length;
|
||||
guint16 info_length;
|
||||
guint total_length;
|
||||
|
||||
proto_item* flags_item;
|
||||
proto_tree* flags_tree;
|
||||
guint8 type;
|
||||
guint16 data_length;
|
||||
guint16 info_length;
|
||||
guint total_length;
|
||||
|
||||
type = tvb_get_guint8(message_tvb, MESSAGE_TYPE_OFFSET);
|
||||
if (pinfo && (check_col(pinfo->cinfo, COL_INFO))) {
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(type, message_type_values, "Unknown SSP type: %u"));
|
||||
}
|
||||
proto_tree_add_item(ssprotocol_tree, hf_message_type, message_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, FALSE);
|
||||
proto_tree_add_item(ssprotocol_tree, hf_message_flags, message_tvb, MESSAGE_FLAGS_OFFSET, MESSAGE_FLAGS_LENGTH, FALSE);
|
||||
flags_item = proto_tree_add_item(ssprotocol_tree, hf_message_flags, message_tvb, MESSAGE_FLAGS_OFFSET, MESSAGE_FLAGS_LENGTH, FALSE);
|
||||
proto_tree_add_item(ssprotocol_tree, hf_message_length, message_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, FALSE);
|
||||
total_length = MESSAGE_LENGTH_OFFSET + MESSAGE_LENGTH_LENGTH;
|
||||
switch (type) {
|
||||
|
@ -146,6 +162,11 @@ dissect_ssprotocol_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree
|
|||
total_length += info_length;
|
||||
}
|
||||
break;
|
||||
case SS_ENVIRONMENT_TYPE:
|
||||
flags_tree = proto_item_add_subtree(flags_item, ett_environment_flags);
|
||||
proto_tree_add_item(flags_tree, hf_environment_u_bit, message_tvb, MESSAGE_FLAGS_OFFSET, MESSAGE_FLAGS_LENGTH, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(ssprotocol_tree, hf_message_hash, message_tvb, MESSAGE_ENVIRON_HASH_OFFSET, MESSAGE_ENVIRON_HASH_LENGTH, FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -191,12 +212,15 @@ proto_register_ssprotocol(void)
|
|||
{ &hf_message_status, { "Status", "ssprotocol.message_status", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_message_reason, { "Reason", "ssprotocol.message_reason", FT_UINT32, BASE_DEC, VALS(notrdy_reason_values), 0x0, NULL, HFILL } },
|
||||
{ &hf_message_info, { "Info", "ssprotocol.message_info", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_message_data, { "Data", "ssprotocol.message_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }
|
||||
{ &hf_message_data, { "Data", "ssprotocol.message_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_message_hash, { "Hash", "ssprotocol.message_hash", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_environment_u_bit, { "U-Bit", "ssprotocol.environment_u_bit", FT_BOOLEAN, 8,TFS(&environment_u_bit), SSP_ENVIRONMENT_U_BIT, NULL, HFILL } }
|
||||
};
|
||||
|
||||
/* Setup protocol subtree array */
|
||||
static gint *ett[] = {
|
||||
&ett_ssprotocol
|
||||
&ett_ssprotocol,
|
||||
&ett_environment_flags
|
||||
};
|
||||
|
||||
/* Register the protocol name and description */
|
||||
|
|
Loading…
Reference in New Issue