diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2010-07-08 14:14:11 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2010-07-08 14:14:11 +0000 |
commit | e64762a0d8e0a19ad15b54530cd42422ff47e5ce (patch) | |
tree | 1bb64f516f7b96b23c31e0904a4974cd49e7b094 /epan/dissectors/packet-scriptingservice.c | |
parent | 7f90713b6ea3e837fee86bae83105b87c88e1cb2 (diff) |
From Thomas Dreibholz via bug 4989:
Extend the SSP dissector to support the SSP Environment message type.
svn path=/trunk/; revision=33476
Diffstat (limited to 'epan/dissectors/packet-scriptingservice.c')
-rw-r--r-- | epan/dissectors/packet-scriptingservice.c | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/epan/dissectors/packet-scriptingservice.c b/epan/dissectors/packet-scriptingservice.c index 69204ed4e1..37b79a2259 100644 --- a/epan/dissectors/packet-scriptingservice.c +++ b/epan/dissectors/packet-scriptingservice.c @@ -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 */ |