diff options
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-scsi-osd.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-osd.h | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi.c | 30 |
3 files changed, 51 insertions, 19 deletions
diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c index 71a92dca34..2c8a3a35d6 100644 --- a/epan/dissectors/packet-scsi-osd.c +++ b/epan/dissectors/packet-scsi-osd.c @@ -179,9 +179,9 @@ typedef struct _scsi_osd_conv_info_t { /* there will be one such structure created for each lun for each conversation * that is handled by the OSD dissector */ -typedef struct _scsi_osd_lun_info_t { +struct _scsi_osd_lun_info_t { emem_tree_t *partitions; -} scsi_osd_lun_info_t; +}; typedef void (*scsi_osd_dissector_t)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, @@ -230,19 +230,6 @@ dissect_osd_user_object_id(tvbuff_t *tvb, int offset, proto_tree *tree) } -typedef struct _attribute_page_numbers_t attribute_page_numbers_t; -typedef void (*attribute_dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - scsi_osd_lun_info_t *lun_info, const attribute_page_numbers_t *att); - -struct _attribute_page_numbers_t { - guint32 number; - const char *name; - attribute_dissector dissector; - int* hf_index; - guint expected_length; -}; - - /*dissects an attribute that is defined as a pair of hf_index,length*/ static void generic_attribute_dissector(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, @@ -287,7 +274,7 @@ static const attribute_pages_t attribute_pages[] = { {0,NULL} }; -static const value_string attributes_page_vals[] = { +const value_string attributes_page_vals[] = { {PAGE_NUMBER_OBJECT+0, "User Object Directory"}, {PAGE_NUMBER_OBJECT+1, "User Object Information"}, {PAGE_NUMBER_OBJECT+2, "User Object Quotas"}, @@ -373,7 +360,8 @@ dissect_osd2_list_attr(tvbuff_t *tvb, int offset, proto_tree *tree) } -/* used by dissect_osd_attributes_list and dissect_osd2_attribute_list_entry*/ +/* used by dissect_osd_attributes_list, dissect_osd2_attribute_list_entry +and dissect_scsi_descriptor_snsinfo from packet-scsi.c*/ const attribute_page_numbers_t * osd_lookup_attribute(guint32 page, guint32 number) { diff --git a/epan/dissectors/packet-scsi-osd.h b/epan/dissectors/packet-scsi-osd.h index 08237216e8..ce97583653 100644 --- a/epan/dissectors/packet-scsi-osd.h +++ b/epan/dissectors/packet-scsi-osd.h @@ -29,6 +29,24 @@ #define SCSI_OSD_OPCODE 0x7f +extern const value_string attributes_page_vals[]; + +typedef struct _scsi_osd_lun_info_t scsi_osd_lun_info_t; +typedef struct _attribute_page_numbers_t attribute_page_numbers_t; +typedef void (*attribute_dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + scsi_osd_lun_info_t *lun_info, const attribute_page_numbers_t *att); + +struct _attribute_page_numbers_t { + guint32 number; + const char *name; + attribute_dissector dissector; + int* hf_index; + guint expected_length; +}; + +const attribute_page_numbers_t * +osd_lookup_attribute(guint32 page, guint32 number); + extern int hf_scsi_osd_opcode; extern scsi_cdb_table_t scsi_osd_table[256]; WS_DLL_PUBLIC const value_string scsi_osd_vals[]; diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index 79126aaa7c..5ff44cc9e5 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -210,6 +210,8 @@ static int hf_scsi_sns_osd_object_ga_cap_v = -1; static int hf_scsi_sns_osd_object_get_att = -1; static int hf_scsi_sns_osd_partition_id = -1; static int hf_scsi_sns_osd_object_id = -1; +static int hf_scsi_sns_osd_attr_page = -1; +static int hf_scsi_sns_osd_attr_number = -1; static int hf_scsi_inq_reladrflags = -1; static int hf_scsi_inq_reladr = -1; static int hf_scsi_inq_linked = -1; @@ -4819,12 +4821,13 @@ dissect_scsi_descriptor_snsinfo(tvbuff_t *tvb, proto_tree *sns_tree, guint offse end = offset+7+additional_length; offset+=8; while (offset<end-2) { - guint8 desc_type, desc_length; + guint8 desc_type, desc_length, desc_end; proto_item *item; proto_tree *desc_tree; desc_type = tvb_get_guint8(tvb, offset); desc_length = tvb_get_guint8(tvb, offset+1); + desc_end = offset+desc_length+2; item = proto_tree_add_text(sns_tree, tvb, offset, desc_length+2, "%s", val_to_str(desc_type, scsi_sense_desc_type_val, "Unknown (0x%02x)")); desc_tree = proto_item_add_subtree(item, ett_sense_descriptor); @@ -4857,6 +4860,25 @@ dissect_scsi_descriptor_snsinfo(tvbuff_t *tvb, proto_tree *sns_tree, guint offse proto_tree_add_item(desc_tree, hf_scsi_sns_osd_object_id, tvb, offset+24, 8, ENC_BIG_ENDIAN); } break; + case 8: + /*OSD attribute identification*/ + offset+=4; + while (offset+8<=desc_end) { + const attribute_page_numbers_t *apn; + guint32 page,number; + page=tvb_get_ntohl(tvb, offset); + proto_tree_add_item(desc_tree, hf_scsi_sns_osd_attr_page, tvb, offset, 4, ENC_BIG_ENDIAN); + offset+=4; + number=tvb_get_ntohl(tvb, offset); + item=proto_tree_add_item(desc_tree, hf_scsi_sns_osd_attr_number, tvb, offset, 4, ENC_BIG_ENDIAN); + apn=osd_lookup_attribute(page,number); + offset+=4; + if (apn) { + proto_item_append_text(item, " (%s)", apn->name); + } else { + proto_item_append_text(item, " (Unknown)"); + } + } default: break; } @@ -4864,7 +4886,7 @@ dissect_scsi_descriptor_snsinfo(tvbuff_t *tvb, proto_tree *sns_tree, guint offse } } -static void +void dissect_scsi_sense(tvbuff_t *tvb, proto_tree *sns_tree, guint offset) { guint8 sense_type; @@ -6099,6 +6121,10 @@ proto_register_scsi(void) {"Partition ID", "scsi.sns.desc.osd_object.partition_id", FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL}}, { &hf_scsi_sns_osd_object_id, {"Object ID", "scsi.sns.desc.osd_object.object_id", FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL}}, + { &hf_scsi_sns_osd_attr_page, + {"Attribute page", "scsi.sns.desc.osd_attr.page", FT_UINT32, BASE_HEX, VALS(attributes_page_vals), 0, NULL, HFILL}}, + { &hf_scsi_sns_osd_attr_number, + {"Attribute number", "scsi.sns.desc.osd_attr.number", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}}, { &hf_scsi_persresv_key, {"Reservation Key", "scsi.spc.resv.key", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}}, |