diff options
-rw-r--r-- | epan/dissectors/packet-scsi-mmc.c | 149 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-mmc.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-osd.c | 1719 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-osd.h | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-sbc.c | 175 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-sbc.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-smc.c | 474 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-smc.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-ssc.c | 401 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-ssc.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi.c | 135 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi.h | 4 | ||||
-rw-r--r-- | ui/cli/tap-scsistat.c | 145 | ||||
-rw-r--r-- | ui/gtk/scsi_stat.c | 129 |
14 files changed, 1796 insertions, 1547 deletions
diff --git a/epan/dissectors/packet-scsi-mmc.c b/epan/dissectors/packet-scsi-mmc.c index 119afb35da..542fa264d9 100644 --- a/epan/dissectors/packet-scsi-mmc.c +++ b/epan/dissectors/packet-scsi-mmc.c @@ -293,6 +293,7 @@ static const value_string scsi_read_dvd_formats[] = { {0xff, "READ/SEND DVD STRUCTURE capability"}, {0,NULL} }; +static value_string_ext scsi_read_dvd_formats_ext = VALUE_STRING_EXT_INIT(scsi_read_dvd_formats); static const value_string scsi_data_mode_vals[] = { {0x01, "Mode 1 (ISO/IEC 10149)"}, @@ -329,6 +330,7 @@ static const value_string scsi_getconf_current_profile_val[] = { {0xffff, "Logical unit not conforming to a standard profile"}, {0,NULL} }; +static value_string_ext scsi_getconf_current_profile_val_ext = VALUE_STRING_EXT_INIT(scsi_getconf_current_profile_val); static const value_string scsi_feature_val[] = { {0x0000, "Profile List"}, @@ -374,6 +376,7 @@ static const value_string scsi_feature_val[] = { {0x010c, "Firmware Information"}, {0,NULL} }; +static value_string_ext scsi_feature_val_ext = VALUE_STRING_EXT_INIT(scsi_feature_val); static void dissect_mmc4_getconfiguration (tvbuff_t *tvb, packet_info *pinfo, @@ -383,10 +386,10 @@ dissect_mmc4_getconfiguration (tvbuff_t *tvb, packet_info *pinfo, scsi_task_data_t *cdata) { - gint32 len; - guint old_offset; - tvbuff_t *volatile tvb_v = tvb; - volatile guint offset_v = offset; + gint32 len; + guint old_offset; + tvbuff_t *volatile tvb_v = tvb; + volatile guint offset_v = offset; if (tree && isreq && iscdb) { proto_tree_add_item (tree, hf_scsi_mmc_getconf_rt, tvb_v, offset_v+0, 1, ENC_BIG_ENDIAN); @@ -442,7 +445,7 @@ dissect_mmc4_getconfiguration (tvbuff_t *tvb, packet_info *pinfo, profile=tvb_get_ntohs(tvb_v, offset_v); proto_tree_add_item (tr, hf_scsi_mmc_feature_profile, tvb_v, offset_v, 2, ENC_BIG_ENDIAN); - proto_item_append_text(it, "%s", val_to_str(profile, scsi_getconf_current_profile_val, "Unknown 0x%04x")); + proto_item_append_text(it, "%s", val_to_str_ext(profile, &scsi_getconf_current_profile_val_ext, "Unknown 0x%04x")); cur_profile=tvb_get_guint8(tvb_v, offset_v+2); proto_tree_add_item (tr, hf_scsi_mmc_feature_profile_current, tvb_v, offset_v+2, 1, ENC_BIG_ENDIAN); @@ -532,19 +535,20 @@ static const value_string scsi_q_subchannel_adr_val[] = { }; static const value_string scsi_q_subchannel_control_val[] = { {0x0, "2 Audio channels without pre-emphasis (digital copy prohibited)"}, - {0x2, "2 Audio channels without pre-emphasis (digital copy permitted)"}, {0x1, "2 Audio channels with pre-emphasis of 50/15us (digital copy prohibited)"}, + {0x2, "2 Audio channels without pre-emphasis (digital copy permitted)"}, {0x3, "2 Audio channels with pre-emphasis of 50/15us (digital copy permitted)"}, - {0x8, "audio channels without pre-emphasis (digital copy prohibited)"}, - {0xa, "audio channels without pre-emphasis (digital copy permitted)"}, - {0x9, "2 Audio channels with pre-emphasis of 50/15us (digital copy prohibited)"}, - {0xb, "2 Audio channels with pre-emphasis of 50/15us (digital copy permitted)"}, {0x4, "Data track, recorded uninterrupted (digital copy prohibited)"}, - {0x6, "Data track, recorded uninterrupted (digital copy permitted)"}, {0x5, "Data track, recorded incremental (digital copy prohibited)"}, + {0x6, "Data track, recorded uninterrupted (digital copy permitted)"}, {0x7, "Data track, recorded incremental (digital copy permitted)"}, + {0x8, "audio channels without pre-emphasis (digital copy prohibited)"}, + {0x9, "2 Audio channels with pre-emphasis of 50/15us (digital copy prohibited)"}, + {0xa, "audio channels without pre-emphasis (digital copy permitted)"}, + {0xb, "2 Audio channels with pre-emphasis of 50/15us (digital copy permitted)"}, {0,NULL} }; +static value_string_ext scsi_q_subchannel_control_val_ext = VALUE_STRING_EXT_INIT(scsi_q_subchannel_control_val); static void dissect_mmc4_readtocpmaatip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, @@ -919,7 +923,7 @@ dissect_mmc4_reportkey (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata) { - guint8 agid, key_format, key_class; + guint8 agid, key_format, key_class; proto_item *ti; if (tree && isreq && iscdb) { @@ -1223,7 +1227,7 @@ dissect_mmc4_setstreaming (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr guint payload_len _U_, scsi_task_data_t *cdata) { - guint8 type; + guint8 type; proto_item *ti; if (tree && isreq && iscdb) { @@ -1308,55 +1312,57 @@ dissect_mmc_preventallowmediaremoval(tvbuff_t *tvb, packet_info *pinfo, proto_tr #define SCSI_MMC4_READDISCSTRUCTURE 0xad #define SCSI_MMC4_SETSTREAMING 0xb6 #define SCSI_MMC4_SETCDSPEED 0xbb -const value_string scsi_mmc_vals[] = { - {SCSI_MMC4_GETCONFIGURATION , "Get Configuration"}, - {SCSI_MMC4_GETEVENTSTATUSNOTIFY , "Get Event Status Notification"}, - {SCSI_MMC4_GETPERFORMANCE , "Get Performance"}, - {SCSI_SPC_INQUIRY , "Inquiry"}, - {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, - {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, - {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, - {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, - {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, - {SCSI_MMC4_READ10 , "Read(10)"}, - {SCSI_MMC4_READ12 , "Read(12)"}, - {SCSI_MMC4_CLOSETRACK , "Close Track"}, - {SCSI_MMC4_READBUFFERCAPACITY , "Read Buffer Capacity"}, - {SCSI_MMC4_READCAPACITY10 , "Read Capacity(10)"}, - {SCSI_MMC4_READDISCINFORMATION , "Read Disc Information"}, - {SCSI_MMC4_READDISCSTRUCTURE , "Read DISC Structure"}, - {SCSI_MMC4_READTOCPMAATIP , "Read TOC/PMA/ATIP"}, - {SCSI_MMC4_READTRACKINFORMATION , "Read Track Information"}, - {SCSI_MMC4_REPORTKEY , "Report Key"}, - {SCSI_SPC_REPORTLUNS , "Report LUNs"}, - {SCSI_SPC_REQSENSE , "Request Sense"}, - {SCSI_MMC4_RESERVETRACK , "Reserve Track"}, - {SCSI_MMC4_SETCDSPEED , "Set CD Speed"}, - {SCSI_MMC4_SETSTREAMING , "Set Streaming"}, - {SCSI_SBC_STARTSTOPUNIT , "Start Stop Unit"}, - {SCSI_MMC4_SYNCHRONIZECACHE , "Synchronize Cache"}, - {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, - {SCSI_MMC4_WRITE10 , "Write(10)"}, - {SCSI_MMC4_WRITE12 , "Write(12)"}, - {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, +static const value_string scsi_mmc_vals[] = { + /* 0x00 */ {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, + /* 0x03 */ {SCSI_SPC_REQSENSE , "Request Sense"}, + /* 0x12 */ {SCSI_SPC_INQUIRY , "Inquiry"}, + /* 0x1A */ {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, + /* 0x1B */ {SCSI_SBC_STARTSTOPUNIT , "Start Stop Unit"}, + /* 0x1E */ {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, + /* 0x25 */ {SCSI_MMC4_READCAPACITY10 , "Read Capacity(10)"}, + /* 0x28 */ {SCSI_MMC4_READ10 , "Read(10)"}, + /* 0x2a */ {SCSI_MMC4_WRITE10 , "Write(10)"}, + /* 0x35 */ {SCSI_MMC4_SYNCHRONIZECACHE , "Synchronize Cache"}, + /* 0x3B */ {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, + /* 0x43 */ {SCSI_MMC4_READTOCPMAATIP , "Read TOC/PMA/ATIP"}, + /* 0x46 */ {SCSI_MMC4_GETCONFIGURATION , "Get Configuration"}, + /* 0x4a */ {SCSI_MMC4_GETEVENTSTATUSNOTIFY , "Get Event Status Notification"}, + /* 0x51 */ {SCSI_MMC4_READDISCINFORMATION , "Read Disc Information"}, + /* 0x52 */ {SCSI_MMC4_READTRACKINFORMATION , "Read Track Information"}, + /* 0x53 */ {SCSI_MMC4_RESERVETRACK , "Reserve Track"}, + /* 0x55 */ {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, + /* 0x5A */ {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, + /* 0x5b */ {SCSI_MMC4_CLOSETRACK , "Close Track"}, + /* 0x5c */ {SCSI_MMC4_READBUFFERCAPACITY , "Read Buffer Capacity"}, + /* 0xA0 */ {SCSI_SPC_REPORTLUNS , "Report LUNs"}, + /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, + /* 0xa4 */ {SCSI_MMC4_REPORTKEY , "Report Key"}, + /* 0xa8 */ {SCSI_MMC4_READ12 , "Read(12)"}, + /* 0xaa */ {SCSI_MMC4_WRITE12 , "Write(12)"}, + /* 0xac */ {SCSI_MMC4_GETPERFORMANCE , "Get Performance"}, + /* 0xad */ {SCSI_MMC4_READDISCSTRUCTURE , "Read DISC Structure"}, + /* 0xb6 */ {SCSI_MMC4_SETSTREAMING , "Set Streaming"}, + /* 0xbb */ {SCSI_MMC4_SETCDSPEED , "Set CD Speed"}, {0, NULL}, }; +value_string_ext scsi_mmc_vals_ext = VALUE_STRING_EXT_INIT(scsi_mmc_vals); -const value_string scsi_track_mode_vals[] = { +static const value_string scsi_track_mode_vals[] = { {0x00 , "2 audio channels without pre-emphasis, digital copy prohibited"}, {0x01 , "2 audio channels with pre-emphasis of 50/15 us, digital copy prohibited"}, - {0x04 , "Data track, recorded uninterrupted, digital copy prohibited"}, - {0x05 , "Data track, recorded incremental, digital copy prohibited"}, - {0x08 , "audio channels without pre-emphasis, digital copy prohibited"}, - {0x09 , "audio channels with pre-emphasis of 50/15 us"}, {0x02 , "2 audio channels without pre-emphasis, digital copy permitted"}, {0x03 , "2 audio channels with pre-emphasis of 50/15 us, digital copy permitted"}, + {0x04 , "Data track, recorded uninterrupted, digital copy prohibited"}, + {0x05 , "Data track, recorded incremental, digital copy prohibited"}, {0x06 , "Data track, recorded uninterrupted, digital copy permitted"}, {0x07 , "Data track, recorded incremental, digital copy permitted"}, + {0x08 , "audio channels without pre-emphasis, digital copy prohibited"}, + {0x09 , "audio channels with pre-emphasis of 50/15 us"}, {0x0a , "audio channels without pre-emphasis, digital copy permitted"}, {0x0b , "audio channels with pre-emphasis of 50/15 us, digital copy permitted"}, {0, NULL}, }; +static value_string_ext scsi_track_mode_vals_ext = VALUE_STRING_EXT_INIT(scsi_track_mode_vals); scsi_cdb_table_t scsi_mmc_table[256] = { /*SPC 0x00*/{dissect_spc_testunitready}, @@ -1623,8 +1629,8 @@ proto_register_scsi_mmc(void) { static hf_register_info hf[] = { { &hf_scsi_mmc_opcode, - {"MMC Opcode", "scsi_mmc.opcode", FT_UINT8, BASE_HEX, - VALS (scsi_mmc_vals), 0x0, NULL, HFILL}}, + {"MMC Opcode", "scsi_mmc.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING, + &scsi_mmc_vals_ext, 0x0, NULL, HFILL}}, { &hf_scsi_mmc_setstreaming_type, {"Type", "scsi_mmc.setstreaming.type", FT_UINT8, BASE_DEC, VALS(scsi_setstreaming_type_val), 0, NULL, HFILL}}, @@ -1689,8 +1695,8 @@ proto_register_scsi_mmc(void) {"Copy", "scsi_mmc.rti.copy", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL}}, { &hf_scsi_mmc_rti_track_mode, - {"Track Mode", "scsi_mmc.rti.track_mode", FT_UINT8, BASE_HEX, - VALS(scsi_track_mode_vals), 0x0f, NULL, HFILL}}, + {"Track Mode", "scsi_mmc.rti.track_mode", FT_UINT8, BASE_HEX | BASE_EXT_STRING, + &scsi_track_mode_vals_ext, 0x0f, NULL, HFILL}}, { &hf_scsi_mmc_rti_rt, {"RT", "scsi_mmc.rti.rt", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}}, @@ -1803,8 +1809,8 @@ proto_register_scsi_mmc(void) {"Q Subchannel ADR", "scsi_mmc.q.subchannel.adr", FT_UINT8, BASE_HEX, VALS(scsi_q_subchannel_adr_val), 0xf0, NULL, HFILL}}, { &hf_scsi_mmc_q_subchannel_control, - {"Q Subchannel Control", "scsi_mmc.q.subchannel.control", FT_UINT8, BASE_HEX, - VALS(scsi_q_subchannel_control_val), 0x0f, NULL, HFILL}}, + {"Q Subchannel Control", "scsi_mmc.q.subchannel.control", FT_UINT8, BASE_HEX | BASE_EXT_STRING, + &scsi_q_subchannel_control_val_ext, 0x0f, NULL, HFILL}}, { &hf_scsi_mmc_agid, {"AGID", "scsi_mmc.agid", FT_UINT8, BASE_HEX, NULL, 0xc0, NULL, HFILL}}, @@ -1833,14 +1839,14 @@ proto_register_scsi_mmc(void) {"RT", "scsi_mmc.getconf.rt", FT_UINT8, BASE_HEX, VALS(scsi_getconf_rt_val), 0x03, NULL, HFILL}}, { &hf_scsi_mmc_getconf_current_profile, - {"Current Profile", "scsi_mmc.getconf.current_profile", FT_UINT16, BASE_HEX, - VALS(scsi_getconf_current_profile_val), 0, NULL, HFILL}}, + {"Current Profile", "scsi_mmc.getconf.current_profile", FT_UINT16, BASE_HEX | BASE_EXT_STRING, + &scsi_getconf_current_profile_val_ext, 0, NULL, HFILL}}, { &hf_scsi_mmc_getconf_starting_feature, - {"Starting Feature", "scsi_mmc.getconf.starting_feature", FT_UINT16, BASE_HEX, - VALS(scsi_feature_val), 0, NULL, HFILL}}, + {"Starting Feature", "scsi_mmc.getconf.starting_feature", FT_UINT16, BASE_HEX | BASE_EXT_STRING, + &scsi_feature_val_ext, 0, NULL, HFILL}}, { &hf_scsi_mmc_feature, - {"Feature", "scsi_mmc.feature", FT_UINT16, BASE_HEX, - VALS(scsi_feature_val), 0, NULL, HFILL}}, + {"Feature", "scsi_mmc.feature", FT_UINT16, BASE_HEX | BASE_EXT_STRING, + &scsi_feature_val_ext, 0, NULL, HFILL}}, { &hf_scsi_mmc_feature_version, {"Version", "scsi_mmc.feature.version", FT_UINT8, BASE_DEC, NULL, 0x3c, NULL, HFILL}}, @@ -1932,8 +1938,8 @@ proto_register_scsi_mmc(void) {"DVD-RW", "scsi_mmc.feature.dvdr.dvdrw", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL}}, { &hf_scsi_mmc_feature_profile, - {"Profile", "scsi_mmc.feature.profile", FT_UINT16, BASE_HEX, - VALS(scsi_getconf_current_profile_val), 0, NULL, HFILL}}, + {"Profile", "scsi_mmc.feature.profile", FT_UINT16, BASE_HEX | BASE_EXT_STRING, + &scsi_getconf_current_profile_val_ext, 0, NULL, HFILL}}, { &hf_scsi_mmc_feature_profile_current, {"Current", "scsi_mmc.feature.profile.current", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}}, @@ -1983,8 +1989,8 @@ proto_register_scsi_mmc(void) {"Free Blocks", "scsi_mmc.free_blocks", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL}}, { &hf_scsi_mmc_read_dvd_format, - { "Format Code", "scsi_mmc.read_dvd.format", FT_UINT8, BASE_HEX, - VALS(scsi_read_dvd_formats), 0x0, NULL, HFILL}}, + { "Format Code", "scsi_mmc.read_dvd.format", FT_UINT8, BASE_HEX | BASE_EXT_STRING, + &scsi_read_dvd_formats_ext, 0x0, NULL, HFILL}}, { &hf_scsi_mmc_disc_book_type, { "Type", "scsi_mmc.book.type", FT_UINT8, BASE_HEX, VALS(scsi_disc_category_type), 0xf0, NULL, HFILL}}, @@ -2123,3 +2129,16 @@ proto_register_scsi_mmc(void) proto_register_subtree_array(ett, array_length(ett)); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/dissectors/packet-scsi-mmc.h b/epan/dissectors/packet-scsi-mmc.h index 58270a38aa..706a3b89ab 100644 --- a/epan/dissectors/packet-scsi-mmc.h +++ b/epan/dissectors/packet-scsi-mmc.h @@ -28,4 +28,6 @@ extern int hf_scsi_mmc_opcode; extern scsi_cdb_table_t scsi_mmc_table[256]; +WS_DLL_PUBLIC value_string_ext scsi_mmc_vals_ext; + #endif diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c index e0cb1f7998..9d4a6709bb 100644 --- a/epan/dissectors/packet-scsi-osd.c +++ b/epan/dissectors/packet-scsi-osd.c @@ -236,13 +236,13 @@ static proto_item* dissect_osd_user_object_id(tvbuff_t *tvb, int offset, proto_tree *tree) { /* user object id */ - proto_item* item; - item=proto_tree_add_item(tree, hf_scsi_osd_user_object_id, tvb, offset, 8, ENC_NA); + proto_item *item; + item = proto_tree_add_item(tree, hf_scsi_osd_user_object_id, tvb, offset, 8, ENC_NA); return item; } -/*dissects an attribute that is defined as a pair of hf_index,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, scsi_osd_lun_info_t *lun_info _U_, const attribute_page_numbers_t *att) @@ -264,14 +264,14 @@ partition_id_attribute_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree * } static const attribute_page_numbers_t user_object_info_attributes[] = { - {0x82, "User object logical length", generic_attribute_dissector, &hf_scsi_osd_attrval_user_object_logical_length,8}, + {0x82, "User object logical length", generic_attribute_dissector, &hf_scsi_osd_attrval_user_object_logical_length, 8}, {0, NULL, NULL, NULL, 0} }; static const attribute_page_numbers_t current_command_attributes[] = { - {0x02, "Object Type", generic_attribute_dissector, &hf_scsi_osd_attrval_object_type, 1}, - {0x03, "Partition ID", partition_id_attribute_dissector, &hf_scsi_osd_attrval_partition_id,8}, - {0x04, "Collection Object ID or User Object ID", generic_attribute_dissector, &hf_scsi_osd_attrval_object_id,8}, + {0x02, "Object Type", generic_attribute_dissector, &hf_scsi_osd_attrval_object_type, 1}, + {0x03, "Partition ID", partition_id_attribute_dissector, &hf_scsi_osd_attrval_partition_id, 8}, + {0x04, "Collection Object ID or User Object ID", generic_attribute_dissector, &hf_scsi_osd_attrval_object_id, 8}, {0, NULL, NULL, NULL, 0} }; @@ -282,43 +282,43 @@ typedef struct _attribute_pages_t { static const attribute_pages_t attribute_pages[] = { {PAGE_NUMBER_OBJECT+1, user_object_info_attributes}, - {0xFFFFFFFE, current_command_attributes}, - {0,NULL} + {0xFFFFFFFE, current_command_attributes}, + {0, NULL} }; -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"}, - {PAGE_NUMBER_OBJECT+3, "User Object Timestamps"}, - {PAGE_NUMBER_OBJECT+4, "User Object Collections"}, - {PAGE_NUMBER_OBJECT+5, "User Object Policy/Security"}, - {PAGE_NUMBER_COLLECTION, "Collection Directory"}, +static 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"}, + {PAGE_NUMBER_OBJECT+3, "User Object Timestamps"}, + {PAGE_NUMBER_OBJECT+4, "User Object Collections"}, + {PAGE_NUMBER_OBJECT+5, "User Object Policy/Security"}, + {PAGE_NUMBER_PARTITION, "Partition Directory"}, + {PAGE_NUMBER_PARTITION+1, "Partition Information"}, + {PAGE_NUMBER_PARTITION+2, "Partition Quotas"}, + {PAGE_NUMBER_PARTITION+3, "Partition Timestamps"}, + {PAGE_NUMBER_PARTITION+5, "Partition Policy/Security"}, + {PAGE_NUMBER_COLLECTION, "Collection Directory"}, {PAGE_NUMBER_COLLECTION+1, "Collection Information"}, {PAGE_NUMBER_COLLECTION+2, "Collection Quotas"}, {PAGE_NUMBER_COLLECTION+4, "Collection Command Tracking"}, {PAGE_NUMBER_COLLECTION+5, "Collection Policy/Security"}, - {PAGE_NUMBER_PARTITION, "Partition Directory"}, - {PAGE_NUMBER_PARTITION+1, "Partition Information"}, - {PAGE_NUMBER_PARTITION+2, "Partition Quotas"}, - {PAGE_NUMBER_PARTITION+3, "Partition Timestamps"}, - {PAGE_NUMBER_PARTITION+5, "Partition Policy/Security"}, - {PAGE_NUMBER_ROOT, "Root Directory"}, - {PAGE_NUMBER_ROOT+1, "Root Information"}, - {PAGE_NUMBER_ROOT+2, "Root Quotas"}, - {PAGE_NUMBER_ROOT+3, "Root Timestamps"}, - {PAGE_NUMBER_ROOT+5, "Root Policy/Security"}, - {0xFFFFFFFE, "Current Command"}, - {0xFFFFFFFF, "All attribute pages"}, + {PAGE_NUMBER_ROOT, "Root Directory"}, + {PAGE_NUMBER_ROOT+1, "Root Information"}, + {PAGE_NUMBER_ROOT+2, "Root Quotas"}, + {PAGE_NUMBER_ROOT+3, "Root Timestamps"}, + {PAGE_NUMBER_ROOT+5, "Root Policy/Security"}, + {0xFFFFFFFE, "Current Command"}, + {0xFFFFFFFF, "All attribute pages"}, {0, NULL} }; - +value_string_ext attributes_page_vals_ext = VALUE_STRING_EXT_INIT(attributes_page_vals); static const value_string attributes_list_type_vals[] = { {0x01, "Retrieve attributes for this OSD object"}, {0x09, "Retrieve/Set attributes for this OSD object"}, {0x0f, "Retrieve attributes for a CREATE command"}, - {0,NULL} + {0, NULL} }; static const value_string scsi_osd2_isolation_val[] = { @@ -328,7 +328,7 @@ static const value_string scsi_osd2_isolation_val[] = { {0x04, "Range"}, {0x05, "Functional"}, {0x07, "Vendor specific"}, - {0,NULL} + {0, NULL} }; static const value_string scsi_osd2_object_descriptor_format_val[] = { @@ -338,18 +338,18 @@ static const value_string scsi_osd2_object_descriptor_format_val[] = { {0x12, "Collection ID followed by attribute parameters"}, {0x21, "User Object ID"}, {0x22, "User Object ID followed by attribute parameters"}, - {0,NULL} + {0, NULL} }; static const value_string scsi_osd2_remove_scope[] = { {0x00, "Fail if there are collections or user objects in the partition"}, {0x01, "Remove collections and user objects in the partition"}, - {0,NULL} + {0, NULL} }; static const value_string scsi_osd2_cdb_continuation_format_val[] = { {0x01, "OSD2"}, - {0,NULL} + {0, NULL} }; static const value_string scsi_osd2_cdb_continuation_descriptor_type_val[] = { @@ -359,13 +359,13 @@ static const value_string scsi_osd2_cdb_continuation_descriptor_type_val[] = { {0x0100, "User object"}, {0x0101, "Copy user object source"}, {0xFFEE, "Extension capabilities"}, - {0,NULL} + {0, NULL} }; static const value_string scsi_osd2_query_type_vals[] = { {0x00, "Match any query criteria"}, {0x01, "Match all query criteria"}, - {0,NULL} + {0, NULL} }; /* OSD2/3 helper functions */ @@ -390,26 +390,26 @@ and dissect_scsi_descriptor_snsinfo from packet-scsi.c*/ const attribute_page_numbers_t * osd_lookup_attribute(guint32 page, guint32 number) { - const attribute_pages_t *ap; + const attribute_pages_t *ap; const attribute_page_numbers_t *apn; /* find the proper attributes page */ - apn=NULL; - for(ap=attribute_pages;ap->attributes;ap++){ - if(ap->page==page){ - apn=ap->attributes; + apn = NULL; + for (ap=attribute_pages;ap->attributes;ap++) { + if (ap->page == page) { + apn = ap->attributes; break; } } - if(!apn) return NULL; + if (!apn) return NULL; /* find the specific attribute */ - for(;apn->name;apn++){ - if(apn->number==number){ + for (;apn->name;apn++) { + if (apn->number == number) { break; } } - if(!apn->name) return NULL; + if (!apn->name) return NULL; /* found it */ return apn; @@ -418,7 +418,7 @@ osd_lookup_attribute(guint32 page, guint32 number) /* OSD-1: 7.1.3.3, OSD2 7.1.4.3 list entry format */ static guint32 dissect_osd_attribute_list_entry(packet_info *pinfo, tvbuff_t *tvb, - proto_tree *tree, proto_item* item, + proto_tree *tree, proto_item *item, guint32 offset, scsi_osd_lun_info_t *lun_info, gboolean osd2) { @@ -427,28 +427,28 @@ dissect_osd_attribute_list_entry(packet_info *pinfo, tvbuff_t *tvb, const attribute_page_numbers_t *apn; /* attributes page */ - page=tvb_get_ntohl(tvb, offset); + page = tvb_get_ntohl(tvb, offset); proto_tree_add_item(tree, hf_scsi_osd_attributes_page, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; /* attribute number */ - number=tvb_get_ntohl(tvb, offset); + number = tvb_get_ntohl(tvb, offset); proto_tree_add_item(tree, hf_scsi_osd_attribute_number, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; if (osd2) { /*6 reserved bytes*/ - offset+=6; + offset += 6; } /* attribute length */ - attribute_length=tvb_get_ntohs(tvb, offset); + attribute_length = tvb_get_ntohs(tvb, offset); proto_tree_add_item(tree, hf_scsi_osd_attribute_length, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; + offset += 2; - proto_item_append_text(item, " 0x%08x (%s)", page, val_to_str_const(page, attributes_page_vals,"Unknown")); + proto_item_append_text(item, " 0x%08x (%s)", page, val_to_str_ext_const(page, &attributes_page_vals_ext, "Unknown")); proto_item_append_text(item, " 0x%08x", number); - apn= osd_lookup_attribute(page,number); + apn= osd_lookup_attribute(page, number); if (!apn) { expert_add_info(pinfo, item, &ei_osd_attr_unknown); @@ -456,19 +456,19 @@ dissect_osd_attribute_list_entry(packet_info *pinfo, tvbuff_t *tvb, } else { proto_item_append_text(item, " (%s)", apn->name); - /* attribute value*/ + /* attribute value */ if (attribute_length) { if (attribute_length != apn->expected_length) { proto_tree_add_expert_format(tree, pinfo, &ei_osd_attr_length_invalid, tvb, 0, attribute_length, "%s", apn->name); } else { - tvbuff_t* next_tvb=tvb_new_subset(tvb, offset, attribute_length, attribute_length); + tvbuff_t *next_tvb = tvb_new_subset(tvb, offset, attribute_length, attribute_length); apn->dissector(next_tvb, pinfo, tree, lun_info, apn); } } } - offset+=attribute_length; + offset += attribute_length; if (osd2 && (attribute_length&7)) { /* 8-bit padding */ offset += 8-(attribute_length&7); @@ -484,60 +484,60 @@ dissect_osd_attributes_list(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree, scsi_osd_lun_info_t *lun_info, gboolean osd2) { - guint8 type; - guint32 length; - guint32 page, number; - int start_offset=offset; + guint8 type; + guint32 length; + guint32 page, number; + int start_offset = offset; proto_item *item, *list_type_item; const attribute_page_numbers_t *apn; /* list type */ - type=tvb_get_guint8(tvb, offset)&0x0f; - list_type_item=proto_tree_add_item(tree, hf_scsi_osd_attributes_list_type, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + type = tvb_get_guint8(tvb, offset)&0x0f; + list_type_item = proto_tree_add_item(tree, hf_scsi_osd_attributes_list_type, tvb, offset, 1, ENC_BIG_ENDIAN); + offset += 1; /* OSD-1: a reserved byte */ /* OSD-2: 3 reserved bytes */ - offset+=(osd2?3:1); + offset += (osd2?3:1); /* OSD-1: length (16 bit) OSD-2: length (32 bit) */ if (osd2) { - length=tvb_get_ntohl(tvb, offset); + length = tvb_get_ntohl(tvb, offset); proto_tree_add_item(tree, hf_scsi_osd2_attributes_list_length, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; } else { - length=tvb_get_ntohs(tvb, offset); + length = tvb_get_ntohs(tvb, offset); proto_tree_add_item(tree, hf_scsi_osd_attributes_list_length, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; + offset += 2; } /* if type is 1 length will be zero and we have to cycle over * all remaining bytes. 7.1.3.1 */ - if(!osd2&&type==1){ - length=tvb_length_remaining(tvb, offset); + if (!osd2 && type == 1) { + length = tvb_length_remaining(tvb, offset); } - length+=(osd2?8:4); + length += (osd2?8:4); - while( (guint32)(offset-start_offset)<length ){ + while ( (guint32)(offset-start_offset)<length ) { proto_item *ti; - proto_tree* tt; - guint32 attribute_entry_length; + proto_tree *tt; + guint32 attribute_entry_length; - switch(type){ + switch (type) { case 0x01: - attribute_entry_length=8; + attribute_entry_length = 8; break; case 0x0f: - attribute_entry_length=18+tvb_get_ntohs(tvb,offset+16); + attribute_entry_length = 18+tvb_get_ntohs(tvb, offset+16); break; case 0x09: if (osd2) { - attribute_entry_length=16+tvb_get_ntohs(tvb,offset+14); + attribute_entry_length = 16+tvb_get_ntohs(tvb, offset+14); } else { - attribute_entry_length=10+tvb_get_ntohs(tvb,offset+8); + attribute_entry_length = 10+tvb_get_ntohs(tvb, offset+8); } break; default: @@ -549,23 +549,23 @@ dissect_osd_attributes_list(packet_info *pinfo, tvbuff_t *tvb, int offset, ti = proto_tree_add_text(tree, tvb, offset, attribute_entry_length, "Attribute:"); tt = proto_item_add_subtree(ti, ett_osd_attribute); - switch(type){ + switch (type) { case 0x01: /* retrieving attributes 7.1.3.2 */ /* attributes page */ - page=tvb_get_ntohl(tvb, offset); + page = tvb_get_ntohl(tvb, offset); proto_tree_add_item(tt, hf_scsi_osd_attributes_page, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; /* attribute number */ - number=tvb_get_ntohl(tvb, offset); - item=proto_tree_add_item(tt, hf_scsi_osd_attribute_number, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + number = tvb_get_ntohl(tvb, offset); + item = proto_tree_add_item(tt, hf_scsi_osd_attribute_number, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_item_append_text(ti, " 0x%08x (%s)", page, val_to_str_const(page, attributes_page_vals,"Unknown")); + proto_item_append_text(ti, " 0x%08x (%s)", page, val_to_str_ext_const(page, &attributes_page_vals_ext, "Unknown")); proto_item_append_text(ti, " 0x%08x", number); /* find the proper attributes page */ - apn=osd_lookup_attribute(page,number); + apn = osd_lookup_attribute(page, number); if (!apn) { proto_item_append_text(ti, " (Unknown)"); proto_item_append_text(item, " (Unknown)"); @@ -577,10 +577,10 @@ dissect_osd_attributes_list(packet_info *pinfo, tvbuff_t *tvb, int offset, case 0x0f: /* create attributes 7.1.3.4 */ /* user object id */ dissect_osd_user_object_id(tvb, offset, tt); - offset+=8; + offset += 8; /* fallthrough to the next case */ case 0x09: /* retrieved/set attributes OSD-1: 7.1.3.3 OSD-2: 7.1.4.3*/ - offset=dissect_osd_attribute_list_entry(pinfo, tvb, tt, ti, offset, lun_info, osd2); + offset = dissect_osd_attribute_list_entry(pinfo, tvb, tt, ti, offset, lun_info, osd2); break; } } @@ -591,24 +591,24 @@ dissect_osd_attributes_list(packet_info *pinfo, tvbuff_t *tvb, int offset, static void dissect_osd_option(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { - proto_tree *tree=NULL; - proto_item *it=NULL; - guint8 option; + proto_tree *tree = NULL; + proto_item *it = NULL; + guint8 option; - option=tvb_get_guint8(tvb, offset); + option = tvb_get_guint8(tvb, offset); - if(parent_tree){ - it=proto_tree_add_item(parent_tree, hf_scsi_osd_option, tvb, offset, 1, ENC_BIG_ENDIAN); + if (parent_tree) { + it = proto_tree_add_item(parent_tree, hf_scsi_osd_option, tvb, offset, 1, ENC_BIG_ENDIAN); tree = proto_item_add_subtree(it, ett_osd_option); } proto_tree_add_item(tree, hf_scsi_osd_option_dpo, tvb, offset, 1, ENC_BIG_ENDIAN); - if(option&0x10){ + if (option&0x10) { proto_item_append_text(tree, " DPO"); } proto_tree_add_item(tree, hf_scsi_osd_option_fua, tvb, offset, 1, ENC_BIG_ENDIAN); - if(option&0x08){ + if (option&0x08) { proto_item_append_text(tree, " FUA"); } } @@ -625,9 +625,9 @@ static const value_string scsi_osd_getsetattrib_vals[] = { static void dissect_osd_getsetattrib(tvbuff_t *tvb, int offset, proto_tree *tree, scsi_task_data_t *cdata) { - if(cdata && cdata->itlq && cdata->itlq->extra_data){ - scsi_osd_extra_data_t *extra_data=(scsi_osd_extra_data_t *)cdata->itlq->extra_data; - extra_data->gsatype=(tvb_get_guint8(tvb, offset)>>4)&0x03; + if (cdata && cdata->itlq && cdata->itlq->extra_data) { + scsi_osd_extra_data_t *extra_data = (scsi_osd_extra_data_t *)cdata->itlq->extra_data; + extra_data->gsatype = (tvb_get_guint8(tvb, offset)>>4)&0x03; } proto_tree_add_item(tree, hf_scsi_osd_getsetattrib, tvb, offset, 1, ENC_BIG_ENDIAN); } @@ -660,126 +660,126 @@ dissect_osd_offset(packet_info *pinfo, tvbuff_t *tvb, int offset, /* dissects an OSD offset value, add proto item and updates *raw_value_ptr */ guint32 value = *raw_value_ptr; - if (value!=0xFFFFFFFF) { + if (value != 0xFFFFFFFF) { if (!osd2) { /*OSD-1: the exponent is an unsigned value (4.12.5)*/ - value = (value&0x0fffffff)<<((value>>28)&0x0f); - value<<=8; + value = (value & 0x0fffffff) << ((value>>28) & 0x0f); + value <<= 8; } else { /*OSD-2: the exponent is a signed value (4.15.5)*/ int exponent = (value>>28); guint32 mantissa = (value&0x0FFFFFFF); if (exponent&0x8) { - exponent=-(((~exponent)&7)+1); - if (exponent<=-6&&mantissa!=0xFFFFFFF) { - proto_item* item; + exponent = -(((~exponent)&7)+1); + if (exponent <=- 6 && mantissa != 0xFFFFFFF) { + proto_item *item; item = proto_tree_add_item(tree, field, tvb, offset, 4, value); expert_add_info(pinfo, item, &ei_osd2_invalid_offset); - *raw_value_ptr=0xFFFFFFFF; + *raw_value_ptr = 0xFFFFFFFF; return; } } - value = mantissa<<(exponent+8); + value = mantissa << (exponent+8); } } proto_tree_add_uint(tree, field, tvb, offset, 4, value); - *raw_value_ptr=value; + *raw_value_ptr = value; } static int dissect_osd_attribute_parameters(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *parent_tree, scsi_task_data_t *cdata) { - guint8 gsatype=0; - proto_item *item=NULL; - proto_tree *tree=NULL; - scsi_osd_extra_data_t *extra_data=NULL; + guint8 gsatype = 0; + proto_item *item = NULL; + proto_tree *tree = NULL; + scsi_osd_extra_data_t *extra_data = NULL; gboolean osd2; - if(parent_tree){ + if (parent_tree) { item = proto_tree_add_text(parent_tree, tvb, offset, 28, "Attribute Parameters"); tree = proto_item_add_subtree(item, ett_osd_attribute_parameters); } - if(cdata && cdata->itlq && cdata->itlq->extra_data){ - extra_data=(scsi_osd_extra_data_t *)cdata->itlq->extra_data; - gsatype=extra_data->gsatype; - osd2=extra_data->osd2; + if (cdata && cdata->itlq && cdata->itlq->extra_data) { + extra_data = (scsi_osd_extra_data_t *)cdata->itlq->extra_data; + gsatype = extra_data->gsatype; + osd2 = extra_data->osd2; } else { return offset; } - switch(gsatype){ + switch (gsatype) { case 1: /* OSD-2 5.2.6.2 Set one attribute using CDB fields*/ if (osd2) { proto_tree_add_item(tree, hf_scsi_osd_set_attributes_page, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_set_attribute_number, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_set_attribute_length, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd2_set_attribute_value, tvb, offset, 18, ENC_NA); - offset+=18; + offset += 18; } break; case 2: /* 5.2.2.2 attribute page */ proto_tree_add_item(tree, hf_scsi_osd_get_attributes_page, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_get_attributes_allocation_length, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_retrieved_attributes_offset, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_set_attributes_page, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_set_attribute_number, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_set_attribute_length, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_set_attributes_offset, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; break; case 3: /* 5.2.2.3 attribute list */ proto_tree_add_item(tree, hf_scsi_osd_get_attributes_list_length, tvb, offset, 4, ENC_BIG_ENDIAN); - extra_data->u.al.get_list_length=tvb_get_ntohl(tvb, offset); - offset+=4; + extra_data->u.al.get_list_length = tvb_get_ntohl(tvb, offset); + offset += 4; /* 4.12.5 */ - extra_data->u.al.get_list_offset=tvb_get_ntohl(tvb, offset); - dissect_osd_offset(pinfo,tvb,offset,tree,hf_scsi_osd_get_attributes_list_offset, - &extra_data->u.al.get_list_offset,osd2); - if (extra_data->u.al.get_list_offset==0xFFFFFFFF) { - extra_data->u.al.get_list_length=0; + extra_data->u.al.get_list_offset = tvb_get_ntohl(tvb, offset); + dissect_osd_offset(pinfo, tvb, offset, tree, hf_scsi_osd_get_attributes_list_offset, + &extra_data->u.al.get_list_offset, osd2); + if (extra_data->u.al.get_list_offset == 0xFFFFFFFF) { + extra_data->u.al.get_list_length = 0; } - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_get_attributes_allocation_length, tvb, offset, 4, ENC_BIG_ENDIAN); - extra_data->u.al.get_list_allocation_length=tvb_get_ntohl(tvb, offset); - offset+=4; + extra_data->u.al.get_list_allocation_length = tvb_get_ntohl(tvb, offset); + offset += 4; /* 4.12.5 */ - extra_data->u.al.retrieved_list_offset=tvb_get_ntohl(tvb, offset); - dissect_osd_offset(pinfo,tvb,offset,tree,hf_scsi_osd_retrieved_attributes_offset, - &extra_data->u.al.retrieved_list_offset,osd2); - if (extra_data->u.al.retrieved_list_offset==0xFFFFFFFF) { - extra_data->u.al.get_list_allocation_length=0; + extra_data->u.al.retrieved_list_offset = tvb_get_ntohl(tvb, offset); + dissect_osd_offset(pinfo, tvb, offset, tree, hf_scsi_osd_retrieved_attributes_offset, + &extra_data->u.al.retrieved_list_offset, osd2); + if (extra_data->u.al.retrieved_list_offset == 0xFFFFFFFF) { + extra_data->u.al.get_list_allocation_length = 0; } - offset+=4; + offset += 4; proto_tree_add_item(tree, hf_scsi_osd_set_attributes_list_length, tvb, offset, 4, ENC_BIG_ENDIAN); - extra_data->u.al.set_list_length=tvb_get_ntohl(tvb, offset); - offset+=4; - - extra_data->u.al.set_list_offset=tvb_get_ntohl(tvb, offset); - dissect_osd_offset(pinfo,tvb,offset,tree,hf_scsi_osd_set_attributes_list_offset, - &extra_data->u.al.set_list_offset,osd2); - if (extra_data->u.al.set_list_offset==0xFFFFFFFF) { - extra_data->u.al.set_list_length=0; + extra_data->u.al.set_list_length = tvb_get_ntohl(tvb, offset); + offset += 4; + + extra_data->u.al.set_list_offset = tvb_get_ntohl(tvb, offset); + dissect_osd_offset(pinfo, tvb, offset, tree, hf_scsi_osd_set_attributes_list_offset, + &extra_data->u.al.set_list_offset, osd2); + if (extra_data->u.al.set_list_offset == 0xFFFFFFFF) { + extra_data->u.al.set_list_length = 0; } - offset+=4; + offset += 4; /* 4 reserved bytes */ - offset+=4; + offset += 4; break; } @@ -792,30 +792,30 @@ dissect_osd_attribute_data_out(packet_info *pinfo, tvbuff_t *tvb, int offset _U_ proto_tree *tree, scsi_task_data_t *cdata, scsi_osd_lun_info_t *lun_info) { - guint8 gsatype=0; + guint8 gsatype = 0; proto_tree *subtree; proto_item *item; - scsi_osd_extra_data_t *extra_data=NULL; + scsi_osd_extra_data_t *extra_data = NULL; - if(cdata && cdata->itlq && cdata->itlq->extra_data){ - extra_data=(scsi_osd_extra_data_t *)cdata->itlq->extra_data; - gsatype=extra_data->gsatype; + if (cdata && cdata->itlq && cdata->itlq->extra_data) { + extra_data = (scsi_osd_extra_data_t *)cdata->itlq->extra_data; + gsatype = extra_data->gsatype; } else { return; } - switch(gsatype){ + switch (gsatype) { case 2: /* 5.2.2.2 attribute page */ /*qqq*/ break; case 3: /* 5.2.2.3 attribute list */ - if(extra_data->u.al.get_list_length){ - item=proto_tree_add_text(tree, tvb, extra_data->u.al.get_list_offset, extra_data->u.al.get_list_length, "Get Attributes Segment"); + if (extra_data->u.al.get_list_length) { + item = proto_tree_add_text(tree, tvb, extra_data->u.al.get_list_offset, extra_data->u.al.get_list_length, "Get Attributes Segment"); subtree= proto_item_add_subtree(item, ett_osd_get_attributes); dissect_osd_attributes_list(pinfo, tvb, extra_data->u.al.get_list_offset, subtree, lun_info, extra_data->osd2); } - if(extra_data->u.al.set_list_length){ - item=proto_tree_add_text(tree, tvb, extra_data->u.al.set_list_offset, extra_data->u.al.set_list_length, "Set Attributes Segment"); + if (extra_data->u.al.set_list_length) { + item = proto_tree_add_text(tree, tvb, extra_data->u.al.set_list_offset, extra_data->u.al.set_list_length, "Set Attributes Segment"); subtree= proto_item_add_subtree(item, ett_osd_set_attributes); dissect_osd_attributes_list(pinfo, tvb, extra_data->u.al.set_list_offset, subtree, lun_info, extra_data->osd2); } @@ -827,22 +827,22 @@ dissect_osd_attribute_data_out(packet_info *pinfo, tvbuff_t *tvb, int offset _U_ static void dissect_osd_attribute_data_in(packet_info *pinfo, tvbuff_t *tvb, int offset _U_, proto_tree *tree, scsi_task_data_t *cdata, scsi_osd_lun_info_t *lun_info) { - guint8 gsatype=0; - scsi_osd_extra_data_t *extra_data=NULL; + guint8 gsatype = 0; + scsi_osd_extra_data_t *extra_data = NULL; - if(cdata && cdata->itlq && cdata->itlq->extra_data){ - extra_data=(scsi_osd_extra_data_t *)cdata->itlq->extra_data; - gsatype=extra_data->gsatype; + if (cdata && cdata->itlq && cdata->itlq->extra_data) { + extra_data = (scsi_osd_extra_data_t *)cdata->itlq->extra_data; + gsatype = extra_data->gsatype; } else { return; } - switch(gsatype){ + switch (gsatype) { case 2: /* 5.2.2.2 attribute page */ /*qqq*/ break; case 3: /* 5.2.2.3 attribute list */ - if(extra_data->u.al.get_list_allocation_length){ + if (extra_data->u.al.get_list_allocation_length) { dissect_osd_attributes_list(pinfo, tvb, extra_data->u.al.retrieved_list_offset, tree, lun_info, extra_data->osd2); } break; @@ -855,17 +855,17 @@ dissect_osd2_cdb_continuation_length(packet_info *pinfo, tvbuff_t *tvb, scsi_task_data_t *cdata) { scsi_osd_extra_data_t *extra_data; - guint32 continuation_length; - proto_item* item; + guint32 continuation_length; + proto_item *item; - continuation_length = tvb_get_ntohl(tvb,offset); - item=proto_tree_add_item(tree, hf_scsi_osd2_cdb_continuation_length, tvb, offset, 4, ENC_BIG_ENDIAN); - if(cdata && cdata->itlq && cdata->itlq->extra_data){ - extra_data=(scsi_osd_extra_data_t *)cdata->itlq->extra_data; - extra_data->continuation_length=continuation_length; + continuation_length = tvb_get_ntohl(tvb, offset); + item = proto_tree_add_item(tree, hf_scsi_osd2_cdb_continuation_length, tvb, offset, 4, ENC_BIG_ENDIAN); + if (cdata && cdata->itlq && cdata->itlq->extra_data) { + extra_data = (scsi_osd_extra_data_t *)cdata->itlq->extra_data; + extra_data->continuation_length = continuation_length; } - if (continuation_length>0&&continuation_length<40) { - expert_add_info(pinfo,item,&ei_osd2_cdb_continuation_length_invalid); + if (continuation_length>0 && continuation_length<40) { + expert_add_info(pinfo, item, &ei_osd2_cdb_continuation_length_invalid); } } @@ -874,37 +874,37 @@ static void dissect_osd2_query_list_descriptor(packet_info *pinfo, tvbuff_t *tvb /* query type */ proto_tree_add_item(tree, hf_scsi_osd2_query_type, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /*query criteria entry*/ while (offset<end) { - guint32 page, number; - guint32 min_value_length, max_value_length; - guint32 min_value_offset, max_value_offset; + guint32 page, number; + guint32 min_value_length, max_value_length; + guint32 min_value_offset, max_value_offset; + proto_item *item; const attribute_page_numbers_t *apn; - proto_item* item; /* 2 reserved bytes */ - offset+=2; + offset += 2; /* query entry length */ proto_tree_add_item(tree, hf_scsi_osd2_query_entry_length, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; + offset += 2; /* query attributes page */ - page=tvb_get_ntohl(tvb, offset); + page = tvb_get_ntohl(tvb, offset); proto_tree_add_item(tree, hf_scsi_osd2_query_attributes_page, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; /* query attributes number */ - number=tvb_get_ntohl(tvb, offset); - item=proto_tree_add_item(tree, hf_scsi_osd2_query_attribute_number, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + number = tvb_get_ntohl(tvb, offset); + item = proto_tree_add_item(tree, hf_scsi_osd2_query_attribute_number, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - apn=osd_lookup_attribute(page,number); + apn = osd_lookup_attribute(page, number); if (!apn) { expert_add_info(pinfo, item, &ei_osd_attr_unknown); @@ -915,35 +915,35 @@ static void dissect_osd2_query_list_descriptor(packet_info *pinfo, tvbuff_t *tvb /* query minimum attribute value length */ proto_tree_add_item(tree, hf_scsi_osd2_query_minimum_attribute_value_length, tvb, offset, 2, ENC_BIG_ENDIAN); - min_value_length=tvb_get_ntohs(tvb,offset); - offset+=2; + min_value_length = tvb_get_ntohs(tvb, offset); + offset += 2; /* query minimum attribute value */ - /* if(apn&&min_value_length) { + /* if (apn && min_value_length) { call_apn_dissector(tvb, pinfo, tree, lun_info, apn, offset, min_value_length); } */ - max_value_offset=offset; - offset+=min_value_length; + max_value_offset = offset; + offset += min_value_length; /* query maximum attribute value length */ - item=proto_tree_add_item(tree, hf_scsi_osd2_query_maximum_attribute_value_length, tvb, offset, 2, ENC_BIG_ENDIAN); - max_value_length=tvb_get_ntohs(tvb,offset); - offset+=2; + item = proto_tree_add_item(tree, hf_scsi_osd2_query_maximum_attribute_value_length, tvb, offset, 2, ENC_BIG_ENDIAN); + max_value_length = tvb_get_ntohs(tvb, offset); + offset += 2; /* xxx query maximum attribute value */ - /* if(apn&&max_value_length) { + /* if (apn && max_value_length) { call_apn_dissector(tvb, pinfo, tree, lun_info, apn, offset, max_value_length); } */ - min_value_offset=offset; - offset+=max_value_length; + min_value_offset = offset; + offset += max_value_length; /* test if min and max values are equal */ - if (max_value_length==min_value_length) { + if (max_value_length == min_value_length) { unsigned int i; for (i=0; i<max_value_length; i++) { - if (tvb_get_guint8(tvb,max_value_offset+i)!=tvb_get_guint8(tvb,min_value_offset+i)) return; + if (tvb_get_guint8(tvb, max_value_offset+i) != tvb_get_guint8(tvb, min_value_offset+i)) return; } - expert_add_info(pinfo,item,&ei_osd2_query_values_equal); + expert_add_info(pinfo, item, &ei_osd2_query_values_equal); } } } @@ -952,62 +952,62 @@ static void dissect_osd2_cdb_continuation(packet_info *pinfo, tvbuff_t *tvb, guint32 offset, proto_tree *tree, scsi_task_data_t *cdata) { - scsi_osd_extra_data_t *extra_data=NULL; - proto_item* item; - guint8 format; - guint16 sa; - if(cdata && cdata->itlq && cdata->itlq->extra_data){ - extra_data=(scsi_osd_extra_data_t *)cdata->itlq->extra_data; + scsi_osd_extra_data_t *extra_data = NULL; + proto_item *item; + guint8 format; + guint16 sa; + if (cdata && cdata->itlq && cdata->itlq->extra_data) { + extra_data = (scsi_osd_extra_data_t *)cdata->itlq->extra_data; } - if (!extra_data||extra_data->continuation_length<40) return; + if (!extra_data || extra_data->continuation_length<40) return; /* cdb continuation format */ - item=proto_tree_add_item(tree, hf_scsi_osd2_cdb_continuation_format, tvb, offset, 1, ENC_BIG_ENDIAN); - format=tvb_get_guint8(tvb, offset); - if (format!=0x01) { + item = proto_tree_add_item(tree, hf_scsi_osd2_cdb_continuation_format, tvb, offset, 1, ENC_BIG_ENDIAN); + format = tvb_get_guint8(tvb, offset); + if (format != 0x01) { expert_add_info(pinfo, item, &ei_osd2_cdb_continuation_format_unknown); return; } - offset++; + offset += 1; /* 1 reserved byte */ - offset++; + offset += 1; /* continued service action */ - item=proto_tree_add_item(tree, hf_scsi_osd2_continued_service_action, tvb, offset, 2, ENC_BIG_ENDIAN); + item = proto_tree_add_item(tree, hf_scsi_osd2_continued_service_action, tvb, offset, 2, ENC_BIG_ENDIAN); sa = tvb_get_ntohs(tvb, offset); - if (sa!=extra_data->svcaction) { - expert_add_info(pinfo,item,&ei_osd2_continued_service_action_mismatch); + if (sa != extra_data->svcaction) { + expert_add_info(pinfo, item, &ei_osd2_continued_service_action_mismatch); } - offset+=2; + offset += 2; /*4 reserved bytes and continuation integrity check value (32 bytes, not dissected)*/ - offset+=36; + offset += 36; /* CDB continuation descriptors */ while (offset<extra_data->continuation_length) { guint16 type; - guint32 length,padlen; + guint32 length, padlen; proto_item *item_type, *item_length; /* descriptor type */ item_type= proto_tree_add_item(tree, hf_scsi_osd2_cdb_continuation_descriptor_type, tvb, offset, 2, ENC_BIG_ENDIAN); - type=tvb_get_ntohs(tvb, offset); - offset+=2; + type = tvb_get_ntohs(tvb, offset); + offset += 2; /* 1 reserved byte*/ - offset++; + offset += 1; /* descriptor pad length */ proto_tree_add_item(tree, hf_scsi_osd2_cdb_continuation_descriptor_pad_length, tvb, offset, 1, ENC_BIG_ENDIAN); - padlen=tvb_get_guint8(tvb, offset)&7; - offset+=1; + padlen = tvb_get_guint8(tvb, offset)&7; + offset += 1; /* descriptor length */ item_length = proto_tree_add_item(tree, hf_scsi_osd2_cdb_continuation_descriptor_length, tvb, offset, 4, ENC_BIG_ENDIAN); - length=tvb_get_ntohl(tvb, offset); - offset+=4; + length = tvb_get_ntohl(tvb, offset); + offset += 4; switch (type) { case 0x0000: break; @@ -1016,14 +1016,14 @@ dissect_osd2_cdb_continuation(packet_info *pinfo, tvbuff_t *tvb, guint32 offset, case 0x0100: break; case 0x0101: break; case 0xFFEE: break; - default: expert_add_info(pinfo,item_type,&ei_osd2_cdb_continuation_descriptor_type_unknown); + default: expert_add_info(pinfo, item_type, &ei_osd2_cdb_continuation_descriptor_type_unknown); } if ((length+padlen)%8) { - expert_add_info(pinfo,item_length,&ei_osd2_cdb_continuation_descriptor_length_invalid); + expert_add_info(pinfo, item_length, &ei_osd2_cdb_continuation_descriptor_length_invalid); return; } - offset+=length+padlen; + offset += length+padlen; } } @@ -1053,59 +1053,59 @@ static const value_string scsi_osd_object_descriptor_type_vals[] = { static void dissect_osd_permissions(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { - proto_tree *tree=NULL; - proto_item *it=NULL; - guint16 permissions; + proto_tree *tree = NULL; + proto_item *it = NULL; + guint16 permissions; - permissions=tvb_get_ntohs(tvb, offset); + permissions = tvb_get_ntohs(tvb, offset); - if(parent_tree){ - it=proto_tree_add_item(parent_tree, hf_scsi_osd_permissions, tvb, offset, 2, ENC_BIG_ENDIAN); + if (parent_tree) { + it = proto_tree_add_item(parent_tree, hf_scsi_osd_permissions, tvb, offset, 2, ENC_BIG_ENDIAN); tree = proto_item_add_subtree(it, ett_osd_permission_bitmask); } proto_tree_add_item(tree, hf_scsi_osd_permissions_read, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x8000){ + if (permissions&0x8000) { proto_item_append_text(tree, " READ"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_write, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x4000){ + if (permissions&0x4000) { proto_item_append_text(tree, " WRITE"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_get_attr, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x2000){ + if (permissions&0x2000) { proto_item_append_text(tree, " GET_ATTR"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_set_attr, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x1000){ + if (permissions&0x1000) { proto_item_append_text(tree, " SET_ATTR"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_create, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x0800){ + if (permissions&0x0800) { proto_item_append_text(tree, " CREATE"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_remove, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x0400){ + if (permissions&0x0400) { proto_item_append_text(tree, " REMOVE"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_obj_mgmt, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x0200){ + if (permissions&0x0200) { proto_item_append_text(tree, " OBJ_MGMT"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_append, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x0100){ + if (permissions&0x0100) { proto_item_append_text(tree, " APPEND"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_dev_mgmt, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x0080){ + if (permissions&0x0080) { proto_item_append_text(tree, " DEV_MGMT"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_global, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x0040){ + if (permissions&0x0040) { proto_item_append_text(tree, " GLOBAL"); } proto_tree_add_item(tree, hf_scsi_osd_permissions_pol_sec, tvb, offset, 2, ENC_BIG_ENDIAN); - if(permissions&0x0020){ + if (permissions&0x0020) { proto_item_append_text(tree, " POL/SEC"); } } @@ -1115,11 +1115,11 @@ dissect_osd_permissions(tvbuff_t *tvb, int offset, proto_tree *parent_tree) static void dissect_osd_capability(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item = NULL; + proto_tree *tree = NULL; guint8 format; - if(parent_tree){ + if (parent_tree) { item = proto_tree_add_text(parent_tree, tvb, offset, 80, "Capability"); tree = proto_item_add_subtree(item, ett_osd_capability); @@ -1128,56 +1128,56 @@ dissect_osd_capability(tvbuff_t *tvb, int offset, proto_tree *parent_tree) /* capability format */ proto_tree_add_item(tree, hf_scsi_osd_capability_format, tvb, offset, 1, ENC_BIG_ENDIAN); format = tvb_get_guint8(tvb, offset)&0x0F; - offset++; + offset += 1; - if (format!=1) return; + if (format != 1) return; /* key version and icva */ proto_tree_add_item(tree, hf_scsi_osd_key_version, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_scsi_osd_icva, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; /* security method */ proto_tree_add_item(tree, hf_scsi_osd_security_method, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; /* a reserved byte */ - offset++; + offset += 1; /* capability expiration time */ proto_tree_add_item(tree, hf_scsi_osd_capability_expiration_time, tvb, offset, 6, ENC_NA); - offset+=6; + offset += 6; /* audit */ proto_tree_add_item(tree, hf_scsi_osd_audit, tvb, offset, 20, ENC_NA); - offset+=20; + offset += 20; /* capability discriminator */ proto_tree_add_item(tree, hf_scsi_osd_capability_discriminator, tvb, offset, 12, ENC_NA); - offset+=12; + offset += 12; /* object created time */ proto_tree_add_item(tree, hf_scsi_osd_object_created_time, tvb, offset, 6, ENC_NA); - offset+=6; + offset += 6; /* object type */ proto_tree_add_item(tree, hf_scsi_osd_object_type, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; /* permission bitmask */ dissect_osd_permissions(tvb, offset, tree); - offset+=5; + offset += 5; /* a reserved byte */ - offset++; + offset += 1; /* object descriptor type */ proto_tree_add_item(tree, hf_scsi_osd_object_descriptor_type, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; /* object descriptor */ proto_tree_add_item(tree, hf_scsi_osd_object_descriptor, tvb, offset, 24, ENC_NA); - /*offset+=24;*/ + /*offset += 24;*/ return; } @@ -1188,10 +1188,10 @@ dissect_osd_capability(tvbuff_t *tvb, int offset, proto_tree *parent_tree) static int dissect_osd_security_parameters(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item = NULL; + proto_tree *tree = NULL; - if(parent_tree){ + if (parent_tree) { item = proto_tree_add_text(parent_tree, tvb, offset, 40, "Security Parameters"); tree = proto_item_add_subtree(item, ett_osd_security_parameters); @@ -1199,19 +1199,19 @@ dissect_osd_security_parameters(tvbuff_t *tvb, int offset, proto_tree *parent_tr /* request integrity check value */ proto_tree_add_item(tree, hf_scsi_osd_ricv, tvb, offset, 20, ENC_NA); - offset+=20; + offset += 20; /* request nonce */ proto_tree_add_item(tree, hf_scsi_osd_request_nonce, tvb, offset, 12, ENC_NA); - offset+=12; + offset += 12; /* data in integrity check value offset */ proto_tree_add_item(tree, hf_scsi_osd_diicvo, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; /* data out integrity check value offset */ proto_tree_add_item(tree, hf_scsi_osd_doicvo, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; return offset; } @@ -1224,44 +1224,44 @@ dissect_osd_format_osd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info _U_) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 23 reserved bytes */ - offset+=23; + offset += 23; /* formatted capacity */ dissect_osd_formatted_capacity(tvb, offset, tree); - offset+=8; + offset += 8; /* 8 reserved bytes */ - offset+=8; + offset += 8; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1269,7 +1269,7 @@ dissect_osd_format_osd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1285,51 +1285,51 @@ dissect_osd_partition_id(packet_info *pinfo, tvbuff_t *tvb, int offset, scsi_osd_lun_info_t *lun_info, gboolean is_created, gboolean is_removed) { - proto_item *item=NULL; - guint32 partition_id[2]; + proto_item *item = NULL; + guint32 partition_id[2]; /* partition id */ - item=proto_tree_add_item(tree, hf_index, tvb, offset, 8, ENC_BIG_ENDIAN); - partition_id[0]=tvb_get_ntohl(tvb, offset); - partition_id[1]=tvb_get_ntohl(tvb, offset+4); - if(!partition_id[0] && !partition_id[1]){ + item = proto_tree_add_item(tree, hf_index, tvb, offset, 8, ENC_BIG_ENDIAN); + partition_id[0] = tvb_get_ntohl(tvb, offset); + partition_id[1] = tvb_get_ntohl(tvb, offset+4); + if (!partition_id[0] && !partition_id[1]) { proto_item_append_text(item, " (ROOT partition)"); } else { partition_info_t *part_info; wmem_tree_key_t pikey[2]; - proto_tree *partition_tree=NULL; - - pikey[0].length=2; - pikey[0].key=partition_id; - pikey[1].length=0; - part_info=(partition_info_t *)wmem_tree_lookup32_array(lun_info->partitions, &pikey[0]); - if(!part_info){ - part_info=wmem_new(wmem_file_scope(), partition_info_t); - part_info->created_in=0; - part_info->removed_in=0; - - pikey[0].length=2; - pikey[0].key=partition_id; - pikey[1].length=0; + proto_tree *partition_tree = NULL; + + pikey[0].length = 2; + pikey[0].key = partition_id; + pikey[1].length = 0; + part_info = (partition_info_t *)wmem_tree_lookup32_array(lun_info->partitions, &pikey[0]); + if (!part_info) { + part_info = wmem_new(wmem_file_scope(), partition_info_t); + part_info->created_in = 0; + part_info->removed_in = 0; + + pikey[0].length = 2; + pikey[0].key = partition_id; + pikey[1].length = 0; wmem_tree_insert32_array(lun_info->partitions, &pikey[0], part_info); } - if(is_created){ - part_info->created_in=pinfo->fd->num; + if (is_created) { + part_info->created_in = pinfo->fd->num; } - if(is_removed){ - part_info->removed_in=pinfo->fd->num; + if (is_removed) { + part_info->removed_in = pinfo->fd->num; } - if(item){ - partition_tree=proto_item_add_subtree(item, ett_osd_partition); + if (item) { + partition_tree = proto_item_add_subtree(item, ett_osd_partition); } - if(part_info->created_in){ + if (part_info->created_in) { proto_item *tmp_item; - tmp_item=proto_tree_add_uint(partition_tree, hf_scsi_osd_partition_created_in, tvb, 0, 0, part_info->created_in); + tmp_item = proto_tree_add_uint(partition_tree, hf_scsi_osd_partition_created_in, tvb, 0, 0, part_info->created_in); PROTO_ITEM_SET_GENERATED(tmp_item); } - if(part_info->removed_in){ + if (part_info->removed_in) { proto_item *tmp_item; - tmp_item=proto_tree_add_uint(partition_tree, hf_scsi_osd_partition_removed_in, tvb, 0, 0, part_info->removed_in); + tmp_item = proto_tree_add_uint(partition_tree, hf_scsi_osd_partition_removed_in, tvb, 0, 0, part_info->removed_in); PROTO_ITEM_SET_GENERATED(tmp_item); } } @@ -1347,55 +1347,55 @@ dissect_osd_create_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree scsi_osd_lun_info_t *lun_info) { gboolean osd2 = ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->svcaction&0x80; - ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2=osd2; + ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2 = osd2; /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ - if (osd2) dissect_osd2_isolation(tvb,offset,tree); + if (osd2) dissect_osd2_isolation(tvb, offset, tree); dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* requested partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_requested_partition_id, lun_info, TRUE, FALSE); - offset+=8; + offset += 8; /* 24 reserved bytes */ - offset+=24; + offset += 24; if (osd2) { dissect_osd2_cdb_continuation_length(pinfo, tvb, offset, tree, cdata); } else { /* 4 reserved bytes */ } - offset+=4; + offset += 4; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=osd2?104:80; + offset += osd2?104:80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=osd2?52:40; + offset += osd2?52:40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* CDB continuation */ dissect_osd2_cdb_continuation(pinfo, tvb, offset, tree, cdata); @@ -1406,7 +1406,7 @@ dissect_osd_create_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1424,7 +1424,7 @@ dissect_osd_sortorder(tvbuff_t *tvb, int offset, proto_tree *tree) { /* sort order */ proto_tree_add_item(tree, hf_scsi_osd_sortorder, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; return offset; } @@ -1434,7 +1434,7 @@ dissect_osd_list_identifier(tvbuff_t *tvb, int offset, proto_tree *tree) { /* list identifier */ proto_tree_add_item(tree, hf_scsi_osd_list_identifier, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; + offset += 4; return offset; } @@ -1446,11 +1446,11 @@ dissect_osd_allocation_length(tvbuff_t *tvb, int offset, proto_tree *tree, scsi_ proto_tree_add_item(tree, hf_scsi_osd_allocation_length, tvb, offset, 8, ENC_BIG_ENDIAN); if (cdata) { - guint64 alloc_len = tvb_get_ntoh64(tvb,offset); + guint64 alloc_len = tvb_get_ntoh64(tvb, offset); if (alloc_len>G_GINT64_CONSTANT(0xFFFFFFFF)) { - alloc_len=G_GINT64_CONSTANT(0xFFFFFFFF); + alloc_len = G_GINT64_CONSTANT(0xFFFFFFFF); } - cdata->itlq->alloc_len=(guint32)alloc_len; + cdata->itlq->alloc_len = (guint32)alloc_len; } } @@ -1459,7 +1459,7 @@ dissect_osd_initial_object_id(tvbuff_t *tvb, int offset, proto_tree *tree) { /* initial object id */ proto_tree_add_item(tree, hf_scsi_osd_initial_object_id, tvb, offset, 8, ENC_NA); - offset+=8; + offset += 8; return offset; } @@ -1469,7 +1469,7 @@ dissect_osd_additional_length(tvbuff_t *tvb, int offset, proto_tree *tree) { /* additional length */ proto_tree_add_item(tree, hf_scsi_osd_additional_length, tvb, offset, 8, ENC_BIG_ENDIAN); - offset+=8; + offset += 8; return offset; } @@ -1480,7 +1480,7 @@ dissect_osd_continuation_object_id(tvbuff_t *tvb, int offset, proto_tree *tree) { /* continuation object id */ proto_tree_add_item(tree, hf_scsi_osd_continuation_object_id, tvb, offset, 8, ENC_NA); - offset+=8; + offset += 8; return offset; } @@ -1502,7 +1502,7 @@ static proto_item* dissect_osd_collection_object_id(tvbuff_t *tvb, int offset, proto_tree *tree, const int hfindex) { /* collection object id */ - proto_item* item; + proto_item *item; item = proto_tree_add_item(tree, hfindex, tvb, offset, 8, ENC_NA); return item; } @@ -1514,34 +1514,34 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_conv_info_t *conv_info _U_, scsi_osd_lun_info_t *lun_info) { - guint svcaction = ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->svcaction; - gboolean list_collection = (svcaction==0x8817) || (svcaction==0x8897); - gboolean osd2 = svcaction&0x80; - ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2=osd2; + guint svcaction = ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->svcaction; + gboolean list_collection = (svcaction == 0x8817) || (svcaction == 0x8897); + gboolean osd2 = svcaction&0x80; + ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2 = osd2; /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /*byte 10*/ - if (osd2) dissect_osd2_isolation(tvb,offset,tree); - offset++; + if (osd2) dissect_osd2_isolation(tvb, offset, tree); + offset += 1; /* getset attributes byte / sort order */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); if (!list_collection) dissect_osd_sortorder(tvb, offset, tree); - if (osd2) dissect_osd2_list_attr(tvb,offset,tree); - offset++; + if (osd2) dissect_osd2_list_attr(tvb, offset, tree); + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; if (list_collection) { /* collection id */ @@ -1549,50 +1549,50 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { /* 8 reserved bytes */ } - offset+=8; + offset += 8; if (osd2) { /* allocation length */ dissect_osd_allocation_length(tvb, offset, tree, cdata); - offset+=8; + offset += 8; /* initial object id */ dissect_osd_initial_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* list identifier */ dissect_osd_list_identifier(tvb, offset, tree); - offset+=4; + offset += 4; } else { /* list identifier */ dissect_osd_list_identifier(tvb, offset, tree); - offset+=4; + offset += 4; /* allocation length */ dissect_osd_allocation_length(tvb, offset, tree, cdata); - offset+=8; + offset += 8; /* initial object id */ dissect_osd_initial_object_id(tvb, offset, tree); - offset+=8; + offset += 8; } /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=osd2?104:80; + offset += osd2?104:80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=osd2?52:40; + offset += osd2?52:40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1600,7 +1600,7 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { guint64 additional_length; guint64 allocation_length; @@ -1611,27 +1611,27 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); - allocation_length=cdata->itlq->alloc_len; - remaining_length=tvb_length_remaining(tvb, offset); - if (remaining_length<allocation_length) allocation_length=remaining_length; + allocation_length = cdata->itlq->alloc_len; + remaining_length = tvb_length_remaining(tvb, offset); + if (remaining_length<allocation_length) allocation_length = remaining_length; if (allocation_length<24) return; /* dissection of the LIST or LIST COLLECTION DATA-IN */ /* additional length */ - additional_length=tvb_get_ntoh64(tvb, offset); - if (allocation_length<additional_length) additional_length=allocation_length; + additional_length = tvb_get_ntoh64(tvb, offset); + if (allocation_length<additional_length) additional_length = allocation_length; dissect_osd_additional_length(tvb, offset, tree); - offset+=8; + offset += 8; /* continuation object id */ dissect_osd_continuation_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* list identifier */ dissect_osd_list_identifier(tvb, offset, tree); - offset+=4; + offset += 4; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* OSD: LSTCHG and ROOT flags OSD2: LSTCHG and OBJECT DESCRIPTOR FORMAT*/ @@ -1640,17 +1640,17 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item; item = proto_tree_add_item(tree, hf_scsi_osd2_object_descriptor_format, tvb, offset, 1, ENC_BIG_ENDIAN); format = tvb_get_guint8(tvb, offset)>>2; - if (format==0x01||format==0x02) { - is_root_or_coltn=TRUE; - if (list_collection) format=0; - } else if (format==0x11||format==0x12) { - is_root_or_coltn=TRUE; - if (!list_collection) format=0; - } else if (format==0x21||format==0x22) { - is_root_or_coltn=FALSE; - } else format=0; + if (format == 0x01 || format == 0x02) { + is_root_or_coltn = TRUE; + if (list_collection) format = 0; + } else if (format == 0x11 || format == 0x12) { + is_root_or_coltn = TRUE; + if (!list_collection) format = 0; + } else if (format == 0x21 || format == 0x22) { + is_root_or_coltn = FALSE; + } else format = 0; if (!format) { - expert_add_info(pinfo,item,&ei_osd2_invalid_object_descriptor_format); + expert_add_info(pinfo, item, &ei_osd2_invalid_object_descriptor_format); return; } } else { @@ -1659,27 +1659,27 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { proto_tree_add_item(tree, hf_scsi_osd_list_flags_root, tvb, offset, 1, ENC_BIG_ENDIAN); } - is_root_or_coltn=tvb_get_guint8(tvb, offset)&0x01; + is_root_or_coltn = tvb_get_guint8(tvb, offset)&0x01; } - offset++; + offset += 1; - while(additional_length > (offset-8)) { + while (additional_length > (offset-8)) { proto_item *ti; /* list of 8-byte IDs; the type of ID is given by is_root_or_coltn and list_collection*/ - if(is_root_or_coltn){ - if (list_collection){ - ti=dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd_collection_object_id); + if (is_root_or_coltn) { + if (list_collection) { + ti = dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd_collection_object_id); } else { - ti=dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); + ti = dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); } } else { - ti=dissect_osd_user_object_id(tvb, offset, tree); + ti = dissect_osd_user_object_id(tvb, offset, tree); } - offset+=8; + offset += 8; /* for OSD-2 if format is 0x02, 0x12 or 0x22: sub-list of attributes*/ - if (osd2&&(format&0x02)) { + if (osd2 && (format&0x02)) { guint32 attr_list_end; proto_tree *subtree; @@ -1688,20 +1688,20 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /*object type*/ proto_tree_add_item(subtree, hf_scsi_osd_object_type, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; /* 5 reserved bytes */ - offset+=5; + offset += 5; /* attribute list length*/ - attr_list_end=offset+2+tvb_get_ntohs(tvb, offset); - offset+=2; + attr_list_end = offset+2+tvb_get_ntohs(tvb, offset); + offset += 2; if (attr_list_end>additional_length+8) break; while (offset+16<attr_list_end) { - guint32 attribute_length=tvb_get_ntohs(tvb, offset+14); + guint32 attribute_length = tvb_get_ntohs(tvb, offset+14); proto_item *att_item = proto_tree_add_text(subtree, tvb, offset, 16+attribute_length, "Attribute:"); proto_tree *att_tree = proto_item_add_subtree(att_item, ett_osd_attribute); - offset=dissect_osd_attribute_list_entry(pinfo,tvb,att_tree,att_item,offset,lun_info,TRUE); + offset = dissect_osd_attribute_list_entry(pinfo, tvb, att_tree, att_item, offset, lun_info, TRUE); } - offset=attr_list_end; + offset = attr_list_end; } } @@ -1714,7 +1714,7 @@ dissect_osd_requested_user_object_id(tvbuff_t *tvb, int offset, proto_tree *tree { /* request user object id */ proto_tree_add_item(tree, hf_scsi_osd_requested_user_object_id, tvb, offset, 8, ENC_NA); - offset+=8; + offset += 8; return offset; } @@ -1724,7 +1724,7 @@ dissect_osd_number_of_user_objects(tvbuff_t *tvb, int offset, proto_tree *tree) { /* number_of_user_objects */ proto_tree_add_item(tree, hf_scsi_osd_number_of_user_objects, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; + offset += 2; return offset; } @@ -1737,55 +1737,55 @@ dissect_osd_create(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* requested user_object id */ dissect_osd_requested_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 4 reserved bytes */ - offset+=4; + offset += 4; /* number of user objects */ dissect_osd_number_of_user_objects(tvb, offset, tree); - offset+=2; + offset += 2; /* 14 reserved bytes */ - offset+=14; + offset += 14; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1793,7 +1793,7 @@ dissect_osd_create(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1811,56 +1811,56 @@ dissect_osd_remove_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree scsi_osd_lun_info_t *lun_info) { gboolean osd2 = ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->svcaction&0x80; - ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2=osd2; + ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2 = osd2; /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ - if (osd2) dissect_osd2_isolation(tvb,offset,tree); + if (osd2) dissect_osd2_isolation(tvb, offset, tree); dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); if (osd2) proto_tree_add_item(tree, hf_scsi_osd2_remove_scope, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, TRUE); - offset+=8; + offset += 8; /* 24 reserved bytes */ - offset+=24; + offset += 24; if (osd2) { dissect_osd2_cdb_continuation_length(pinfo, tvb, offset, tree, cdata); } else { /* 4 reserved bytes */ } - offset+=4; + offset += 4; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=osd2?104:80; + offset += osd2?104:80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=osd2?52:40; + offset += osd2?52:40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* CDB continuation */ dissect_osd2_cdb_continuation(pinfo, tvb, offset, tree, cdata); @@ -1871,7 +1871,7 @@ dissect_osd_remove_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1918,53 +1918,53 @@ dissect_osd_set_key(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* a reserved byte */ - offset++; + offset += 1; /* getset attributes byte and key to set*/ dissect_osd_getsetattrib(tvb, offset, tree, cdata); dissect_osd_key_to_set(tvb, offset, tree); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* key version */ dissect_osd_set_key_version(tvb, offset, tree); - offset++; + offset += 1; /* key identifier */ dissect_osd_key_identifier(tvb, offset, tree); - offset+=7; + offset += 7; /* seed */ dissect_osd_seed(tvb, offset, tree); - offset+=20; + offset += 20; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1972,7 +1972,7 @@ dissect_osd_set_key(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -1989,48 +1989,48 @@ dissect_osd_remove(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* user object id */ dissect_osd_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 20 reserved bytes */ - offset+=20; + offset += 20; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2038,7 +2038,7 @@ dissect_osd_remove(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2061,59 +2061,59 @@ dissect_osd_remove_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre scsi_osd_lun_info_t *lun_info) { gboolean osd2 = ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->svcaction&0x80; - ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2=osd2; + ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2 = osd2; /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); dissect_osd_collection_fcr(tvb, offset, tree); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* collection object id */ dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd_collection_object_id); - offset+=8; + offset += 8; /* 16 reserved bytes */ - offset+=16; + offset += 16; if (osd2) { dissect_osd2_cdb_continuation_length(pinfo, tvb, offset, tree, cdata); } else { /* 4 reserved bytes */ } - offset+=4; + offset += 4; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=osd2?104:80; + offset += osd2?104:80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=osd2?52:40; + offset += osd2?52:40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* CDB continuation */ dissect_osd2_cdb_continuation(pinfo, tvb, offset, tree, cdata); @@ -2124,7 +2124,7 @@ dissect_osd_remove_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2139,7 +2139,7 @@ dissect_osd_length(tvbuff_t *tvb, int offset, proto_tree *tree) { /* length */ proto_tree_add_item(tree, hf_scsi_osd_length, tvb, offset, 8, ENC_BIG_ENDIAN); - offset+=8; + offset += 8; return offset; } @@ -2149,7 +2149,7 @@ dissect_osd_starting_byte_address(tvbuff_t *tvb, int offset, proto_tree *tree) { /* starting_byte_address */ proto_tree_add_item(tree, hf_scsi_osd_starting_byte_address, tvb, offset, 8, ENC_BIG_ENDIAN); - offset+=8; + offset += 8; return offset; } @@ -2163,56 +2163,56 @@ dissect_osd_write(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte / sort order */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* user object id */ dissect_osd_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 4 reserved bytes */ - offset+=4; + offset += 4; /* length */ dissect_osd_length(tvb, offset, tree); - offset+=8; + offset += 8; /* starting byte address */ dissect_osd_starting_byte_address(tvb, offset, tree); - offset+=8; + offset += 8; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2220,7 +2220,7 @@ dissect_osd_write(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2237,49 +2237,49 @@ dissect_osd_create_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); dissect_osd_collection_fcr(tvb, offset, tree); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* requested collection object id */ dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd_requested_collection_object_id); - offset+=8; + offset += 8; /* 20 reserved bytes */ - offset+=20; + offset += 20; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2287,7 +2287,7 @@ dissect_osd_create_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2308,7 +2308,7 @@ dissect_osd_flush_scope(tvbuff_t *tvb, int offset, proto_tree *tree) { /* flush scope */ proto_tree_add_item(tree, hf_scsi_osd_flush_scope, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; return offset; } @@ -2321,48 +2321,48 @@ dissect_osd_flush(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_flush_scope(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* user object id */ dissect_osd_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 20 reserved bytes */ - offset+=20; + offset += 20; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2370,7 +2370,7 @@ dissect_osd_flush(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2392,7 +2392,7 @@ dissect_osd_flush_collection_scope(tvbuff_t *tvb, int offset, proto_tree *tree) { /* flush collection scope */ proto_tree_add_item(tree, hf_scsi_osd_flush_collection_scope, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; return offset; } @@ -2405,49 +2405,49 @@ dissect_osd_flush_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_flush_collection_scope(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); dissect_osd_collection_fcr(tvb, offset, tree); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* collection object id */ dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd_collection_object_id); - offset+=8; + offset += 8; /* 20 reserved bytes */ - offset+=20; + offset += 20; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2455,7 +2455,7 @@ dissect_osd_flush_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2473,55 +2473,55 @@ dissect_osd_append(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* user object id */ dissect_osd_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 4 reserved bytes */ - offset+=4; + offset += 4; /* length */ dissect_osd_length(tvb, offset, tree); - offset+=8; + offset += 8; /* 8 reserved bytes */ - offset+=8; + offset += 8; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2529,7 +2529,7 @@ dissect_osd_append(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2546,56 +2546,56 @@ dissect_osd_create_and_write(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* requested user_object id */ dissect_osd_requested_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 4 reserved bytes */ - offset+=4; + offset += 4; /* length */ dissect_osd_length(tvb, offset, tree); - offset+=8; + offset += 8; /* starting byte address */ dissect_osd_starting_byte_address(tvb, offset, tree); - offset+=8; + offset += 8; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2603,7 +2603,7 @@ dissect_osd_create_and_write(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2625,7 +2625,7 @@ dissect_osd_flush_osd_scope(tvbuff_t *tvb, int offset, proto_tree *tree) { /* flush osd scope */ proto_tree_add_item(tree, hf_scsi_osd_flush_osd_scope, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; return offset; } @@ -2638,37 +2638,37 @@ dissect_osd_flush_osd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info _U_) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_flush_osd_scope(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 39 reserved bytes */ - offset+=39; + offset += 39; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2676,7 +2676,7 @@ dissect_osd_flush_osd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2698,7 +2698,7 @@ dissect_osd_flush_partition_scope(tvbuff_t *tvb, int offset, proto_tree *tree) { /* flush partition scope */ proto_tree_add_item(tree, hf_scsi_osd_flush_partition_scope, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; return offset; } @@ -2712,44 +2712,44 @@ dissect_osd_flush_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_flush_partition_scope(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* 28 reserved bytes */ - offset+=28; + offset += 28; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2757,7 +2757,7 @@ dissect_osd_flush_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2775,58 +2775,58 @@ dissect_osd_get_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { gboolean osd2 = ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->svcaction&0x80; - ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2=osd2; + ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2 = osd2; /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* user_object id */ dissect_osd_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 16 reserved bytes */ - offset+=16; + offset += 16; if (osd2) { dissect_osd2_cdb_continuation_length(pinfo, tvb, offset, tree, cdata); } else { /* 4 reserved bytes */ } - offset+=4; + offset += 4; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=osd2?104:80; + offset += osd2?104:80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=osd2?52:40; + offset += osd2?52:40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2834,7 +2834,7 @@ dissect_osd_get_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2852,56 +2852,56 @@ dissect_osd_read(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte / sort order */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* user object id */ dissect_osd_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 4 reserved bytes */ - offset+=4; + offset += 4; /* length */ dissect_osd_length(tvb, offset, tree); - offset+=8; + offset += 8; /* starting byte address */ dissect_osd_starting_byte_address(tvb, offset, tree); - offset+=8; + offset += 8; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=80; + offset += 80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=40; + offset += 40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2909,7 +2909,7 @@ dissect_osd_read(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2927,58 +2927,58 @@ dissect_osd_set_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_lun_info_t *lun_info) { gboolean osd2 = ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->svcaction&0x80; - ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2=osd2; + ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2 = osd2; /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partiton id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* user_object id */ dissect_osd_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; /* 16 reserved bytes */ - offset+=16; + offset += 16; if (osd2) { dissect_osd2_cdb_continuation_length(pinfo, tvb, offset, tree, cdata); } else { /* 4 reserved bytes */ } - offset+=4; + offset += 4; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=osd2?104:80; + offset += osd2?104:80; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=osd2?52:40; + offset += osd2?52:40; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* attribute data out */ dissect_osd_attribute_data_out(pinfo, tvb, offset, tree, cdata, lun_info); @@ -2986,7 +2986,7 @@ dissect_osd_set_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -3003,61 +3003,61 @@ dissect_osd2_create_user_tracking_collection(tvbuff_t *tvb, packet_info *pinfo, scsi_osd_conv_info_t *conv_info _U_, scsi_osd_lun_info_t *lun_info) { - ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2=TRUE; + ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2 = TRUE; /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* options byte */ - dissect_osd2_isolation(tvb,offset,tree); + dissect_osd2_isolation(tvb, offset, tree); dissect_osd_option(tvb, offset, tree); - offset++; + offset += 1; /* getset attributes byte */ dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partition id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* user_object id */ dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd_requested_collection_object_id); - offset+=8; + offset += 8; /* 8 reserved bytes */ - offset+=8; + offset += 8; /* source collection id */ dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd2_source_collection_object_id); - offset+=8; + offset += 8; /*cdb continuation length*/ dissect_osd2_cdb_continuation_length(pinfo, tvb, offset, tree, cdata); - offset+=4; + offset += 4; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=104; + offset += 104; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=52; + offset += 52; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* CDB continuation */ dissect_osd2_cdb_continuation(pinfo, tvb, offset, tree, cdata); @@ -3068,7 +3068,7 @@ dissect_osd2_create_user_tracking_collection(tvbuff_t *tvb, packet_info *pinfo, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); @@ -3084,62 +3084,62 @@ dissect_osd2_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_conv_info_t *conv_info _U_, scsi_osd_lun_info_t *lun_info) { - ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2=TRUE; + ((scsi_osd_extra_data_t *)cdata->itlq->extra_data)->osd2 = TRUE; /* dissecting the CDB dissection starts at byte 10 of the CDB */ - if(isreq && iscdb){ + if (isreq && iscdb) { /* isolation field */ - dissect_osd2_isolation(tvb,offset,tree); - offset++; + dissect_osd2_isolation(tvb, offset, tree); + offset += 1; /* immed_tr, getset attributes*/ proto_tree_add_item(tree, hf_scsi_osd2_immed_tr, tvb, offset, 1, ENC_BIG_ENDIAN); dissect_osd_getsetattrib(tvb, offset, tree, cdata); - offset++; + offset += 1; /* timestamps control */ dissect_osd_timestamps_control(tvb, offset, tree); - offset++; + offset += 1; /* 3 reserved bytes */ - offset+=3; + offset += 3; /* partition id */ dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE); - offset+=8; + offset += 8; /* collection_object id */ dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd_collection_object_id); - offset+=8; + offset += 8; /* allocation_length */ dissect_osd_allocation_length(tvb, offset, tree, cdata); - offset+=8; + offset += 8; /* matches collection id */ dissect_osd_collection_object_id(tvb, offset, tree, hf_scsi_osd2_matches_collection_object_id); - offset+=8; + offset += 8; /*cdb continuation length*/ dissect_osd2_cdb_continuation_length(pinfo, tvb, offset, tree, cdata); - offset+=4; + offset += 4; /* attribute parameters */ dissect_osd_attribute_parameters(pinfo, tvb, offset, tree, cdata); - offset+=28; + offset += 28; /* capability */ dissect_osd_capability(tvb, offset, tree); - offset+=104; + offset += 104; /* security parameters */ dissect_osd_security_parameters(tvb, offset, tree); - offset+=52; + offset += 52; } /* dissecting the DATA OUT */ - if(isreq && !iscdb){ + if (isreq && !iscdb) { /* CDB continuation */ dissect_osd2_cdb_continuation(pinfo, tvb, offset, tree, cdata); @@ -3150,7 +3150,7 @@ dissect_osd2_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissecting the DATA IN */ - if(!isreq && !iscdb){ + if (!isreq && !iscdb) { guint64 additional_length; guint64 allocation_length; guint64 remaining_length; @@ -3160,173 +3160,173 @@ dissect_osd2_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* attribute data in */ dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); - allocation_length=cdata->itlq->alloc_len; - remaining_length=tvb_length_remaining(tvb, offset); - if (remaining_length<allocation_length) allocation_length=remaining_length; + allocation_length = cdata->itlq->alloc_len; + remaining_length = tvb_length_remaining(tvb, offset); + if (remaining_length<allocation_length) allocation_length = remaining_length; if (allocation_length<12) return; /* dissection of the LIST or LIST COLLECTION DATA-IN */ /* additional length */ - additional_length=tvb_get_ntoh64(tvb, offset); - if ((guint32)(allocation_length-8)<additional_length) additional_length=(guint32)(allocation_length-8); + additional_length = tvb_get_ntoh64(tvb, offset); + if ((guint32)(allocation_length-8)<additional_length) additional_length = (guint32)(allocation_length-8); dissect_osd_additional_length(tvb, offset, tree); - offset+=8; + offset += 8; /* 3 reserved bytes */ - offset+=3; + offset += 3; item = proto_tree_add_item(tree, hf_scsi_osd2_object_descriptor_format, tvb, offset, 1, ENC_BIG_ENDIAN); format = tvb_get_guint8(tvb, offset)>>2; - offset++; - if (format!=0x21) { - expert_add_info(pinfo,item,&ei_osd2_invalid_object_descriptor_format); + offset += 1; + if (format != 0x21) { + expert_add_info(pinfo, item, &ei_osd2_invalid_object_descriptor_format); return; } - while(additional_length > (offset-4)) { + while (additional_length > (offset-4)) { dissect_osd_user_object_id(tvb, offset, tree); - offset+=8; + offset += 8; } } } /* OSD Service Actions */ -#define OSD_FORMAT_OSD 0x8801 -#define OSD_CREATE 0x8802 -#define OSD_LIST 0x8803 -#define OSD_READ 0x8805 -#define OSD_WRITE 0x8806 -#define OSD_APPEND 0x8807 -#define OSD_FLUSH 0x8808 -#define OSD_REMOVE 0x880a -#define OSD_CREATE_PARTITION 0x880b -#define OSD_REMOVE_PARTITION 0x880c -#define OSD_GET_ATTRIBUTES 0x880e -#define OSD_SET_ATTRIBUTES 0x880f -#define OSD_CREATE_AND_WRITE 0x8812 -#define OSD_CREATE_COLLECTION 0x8815 -#define OSD_REMOVE_COLLECTION 0x8816 -#define OSD_LIST_COLLECTION 0x8817 -#define OSD_SET_KEY 0x8818 -#define OSD_FLUSH_COLLECTION 0x881a -#define OSD_FLUSH_PARTITION 0x881b -#define OSD_FLUSH_OSD 0x881c - -#define OSD_2_CREATE 0x8882 -#define OSD_2_LIST 0x8883 -#define OSD_2_READ 0x8885 -#define OSD_2_WRITE 0x8886 -#define OSD_2_APPEND 0x8887 -#define OSD_2_CLEAR 0x8889 -#define OSD_2_REMOVE 0x888a -#define OSD_2_CREATE_PARTITION 0x888b -#define OSD_2_REMOVE_PARTITION 0x888c -#define OSD_2_GET_ATTRIBUTES 0x888e -#define OSD_2_SET_ATTRIBUTES 0x888f -#define OSD_2_CREATE_AND_WRITE 0x8892 -#define OSD_2_COPY_USER_OBJECTS 0x8893 -#define OSD_2_CREATE_USER_TRACKING_COLLECTION 0x8894 -#define OSD_2_REMOVE_COLLECTION 0x8896 -#define OSD_2_LIST_COLLECTION 0x8897 -#define OSD_2_QUERY 0x88a0 -#define OSD_2_REMOVE_MEMBER_OBJECTS 0x88a1 -#define OSD_2_GET_MEMBER_ATTRIBUTES 0x88a2 -#define OSD_2_SET_MEMBER_ATTRIBUTES 0x88a3 +#define OSD_FORMAT_OSD 0x8801 +#define OSD_CREATE 0x8802 +#define OSD_LIST 0x8803 +#define OSD_READ 0x8805 +#define OSD_WRITE 0x8806 +#define OSD_APPEND 0x8807 +#define OSD_FLUSH 0x8808 +#define OSD_REMOVE 0x880a +#define OSD_CREATE_PARTITION 0x880b +#define OSD_REMOVE_PARTITION 0x880c +#define OSD_GET_ATTRIBUTES 0x880e +#define OSD_SET_ATTRIBUTES 0x880f +#define OSD_CREATE_AND_WRITE 0x8812 +#define OSD_CREATE_COLLECTION 0x8815 +#define OSD_REMOVE_COLLECTION 0x8816 +#define OSD_LIST_COLLECTION 0x8817 +#define OSD_SET_KEY 0x8818 +#define OSD_FLUSH_COLLECTION 0x881a +#define OSD_FLUSH_PARTITION 0x881b +#define OSD_FLUSH_OSD 0x881c + +#define OSD_2_CREATE 0x8882 +#define OSD_2_LIST 0x8883 +#define OSD_2_READ 0x8885 +#define OSD_2_WRITE 0x8886 +#define OSD_2_APPEND 0x8887 +#define OSD_2_CLEAR 0x8889 +#define OSD_2_REMOVE 0x888a +#define OSD_2_CREATE_PARTITION 0x888b +#define OSD_2_REMOVE_PARTITION 0x888c +#define OSD_2_GET_ATTRIBUTES 0x888e +#define OSD_2_SET_ATTRIBUTES 0x888f +#define OSD_2_CREATE_AND_WRITE 0x8892 +#define OSD_2_COPY_USER_OBJECTS 0x8893 +#define OSD_2_CREATE_USER_TRACKING_COLLECTION 0x8894 +#define OSD_2_REMOVE_COLLECTION 0x8896 +#define OSD_2_LIST_COLLECTION 0x8897 +#define OSD_2_QUERY 0x88a0 +#define OSD_2_REMOVE_MEMBER_OBJECTS 0x88a1 +#define OSD_2_GET_MEMBER_ATTRIBUTES 0x88a2 +#define OSD_2_SET_MEMBER_ATTRIBUTES 0x88a3 static const value_string scsi_osd_svcaction_vals[] = { - {OSD_FORMAT_OSD, "Format OSD"}, - {OSD_CREATE, "Create"}, - {OSD_LIST, "List"}, - {OSD_READ, "Read"}, - {OSD_WRITE, "Write"}, - {OSD_APPEND, "Append"}, - {OSD_FLUSH, "Flush"}, - {OSD_REMOVE, "Remove"}, - {OSD_CREATE_PARTITION, "Create Partition"}, - {OSD_REMOVE_PARTITION, "Remove Partition"}, - {OSD_GET_ATTRIBUTES, "Get Attributes"}, - {OSD_SET_ATTRIBUTES, "Set Attributes"}, - {OSD_CREATE_AND_WRITE, "Create And Write"}, - {OSD_CREATE_COLLECTION, "Create Collection"}, - {OSD_REMOVE_COLLECTION, "Remove Collection"}, - {OSD_LIST_COLLECTION, "List Collection"}, - {OSD_SET_KEY, "Set Key"}, - {OSD_FLUSH_COLLECTION, "Flush Collection"}, - {OSD_FLUSH_PARTITION, "Flush Partition"}, - {OSD_FLUSH_OSD, "Flush OSD"}, - {OSD_2_CREATE, "Create (OSD-2)"}, - {OSD_2_LIST, "List (OSD-2)"}, - {OSD_2_READ, "Read (OSD-2)"}, - {OSD_2_WRITE, "Write (OSD-2)"}, - {OSD_2_APPEND, "Append (OSD-2)"}, - {OSD_2_CLEAR, "Clear (OSD-2)"}, - {OSD_2_REMOVE, "Remove (OSD-2)"}, - {OSD_2_CREATE_PARTITION, "Create Partition (OSD-2)"}, - {OSD_2_REMOVE_PARTITION, "Remove Partition (OSD-2)"}, - {OSD_2_GET_ATTRIBUTES, "Get Attributes (OSD-2)"}, - {OSD_2_SET_ATTRIBUTES, "Set Attributes (OSD-2)"}, - {OSD_2_CREATE_AND_WRITE, "Create And Write (OSD-2)"}, - {OSD_2_REMOVE_COLLECTION, "Remove Collection (OSD-2)"}, - {OSD_2_LIST_COLLECTION, "List Collection (OSD-2)"}, - {OSD_2_COPY_USER_OBJECTS, "Copy User Objects (OSD-2)"}, + {OSD_FORMAT_OSD, "Format OSD"}, + {OSD_CREATE, "Create"}, + {OSD_LIST, "List"}, + {OSD_READ, "Read"}, + {OSD_WRITE, "Write"}, + {OSD_APPEND, "Append"}, + {OSD_FLUSH, "Flush"}, + {OSD_REMOVE, "Remove"}, + {OSD_CREATE_PARTITION, "Create Partition"}, + {OSD_REMOVE_PARTITION, "Remove Partition"}, + {OSD_GET_ATTRIBUTES, "Get Attributes"}, + {OSD_SET_ATTRIBUTES, "Set Attributes"}, + {OSD_CREATE_AND_WRITE, "Create And Write"}, + {OSD_CREATE_COLLECTION, "Create Collection"}, + {OSD_REMOVE_COLLECTION, "Remove Collection"}, + {OSD_LIST_COLLECTION, "List Collection"}, + {OSD_SET_KEY, "Set Key"}, + {OSD_FLUSH_COLLECTION, "Flush Collection"}, + {OSD_FLUSH_PARTITION, "Flush Partition"}, + {OSD_FLUSH_OSD, "Flush OSD"}, + + {OSD_2_CREATE, "Create (OSD-2)"}, + {OSD_2_LIST, "List (OSD-2)"}, + {OSD_2_READ, "Read (OSD-2)"}, + {OSD_2_WRITE, "Write (OSD-2)"}, + {OSD_2_APPEND, "Append (OSD-2)"}, + {OSD_2_CLEAR, "Clear (OSD-2)"}, + {OSD_2_REMOVE, "Remove (OSD-2)"}, + {OSD_2_CREATE_PARTITION, "Create Partition (OSD-2)"}, + {OSD_2_REMOVE_PARTITION, "Remove Partition (OSD-2)"}, + {OSD_2_GET_ATTRIBUTES, "Get Attributes (OSD-2)"}, + {OSD_2_SET_ATTRIBUTES, "Set Attributes (OSD-2)"}, + {OSD_2_CREATE_AND_WRITE, "Create And Write (OSD-2)"}, + {OSD_2_COPY_USER_OBJECTS, "Copy User Objects (OSD-2)"}, {OSD_2_CREATE_USER_TRACKING_COLLECTION, "Create User Tracking Collection (OSD-2)"}, - {OSD_2_REMOVE_COLLECTION, "Remove Collection (OSD-2)"}, - {OSD_2_LIST_COLLECTION, "List Collection (OSD-2)"}, - {OSD_2_QUERY, "Query (OSD-2)"}, - {OSD_2_REMOVE_MEMBER_OBJECTS, "Remove Member Objects (OSD-2)"}, - {OSD_2_GET_MEMBER_ATTRIBUTES, "Get Member Attributes (OSD-2)"}, - {OSD_2_SET_MEMBER_ATTRIBUTES, "Set Member Attributes (OSD-2)"}, + {OSD_2_REMOVE_COLLECTION, "Remove Collection (OSD-2)"}, + {OSD_2_LIST_COLLECTION, "List Collection (OSD-2)"}, + {OSD_2_QUERY, "Query (OSD-2)"}, + {OSD_2_REMOVE_MEMBER_OBJECTS, "Remove Member Objects (OSD-2)"}, + {OSD_2_GET_MEMBER_ATTRIBUTES, "Get Member Attributes (OSD-2)"}, + {OSD_2_SET_MEMBER_ATTRIBUTES, "Set Member Attributes (OSD-2)"}, {0, NULL}, }; +static value_string_ext scsi_osd_svcaction_vals_ext = VALUE_STRING_EXT_INIT(scsi_osd_svcaction_vals); /* OSD Service Action dissectors */ typedef struct _scsi_osd_svcaction_t { - guint16 svcaction; + guint16 svcaction; scsi_osd_dissector_t dissector; } scsi_osd_svcaction_t; static const scsi_osd_svcaction_t scsi_osd_svcaction[] = { - {OSD_FORMAT_OSD, dissect_osd_format_osd}, - {OSD_CREATE, dissect_osd_create}, - {OSD_LIST, dissect_osd_list}, - {OSD_READ, dissect_osd_read}, - {OSD_WRITE, dissect_osd_write}, - {OSD_APPEND, dissect_osd_append}, - {OSD_FLUSH, dissect_osd_flush}, - {OSD_REMOVE, dissect_osd_remove}, - {OSD_CREATE_PARTITION, dissect_osd_create_partition}, - {OSD_REMOVE_PARTITION, dissect_osd_remove_partition}, - {OSD_GET_ATTRIBUTES, dissect_osd_get_attributes}, - {OSD_SET_ATTRIBUTES, dissect_osd_set_attributes}, - {OSD_CREATE_AND_WRITE, dissect_osd_create_and_write}, - {OSD_CREATE_COLLECTION, dissect_osd_create_collection}, - {OSD_REMOVE_COLLECTION, dissect_osd_remove_collection}, - {OSD_LIST_COLLECTION, dissect_osd_list}, - {OSD_SET_KEY, dissect_osd_set_key}, - {OSD_FLUSH_COLLECTION, dissect_osd_flush_collection}, - {OSD_FLUSH_PARTITION, dissect_osd_flush_partition}, - {OSD_FLUSH_OSD, dissect_osd_flush_osd}, - {OSD_2_LIST, dissect_osd_list}, - {OSD_2_CREATE_PARTITION, dissect_osd_create_partition}, + {OSD_FORMAT_OSD, dissect_osd_format_osd}, + {OSD_CREATE, dissect_osd_create}, + {OSD_LIST, dissect_osd_list}, + {OSD_READ, dissect_osd_read}, + {OSD_WRITE, dissect_osd_write}, + {OSD_APPEND, dissect_osd_append}, + {OSD_FLUSH, dissect_osd_flush}, + {OSD_REMOVE, dissect_osd_remove}, + {OSD_CREATE_PARTITION, dissect_osd_create_partition}, + {OSD_REMOVE_PARTITION, dissect_osd_remove_partition}, + {OSD_GET_ATTRIBUTES, dissect_osd_get_attributes}, + {OSD_SET_ATTRIBUTES, dissect_osd_set_attributes}, + {OSD_CREATE_AND_WRITE, dissect_osd_create_and_write}, + {OSD_CREATE_COLLECTION, dissect_osd_create_collection}, + {OSD_REMOVE_COLLECTION, dissect_osd_remove_collection}, + {OSD_LIST_COLLECTION, dissect_osd_list}, + {OSD_SET_KEY, dissect_osd_set_key}, + {OSD_FLUSH_COLLECTION, dissect_osd_flush_collection}, + {OSD_FLUSH_PARTITION, dissect_osd_flush_partition}, + {OSD_FLUSH_OSD, dissect_osd_flush_osd}, + {OSD_2_LIST, dissect_osd_list}, + {OSD_2_CREATE_PARTITION, dissect_osd_create_partition}, {OSD_2_CREATE_USER_TRACKING_COLLECTION, dissect_osd2_create_user_tracking_collection}, - {OSD_2_REMOVE_PARTITION, dissect_osd_remove_partition}, - {OSD_2_LIST_COLLECTION, dissect_osd_list}, + {OSD_2_REMOVE_PARTITION, dissect_osd_remove_partition}, + {OSD_2_LIST_COLLECTION, dissect_osd_list}, {OSD_2_CREATE_USER_TRACKING_COLLECTION, dissect_osd2_create_user_tracking_collection}, - {OSD_2_REMOVE_COLLECTION, dissect_osd_remove_collection}, - {OSD_2_GET_ATTRIBUTES, dissect_osd_get_attributes}, - {OSD_2_SET_ATTRIBUTES, dissect_osd_set_attributes}, - {OSD_2_QUERY, dissect_osd2_query}, + {OSD_2_REMOVE_COLLECTION, dissect_osd_remove_collection}, + {OSD_2_GET_ATTRIBUTES, dissect_osd_get_attributes}, + {OSD_2_SET_ATTRIBUTES, dissect_osd_set_attributes}, + {OSD_2_QUERY, dissect_osd2_query}, {0, NULL}, }; static scsi_osd_dissector_t find_svcaction_dissector(guint16 svcaction) { - const scsi_osd_svcaction_t *sa=scsi_osd_svcaction; + const scsi_osd_svcaction_t *sa = scsi_osd_svcaction; - while(sa&&sa->dissector){ - if(sa->svcaction==svcaction){ + while (sa && sa->dissector) { + if (sa->svcaction == svcaction) { return sa->dissector; } sa++; @@ -3341,70 +3341,70 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len, scsi_task_data_t *cdata) { - guint16 svcaction=0; - scsi_osd_dissector_t dissector; - scsi_osd_conv_info_t *conv_info=NULL; - scsi_osd_lun_info_t *lun_info=NULL; + guint16 svcaction = 0; + scsi_osd_dissector_t dissector; + scsi_osd_conv_info_t *conv_info; + scsi_osd_lun_info_t *lun_info; - if(!tree) { + if (!tree) { return; } /* We must have an itl an itlq and a conversation */ - if(!cdata || !cdata->itl || !cdata->itl->conversation || !cdata->itlq){ + if (!cdata || !cdata->itl || !cdata->itl->conversation || !cdata->itlq) { return; } /* make sure we have a conversation info for this */ - conv_info=(scsi_osd_conv_info_t *)conversation_get_proto_data(cdata->itl->conversation, proto_scsi_osd); - if(!conv_info){ - conv_info=wmem_new(wmem_file_scope(), scsi_osd_conv_info_t); - conv_info->luns=wmem_tree_new(wmem_file_scope()); + conv_info = (scsi_osd_conv_info_t *)conversation_get_proto_data(cdata->itl->conversation, proto_scsi_osd); + if (!conv_info) { + conv_info = wmem_new(wmem_file_scope(), scsi_osd_conv_info_t); + conv_info->luns = wmem_tree_new(wmem_file_scope()); conversation_add_proto_data(cdata->itl->conversation, proto_scsi_osd, conv_info); } /* make sure we have a lun_info structure for this */ - lun_info=(scsi_osd_lun_info_t *)wmem_tree_lookup32(conv_info->luns, cdata->itlq->lun); - if(!lun_info){ - lun_info=wmem_new(wmem_file_scope(), scsi_osd_lun_info_t); - lun_info->partitions=wmem_tree_new(wmem_file_scope()); + lun_info = (scsi_osd_lun_info_t *)wmem_tree_lookup32(conv_info->luns, cdata->itlq->lun); + if (!lun_info) { + lun_info = wmem_new(wmem_file_scope(), scsi_osd_lun_info_t); + lun_info->partitions = wmem_tree_new(wmem_file_scope()); wmem_tree_insert32(conv_info->luns, cdata->itlq->lun, (void *)lun_info); } /* dissecting the CDB */ if (isreq && iscdb) { proto_tree_add_item (tree, hf_scsi_control, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; /* 5 reserved bytes */ - offset+=5; + offset += 5; proto_tree_add_item (tree, hf_scsi_osd_add_cdblen, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + offset += 1; - svcaction=tvb_get_ntohs(tvb, offset); - if(cdata && cdata->itlq){ + svcaction = tvb_get_ntohs(tvb, offset); + if (cdata && cdata->itlq) { /* We must store the service action for this itlq * so we can indentify what the data contains */ - if((!pinfo->fd->flags.visited) || (!cdata->itlq->extra_data)){ + if ((!pinfo->fd->flags.visited) || (!cdata->itlq->extra_data)) { scsi_osd_extra_data_t *extra_data; - extra_data=wmem_new(wmem_file_scope(), scsi_osd_extra_data_t); - extra_data->svcaction=svcaction; - extra_data->gsatype=0; - extra_data->osd2=0; - extra_data->continuation_length=0; - cdata->itlq->extra_data=extra_data; + extra_data = wmem_new(wmem_file_scope(), scsi_osd_extra_data_t); + extra_data->svcaction = svcaction; + extra_data->gsatype = 0; + extra_data->osd2 = 0; + extra_data->continuation_length = 0; + cdata->itlq->extra_data = extra_data; } } proto_tree_add_item (tree, hf_scsi_osd_svcaction, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; + offset += 2; col_append_str(pinfo->cinfo, COL_INFO, - val_to_str_const(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Service Action")); + val_to_str_ext_const(svcaction, &scsi_osd_svcaction_vals_ext, "Unknown OSD Service Action")); - dissector=find_svcaction_dissector(svcaction); - if(dissector){ + dissector = find_svcaction_dissector(svcaction); + if (dissector) { (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata, conv_info, lun_info); } return; @@ -3413,19 +3413,19 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* If it was not a CDB, try to find the service action and pass it * off to the service action dissector */ - if(cdata && cdata->itlq && cdata->itlq->extra_data){ - scsi_osd_extra_data_t *extra_data=(scsi_osd_extra_data_t *)cdata->itlq->extra_data; - svcaction=extra_data->svcaction; + if (cdata && cdata->itlq && cdata->itlq->extra_data) { + scsi_osd_extra_data_t *extra_data = (scsi_osd_extra_data_t *)cdata->itlq->extra_data; + svcaction = extra_data->svcaction; } col_append_str(pinfo->cinfo, COL_INFO, - val_to_str_const(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Service Action")); - if(svcaction){ + val_to_str_ext_const(svcaction, &scsi_osd_svcaction_vals_ext, "Unknown OSD Service Action")); + if (svcaction) { proto_item *it; - it=proto_tree_add_uint_format_value(tree, hf_scsi_osd_svcaction, tvb, 0, 0, svcaction, "0x%04x", svcaction); + it = proto_tree_add_uint_format_value(tree, hf_scsi_osd_svcaction, tvb, 0, 0, svcaction, "0x%04x", svcaction); PROTO_ITEM_SET_GENERATED(it); } - dissector=find_svcaction_dissector(svcaction); - if(dissector){ + dissector = find_svcaction_dissector(svcaction); + if (dissector) { (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata, conv_info, lun_info); } @@ -3433,21 +3433,20 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* OSD Commands */ -const value_string scsi_osd_vals[] = { - {SCSI_SPC_INQUIRY, "Inquiry"}, - {SCSI_SPC_LOGSELECT, "Log Select"}, - {SCSI_SPC_LOGSENSE, "Log Sense"}, - {SCSI_SPC_MGMT_PROTOCOL_IN, "Mgmt Protocol In"}, - {SCSI_SPC_MODESELECT10, "Mode Select(10)"}, - {SCSI_SPC_MODESENSE10, "Mode Sense(10)"}, - {SCSI_SPC_PERSRESVIN, "Persistent Reserve In"}, - {SCSI_SPC_PERSRESVOUT, "Persistent Reserve Out"}, - {SCSI_SPC_REPORTLUNS, "Report LUNs"}, - {SCSI_OSD_OPCODE, "OSD Command" }, +static const value_string scsi_osd_vals[] = { + /* 0x12 */ {SCSI_SPC_INQUIRY, "Inquiry"}, + /* 0x4C */ {SCSI_SPC_LOGSELECT, "Log Select"}, + /* 0x4D */ {SCSI_SPC_LOGSENSE, "Log Sense"}, + /* 0x55 */ {SCSI_SPC_MODESELECT10, "Mode Select(10)"}, + /* 0x5A */ {SCSI_SPC_MODESENSE10, "Mode Sense(10)"}, + /* 0x5E */ {SCSI_SPC_PERSRESVIN, "Persistent Reserve In"}, + /* 0x5F */ {SCSI_SPC_PERSRESVOUT, "Persistent Reserve Out"}, + /* 0x7f */ {SCSI_OSD_OPCODE, "OSD Command" }, + /* 0xA0 */ {SCSI_SPC_REPORTLUNS, "Report LUNs"}, + /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN, "Mgmt Protocol In"}, {0, NULL}, }; - - +value_string_ext scsi_osd_vals_ext = VALUE_STRING_EXT_INIT(scsi_osd_vals); scsi_cdb_table_t scsi_osd_table[256] = { /*OSD 0x00*/{NULL}, @@ -3714,18 +3713,18 @@ scsi_cdb_table_t scsi_osd_table[256] = { void proto_register_scsi_osd(void) { - expert_module_t* expert_scsi_osd; + expert_module_t *expert_scsi_osd; static hf_register_info hf[] = { { &hf_scsi_osd_opcode, - {"OSD Opcode", "scsi_osd.opcode", FT_UINT8, BASE_HEX, - VALS (scsi_osd_vals), 0x0, NULL, HFILL}}, + {"OSD Opcode", "scsi_osd.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING, + &scsi_osd_vals_ext, 0x0, NULL, HFILL}}, { &hf_scsi_osd_add_cdblen, {"Additional CDB Length", "scsi_osd.addcdblen", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}}, { &hf_scsi_osd_svcaction, - {"Service Action", "scsi_osd.svcaction", FT_UINT16, BASE_HEX, - VALS(scsi_osd_svcaction_vals), 0x0, NULL, HFILL}}, + {"Service Action", "scsi_osd.svcaction", FT_UINT16, BASE_HEX | BASE_EXT_STRING, + &scsi_osd_svcaction_vals_ext, 0x0, NULL, HFILL}}, { &hf_scsi_osd_option, {"Options Byte", "scsi_osd.option", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, @@ -3958,8 +3957,8 @@ proto_register_scsi_osd(void) {"Attributes List Length", "scsi_osd.attributes_list.length", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, { &hf_scsi_osd_attributes_page, - {"Attributes Page", "scsi_osd.attributes.page", FT_UINT32, BASE_HEX, - VALS(attributes_page_vals), 0, NULL, HFILL}}, + {"Attributes Page", "scsi_osd.attributes.page", FT_UINT32, BASE_HEX | BASE_EXT_STRING, + &attributes_page_vals_ext, 0, NULL, HFILL}}, { &hf_scsi_osd_attribute_number, {"Attribute Number", "scsi_osd.attribute.number", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}}, @@ -3991,7 +3990,7 @@ proto_register_scsi_osd(void) { &hf_scsi_osd2_immed_tr, {"Immed TR", "scsi_osd2.immed_tr", FT_UINT8, BASE_DEC, 0, 0x80, NULL, HFILL}}, { &hf_scsi_osd2_remove_scope, - {"Remove scope","scsi_osd2.remove_scope", FT_UINT8, BASE_HEX, VALS(scsi_osd2_remove_scope), 0x07, NULL, HFILL}}, + {"Remove scope", "scsi_osd2.remove_scope", FT_UINT8, BASE_HEX, VALS(scsi_osd2_remove_scope), 0x07, NULL, HFILL}}, { &hf_scsi_osd2_source_collection_object_id, {"Source Collection Object ID", "scsi_osd2.source_collection_object_id", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}}, { &hf_scsi_osd2_matches_collection_object_id, @@ -4013,7 +4012,7 @@ proto_register_scsi_osd(void) { &hf_scsi_osd2_query_entry_length, {"Entry Length", "scsi_osd2.query.entry.length", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, { &hf_scsi_osd2_query_attributes_page, - {"Attributes Page", "scsi_osd2.query.entry.page", FT_UINT32, BASE_HEX, VALS(attributes_page_vals), 0, NULL, HFILL}}, + {"Attributes Page", "scsi_osd2.query.entry.page", FT_UINT32, BASE_HEX | BASE_EXT_STRING, &attributes_page_vals_ext, 0, NULL, HFILL}}, { &hf_scsi_osd2_query_attribute_number, {"Attribute Number", "scsi_osd2.query.entry.number", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}}, { &hf_scsi_osd2_query_minimum_attribute_value_length, @@ -4049,7 +4048,7 @@ proto_register_scsi_osd(void) { &ei_osd2_cdb_continuation_descriptor_length_invalid, {"scsi_osd2.cdb_continuation.desc.length.invalid", PI_PROTOCOL, PI_ERROR, "Invalid descriptor length (not a multiple of 8)", EXPFILL }}, { &ei_osd2_cdb_continuation_length_invalid, {"scsi_osd2.cdb_continuation.length.invalid", PI_PROTOCOL, PI_ERROR, "Invalid CDB continuation length", EXPFILL }}, { &ei_osd_attr_length_invalid, {"scsi_osd.attribute_length.invalid", PI_PROTOCOL, PI_ERROR, "Invalid Attribute Length", EXPFILL }}, - { &ei_osd2_query_values_equal,{"scsi_osd2.query.entry.equal",PI_PROTOCOL,PI_NOTE,"The minimum and maximum values are equal", EXPFILL }}, + { &ei_osd2_query_values_equal, {"scsi_osd2.query.entry.equal", PI_PROTOCOL, PI_NOTE, "The minimum and maximum values are equal", EXPFILL }}, }; /* Register the protocol name and description */ diff --git a/epan/dissectors/packet-scsi-osd.h b/epan/dissectors/packet-scsi-osd.h index ce97583653..ae91379d30 100644 --- a/epan/dissectors/packet-scsi-osd.h +++ b/epan/dissectors/packet-scsi-osd.h @@ -29,7 +29,7 @@ #define SCSI_OSD_OPCODE 0x7f -extern const value_string attributes_page_vals[]; +WS_DLL_PUBLIC value_string_ext attributes_page_vals_ext; typedef struct _scsi_osd_lun_info_t scsi_osd_lun_info_t; typedef struct _attribute_page_numbers_t attribute_page_numbers_t; @@ -49,6 +49,6 @@ 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[]; +WS_DLL_PUBLIC value_string_ext scsi_osd_vals_ext; #endif diff --git a/epan/dissectors/packet-scsi-sbc.c b/epan/dissectors/packet-scsi-sbc.c index 22c3958082..67c9fc375e 100644 --- a/epan/dissectors/packet-scsi-sbc.c +++ b/epan/dissectors/packet-scsi-sbc.c @@ -984,7 +984,7 @@ dissect_sbc_readcapacity10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_) { - guint32 len, block_len, tot_len; + guint32 len, block_len, tot_len; const char *un; if (!tree) @@ -1221,9 +1221,8 @@ dissect_sbc_sanitize (tvbuff_t *tvb, packet_info *pinfo _U_, guint8 service_action; service_action = tvb_get_guint8 (tvb, offset) & 0x1F; - col_append_str(pinfo->cinfo, COL_INFO, val_to_str(service_action, - sanitize_val, - "Unknown (0x%02x)")); + col_append_str(pinfo->cinfo, COL_INFO, + val_to_str(service_action, sanitize_val, "Unknown (0x%02x)")); proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_sanitize_flags, ett_scsi_sanitize, sanitize_fields, ENC_BIG_ENDIAN); @@ -1322,9 +1321,9 @@ dissect_sbc_serviceactionin16 (tvbuff_t *tvb, packet_info *pinfo _U_, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_) { - guint8 service_action; - guint32 block_len; - guint64 len, tot_len; + guint8 service_action; + guint32 block_len; + guint64 len, tot_len; const char *un; if (!tree) @@ -1485,82 +1484,85 @@ dissect_sbc_serviceactionin16 (tvbuff_t *tvb, packet_info *pinfo _U_, /* SBC Commands */ -const value_string scsi_sbc_vals[] = { - {SCSI_SPC_EXTCOPY , "Extended Copy"}, - {SCSI_SPC_INQUIRY , "Inquiry"}, - {SCSI_SBC_FORMATUNIT , "Format Unit"}, - {SCSI_SBC_LOCKUNLKCACHE10 , "Lock Unlock Cache(10)"}, - {SCSI_SBC_LOCKUNLKCACHE16 , "Lock Unlock Cache(16)"}, - {SCSI_SPC_LOGSELECT , "Log Select"}, - {SCSI_SPC_LOGSENSE , "Log Sense"}, - {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, - {SCSI_SPC_MODESELECT6 , "Mode Select(6)"}, - {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, - {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, - {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, - {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"}, - {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"}, - {SCSI_SBC_PREFETCH10 , "Pre-Fetch(10)"}, - {SCSI_SBC_PREFETCH16 , "Pre-Fetch(16)"}, - {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, - {SCSI_SBC_READ6 , "Read(6)"}, - {SCSI_SBC_READ10 , "Read(10)"}, - {SCSI_SBC_READ12 , "Read(12)"}, - {SCSI_SBC_READ16 , "Read(16)"}, - {SCSI_SBC_READCAPACITY10 , "Read Capacity(10)"}, - {SCSI_SPC_REPORTLUNS , "Report LUNs"}, - {SCSI_SPC_REQSENSE , "Request Sense"}, - {SCSI_SBC_SERVICEACTIONIN16 , "Service Action In(16)"}, - {SCSI_SBC_READDEFDATA10 , "Read Defect Data(10)"}, - {SCSI_SBC_READDEFDATA12 , "Read Defect Data(12)"}, - {SCSI_SBC_READLONG , "Read Long(10)"}, - {SCSI_SBC_REASSIGNBLKS , "Reassign Blocks"}, - {SCSI_SBC_REBUILD16 , "Rebuild(16)"}, - {SCSI_SBC_REBUILD32 , "Rebuild(32)"}, - {SCSI_SBC_REGENERATE16 , "Regenerate(16)"}, - {SCSI_SBC_REGENERATE32 , "Regenerate(32)"}, - {SCSI_SPC_RELEASE6 , "Release(6)"}, /* obsolete in SBC2 and later */ - {SCSI_SPC_RELEASE10 , "Release(10)"},/* obsolete in SBC2 and later */ - {SCSI_SPC_RESERVE6 , "Reserve(6)"}, /* obsolete in SBC2 and later */ - {SCSI_SPC_RESERVE10 , "Reserve(10)"},/* obsolete in SBC2 and later */ - {SCSI_SBC_SANITIZE , "Sanitize"}, - {SCSI_SBC_SEEK10 , "Seek(10)"}, - {SCSI_SPC_SENDDIAG , "Send Diagnostic"}, - {SCSI_SBC_SETLIMITS10 , "Set Limits(10)"}, - {SCSI_SBC_SETLIMITS12 , "Set Limits(12)"}, - {SCSI_SBC_STARTSTOPUNIT , "Start Stop Unit"}, - {SCSI_SBC_SYNCCACHE10 , "Synchronize Cache(10)"}, - {SCSI_SBC_SYNCCACHE16 , "Synchronize Cache(16)"}, - {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, - {SCSI_SBC_UNMAP , "Unmap"}, - {SCSI_SBC_VERIFY10 , "Verify(10)"}, - {SCSI_SBC_VERIFY12 , "Verify(12)"}, - {SCSI_SBC_VERIFY16 , "Verify(16)"}, - {SCSI_SBC_WRITE6 , "Write(6)"}, - {SCSI_SBC_WRITE10 , "Write(10)"}, - {SCSI_SBC_WRITE12 , "Write(12)"}, - {SCSI_SBC_WRITE16 , "Write(16)"}, - {SCSI_SBC_ORWRITE , "OrWrite(16)"}, - {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, - {SCSI_SBC_COMPARENWRITE , "Compare & Write(16)"}, - {SCSI_SBC_WRITENVERIFY10 , "Write & Verify(10)"}, - {SCSI_SBC_WRITENVERIFY12 , "Write & Verify(12)"}, - {SCSI_SBC_WRITENVERIFY16 , "Write & Verify(16)"}, - {SCSI_SBC_WRITELONG , "Write Long"}, - {SCSI_SBC_WRITESAME10 , "Write Same(10)"}, - {SCSI_SBC_WRITESAME16 , "Write Same(16)"}, - {SCSI_SBC_XDREAD10 , "XdRead(10)"}, - {SCSI_SBC_XDREAD32 , "XdRead(32)"}, - {SCSI_SBC_XDWRITE10 , "XdWrite(10)"}, - {SCSI_SBC_XDWRITE32 , "XdWrite(32)"}, - {SCSI_SBC_XDWRITEREAD10 , "XdWriteRead(10)"}, - {SCSI_SBC_XDWRITEREAD32 , "XdWriteRead(32)"}, - {SCSI_SBC_XDWRITEEXTD16 , "XdWrite Extended(16)"}, - {SCSI_SBC_XDWRITEEXTD32 , "XdWrite Extended(32)"}, - {SCSI_SBC_XPWRITE10 , "XpWrite(10)"}, - {SCSI_SBC_XPWRITE32 , "XpWrite(32)"}, +static const value_string scsi_sbc_vals[] = { + /* 0x00 */ {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, + /* 0x03 */ {SCSI_SPC_REQSENSE , "Request Sense"}, + /* 0x04 */ {SCSI_SBC_FORMATUNIT , "Format Unit"}, + /* 0x07 */ {SCSI_SBC_REASSIGNBLKS , "Reassign Blocks"}, + /* 0x08 */ {SCSI_SBC_READ6 , "Read(6)"}, + /* 0x0A */ {SCSI_SBC_WRITE6 , "Write(6)"}, + /* 0x12 */ {SCSI_SPC_INQUIRY , "Inquiry"}, + /* 0x15 */ {SCSI_SPC_MODESELECT6 , "Mode Select(6)"}, + /* 0x16 */ {SCSI_SPC_RESERVE6 , "Reserve(6)"}, /* obsolete in SBC2 and later */ + /* 0x17 */ {SCSI_SPC_RELEASE6 , "Release(6)"}, /* obsolete in SBC2 and later */ + /* 0x1A */ {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, + /* 0x1B */ {SCSI_SBC_STARTSTOPUNIT , "Start Stop Unit"}, + /* 0x1D */ {SCSI_SPC_SENDDIAG , "Send Diagnostic"}, + /* 0x1E */ {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, + /* 0x25 */ {SCSI_SBC_READCAPACITY10 , "Read Capacity(10)"}, + /* 0x28 */ {SCSI_SBC_READ10 , "Read(10)"}, + /* 0x2A */ {SCSI_SBC_WRITE10 , "Write(10)"}, + /* 0x2B */ {SCSI_SBC_SEEK10 , "Seek(10)"}, + /* 0x2E */ {SCSI_SBC_WRITENVERIFY10 , "Write & Verify(10)"}, + /* 0x2F */ {SCSI_SBC_VERIFY10 , "Verify(10)"}, + /* 0x33 */ {SCSI_SBC_SETLIMITS10 , "Set Limits(10)"}, + /* 0x34 */ {SCSI_SBC_PREFETCH10 , "Pre-Fetch(10)"}, + /* 0x35 */ {SCSI_SBC_SYNCCACHE10 , "Synchronize Cache(10)"}, + /* 0x36 */ {SCSI_SBC_LOCKUNLKCACHE10 , "Lock Unlock Cache(10)"}, + /* 0x37 */ {SCSI_SBC_READDEFDATA10 , "Read Defect Data(10)"}, + /* 0x3B */ {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, + /* 0x3E */ {SCSI_SBC_READLONG , "Read Long(10)"}, + /* 0x3F */ {SCSI_SBC_WRITELONG , "Write Long"}, + /* 0x41 */ {SCSI_SBC_WRITESAME10 , "Write Same(10)"}, + /* 0x42 */ {SCSI_SBC_UNMAP , "Unmap"}, + /* 0x48 */ {SCSI_SBC_SANITIZE , "Sanitize"}, + /* 0x4C */ {SCSI_SPC_LOGSELECT , "Log Select"}, + /* 0x4D */ {SCSI_SPC_LOGSENSE , "Log Sense"}, + /* 0x50 */ {SCSI_SBC_XDWRITE10 , "XdWrite(10)"}, + /* 0x51 */ {SCSI_SBC_XPWRITE10 , "XpWrite(10)"}, + /* 0x52 */ {SCSI_SBC_XDREAD10 , "XdRead(10)"}, + /* 0x53 */ {SCSI_SBC_XDWRITEREAD10 , "XdWriteRead(10)"}, + /* 0x55 */ {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, + /* 0x56 */ {SCSI_SPC_RESERVE10 , "Reserve(10)"},/* obsolete in SBC2 and later */ + /* 0x57 */ {SCSI_SPC_RELEASE10 , "Release(10)"},/* obsolete in SBC2 and later */ + /* 0x5A */ {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, + /* 0x5E */ {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"}, + /* 0x5F */ {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"}, + /* 0x7F */ {SCSI_SBC_REBUILD32 , "Rebuild(32)"}, +#if 0 /* dups which would never have been found (in the previous unsorted version of this array) */ + /* 0x7F */ {SCSI_SBC_REGENERATE32 , "Regenerate(32)"}, + /* 0x7F */ {SCSI_SBC_XDREAD32 , "XdRead(32)"}, + /* 0x7F */ {SCSI_SBC_XDWRITE32 , "XdWrite(32)"}, + /* 0x7F */ {SCSI_SBC_XDWRITEEXTD32 , "XdWrite Extended(32)"}, + /* 0x7F */ {SCSI_SBC_XDWRITEREAD32 , "XdWriteRead(32)"}, + /* 0x7F */ {SCSI_SBC_XPWRITE32 , "XpWrite(32)"}, +#endif + /* 0x80 */ {SCSI_SBC_XDWRITEEXTD16 , "XdWrite Extended(16)"}, + /* 0x81 */ {SCSI_SBC_REBUILD16 , "Rebuild(16)"}, + /* 0x82 */ {SCSI_SBC_REGENERATE16 , "Regenerate(16)"}, + /* 0x83 */ {SCSI_SPC_EXTCOPY , "Extended Copy"}, + /* 0x88 */ {SCSI_SBC_READ16 , "Read(16)"}, + /* 0x89 */ {SCSI_SBC_COMPARENWRITE , "Compare & Write(16)"}, + /* 0x8A */ {SCSI_SBC_WRITE16 , "Write(16)"}, + /* 0x8B */ {SCSI_SBC_ORWRITE , "OrWrite(16)"}, + /* 0x8E */ {SCSI_SBC_WRITENVERIFY16 , "Write & Verify(16)"}, + /* 0x8F */ {SCSI_SBC_VERIFY16 , "Verify(16)"}, + /* 0x90 */ {SCSI_SBC_PREFETCH16 , "Pre-Fetch(16)"}, + /* 0x91 */ {SCSI_SBC_SYNCCACHE16 , "Synchronize Cache(16)"}, + /* 0x92 */ {SCSI_SBC_LOCKUNLKCACHE16 , "Lock Unlock Cache(16)"}, + /* 0x93 */ {SCSI_SBC_WRITESAME16 , "Write Same(16)"}, + /* 0x9E */ {SCSI_SBC_SERVICEACTIONIN16 , "Service Action In(16)"}, + /* 0xA0 */ {SCSI_SPC_REPORTLUNS , "Report LUNs"}, + /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, + /* 0xA8 */ {SCSI_SBC_READ12 , "Read(12)"}, + /* 0xAA */ {SCSI_SBC_WRITE12 , "Write(12)"}, + /* 0xAE */ {SCSI_SBC_WRITENVERIFY12 , "Write & Verify(12)"}, + /* 0xAF */ {SCSI_SBC_VERIFY12 , "Verify(12)"}, + /* 0xB3 */ {SCSI_SBC_SETLIMITS12 , "Set Limits(12)"}, + /* 0xB7 */ {SCSI_SBC_READDEFDATA12 , "Read Defect Data(12)"}, {0, NULL} }; +value_string_ext scsi_sbc_vals_ext = VALUE_STRING_EXT_INIT(scsi_sbc_vals); scsi_cdb_table_t scsi_sbc_table[256] = { /*SPC 0x00*/{dissect_spc_testunitready}, @@ -1827,8 +1829,8 @@ proto_register_scsi_sbc(void) { static hf_register_info hf[] = { { &hf_scsi_sbc_opcode, - {"SBC Opcode", "scsi_sbc.opcode", FT_UINT8, BASE_HEX, - VALS (scsi_sbc_vals), 0x0, NULL, HFILL}}, + {"SBC Opcode", "scsi_sbc.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING, + &scsi_sbc_vals_ext, 0x0, NULL, HFILL}}, { &hf_scsi_sbc_formatunit_flags, {"Flags", "scsi_sbc.formatunit.flags", FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL}}, @@ -2165,16 +2167,15 @@ proto_reg_handoff_scsi_sbc(void) { } - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 - * tab-width: 4 + * tab-width: 8 * indent-tabs-mode: nil * End: * - * vi: set shiftwidth=4 tabstop=4 expandtab: - * :indentSize=4:tabSize=4:noTabs=true: + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: */ diff --git a/epan/dissectors/packet-scsi-sbc.h b/epan/dissectors/packet-scsi-sbc.h index 26bb496544..afa0ab4ec9 100644 --- a/epan/dissectors/packet-scsi-sbc.h +++ b/epan/dissectors/packet-scsi-sbc.h @@ -97,6 +97,6 @@ void dissect_sbc_readcapacity10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr extern int hf_scsi_sbc_opcode; extern scsi_cdb_table_t scsi_sbc_table[256]; -WS_DLL_PUBLIC const value_string scsi_sbc_vals[]; +WS_DLL_PUBLIC value_string_ext scsi_sbc_vals_ext; #endif diff --git a/epan/dissectors/packet-scsi-smc.c b/epan/dissectors/packet-scsi-smc.c index 4cc362293e..a51abcd753 100644 --- a/epan/dissectors/packet-scsi-smc.c +++ b/epan/dissectors/packet-scsi-smc.c @@ -465,9 +465,9 @@ dissect_smc_readelementstatus (tvbuff_t *tvb, packet_info *pinfo, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_) { - guint bytecnt, desc_bytecnt; - guint8 elem_type; - guint8 voltag_flags; + guint bytecnt, desc_bytecnt; + guint8 elem_type; + guint8 voltag_flags; guint16 elem_desc_len; if (!tree) @@ -542,47 +542,48 @@ dissect_smc_readelementstatus (tvbuff_t *tvb, packet_info *pinfo, /* SMC Commands */ -const value_string scsi_smc_vals[] = { - {SCSI_SPC_ACCESS_CONTROL_IN , "Access Control In"}, - {SCSI_SPC_ACCESS_CONTROL_OUT , "Access Control Out"}, - {SCSI_SMC_EXCHANGE_MEDIUM , "Exchange Medium"}, - {SCSI_SMC_INITIALIZE_ELEMENT_STATUS , "Initialize Element Status"}, - {SCSI_SMC_INITIALIZE_ELEMENT_STATUS_RANGE , "Initialize Element Status With Range"}, - {SCSI_SPC_INQUIRY , "Inquiry"}, - {SCSI_SPC_LOGSELECT , "Log Select"}, - {SCSI_SPC_LOGSENSE , "Log Sense"}, - {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, - {SCSI_SPC_MODESELECT6 , "Mode Select(6)"}, - {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, - {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, - {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, - {SCSI_SMC_MOVE_MEDIUM , "Move Medium"}, - {SCSI_SMC_MOVE_MEDIUM_ATTACHED , "Move Medium Attached"}, - {SCSI_SMC_OPENCLOSE_ELEMENT , "Open/Close Import/Export Element"}, - {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"}, - {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"}, - {SCSI_SMC_POSITION_TO_ELEMENT , "Position To Element"}, - {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, - {SCSI_SMC_READ_ATTRIBUTE , "Read Attribute"}, - {SCSI_SPC_READBUFFER , "Read Buffer"}, - {SCSI_SMC_READ_ELEMENT_STATUS , "Read Element Status"}, - {SCSI_SMC_READ_ELEMENT_STATUS_ATTACHED , "Read Element Status Attached"}, - {SCSI_SPC_RCVDIAGRESULTS , "Receive Diagnostics Results"}, - {SCSI_SPC_RELEASE6 , "Release(6)"}, - {SCSI_SPC_RELEASE10 , "Release(10)"}, - {SCSI_SPC_REPORTLUNS , "Report LUNs"}, - {SCSI_SMC_REPORT_VOLUME_TYPES_SUPPORTED , "Report Volume Types Supported"}, - {SCSI_SPC_REQSENSE , "Request Sense"}, - {SCSI_SMC_REQUEST_VOLUME_ELEMENT_ADDRESS , "Request Volume Element Address"}, - {SCSI_SPC_RESERVE6 , "Reserve(6)"}, - {SCSI_SPC_RESERVE10 , "Reserve(10)"}, - {SCSI_SMC_SEND_VOLUME_TAG , "Send Volume Tag"}, - {SCSI_SPC_SENDDIAG , "Send Diagnostic"}, - {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, - {SCSI_SMC_WRITE_ATTRIBUTE , "Write Attribute"}, - {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, +static const value_string scsi_smc_vals[] = { + /* 0x00 */ {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, + /* 0x03 */ {SCSI_SPC_REQSENSE , "Request Sense"}, + /* 0x07 */ {SCSI_SMC_INITIALIZE_ELEMENT_STATUS , "Initialize Element Status"}, + /* 0x12 */ {SCSI_SPC_INQUIRY , "Inquiry"}, + /* 0x15 */ {SCSI_SPC_MODESELECT6 , "Mode Select(6)"}, + /* 0x16 */ {SCSI_SPC_RESERVE6 , "Reserve(6)"}, + /* 0x17 */ {SCSI_SPC_RELEASE6 , "Release(6)"}, + /* 0x1A */ {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, + /* 0x1B */ {SCSI_SMC_OPENCLOSE_ELEMENT , "Open/Close Import/Export Element"}, + /* 0x1C */ {SCSI_SPC_RCVDIAGRESULTS , "Receive Diagnostics Results"}, + /* 0x1D */ {SCSI_SPC_SENDDIAG , "Send Diagnostic"}, + /* 0x1E */ {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, + /* 0x2B */ {SCSI_SMC_POSITION_TO_ELEMENT , "Position To Element"}, + /* 0x37 */ {SCSI_SMC_INITIALIZE_ELEMENT_STATUS_RANGE , "Initialize Element Status With Range"}, + /* 0x3B */ {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, + /* 0x3C */ {SCSI_SPC_READBUFFER , "Read Buffer"}, + /* 0x40 */ {SCSI_SMC_EXCHANGE_MEDIUM , "Exchange Medium"}, + /* 0x44 */ {SCSI_SMC_REPORT_VOLUME_TYPES_SUPPORTED , "Report Volume Types Supported"}, + /* 0x4C */ {SCSI_SPC_LOGSELECT , "Log Select"}, + /* 0x4D */ {SCSI_SPC_LOGSENSE , "Log Sense"}, + /* 0x55 */ {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, + /* 0x56 */ {SCSI_SPC_RESERVE10 , "Reserve(10)"}, + /* 0x57 */ {SCSI_SPC_RELEASE10 , "Release(10)"}, + /* 0x5A */ {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, + /* 0x5E */ {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"}, + /* 0x5F */ {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"}, + /* 0x86 */ {SCSI_SPC_ACCESS_CONTROL_IN , "Access Control In"}, + /* 0x87 */ {SCSI_SPC_ACCESS_CONTROL_OUT , "Access Control Out"}, + /* 0x8C */ {SCSI_SMC_READ_ATTRIBUTE , "Read Attribute"}, + /* 0x8D */ {SCSI_SMC_WRITE_ATTRIBUTE , "Write Attribute"}, + /* 0xA0 */ {SCSI_SPC_REPORTLUNS , "Report LUNs"}, + /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, + /* 0xA5 */ {SCSI_SMC_MOVE_MEDIUM , "Move Medium"}, + /* 0xA7 */ {SCSI_SMC_MOVE_MEDIUM_ATTACHED , "Move Medium Attached"}, + /* 0xB4 */ {SCSI_SMC_READ_ELEMENT_STATUS_ATTACHED , "Read Element Status Attached"}, + /* 0xB5 */ {SCSI_SMC_REQUEST_VOLUME_ELEMENT_ADDRESS , "Request Volume Element Address"}, + /* 0xB6 */ {SCSI_SMC_SEND_VOLUME_TAG , "Send Volume Tag"}, + /* 0xB8 */ {SCSI_SMC_READ_ELEMENT_STATUS , "Read Element Status"}, {0, NULL}, }; +value_string_ext scsi_smc_vals_ext = VALUE_STRING_EXT_INIT(scsi_smc_vals); scsi_cdb_table_t scsi_smc_table[256] = { /*SPC 0x00*/{dissect_spc_testunitready}, @@ -847,118 +848,308 @@ scsi_cdb_table_t scsi_smc_table[256] = { void proto_register_scsi_smc(void) { - static hf_register_info hf[] = { + static hf_register_info hf[] = { { &hf_scsi_smc_opcode, - {"SMC Opcode", "scsi_smc.opcode", FT_UINT8, BASE_HEX, - VALS (scsi_smc_vals), 0x0, NULL, HFILL}}, + {"SMC Opcode", "scsi_smc.opcode", + FT_UINT8, BASE_HEX | BASE_EXT_STRING, &scsi_smc_vals_ext, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_mta, - {"Medium Transport Address", "scsi_smc.mta", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + {"Medium Transport Address", "scsi_smc.mta", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_sa, - {"Source Address", "scsi_smc.sa", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + {"Source Address", "scsi_smc.sa", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_da, - {"Destination Address", "scsi_smc.da", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + {"Destination Address", "scsi_smc.da", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_fda, - {"First Destination Address", "scsi_smc.fda", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + {"First Destination Address", "scsi_smc.fda", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_sda, - {"Second Destination Address", "scsi_smc.sda", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + {"Second Destination Address", "scsi_smc.sda", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_medium_flags, - {"Flags", "scsi_smc.medium_flags", FT_UINT8, BASE_HEX, - NULL, 0x0, NULL, HFILL}}, + {"Flags", "scsi_smc.medium_flags", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_inv1, - {"INV1", "scsi_smc.inv1", FT_BOOLEAN, 8, - NULL, 0x02, NULL, HFILL}}, + {"INV1", "scsi_smc.inv1", + FT_BOOLEAN, 8, NULL, 0x02, + NULL, HFILL} + }, { &hf_scsi_smc_inv2, - {"INV2", "scsi_smc.inv2", FT_BOOLEAN, 8, - NULL, 0x01, NULL, HFILL}}, + {"INV2", "scsi_smc.inv2", + FT_BOOLEAN, 8, NULL, 0x01, + NULL, HFILL} + }, { &hf_scsi_smc_range_flags, - {"Flags", "scsi_smc.range_flags", FT_UINT8, BASE_HEX, - NULL, 0x0, NULL, HFILL}}, + {"Flags", "scsi_smc.range_flags", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_fast, - {"FAST", "scsi_smc.fast", FT_BOOLEAN, 8, - NULL, 0x02, NULL, HFILL}}, + {"FAST", "scsi_smc.fast", + FT_BOOLEAN, 8, NULL, 0x02, + NULL, HFILL} + }, { &hf_scsi_smc_range, - {"RANGE", "scsi_smc.range", FT_BOOLEAN, 8, - NULL, 0x01, NULL, HFILL}}, + {"RANGE", "scsi_smc.range", + FT_BOOLEAN, 8, NULL, 0x01, + NULL, HFILL} + }, #if 0 { &hf_scsi_smc_sea, - {"Starting Element Address", "scsi_smc.sea", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + {"Starting Element Address", "scsi_smc.sea", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, #endif { &hf_scsi_smc_num_elements, - {"Number of Elements", "scsi_smc.num_elements", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + {"Number of Elements", "scsi_smc.num_elements", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_invert, - {"INVERT", "scsi_smc.invert", FT_BOOLEAN, 8, - NULL, 0x01, NULL, HFILL}}, + {"INVERT", "scsi_smc.invert", + FT_BOOLEAN, 8, NULL, 0x01, + NULL, HFILL} + }, { &hf_scsi_smc_ea, - {"Element Address", "scsi_smc.ea", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + {"Element Address", "scsi_smc.ea", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, { &hf_scsi_smc_action_code, - {"Action Code", "scsi_smc.action_code", FT_UINT8, BASE_HEX, - VALS(action_code_vals), 0x1f, NULL, HFILL}}, - - /* Generated from convert_proto_tree_add_text.pl */ - { &hf_scsi_smc_scsi_bus_address, { "SCSI Bus Address", "scsi_smc.scsi_bus_address", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_source_storage_element_address, { "Source Storage Element Address", "scsi_smc.source_storage_element_address", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_code_set, { "Code Set", "scsi_smc.code_set", FT_UINT8, BASE_DEC, VALS(scsi_devid_codeset_val), 0x0F, NULL, HFILL }}, - { &hf_scsi_smc_identifier_type, { "Identifier Type", "scsi_smc.identifier_type", FT_UINT8, BASE_DEC, VALS(scsi_devid_idtype_val), 0x0F, NULL, HFILL }}, - { &hf_scsi_smc_identifier_length, { "Identifier Length", "scsi_smc.identifier_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_identifier, { "Identifier", "scsi_smc.identifier", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_vendor_specific_data, { "Vendor-specific Data", "scsi_smc.vendor_specific_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_voltag, { "VOLTAG", "scsi_smc.voltag", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }}, - { &hf_scsi_smc_starting_element_address, { "Starting Element Address", "scsi_smc.starting_element_address", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_number_of_elements, { "Number of Elements", "scsi_smc.number_of_elements", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_curdata, { "CURDATA", "scsi_smc.curdata", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }}, - { &hf_scsi_smc_allocation_length, { "Allocation Length", "scsi_smc.allocation_length", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_first_element_address_reported, { "First Element Address Reported", "scsi_smc.first_element_address_reported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_number_of_elements_available, { "Number of Elements Available", "scsi_smc.number_of_elements_available", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_byte_count_of_report_available, { "Byte Count of Report Available", "scsi_smc.byte_count_of_report_available", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_element_type_code, { "Element Type Code", "scsi_smc.element_type_code", FT_UINT8, BASE_DEC, VALS(element_type_code_vals), 0x0, NULL, HFILL }}, - { &hf_scsi_smc_element_type_code_0F, { "Element Type Code", "scsi_smc.element_type_code", FT_UINT8, BASE_DEC, VALS(element_type_code_vals), 0x0F, NULL, HFILL }}, - { &hf_scsi_smc_pvoltag, { "PVOLTAG", "scsi_smc.pvoltag", FT_BOOLEAN, 8, NULL, PVOLTAG, NULL, HFILL }}, - { &hf_scsi_smc_element_descriptor_length, { "Element Descriptor Length", "scsi_smc.element_descriptor_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_byte_count_of_descriptor_data_available, { "Byte Count Of Descriptor Data Available", "scsi_smc.byte_count_of_descriptor_data_available", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_except, { "EXCEPT", "scsi_smc.except", FT_BOOLEAN, 8, NULL, EXCEPT, NULL, HFILL }}, - { &hf_scsi_smc_access, { "ACCESS", "scsi_smc.access", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }}, - { &hf_scsi_smc_cmc, { "cmc", "scsi_smc.cmc", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }}, - { &hf_scsi_smc_additional_sense_code_qualifier, { "Additional Sense Code+Qualifier", "scsi_smc.additional_sense_code_qualifier", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &scsi_asc_val_ext, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_not_bus, { "NOT BUS", "scsi_smc.not_bus", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }}, - { &hf_scsi_smc_id_valid, { "ID VALID", "scsi_smc.id_valid", FT_BOOLEAN, 8, NULL, ID_VALID, NULL, HFILL }}, - { &hf_scsi_smc_lu_valid, { "LU VALID", "scsi_smc.lu_valid", FT_BOOLEAN, 8, NULL, LU_VALID, NULL, HFILL }}, - { &hf_scsi_smc_svalid, { "SVALID", "scsi_smc.svalid", FT_BOOLEAN, 8, NULL, SVALID, NULL, HFILL }}, - { &hf_scsi_smc_dvcid, { "DVCID", "scsi_smc.dvcid", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }}, - { &hf_scsi_smc_avoltag, { "AVOLTAG", "scsi_smc.pvoltag", FT_BOOLEAN, 8, NULL, AVOLTAG, NULL, HFILL }}, - { &hf_scsi_smc_full, { "FULL", "scsi_smc.full", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }}, - { &hf_scsi_smc_exenab, { "EXENAB", "scsi_smc.exenab", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }}, - { &hf_scsi_smc_inenab, { "INENAB", "scsi_smc.inenab", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }}, - { &hf_scsi_smc_impexp, { "IMPEXP", "scsi_smc.impexp", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }}, - { &hf_scsi_smc_lun, { "LUN", "scsi_smc.lun", FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL }}, - { &hf_scsi_smc_primary_vol_tag_id, { "Primary Volume Identification", "scsi_smc.primary_vol_tag_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_alternate_vol_tag_id, { "Alternate Volume Identification", "scsi_smc.alternate_vol_tag_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_primary_vol_seq_num, { "Primary Volume Sequence Number", "scsi_smc.primary_vol_seq_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_smc_alternate_vol_seq_num, { "Alternate Volume Sequence Number", "scsi_smc.alternate_vol_seq_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - }; - - - /* Setup protocol subtree array */ - static gint *ett[] = { - &ett_scsi_exchange_medium, - &ett_scsi_range, - &ett_scsi_move - }; - - /* Register the protocol name and description */ - proto_scsi_smc = proto_register_protocol("SCSI_SMC", "SCSI_SMC", "scsi_smc"); - - /* Required function calls to register the header fields and subtrees used */ - proto_register_field_array(proto_scsi_smc, hf, array_length(hf)); - - proto_register_subtree_array(ett, array_length(ett)); + {"Action Code", "scsi_smc.action_code", + FT_UINT8, BASE_HEX, VALS(action_code_vals), 0x1f, + NULL, HFILL} + }, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_scsi_smc_scsi_bus_address, + { "SCSI Bus Address", "scsi_smc.scsi_bus_address", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_source_storage_element_address, + { "Source Storage Element Address", "scsi_smc.source_storage_element_address", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_code_set, + { "Code Set", "scsi_smc.code_set", + FT_UINT8, BASE_DEC, VALS(scsi_devid_codeset_val), 0x0F, + NULL, HFILL } + }, + { &hf_scsi_smc_identifier_type, + { "Identifier Type", "scsi_smc.identifier_type", + FT_UINT8, BASE_DEC, VALS(scsi_devid_idtype_val), 0x0F, + NULL, HFILL } + }, + { &hf_scsi_smc_identifier_length, + { "Identifier Length", "scsi_smc.identifier_length", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_identifier, + { "Identifier", "scsi_smc.identifier", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_vendor_specific_data, + { "Vendor-specific Data", "scsi_smc.vendor_specific_data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_voltag, + { "VOLTAG", "scsi_smc.voltag", + FT_BOOLEAN, 8, NULL, 0x10, + NULL, HFILL } + }, + { &hf_scsi_smc_starting_element_address, + { "Starting Element Address", "scsi_smc.starting_element_address", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_number_of_elements, + { "Number of Elements", "scsi_smc.number_of_elements", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_curdata, + { "CURDATA", "scsi_smc.curdata", + FT_BOOLEAN, 8, NULL, 0x02, + NULL, HFILL } + }, + { &hf_scsi_smc_allocation_length, + { "Allocation Length", "scsi_smc.allocation_length", + FT_UINT24, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_first_element_address_reported, + { "First Element Address Reported", "scsi_smc.first_element_address_reported", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_number_of_elements_available, + { "Number of Elements Available", "scsi_smc.number_of_elements_available", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_byte_count_of_report_available, + { "Byte Count of Report Available", "scsi_smc.byte_count_of_report_available", + FT_UINT24, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_element_type_code, + { "Element Type Code", "scsi_smc.element_type_code", + FT_UINT8, BASE_DEC, VALS(element_type_code_vals), 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_element_type_code_0F, + { "Element Type Code", "scsi_smc.element_type_code", + FT_UINT8, BASE_DEC, VALS(element_type_code_vals), 0x0F, + NULL, HFILL } + }, + { &hf_scsi_smc_pvoltag, + { "PVOLTAG", "scsi_smc.pvoltag", + FT_BOOLEAN, 8, NULL, PVOLTAG, + NULL, HFILL } + }, + { &hf_scsi_smc_element_descriptor_length, + { "Element Descriptor Length", "scsi_smc.element_descriptor_length", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_byte_count_of_descriptor_data_available, + { "Byte Count Of Descriptor Data Available", "scsi_smc.byte_count_of_descriptor_data_available", + FT_UINT24, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_except, + { "EXCEPT", "scsi_smc.except", + FT_BOOLEAN, 8, NULL, EXCEPT, + NULL, HFILL } + }, + { &hf_scsi_smc_access, + { "ACCESS", "scsi_smc.access", + FT_BOOLEAN, 8, NULL, 0x08, + NULL, HFILL } + }, + { &hf_scsi_smc_cmc, + { "cmc", "scsi_smc.cmc", + FT_BOOLEAN, 8, NULL, 0x40, + NULL, HFILL } + }, + { &hf_scsi_smc_additional_sense_code_qualifier, + { "Additional Sense Code+Qualifier", "scsi_smc.additional_sense_code_qualifier", + FT_UINT16, BASE_HEX|BASE_EXT_STRING, &scsi_asc_val_ext, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_not_bus, + { "NOT BUS", "scsi_smc.not_bus", + FT_BOOLEAN, 8, NULL, 0x80, + NULL, HFILL } + }, + { &hf_scsi_smc_id_valid, + { "ID VALID", "scsi_smc.id_valid", + FT_BOOLEAN, 8, NULL, ID_VALID, + NULL, HFILL } + }, + { &hf_scsi_smc_lu_valid, + { "LU VALID", "scsi_smc.lu_valid", + FT_BOOLEAN, 8, NULL, LU_VALID, + NULL, HFILL } + }, + { &hf_scsi_smc_svalid, + { "SVALID", "scsi_smc.svalid", + FT_BOOLEAN, 8, NULL, SVALID, + NULL, HFILL } + }, + { &hf_scsi_smc_dvcid, + { "DVCID", "scsi_smc.dvcid", + FT_BOOLEAN, 8, NULL, 0x01, + NULL, HFILL } + }, + { &hf_scsi_smc_avoltag, + { "AVOLTAG", "scsi_smc.pvoltag", + FT_BOOLEAN, 8, NULL, AVOLTAG, + NULL, HFILL } + }, + { &hf_scsi_smc_full, + { "FULL", "scsi_smc.full", + FT_BOOLEAN, 8, NULL, 0x01, + NULL, HFILL } + }, + { &hf_scsi_smc_exenab, + { "EXENAB", "scsi_smc.exenab", + FT_BOOLEAN, 8, NULL, 0x10, + NULL, HFILL } + }, + { &hf_scsi_smc_inenab, + { "INENAB", "scsi_smc.inenab", + FT_BOOLEAN, 8, NULL, 0x20, + NULL, HFILL } + }, + { &hf_scsi_smc_impexp, + { "IMPEXP", "scsi_smc.impexp", + FT_BOOLEAN, 8, NULL, 0x02, + NULL, HFILL } + }, + { &hf_scsi_smc_lun, + { "LUN", "scsi_smc.lun", + FT_UINT8, BASE_DEC, NULL, 0x07, + NULL, HFILL } + }, + { &hf_scsi_smc_primary_vol_tag_id, + { "Primary Volume Identification", "scsi_smc.primary_vol_tag_id", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_alternate_vol_tag_id, + { "Alternate Volume Identification", "scsi_smc.alternate_vol_tag_id", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_primary_vol_seq_num, + { "Primary Volume Sequence Number", "scsi_smc.primary_vol_seq_num", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_scsi_smc_alternate_vol_seq_num, + { "Alternate Volume Sequence Number", "scsi_smc.alternate_vol_seq_num", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + }; + + + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_scsi_exchange_medium, + &ett_scsi_range, + &ett_scsi_move + }; + + /* Register the protocol name and description */ + proto_scsi_smc = proto_register_protocol("SCSI_SMC", "SCSI_SMC", "scsi_smc"); + + /* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_scsi_smc, hf, array_length(hf)); + + proto_register_subtree_array(ett, array_length(ett)); } void @@ -966,3 +1157,16 @@ proto_reg_handoff_scsi_smc(void) { } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/dissectors/packet-scsi-smc.h b/epan/dissectors/packet-scsi-smc.h index b512ef367a..a80040b255 100644 --- a/epan/dissectors/packet-scsi-smc.h +++ b/epan/dissectors/packet-scsi-smc.h @@ -52,6 +52,6 @@ void dissect_smc_readelementstatus (tvbuff_t *tvb, packet_info *pinfo, proto_tre extern int hf_scsi_smc_opcode; extern scsi_cdb_table_t scsi_smc_table[256]; -WS_DLL_PUBLIC const value_string scsi_smc_vals[]; +WS_DLL_PUBLIC value_string_ext scsi_smc_vals_ext; #endif diff --git a/epan/dissectors/packet-scsi-ssc.c b/epan/dissectors/packet-scsi-ssc.c index 4d84cef7ef..c347d624eb 100644 --- a/epan/dissectors/packet-scsi-ssc.c +++ b/epan/dissectors/packet-scsi-ssc.c @@ -45,56 +45,56 @@ void proto_register_scsi_ssc(void); void proto_reg_handoff_scsi_ssc(void); -static int proto_scsi_ssc = -1; -int hf_scsi_ssc_opcode = -1; -static int hf_scsi_ssc_rdwr6_xferlen = -1; -static int hf_scsi_ssc_ver16_verlen = -1; -static int hf_scsi_ssc_locate10_loid = -1; -static int hf_scsi_ssc_locate16_loid = -1; -static int hf_scsi_ssc_space6_code = -1; -static int hf_scsi_ssc_space6_count = -1; -static int hf_scsi_ssc_space16_count = -1; -static int hf_scsi_ssc_erase_flags = -1; -static int hf_scsi_ssc_fcs = -1; -static int hf_scsi_ssc_lcs = -1; -static int hf_scsi_ssc_erase_immed = -1; -static int hf_scsi_ssc_long = -1; -static int hf_scsi_ssc_partition = -1; -static int hf_scsi_ssc_lbi = -1; -static int hf_scsi_ssc_verify = -1; -static int hf_scsi_ssc_immed = -1; -static int hf_scsi_ssc_formatmedium_flags = -1; -static int hf_scsi_ssc_format = -1; -static int hf_scsi_ssc_rdwr10_xferlen = -1; -static int hf_scsi_ssc_loadunload_immed_flags = -1; -static int hf_scsi_ssc_loadunload_flags = -1; -static int hf_scsi_ssc_hold = -1; -static int hf_scsi_ssc_eot = -1; -static int hf_scsi_ssc_reten = -1; -static int hf_scsi_ssc_load = -1; -static int hf_scsi_ssc_locate_flags = -1; -static int hf_scsi_ssc_bt = -1; -static int hf_scsi_ssc_cp = -1; -static int hf_scsi_ssc_dest_type = -1; -static int hf_scsi_ssc_bam_flags = -1; -static int hf_scsi_ssc_bam = -1; -static int hf_scsi_ssc_read6_flags = -1; -static int hf_scsi_ssc_sili = -1; -static int hf_scsi_ssc_fixed = -1; -static int hf_scsi_ssc_bytord = -1; -static int hf_scsi_ssc_bytcmp = -1; -static int hf_scsi_ssc_verify16_immed = -1; -static int hf_scsi_ssc_medium_type = -1; -static int hf_scsi_ssc_media = -1; -static int hf_scsi_ssc_capacity_prop_value = -1; - -static gint ett_scsi_erase = -1; -static gint ett_scsi_formatmedium = -1; -static gint ett_scsi_loadunload_immed = -1; -static gint ett_scsi_loadunload = -1; -static gint ett_scsi_locate = -1; -static gint ett_scsi_bam = -1; -static gint ett_scsi_read6 = -1; +static int proto_scsi_ssc = -1; +int hf_scsi_ssc_opcode = -1; +static int hf_scsi_ssc_rdwr6_xferlen = -1; +static int hf_scsi_ssc_ver16_verlen = -1; +static int hf_scsi_ssc_locate10_loid = -1; +static int hf_scsi_ssc_locate16_loid = -1; +static int hf_scsi_ssc_space6_code = -1; +static int hf_scsi_ssc_space6_count = -1; +static int hf_scsi_ssc_space16_count = -1; +static int hf_scsi_ssc_erase_flags = -1; +static int hf_scsi_ssc_fcs = -1; +static int hf_scsi_ssc_lcs = -1; +static int hf_scsi_ssc_erase_immed = -1; +static int hf_scsi_ssc_long = -1; +static int hf_scsi_ssc_partition = -1; +static int hf_scsi_ssc_lbi = -1; +static int hf_scsi_ssc_verify = -1; +static int hf_scsi_ssc_immed = -1; +static int hf_scsi_ssc_formatmedium_flags = -1; +static int hf_scsi_ssc_format = -1; +static int hf_scsi_ssc_rdwr10_xferlen = -1; +static int hf_scsi_ssc_loadunload_immed_flags = -1; +static int hf_scsi_ssc_loadunload_flags = -1; +static int hf_scsi_ssc_hold = -1; +static int hf_scsi_ssc_eot = -1; +static int hf_scsi_ssc_reten = -1; +static int hf_scsi_ssc_load = -1; +static int hf_scsi_ssc_locate_flags = -1; +static int hf_scsi_ssc_bt = -1; +static int hf_scsi_ssc_cp = -1; +static int hf_scsi_ssc_dest_type = -1; +static int hf_scsi_ssc_bam_flags = -1; +static int hf_scsi_ssc_bam = -1; +static int hf_scsi_ssc_read6_flags = -1; +static int hf_scsi_ssc_sili = -1; +static int hf_scsi_ssc_fixed = -1; +static int hf_scsi_ssc_bytord = -1; +static int hf_scsi_ssc_bytcmp = -1; +static int hf_scsi_ssc_verify16_immed = -1; +static int hf_scsi_ssc_medium_type = -1; +static int hf_scsi_ssc_media = -1; +static int hf_scsi_ssc_capacity_prop_value = -1; + +static gint ett_scsi_erase = -1; +static gint ett_scsi_formatmedium = -1; +static gint ett_scsi_loadunload_immed = -1; +static gint ett_scsi_loadunload = -1; +static gint ett_scsi_locate = -1; +static gint ett_scsi_bam = -1; +static gint ett_scsi_read6 = -1; static void @@ -103,9 +103,9 @@ dissect_ssc_read6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *read6_fields[] = { - &hf_scsi_ssc_sili, - &hf_scsi_ssc_fixed, - NULL + &hf_scsi_ssc_sili, + &hf_scsi_ssc_fixed, + NULL }; if (isreq) { @@ -128,9 +128,9 @@ dissect_ssc_recoverbuffereddata (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *recover_fields[] = { - &hf_scsi_ssc_sili, - &hf_scsi_ssc_fixed, - NULL + &hf_scsi_ssc_sili, + &hf_scsi_ssc_fixed, + NULL }; if (isreq) { @@ -153,9 +153,9 @@ dissect_ssc_reportdensitysupport (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *rd_fields[] = { - &hf_scsi_ssc_medium_type, - &hf_scsi_ssc_media, - NULL + &hf_scsi_ssc_medium_type, + &hf_scsi_ssc_media, + NULL }; if (isreq) { @@ -183,10 +183,10 @@ dissect_ssc_readreverse6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *rr6_fields[] = { - &hf_scsi_ssc_bytord, - &hf_scsi_ssc_sili, - &hf_scsi_ssc_fixed, - NULL + &hf_scsi_ssc_bytord, + &hf_scsi_ssc_sili, + &hf_scsi_ssc_fixed, + NULL }; if (isreq) { @@ -209,9 +209,9 @@ dissect_ssc_read16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *read6_fields[] = { - &hf_scsi_ssc_sili, - &hf_scsi_ssc_fixed, - NULL + &hf_scsi_ssc_sili, + &hf_scsi_ssc_fixed, + NULL }; if (isreq) { @@ -236,10 +236,10 @@ dissect_ssc_write16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *write16_fields[] = { - &hf_scsi_ssc_fcs, - &hf_scsi_ssc_lcs, - &hf_scsi_ssc_fixed, - NULL + &hf_scsi_ssc_fcs, + &hf_scsi_ssc_lcs, + &hf_scsi_ssc_fixed, + NULL }; if (isreq) { @@ -264,10 +264,10 @@ dissect_ssc_writefilemarks16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *wf16_fields[] = { - &hf_scsi_ssc_fcs, - &hf_scsi_ssc_lcs, - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_fcs, + &hf_scsi_ssc_lcs, + &hf_scsi_ssc_immed, + NULL }; if (isreq) { @@ -292,10 +292,10 @@ dissect_ssc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *verify16_fields[] = { - &hf_scsi_ssc_verify16_immed, - &hf_scsi_ssc_bytcmp, - &hf_scsi_ssc_fixed, - NULL + &hf_scsi_ssc_verify16_immed, + &hf_scsi_ssc_bytcmp, + &hf_scsi_ssc_fixed, + NULL }; if (isreq) { @@ -320,10 +320,10 @@ dissect_ssc_verify6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *verify6_fields[] = { - &hf_scsi_ssc_verify16_immed, - &hf_scsi_ssc_bytcmp, - &hf_scsi_ssc_fixed, - NULL + &hf_scsi_ssc_verify16_immed, + &hf_scsi_ssc_bytcmp, + &hf_scsi_ssc_fixed, + NULL }; if (isreq) { @@ -346,10 +346,10 @@ dissect_ssc_readreverse16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *rr16_fields[] = { - &hf_scsi_ssc_bytord, - &hf_scsi_ssc_sili, - &hf_scsi_ssc_fixed, - NULL + &hf_scsi_ssc_bytord, + &hf_scsi_ssc_sili, + &hf_scsi_ssc_fixed, + NULL }; if (isreq) { @@ -374,8 +374,8 @@ dissect_ssc_write6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *write6_fields[] = { - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_immed, + NULL }; if (isreq && iscdb) { @@ -398,8 +398,8 @@ dissect_ssc_writefilemarks6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *wf6_fields[] = { - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_immed, + NULL }; if (isreq) { @@ -422,15 +422,15 @@ dissect_ssc_loadunload (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *loadunload_immed_fields[] = { - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_immed, + NULL }; static const int *loadunload_fields[] = { - &hf_scsi_ssc_hold, - &hf_scsi_ssc_eot, - &hf_scsi_ssc_reten, - &hf_scsi_ssc_load, - NULL + &hf_scsi_ssc_hold, + &hf_scsi_ssc_eot, + &hf_scsi_ssc_reten, + &hf_scsi_ssc_load, + NULL }; if (isreq && iscdb) { @@ -468,7 +468,7 @@ dissect_ssc_readblocklimits (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else if (!iscdb) { - granularity = tvb_get_guint8 (tvb, offset); + granularity = tvb_get_guint8 (tvb, offset); proto_tree_add_text (tree, tvb, offset, 1, "Granularity: %u (%u %s)", granularity, 1 << granularity, plurality(1 << granularity, "byte", "bytes")); @@ -485,8 +485,8 @@ dissect_ssc_rewind (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *rewind_fields[] = { - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_immed, + NULL }; if (!tree) @@ -508,8 +508,8 @@ dissect_ssc_setcapacity (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *sc_fields[] = { - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_immed, + NULL }; if (!tree) @@ -531,10 +531,10 @@ dissect_ssc_locate10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *locate_fields[] = { - &hf_scsi_ssc_bt, - &hf_scsi_ssc_cp, - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_bt, + &hf_scsi_ssc_cp, + &hf_scsi_ssc_immed, + NULL }; if (!tree) @@ -557,14 +557,14 @@ dissect_ssc_locate16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *locate_fields[] = { - &hf_scsi_ssc_dest_type, - &hf_scsi_ssc_cp, - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_dest_type, + &hf_scsi_ssc_cp, + &hf_scsi_ssc_immed, + NULL }; static const int *bam_fields[] = { - &hf_scsi_ssc_bam, - NULL + &hf_scsi_ssc_bam, + NULL }; if (!tree) @@ -612,11 +612,11 @@ dissect_ssc_erase16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *erase16_fields[] = { - &hf_scsi_ssc_fcs, - &hf_scsi_ssc_lcs, - &hf_scsi_ssc_erase_immed, - &hf_scsi_ssc_long, - NULL + &hf_scsi_ssc_fcs, + &hf_scsi_ssc_lcs, + &hf_scsi_ssc_erase_immed, + &hf_scsi_ssc_long, + NULL }; if (!tree) @@ -668,10 +668,10 @@ dissect_ssc_space16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } static const value_string space6_code_vals[] = { - {0, "Logical Blocks"}, - {1, "Filemarks"}, - {2, "Sequential Filemarks"}, - {3, "End-Of-Data"}, + {0, "Logical Blocks"}, + {1, "Filemarks"}, + {2, "Sequential Filemarks"}, + {3, "End-Of-Data"}, {0, NULL} }; @@ -694,9 +694,9 @@ dissect_ssc_formatmedium (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *formatmedium_fields[] = { - &hf_scsi_ssc_verify, - &hf_scsi_ssc_immed, - NULL + &hf_scsi_ssc_verify, + &hf_scsi_ssc_immed, + NULL }; if (!tree) @@ -891,60 +891,58 @@ dissect_ssc_readposition (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre } - - - /* SSC Commands */ -const value_string scsi_ssc_vals[] = { - {SCSI_SSC_ERASE_6 , "Erase(6)"}, - {SCSI_SSC_ERASE_16 , "Erase(16)"}, - {SCSI_SPC_EXTCOPY , "Extended Copy"}, - {SCSI_SSC_FORMAT_MEDIUM , "Format Medium"}, - {SCSI_SPC_INQUIRY , "Inquiry"}, - {SCSI_SSC_LOAD_UNLOAD , "Load Unload"}, - {SCSI_SSC_LOCATE_10 , "Locate(10)"}, - {SCSI_SSC_LOCATE_16 , "Locate(16)"}, - {SCSI_SPC_LOGSELECT , "Log Select"}, - {SCSI_SPC_LOGSENSE , "Log Sense"}, - {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, - {SCSI_SPC_MODESELECT6 , "Mode Select(6)"}, - {SCSI_SPC_RESERVE6 , "Reserve(6)"}, - {SCSI_SPC_RELEASE6 , "Release(6)"}, - {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, - {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, - {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, - {SCSI_SMC_MOVE_MEDIUM , "Move Medium"}, - {SCSI_SMC_MOVE_MEDIUM_ATTACHED , "Move Medium Attached"}, - {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"}, - {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"}, - {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, - {SCSI_SSC_READ6 , "Read(6)"}, - {SCSI_SSC_READ_16 , "Read(16)"}, - {SCSI_SSC_READ_BLOCK_LIMITS , "Read Block Limits"}, - {SCSI_SMC_READ_ELEMENT_STATUS , "Read Element Status"}, - {SCSI_SMC_READ_ELEMENT_STATUS_ATTACHED , "Read Element Status Attached"}, - {SCSI_SSC_READ_POSITION , "Read Position"}, - {SCSI_SSC_READ_REVERSE_6 , "Read Reverse(6)"}, - {SCSI_SSC_READ_REVERSE_16 , "Read Reverse(16)"}, - {SCSI_SSC_RECOVER_BUFFERED_DATA , "Recover Buffered Data"}, - {SCSI_SSC_REPORT_DENSITY_SUPPORT , "Report Density Support"}, - {SCSI_SPC_REPORTLUNS , "Report LUNs"}, - {SCSI_SPC_REQSENSE , "Request Sense"}, - {SCSI_SSC_REWIND , "Rewind"}, - {SCSI_SPC_SENDDIAG , "Send Diagnostic"}, - {SCSI_SSC_SET_CAPACITY , "Set Capacity"}, - {SCSI_SSC_SPACE_6 , "Space(6)"}, - {SCSI_SSC_SPACE_16 , "Space(16)"}, - {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, - {SCSI_SSC_VERIFY_6 , "Verify(6)"}, - {SCSI_SSC_VERIFY_16 , "Verify(16)"}, - {SCSI_SSC_WRITE6 , "Write(6)"}, - {SCSI_SSC_WRITE_16 , "Write(16)"}, - {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, - {SCSI_SSC_WRITE_FILEMARKS_16 , "Write Filemarks(16)"}, - {SCSI_SSC_WRITE_FILEMARKS_6 , "Write Filemarks(6)"}, +static const value_string scsi_ssc_vals[] = { + /* 0x00 */ {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, + /* 0x01 */ {SCSI_SSC_REWIND , "Rewind"}, + /* 0x03 */ {SCSI_SPC_REQSENSE , "Request Sense"}, + /* 0x04 */ {SCSI_SSC_FORMAT_MEDIUM , "Format Medium"}, + /* 0x05 */ {SCSI_SSC_READ_BLOCK_LIMITS , "Read Block Limits"}, + /* 0x08 */ {SCSI_SSC_READ6 , "Read(6)"}, + /* 0x0A */ {SCSI_SSC_WRITE6 , "Write(6)"}, + /* 0x0B */ {SCSI_SSC_SET_CAPACITY , "Set Capacity"}, + /* 0x0F */ {SCSI_SSC_READ_REVERSE_6 , "Read Reverse(6)"}, + /* 0x10 */ {SCSI_SSC_WRITE_FILEMARKS_6 , "Write Filemarks(6)"}, + /* 0x11 */ {SCSI_SSC_SPACE_6 , "Space(6)"}, + /* 0x12 */ {SCSI_SPC_INQUIRY , "Inquiry"}, + /* 0x13 */ {SCSI_SSC_VERIFY_6 , "Verify(6)"}, + /* 0x14 */ {SCSI_SSC_RECOVER_BUFFERED_DATA , "Recover Buffered Data"}, + /* 0x15 */ {SCSI_SPC_MODESELECT6 , "Mode Select(6)"}, + /* 0x16 */ {SCSI_SPC_RESERVE6 , "Reserve(6)"}, + /* 0x17 */ {SCSI_SPC_RELEASE6 , "Release(6)"}, + /* 0x19 */ {SCSI_SSC_ERASE_6 , "Erase(6)"}, + /* 0x1A */ {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, + /* 0x1B */ {SCSI_SSC_LOAD_UNLOAD , "Load Unload"}, + /* 0x1D */ {SCSI_SPC_SENDDIAG , "Send Diagnostic"}, + /* 0x1E */ {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, + /* 0x2B */ {SCSI_SSC_LOCATE_10 , "Locate(10)"}, + /* 0x34 */ {SCSI_SSC_READ_POSITION , "Read Position"}, + /* 0x3B */ {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, + /* 0x44 */ {SCSI_SSC_REPORT_DENSITY_SUPPORT , "Report Density Support"}, + /* 0x4C */ {SCSI_SPC_LOGSELECT , "Log Select"}, + /* 0x4D */ {SCSI_SPC_LOGSENSE , "Log Sense"}, + /* 0x55 */ {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, + /* 0x5A */ {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, + /* 0x5E */ {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"}, + /* 0x5F */ {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"}, + /* 0x80 */ {SCSI_SSC_WRITE_FILEMARKS_16 , "Write Filemarks(16)"}, + /* 0x81 */ {SCSI_SSC_READ_REVERSE_16 , "Read Reverse(16)"}, + /* 0x83 */ {SCSI_SPC_EXTCOPY , "Extended Copy"}, + /* 0x88 */ {SCSI_SSC_READ_16 , "Read(16)"}, + /* 0x8A */ {SCSI_SSC_WRITE_16 , "Write(16)"}, + /* 0x8F */ {SCSI_SSC_VERIFY_16 , "Verify(16)"}, + /* 0x91 */ {SCSI_SSC_SPACE_16 , "Space(16)"}, + /* 0x92 */ {SCSI_SSC_LOCATE_16 , "Locate(16)"}, + /* 0x93 */ {SCSI_SSC_ERASE_16 , "Erase(16)"}, + /* 0xA0 */ {SCSI_SPC_REPORTLUNS , "Report LUNs"}, + /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, + /* 0xA5 */ {SCSI_SMC_MOVE_MEDIUM , "Move Medium"}, + /* 0xA7 */ {SCSI_SMC_MOVE_MEDIUM_ATTACHED , "Move Medium Attached"}, + /* 0xB4 */ {SCSI_SMC_READ_ELEMENT_STATUS_ATTACHED , "Read Element Status Attached"}, + /* 0xB8 */ {SCSI_SMC_READ_ELEMENT_STATUS , "Read Element Status"}, {0, NULL} }; +value_string_ext scsi_ssc_vals_ext = VALUE_STRING_EXT_INIT(scsi_ssc_vals); scsi_cdb_table_t scsi_ssc_table[256] = { @@ -1211,10 +1209,10 @@ scsi_cdb_table_t scsi_ssc_table[256] = { void proto_register_scsi_ssc(void) { - static hf_register_info hf[] = { + static hf_register_info hf[] = { { &hf_scsi_ssc_opcode, - {"SSC Opcode", "scsi_ssc.opcode", FT_UINT8, BASE_HEX, - VALS (scsi_ssc_vals), 0x0, NULL, HFILL}}, + {"SSC Opcode", "scsi_ssc.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING, + &scsi_ssc_vals_ext, 0x0, NULL, HFILL}}, { &hf_scsi_ssc_rdwr6_xferlen, {"Transfer Length", "scsi_ssc.rdwr6.xferlen", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}}, @@ -1232,7 +1230,7 @@ proto_register_scsi_ssc(void) NULL, HFILL}}, { &hf_scsi_ssc_space6_code, {"Code", "scsi_ssc.space6.code", FT_UINT8, BASE_HEX, - VALS(space6_code_vals), 0x0f, + VALS(space6_code_vals), 0x0f, NULL, HFILL}}, { &hf_scsi_ssc_space16_count, {"Count", "scsi_ssc.space16.count", FT_UINT64, BASE_DEC, NULL, 0x0, @@ -1336,28 +1334,28 @@ proto_register_scsi_ssc(void) { &hf_scsi_ssc_capacity_prop_value, {"Capacity Proportion Value", "scsi_ssc.cpv", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, - }; + }; - /* Setup protocol subtree array */ - static gint *ett[] = { - &ett_scsi_erase, - &ett_scsi_formatmedium, - &ett_scsi_loadunload_immed, - &ett_scsi_loadunload, - &ett_scsi_locate, - &ett_scsi_bam, - &ett_scsi_read6 - }; + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_scsi_erase, + &ett_scsi_formatmedium, + &ett_scsi_loadunload_immed, + &ett_scsi_loadunload, + &ett_scsi_locate, + &ett_scsi_bam, + &ett_scsi_read6 + }; - /* Register the protocol name and description */ - proto_scsi_ssc = proto_register_protocol("SCSI_SSC", "SCSI_SSC", "scsi_ssc"); + /* Register the protocol name and description */ + proto_scsi_ssc = proto_register_protocol("SCSI_SSC", "SCSI_SSC", "scsi_ssc"); - /* Required function calls to register the header fields and subtrees used */ - proto_register_field_array(proto_scsi_ssc, hf, array_length(hf)); + /* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_scsi_ssc, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); + proto_register_subtree_array(ett, array_length(ett)); } @@ -1366,3 +1364,16 @@ proto_reg_handoff_scsi_ssc(void) { } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/dissectors/packet-scsi-ssc.h b/epan/dissectors/packet-scsi-ssc.h index 5166cb088d..b86681912e 100644 --- a/epan/dissectors/packet-scsi-ssc.h +++ b/epan/dissectors/packet-scsi-ssc.h @@ -59,6 +59,6 @@ extern int hf_scsi_ssc_opcode; extern scsi_cdb_table_t scsi_ssc_table[256]; -WS_DLL_PUBLIC const value_string scsi_ssc_vals[]; +WS_DLL_PUBLIC value_string_ext scsi_ssc_vals_ext; #endif diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index ad8b0c19dd..821037ae37 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -758,39 +758,40 @@ typedef guint32 scsi_device_type; /* SPC and SPC-2 Commands */ static const value_string scsi_spc_vals[] = { - {SCSI_SPC_ACCESS_CONTROL_IN , "Access Control In"}, - {SCSI_SPC_ACCESS_CONTROL_OUT , "Access Control Out"}, - {SCSI_SPC_CHANGE_DEFINITION , "Change Definition"}, - {SCSI_SPC_COMPARE , "Compare"}, - {SCSI_SPC_COPY , "Copy"}, - {SCSI_SPC_COPY_AND_VERIFY , "Copy And Verify"}, - {SCSI_SPC_EXTCOPY , "Extended Copy"}, - {SCSI_SPC_INQUIRY , "Inquiry"}, - {SCSI_SPC_LOGSELECT , "Log Select"}, - {SCSI_SPC_LOGSENSE , "Log Sense"}, - {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, - {SCSI_SPC_MODESELECT6 , "Mode Select(6)"}, - {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, - {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, - {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, - {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"}, - {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"}, - {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, - {SCSI_SPC_RCVCOPYRESULTS , "Receive Copy Results"}, - {SCSI_SPC_RCVDIAGRESULTS , "Receive Diagnostics Results"}, - {SCSI_SPC_READBUFFER , "Read Buffer"}, - {SCSI_SPC_RELEASE6 , "Release(6)"}, - {SCSI_SPC_RELEASE10 , "Release(10)"}, - {SCSI_SPC_REPORTLUNS , "Report LUNs"}, - {SCSI_SPC_REQSENSE , "Request Sense"}, - {SCSI_SPC_RESERVE6 , "Reserve(6)"}, - {SCSI_SPC_RESERVE10 , "Reserve(10)"}, - {SCSI_SPC_SENDDIAG , "Send Diagnostic"}, - {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, - {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, - {SCSI_SPC_VARLENCDB , "Variable Length CDB"}, + /* 0x00 */ {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"}, + /* 0x03 */ {SCSI_SPC_REQSENSE , "Request Sense"}, + /* 0x12 */ {SCSI_SPC_INQUIRY , "Inquiry"}, + /* 0x15 */ {SCSI_SPC_MODESELECT6 , "Mode Select(6)"}, + /* 0x16 */ {SCSI_SPC_RESERVE6 , "Reserve(6)"}, + /* 0x17 */ {SCSI_SPC_RELEASE6 , "Release(6)"}, + /* 0x18 */ {SCSI_SPC_COPY , "Copy"}, + /* 0x1A */ {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"}, + /* 0x1C */ {SCSI_SPC_RCVDIAGRESULTS , "Receive Diagnostics Results"}, + /* 0x1D */ {SCSI_SPC_SENDDIAG , "Send Diagnostic"}, + /* 0x1E */ {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"}, + /* 0x39 */ {SCSI_SPC_COMPARE , "Compare"}, + /* 0x3A */ {SCSI_SPC_COPY_AND_VERIFY , "Copy And Verify"}, + /* 0x3B */ {SCSI_SPC_WRITEBUFFER , "Write Buffer"}, + /* 0x3C */ {SCSI_SPC_READBUFFER , "Read Buffer"}, + /* 0x40 */ {SCSI_SPC_CHANGE_DEFINITION , "Change Definition"}, + /* 0x4C */ {SCSI_SPC_LOGSELECT , "Log Select"}, + /* 0x4D */ {SCSI_SPC_LOGSENSE , "Log Sense"}, + /* 0x55 */ {SCSI_SPC_MODESELECT10 , "Mode Select(10)"}, + /* 0x56 */ {SCSI_SPC_RESERVE10 , "Reserve(10)"}, + /* 0x57 */ {SCSI_SPC_RELEASE10 , "Release(10)"}, + /* 0x5A */ {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"}, + /* 0x5E */ {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"}, + /* 0x5F */ {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"}, + /* 0x7F */ {SCSI_SPC_VARLENCDB , "Variable Length CDB"}, + /* 0x83 */ {SCSI_SPC_EXTCOPY , "Extended Copy"}, + /* 0x84 */ {SCSI_SPC_RCVCOPYRESULTS , "Receive Copy Results"}, + /* 0x86 */ {SCSI_SPC_ACCESS_CONTROL_IN , "Access Control In"}, + /* 0x87 */ {SCSI_SPC_ACCESS_CONTROL_OUT , "Access Control Out"}, + /* 0xA0 */ {SCSI_SPC_REPORTLUNS , "Report LUNs"}, + /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"}, {0, NULL}, }; +static value_string_ext scsi_spc_vals_ext = VALUE_STRING_EXT_INIT(scsi_spc_vals); static const value_string scsi_lun_address_mode_vals[] = { { 0, "Single Level LUN Structure" }, @@ -2592,7 +2593,7 @@ static gint scsi_def_devtype = SCSI_DEV_SBC; typedef struct _cmdset_t { int hf_opcode; - const value_string *cdb_vals; + value_string_ext *cdb_vals_ext; scsi_cdb_table_t *cdb_table; } cmdset_t; @@ -4774,7 +4775,7 @@ dissect_spc_mgmt_protocol_in(tvbuff_t *tvb, packet_info *pinfo _U_, it = proto_tree_add_text(tree, tvb_v, offset_v, 20, "Command Descriptor: %s", - val_to_str(tvb_get_guint8(tvb_v, offset_v+0), csdata->cdb_vals, "Unknown")); + val_to_str_ext_const(tvb_get_guint8(tvb_v, offset_v+0), csdata->cdb_vals_ext, "Unknown")); tr = proto_item_add_subtree(it, ett_command_descriptor); @@ -5118,9 +5119,9 @@ dissect_scsi_rsp(tvbuff_t *tvb, packet_info *pinfo, if (tree) { ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, 0, 0, "SCSI Response (%s)", - val_to_str(itlq->scsi_opcode, - csdata->cdb_vals, - "CDB:0x%02x")); + val_to_str_ext(itlq->scsi_opcode, + csdata->cdb_vals_ext, + "CDB:0x%02x")); scsi_tree = proto_item_add_subtree(ti, ett_scsi); } @@ -5150,7 +5151,7 @@ dissect_scsi_rsp(tvbuff_t *tvb, packet_info *pinfo, ti = proto_tree_add_uint(scsi_tree, hf_scsi_status, tvb, 0, 0, scsi_status); PROTO_ITEM_SET_GENERATED(ti); col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: Response LUN: 0x%02x (%s) (%s)", itlq->lun, - val_to_str(itlq->scsi_opcode, csdata->cdb_vals, "CDB:0x%02x"), + val_to_str_ext(itlq->scsi_opcode, csdata->cdb_vals_ext, "CDB:0x%02x"), val_to_str(scsi_status, scsi_status_val, "Unknown (0x%08x)")); col_set_fence(pinfo->cinfo, COL_INFO); @@ -5498,8 +5499,8 @@ dissect_scsi_cdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } #endif - if ((valstr = try_val_to_str(opcode, scsi_spc_vals)) == NULL) { - valstr = try_val_to_str(opcode, csdata->cdb_vals); + if ((valstr = try_val_to_str_ext(opcode, &scsi_spc_vals_ext)) == NULL) { + valstr = try_val_to_str_ext(opcode, csdata->cdb_vals_ext); } if (valstr != NULL) { @@ -5519,9 +5520,9 @@ dissect_scsi_cdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (tree) { ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, 0, -1, "SCSI CDB %s", - val_to_str(opcode, - csdata->cdb_vals, - "0x%02x") + val_to_str_ext(opcode, + csdata->cdb_vals_ext, + "0x%02x") ); scsi_tree = proto_item_add_subtree(ti, ett_scsi); } @@ -5608,9 +5609,9 @@ dissect_scsi_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, offset, payload_len, "SCSI Payload (%s %s)", - val_to_str(opcode, - csdata->cdb_vals, - "CDB:0x%02x"), + val_to_str_ext(opcode, + csdata->cdb_vals_ext, + "CDB:0x%02x"), isreq ? "Request Data" : "Response Data"); scsi_tree = proto_item_add_subtree(ti, ett_scsi); } @@ -5619,7 +5620,7 @@ dissect_scsi_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, "SCSI: Data %s LUN: 0x%02x (%s %s) ", isreq ? "Out" : "In", itlq->lun, - val_to_str(opcode, csdata->cdb_vals, "0x%02x"), + val_to_str_ext(opcode, csdata->cdb_vals_ext, "0x%02x"), isreq ? "Request Data" : "Response Data"); col_set_fence(pinfo->cinfo, COL_INFO); @@ -5792,34 +5793,34 @@ get_cmdset_data(itlq_nexus_t *itlq, itl_nexus_t *itl) switch(cmdset&SCSI_CMDSET_MASK) { case SCSI_DEV_SBC: - csdata->hf_opcode = hf_scsi_sbc_opcode; - csdata->cdb_vals = scsi_sbc_vals; - csdata->cdb_table = scsi_sbc_table; + csdata->hf_opcode = hf_scsi_sbc_opcode; + csdata->cdb_vals_ext = &scsi_sbc_vals_ext; + csdata->cdb_table = scsi_sbc_table; break; case SCSI_DEV_CDROM: - csdata->hf_opcode = hf_scsi_mmc_opcode; - csdata->cdb_vals = scsi_mmc_vals; - csdata->cdb_table = scsi_mmc_table; + csdata->hf_opcode = hf_scsi_mmc_opcode; + csdata->cdb_vals_ext = &scsi_mmc_vals_ext; + csdata->cdb_table = scsi_mmc_table; break; case SCSI_DEV_SSC: - csdata->hf_opcode = hf_scsi_ssc_opcode; - csdata->cdb_vals = scsi_ssc_vals; - csdata->cdb_table = scsi_ssc_table; + csdata->hf_opcode = hf_scsi_ssc_opcode; + csdata->cdb_vals_ext = &scsi_ssc_vals_ext; + csdata->cdb_table = scsi_ssc_table; break; case SCSI_DEV_SMC: - csdata->hf_opcode = hf_scsi_smc_opcode; - csdata->cdb_vals = scsi_smc_vals; - csdata->cdb_table = scsi_smc_table; + csdata->hf_opcode = hf_scsi_smc_opcode; + csdata->cdb_vals_ext = &scsi_smc_vals_ext; + csdata->cdb_table = scsi_smc_table; break; case SCSI_DEV_OSD: - csdata->hf_opcode = hf_scsi_osd_opcode; - csdata->cdb_vals = scsi_osd_vals; - csdata->cdb_table = scsi_osd_table; + csdata->hf_opcode = hf_scsi_osd_opcode; + csdata->cdb_vals_ext = &scsi_osd_vals_ext; + csdata->cdb_table = scsi_osd_table; break; default: - csdata->hf_opcode = hf_scsi_spcopcode; - csdata->cdb_vals = scsi_spc_vals; - csdata->cdb_table = spc; + csdata->hf_opcode = hf_scsi_spcopcode; + csdata->cdb_vals_ext = &scsi_spc_vals_ext; + csdata->cdb_table = spc; break; } @@ -5835,8 +5836,8 @@ proto_register_scsi(void) { "Status", "scsi.status", FT_UINT8, BASE_HEX, VALS(scsi_status_val), 0, "SCSI command status value", HFILL }}, { &hf_scsi_spcopcode, - {"SPC-2 Opcode", "scsi.spc.opcode", FT_UINT8, BASE_HEX, - VALS(scsi_spc_vals), 0x0, NULL, HFILL}}, + {"SPC-2 Opcode", "scsi.spc.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING, + &scsi_spc_vals_ext, 0x0, NULL, HFILL}}, { &hf_scsi_control, {"Control", "scsi.cdb.control", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, @@ -6184,7 +6185,7 @@ proto_register_scsi(void) { &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}}, + {"Attribute page", "scsi.sns.desc.osd_attr.page", FT_UINT32, BASE_HEX | BASE_EXT_STRING, &attributes_page_vals_ext, 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, diff --git a/epan/dissectors/packet-scsi.h b/epan/dissectors/packet-scsi.h index 2dbd714e0b..240365426a 100644 --- a/epan/dissectors/packet-scsi.h +++ b/epan/dissectors/packet-scsi.h @@ -25,8 +25,6 @@ #ifndef __PACKET_SCSI_H_ #define __PACKET_SCSI_H_ -#include "ws_symbol_export.h" - #include <epan/exceptions.h> /* Structure containing itl nexus data : @@ -216,8 +214,6 @@ void dissect_scsi_snsinfo (tvbuff_t *, packet_info *, proto_tree *, guint, guint void dissect_scsi_lun(proto_tree *, tvbuff_t *, guint); -WS_DLL_PUBLIC const value_string scsi_mmc_vals[]; - extern const int *cdb_control_fields[6]; extern gint ett_scsi_control; extern int hf_scsi_control; diff --git a/ui/cli/tap-scsistat.c b/ui/cli/tap-scsistat.c index 4d8e8033a2..94c2168c03 100644 --- a/ui/cli/tap-scsistat.c +++ b/ui/cli/tap-scsistat.c @@ -37,26 +37,27 @@ #include <epan/dissectors/packet-scsi-ssc.h> #include <epan/dissectors/packet-scsi-smc.h> #include <epan/dissectors/packet-scsi-osd.h> +#include <epan/dissectors/packet-scsi-mmc.h> void register_tap_listener_scsistat(void); -static guint8 scsi_program=0; +static guint8 scsi_program = 0; /* used to keep track of statistics for a specific procedure */ typedef struct _scsi_procedure_t { const char *proc; - int num; - nstime_t min; - nstime_t max; - nstime_t tot; + int num; + nstime_t min; + nstime_t max; + nstime_t tot; } scsi_procedure_t; /* used to keep track of the statistics for an entire program interface */ typedef struct _scsistat_t { - guint8 cmdset; - char *filter; - const value_string *cdbnames; - const char *prog; + guint8 cmdset; + char *filter; + value_string_ext *cdbnames_ext; + const char *prog; #define MAX_PROCEDURES 256 scsi_procedure_t *procedures; } scsistat_t; @@ -66,34 +67,34 @@ typedef struct _scsistat_t { static void scsistat_reset(void *prs) { - scsistat_t *rs=(scsistat_t *)prs; - guint32 i; + scsistat_t *rs = (scsistat_t *)prs; + guint32 i; - for(i=0; i < MAX_PROCEDURES; i++) { - rs->procedures[i].num=0; - rs->procedures[i].min.secs=0; - rs->procedures[i].min.nsecs=0; - rs->procedures[i].max.secs=0; - rs->procedures[i].max.nsecs=0; - rs->procedures[i].tot.secs=0; - rs->procedures[i].tot.nsecs=0; + for(i = 0; i < MAX_PROCEDURES; i++) { + rs->procedures[i].num = 0; + rs->procedures[i].min.secs = 0; + rs->procedures[i].min.nsecs = 0; + rs->procedures[i].max.secs = 0; + rs->procedures[i].max.nsecs = 0; + rs->procedures[i].tot.secs = 0; + rs->procedures[i].tot.nsecs = 0; } } static int scsistat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri) { - scsistat_t *rs = (scsistat_t *)prs; + scsistat_t *rs = (scsistat_t *)prs; const scsi_task_data_t *ri = (const scsi_task_data_t *)pri; - nstime_t delta; - scsi_procedure_t *rp; + nstime_t delta; + scsi_procedure_t *rp; /* we are only interested in response packets */ - if(ri->type!=SCSI_PDU_TYPE_RSP) { + if(ri->type != SCSI_PDU_TYPE_RSP) { return 0; } /* we are only interested in a specific commandset */ - if( (!ri->itl) || ((ri->itl->cmdset&SCSI_CMDSET_MASK)!=rs->cmdset) ) { + if( (!ri->itl) || ((ri->itl->cmdset&SCSI_CMDSET_MASK) != rs->cmdset) ) { return 0; } /* check that the opcode looks sane */ @@ -101,24 +102,24 @@ scsistat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const vo return 0; } - rp=&(rs->procedures[ri->itlq->scsi_opcode]); + rp = &(rs->procedures[ri->itlq->scsi_opcode]); /* calculate time delta between request and reply */ nstime_delta(&delta, &pinfo->fd->abs_ts, &ri->itlq->fc_time); - if(rp->num==0) { - rp->max.secs=delta.secs; - rp->max.nsecs=delta.nsecs; + if(rp->num == 0) { + rp->max.secs = delta.secs; + rp->max.nsecs = delta.nsecs; } - if(rp->num==0) { - rp->min.secs= delta.secs; - rp->min.nsecs=delta.nsecs; + if(rp->num == 0) { + rp->min.secs = delta.secs; + rp->min.nsecs = delta.nsecs; } if( (delta.secs < rp->min.secs) ||( (delta.secs == rp->min.secs) &&(delta.nsecs < rp->min.nsecs) ) ) { rp->min.secs = delta.secs; - rp->min.nsecs= delta.nsecs; + rp->min.nsecs = delta.nsecs; } if( (delta.secs > rp->max.secs) ||( (delta.secs == rp->max.secs) @@ -139,9 +140,9 @@ scsistat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const vo static void scsistat_draw(void *prs) { - scsistat_t *rs=(scsistat_t *)prs; - guint32 i; - guint64 td; + scsistat_t *rs = (scsistat_t *)prs; + guint32 i; + guint64 td; printf("\n"); printf("===========================================================\n"); @@ -149,7 +150,7 @@ scsistat_draw(void *prs) printf("Filter: %s\n", rs->filter?rs->filter:""); printf("Procedure Calls Min SRT Max SRT Avg SRT\n"); for(i=0; i < MAX_PROCEDURES; i++) { - if(rs->procedures[i].num==0) { + if(rs->procedures[i].num == 0) { continue; } /* scale it to units of 1us.*/ @@ -173,72 +174,72 @@ static void scsistat_init(const char *opt_arg, void* userdata _U_) { scsistat_t *rs; - guint32 i; - int program, pos; - const char *filter=NULL; - GString *error_string; + guint32 i; + int program, pos; + const char *filter = NULL; + GString *error_string; - pos=0; - if(sscanf(opt_arg, "scsi,srt,%d,%n", &program, &pos)==1) { + pos = 0; + if(sscanf(opt_arg, "scsi,srt,%d,%n", &program, &pos) == 1) { if(pos) { - filter=opt_arg+pos; + filter = opt_arg+pos; } else { - filter=NULL; + filter = NULL; } } else { fprintf(stderr, "tshark: invalid \"-z scsi,srt,<cmdset>[,<filter>]\" argument\n"); exit(1); } - scsi_program=program; - rs=g_new(scsistat_t,1); + scsi_program = program; + rs = g_new(scsistat_t,1); if(filter) { - rs->filter=g_strdup(filter); + rs->filter = g_strdup(filter); } else { - rs->filter=NULL; + rs->filter = NULL; } - rs->cmdset=program; + rs->cmdset = program; switch(program) { case SCSI_DEV_SBC: - rs->prog="SBC (disk)"; - rs->cdbnames=scsi_sbc_vals; + rs->prog = "SBC (disk)"; + rs->cdbnames_ext = &scsi_sbc_vals_ext; break; case SCSI_DEV_SSC: - rs->prog="SSC (tape)"; - rs->cdbnames=scsi_ssc_vals; + rs->prog = "SSC (tape)"; + rs->cdbnames_ext = &scsi_ssc_vals_ext; break; case SCSI_DEV_CDROM: - rs->prog="MMC (cd/dvd)"; - rs->cdbnames=scsi_mmc_vals; + rs->prog = "MMC (cd/dvd)"; + rs->cdbnames_ext = &scsi_mmc_vals_ext; break; case SCSI_DEV_SMC: - rs->prog="SMC (tape robot)"; - rs->cdbnames=scsi_smc_vals; + rs->prog = "SMC (tape robot)"; + rs->cdbnames_ext = &scsi_smc_vals_ext; break; case SCSI_DEV_OSD: - rs->prog="OSD (object based)"; - rs->cdbnames=scsi_osd_vals; + rs->prog = "OSD (object based)"; + rs->cdbnames_ext = &scsi_osd_vals_ext; break; default: /* Default to the SBC (disk), since this is what EMC SCSI seem to always be */ - rs->cmdset=0; - rs->prog="SBC (disk)"; - rs->cdbnames=scsi_sbc_vals; + rs->cmdset = 0; + rs->prog = "SBC (disk)"; + rs->cdbnames_ext = &scsi_sbc_vals_ext; break; } - rs->procedures=g_new(scsi_procedure_t,MAX_PROCEDURES); + rs->procedures = g_new(scsi_procedure_t,MAX_PROCEDURES); for(i=0; i < MAX_PROCEDURES; i++) { - rs->procedures[i].proc=val_to_str(i, rs->cdbnames, "Unknown-0x%02x"); - rs->procedures[i].num=0; - rs->procedures[i].min.secs=0; - rs->procedures[i].min.nsecs=0; - rs->procedures[i].max.secs=0; - rs->procedures[i].max.nsecs=0; - rs->procedures[i].tot.secs=0; - rs->procedures[i].tot.nsecs=0; + rs->procedures[i].proc = val_to_str_ext(i, rs->cdbnames_ext, "Unknown-0x%02x"); + rs->procedures[i].num = 0; + rs->procedures[i].min.secs = 0; + rs->procedures[i].min.nsecs = 0; + rs->procedures[i].max.secs = 0; + rs->procedures[i].max.nsecs = 0; + rs->procedures[i].tot.secs = 0; + rs->procedures[i].tot.nsecs = 0; } - error_string=register_tap_listener("scsi", rs, filter, 0, scsistat_reset, scsistat_packet, scsistat_draw); + error_string = register_tap_listener("scsi", rs, filter, 0, scsistat_reset, scsistat_packet, scsistat_draw); if(error_string) { /* error, we failed to attach to the tap. clean up */ g_free(rs->procedures); diff --git a/ui/gtk/scsi_stat.c b/ui/gtk/scsi_stat.c index b8c3892bd2..54b13fe74f 100644 --- a/ui/gtk/scsi_stat.c +++ b/ui/gtk/scsi_stat.c @@ -43,6 +43,7 @@ #include <epan/dissectors/packet-scsi-ssc.h> #include <epan/dissectors/packet-scsi-smc.h> #include <epan/dissectors/packet-scsi-osd.h> +#include <epan/dissectors/packet-scsi-mmc.h> #include "ui/simple_dialog.h" #include "../globals.h" @@ -60,20 +61,20 @@ /* used to keep track of the statistics for an entire scsi command set */ typedef struct _scsistat_t { - GtkWidget *win; - srt_stat_table srt_table; - guint8 cmdset; - const value_string *cdbnames; - const char *prog; + GtkWidget *win; + srt_stat_table srt_table; + guint8 cmdset; + value_string_ext *cdbnames_ext; + const char *prog; } scsistat_t; -static guint8 scsi_program=0; +static guint8 scsi_program = 0; enum { - SCSI_STAT_PROG_LABEL_SBC, - SCSI_STAT_PROG_LABEL_SSC, - SCSI_STAT_PROG_LABEL_MMC + SCSI_STAT_PROG_LABEL_SBC, + SCSI_STAT_PROG_LABEL_SSC, + SCSI_STAT_PROG_LABEL_MMC }; @@ -145,7 +146,7 @@ scsistat_draw(void *arg) static void win_destroy_cb(GtkWindow *win _U_, gpointer data) { - scsistat_t *rs=(scsistat_t *)data; + scsistat_t *rs = (scsistat_t *)data; remove_tap_listener(rs); @@ -160,59 +161,59 @@ static void gtk_scsistat_init(const char *opt_arg, void* userdata _U_) { scsistat_t *rs; - guint32 i; - char *title_string; - char *filter_string; - GtkWidget *vbox; - GtkWidget *stat_label; - GtkWidget *filter_label; - GtkWidget *bbox; - GtkWidget *close_bt; - int program, pos; - const char *filter=NULL; - GString *error_string; - const char *hf_name=NULL; - - pos=0; - if(sscanf(opt_arg,"scsi,srt,%d,%n",&program,&pos)==1){ + guint32 i; + char *title_string; + char *filter_string; + GtkWidget *vbox; + GtkWidget *stat_label; + GtkWidget *filter_label; + GtkWidget *bbox; + GtkWidget *close_bt; + int program, pos; + const char *filter = NULL; + GString *error_string; + const char *hf_name = NULL; + + pos = 0; + if(sscanf(opt_arg,"scsi,srt,%d,%n",&program,&pos) == 1){ if(pos){ - filter=opt_arg+pos; + filter = opt_arg+pos; } else { - filter=NULL; + filter = NULL; } } else { fprintf(stderr, "wireshark: invalid \"-z scsi,srt,<cmdset>[,<filter>]\" argument\n"); exit(1); } - scsi_program=program; - rs=(scsistat_t *)g_malloc(sizeof(scsistat_t)); - rs->cmdset=program; - switch(program){ + scsi_program = program; + rs = (scsistat_t *)g_malloc(sizeof(scsistat_t)); + rs->cmdset = program; + switch(program){ case SCSI_DEV_SBC: - rs->prog="SBC (disk)"; - rs->cdbnames=scsi_sbc_vals; - hf_name="scsi_sbc.opcode"; + rs->prog = "SBC (disk)"; + rs->cdbnames_ext = &scsi_sbc_vals_ext; + hf_name = "scsi_sbc.opcode"; break; case SCSI_DEV_SSC: - rs->prog="SSC (tape)"; - rs->cdbnames=scsi_ssc_vals; - hf_name="scsi_ssc.opcode"; + rs->prog = "SSC (tape)"; + rs->cdbnames_ext = &scsi_ssc_vals_ext; + hf_name = "scsi_ssc.opcode"; break; case SCSI_DEV_CDROM: - rs->prog="MMC (cd/dvd)"; - rs->cdbnames=scsi_mmc_vals; - hf_name="scsi_mmc.opcode"; + rs->prog = "MMC (cd/dvd)"; + rs->cdbnames_ext = &scsi_mmc_vals_ext; + hf_name = "scsi_mmc.opcode"; break; case SCSI_DEV_SMC: - rs->prog="SMC (tape robot)"; - rs->cdbnames=scsi_smc_vals; - hf_name="scsi_smc.opcode"; + rs->prog = "SMC (tape robot)"; + rs->cdbnames_ext = &scsi_smc_vals_ext; + hf_name = "scsi_smc.opcode"; break; case SCSI_DEV_OSD: - rs->prog="OSD (object based)"; - rs->cdbnames=scsi_osd_vals; - hf_name="scsi_osd.opcode"; + rs->prog = "OSD (object based)"; + rs->cdbnames_ext = &scsi_osd_vals_ext; + hf_name = "scsi_osd.opcode"; break; } @@ -221,17 +222,17 @@ gtk_scsistat_init(const char *opt_arg, void* userdata _U_) gtk_window_set_default_size(GTK_WINDOW(rs->win), 550, 400); scsistat_set_title(rs); - vbox=ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE); + vbox = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE); gtk_container_add(GTK_CONTAINER(rs->win), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); title_string = scsistat_gen_title(rs); - stat_label=gtk_label_new(title_string); + stat_label = gtk_label_new(title_string); g_free(title_string); gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0); filter_string = g_strdup_printf("Filter: %s", filter ? filter : ""); - filter_label=gtk_label_new(filter_string); + filter_label = gtk_label_new(filter_string); g_free(filter_string); gtk_label_set_line_wrap(GTK_LABEL(filter_label), TRUE); gtk_box_pack_start(GTK_BOX(vbox), filter_label, FALSE, FALSE, 0); @@ -241,12 +242,12 @@ gtk_scsistat_init(const char *opt_arg, void* userdata _U_) init_srt_table(&rs->srt_table, 256, vbox, hf_name); - for(i=0;i<256;i++){ - init_srt_table_row(&rs->srt_table, i, val_to_str(i, rs->cdbnames, "Unknown-0x%02x")); + for(i=0; i<256; i++){ + init_srt_table_row(&rs->srt_table, i, val_to_str_ext(i, rs->cdbnames_ext, "Unknown-0x%02x")); } - error_string=register_tap_listener("scsi", rs, filter, 0, scsistat_reset, scsistat_packet, scsistat_draw); + error_string = register_tap_listener("scsi", rs, filter, 0, scsistat_reset, scsistat_packet, scsistat_draw); if(error_string){ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); g_string_free(error_string, TRUE); @@ -273,16 +274,16 @@ gtk_scsistat_init(const char *opt_arg, void* userdata _U_) } static const enum_val_t scsi_command_sets[] = { - { "sbc", "SBC (disk)", SCSI_DEV_SBC }, - { "ssc", "SSC (tape)", SCSI_DEV_SSC }, - { "mmc", "MMC (cd/dvd)", SCSI_DEV_CDROM }, - { "smc", "SMC (tape robot)", SCSI_DEV_SMC }, + { "sbc", "SBC (disk)", SCSI_DEV_SBC }, + { "ssc", "SSC (tape)", SCSI_DEV_SSC }, + { "mmc", "MMC (cd/dvd)", SCSI_DEV_CDROM }, + { "smc", "SMC (tape robot)", SCSI_DEV_SMC }, { "osd", "OSD (object based)", SCSI_DEV_OSD }, { NULL, NULL, 0 } }; static tap_param scsi_stat_params[] = { - { PARAM_ENUM, "Command set", scsi_command_sets }, + { PARAM_ENUM, "Command set", scsi_command_sets }, { PARAM_FILTER, "Filter", NULL } }; @@ -301,3 +302,17 @@ register_tap_listener_gtkscsistat(void) register_param_stat(&scsi_stat_dlg, "SCSI", REGISTER_STAT_GROUP_RESPONSE_TIME); } + + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ |