diff options
author | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-02-11 01:50:16 +0000 |
---|---|---|
committer | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-02-11 01:50:16 +0000 |
commit | a25238ff41937eb41148a4366ae2361028791e0e (patch) | |
tree | 195678292d6d70da057c3a6e8ef0a6aed65d2407 /epan/dissectors/packet-scsi-smc.c | |
parent | 5be54fa9c803751cfe63f1a9e79cc3279c082e23 (diff) |
add dissection of the two SMC cdbs
INITIALIZE ELEMENT STATUS
INITIALIZE ELEMENT STATUS WITH RANGE
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20781 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-scsi-smc.c')
-rw-r--r-- | epan/dissectors/packet-scsi-smc.c | 82 |
1 files changed, 76 insertions, 6 deletions
diff --git a/epan/dissectors/packet-scsi-smc.c b/epan/dissectors/packet-scsi-smc.c index c8fe9107a1..4a219cbba8 100644 --- a/epan/dissectors/packet-scsi-smc.c +++ b/epan/dissectors/packet-scsi-smc.c @@ -50,11 +50,17 @@ static int hf_scsi_smc_mta = -1; static int hf_scsi_smc_sa = -1; static int hf_scsi_smc_fda = -1; static int hf_scsi_smc_sda = -1; -static int hf_scsi_ssc_medium_flags = -1; +static int hf_scsi_smc_medium_flags = -1; static int hf_scsi_smc_inv1 = -1; static int hf_scsi_smc_inv2 = -1; +static int hf_scsi_smc_range_flags = -1; +static int hf_scsi_smc_fast = -1; +static int hf_scsi_smc_range = -1; +static int hf_scsi_smc_sea = -1; +static int hf_scsi_smc_num_elements = -1; static gint ett_scsi_exchange_medium = -1; +static gint ett_scsi_range = -1; void dissect_smc_exchangemedium (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, @@ -78,7 +84,7 @@ dissect_smc_exchangemedium (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t proto_tree_add_item (tree, hf_scsi_smc_sda, tvb, offset+7, 2, 0); - proto_tree_add_bitmask(tree, tvb, offset+9, hf_scsi_ssc_medium_flags, ett_scsi_exchange_medium, exchg_fields, FALSE); + proto_tree_add_bitmask(tree, tvb, offset+9, hf_scsi_smc_medium_flags, ett_scsi_exchange_medium, exchg_fields, FALSE); flags = tvb_get_guint8 (tvb, offset+10); proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1, @@ -88,6 +94,54 @@ dissect_smc_exchangemedium (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t } } +void +dissect_smc_initialize_element_status (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) +{ + guint8 flags; + + if (!tree) + return; + + if (isreq && iscdb) { + flags = tvb_get_guint8 (tvb, offset+4); + proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1, + flags, + "Vendor Unique = %u, NACA = %u, Link = %u", + flags & 0xC0, flags & 0x4, flags & 0x1); + } +} + +void +dissect_smc_initialize_element_status_with_range (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) +{ + guint8 flags; + static const int *range_fields[] = { + &hf_scsi_smc_fast, + &hf_scsi_smc_range, + NULL + }; + + if (!tree) + return; + + if (isreq && iscdb) { + proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_smc_range_flags, ett_scsi_range, range_fields, FALSE); + + proto_tree_add_item (tree, hf_scsi_smc_sa, tvb, offset+1, 2, 0); + + proto_tree_add_item (tree, hf_scsi_smc_num_elements, tvb, offset+5, 2, 0); + + flags = tvb_get_guint8 (tvb, offset+8); + proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1, + flags, + "Vendor Unique = %u, NACA = %u, Link = %u", + flags & 0xC0, flags & 0x4, flags & 0x1); + } +} void dissect_smc_movemedium (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, @@ -539,7 +593,7 @@ scsi_cdb_table_t scsi_smc_table[256] = { /*SMC 0x04*/{NULL}, /*SMC 0x05*/{NULL}, /*SMC 0x06*/{NULL}, -/*SMC 0x07*/{NULL}, +/*SMC 0x07*/{dissect_smc_initialize_element_status}, /*SMC 0x08*/{NULL}, /*SMC 0x09*/{NULL}, /*SMC 0x0a*/{NULL}, @@ -587,7 +641,7 @@ scsi_cdb_table_t scsi_smc_table[256] = { /*SMC 0x34*/{NULL}, /*SMC 0x35*/{NULL}, /*SMC 0x36*/{NULL}, -/*SMC 0x37*/{NULL}, +/*SMC 0x37*/{dissect_smc_initialize_element_status_with_range}, /*SMC 0x38*/{NULL}, /*SMC 0x39*/{NULL}, /*SMC 0x3a*/{NULL}, @@ -810,7 +864,7 @@ proto_register_scsi_smc(void) { &hf_scsi_smc_sda, {"Second Destination Address", "scsi.smc.sda", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL}}, - { &hf_scsi_ssc_medium_flags, + { &hf_scsi_smc_medium_flags, {"Flags", "scsi.smc.medium_flags", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL}}, { &hf_scsi_smc_inv1, @@ -819,12 +873,28 @@ proto_register_scsi_smc(void) { &hf_scsi_smc_inv2, {"INV2", "scsi.smc.inv2", FT_BOOLEAN, 8, NULL, 0x01, "", HFILL}}, + { &hf_scsi_smc_range_flags, + {"Flags", "scsi.smc.range_flags", FT_UINT8, BASE_HEX, + NULL, 0x0, "", HFILL}}, + { &hf_scsi_smc_fast, + {"FAST", "scsi.smc.fast", FT_BOOLEAN, 8, + NULL, 0x02, "", HFILL}}, + { &hf_scsi_smc_range, + {"RANGE", "scsi.smc.range", FT_BOOLEAN, 8, + NULL, 0x01, "", HFILL}}, + { &hf_scsi_smc_sea, + {"Starting Element Address", "scsi.smc.sea", FT_UINT16, BASE_DEC, + NULL, 0x0, "", HFILL}}, + { &hf_scsi_smc_num_elements, + {"Number of Elements", "scsi.smc.num_elements", FT_UINT16, BASE_DEC, + NULL, 0x0, "", HFILL}}, }; /* Setup protocol subtree array */ static gint *ett[] = { - &ett_scsi_exchange_medium + &ett_scsi_exchange_medium, + &ett_scsi_range }; /* Register the protocol name and description */ |