Beispiel #1
0
class UnknownVPDPageBuffer(Buffer):
    peripheral_device = buffer_field(where=bytes_ref[0:],
                                     type=PeripheralDeviceDataBuffer)
    page_code = be_uint_field(where=bytes_ref[1])
    page_length = be_uint_field(where=bytes_ref[2:4],
                                set_before_pack=len_ref(self_ref.page_data))
    page_data = list_field(where=bytes_ref[4:4 + page_length], type=b_uint8)
class UnitSerialNumberVPDPageBuffer(Buffer):
    peripheral_device = buffer_field(where=bytes_ref[0:],
                                     type=PeripheralDeviceDataBuffer)
    page_code = be_uint_field(where=bytes_ref[1])
    page_length = be_uint_field(where=bytes_ref[3],
                                set_before_pack=len_ref(
                                    self_ref.product_serial_number))
    product_serial_number = str_field(where=bytes_ref[4:4 + page_length])
Beispiel #3
0
class StringInquiryPageBuffer(Buffer):
    peripheral_device = buffer_field(where=bytes_ref[0:],
                                     type=PeripheralDeviceDataBuffer)
    page_code = be_uint_field(where=bytes_ref[1])
    page_length = be_uint_field(where=bytes_ref[2:4],
                                set_before_pack=len_ref(self_ref.string))
    string = str_field(where=bytes_ref[4:4 + page_length],
                       unpack_after=page_length)
Beispiel #4
0
class AtaInformationVPDPageBuffer(Buffer):
    byte_size = 572
    peripheral_device = buffer_field(where=bytes_ref[0:],
                                     type=PeripheralDeviceDataBuffer)
    page_code = be_int_field(where=bytes_ref[1:2])
    page_length = be_int_field(where=bytes_ref[2:4])
    sat_vendor_identification = str_field(where=bytes_ref[8:16])  # bytes 8-15
    sat_product_identification = str_field(
        where=bytes_ref[16:32])  # bytes 16-31
    sat_product_revision_level = str_field(
        where=bytes_ref[32:36])  # bytes 32-35
    device_signature = buffer_field(where=bytes_ref[36:56],
                                    type=DeviceSignature)  # bytes 36-55
    command_code = be_int_field(where=bytes_ref[56:57])
    # ATA IDENTIFY DEVICE: bytes 60-571
    identify_device = buffer_field(where=bytes_ref[60:572],
                                   type=AtaIdentifyDevice)
Beispiel #5
0
class SupportedVPDPagesBuffer(Buffer):
    peripheral_device = buffer_field(where=bytes_ref[0:],
                                     type=PeripheralDeviceDataBuffer)
    page_code = be_uint_field(where=bytes_ref[1])
    page_length = be_uint_field(where=bytes_ref[3])

    vpd_parameters = list_field(where=bytes_ref[4:],
                                type=b_uint8,
                                n=page_length)
class LogicalBlockProvisioningVPDPageBuffer(Buffer):
    peripheral_device = buffer_field(where=bytes_ref[0:], type=PeripheralDeviceDataBuffer)
    page_code = be_uint_field(where=bytes_ref[1])
    page_length = be_uint_field(where=bytes_ref[2:4])

    threshold_exponent = be_uint_field(where=bytes_ref[4])
    # bit-field
    dp = be_uint_field(where=bytes_ref[5].bits[0])
    anc_sup = be_uint_field(where=bytes_ref[5].bits[1])
    lbprz = be_uint_field(where=bytes_ref[5].bits[2])
    # reserved
    lbpws10 = be_uint_field(where=bytes_ref[5].bits[5])
    lbpws = be_uint_field(where=bytes_ref[5].bits[6])
    lbpu = be_uint_field(where=bytes_ref[5].bits[7])
    provisioning_type = be_uint_field(where=bytes_ref[6].bits[0:3])
    # reserved
    provisioning_group_descriptor = buffer_field(where=bytes_ref[8:], type=DesignatorDescriptor,
                                                 unpack_selector=determine_designator,
                                                 unpack_if=input_buffer_length>8)
class ElementDescriptor(Buffer):
    def _possible_elements_num(self):
        return self.type_descriptor_header.possible_elements_num

    overall_element = buffer_field(where=bytes_ref[0:], type=Descriptor)
    individual_elements = list_field(where=bytes_ref[after_ref(overall_element):], type=Descriptor,
                                     n=member_func_ref(_possible_elements_num))

    def unpack(self, buffer, type_descriptor_header):
        self.type_descriptor_header = type_descriptor_header
        return super(ElementDescriptor, self).unpack(buffer)
Beispiel #8
0
class JSONInquiryPageBuffer(Buffer):
    def _calc_json_length(self):
        import json
        return len(json.dumps(self.json_data))

    peripheral_device = buffer_field(where=bytes_ref[0:],
                                     type=PeripheralDeviceDataBuffer)
    page_code = be_uint_field(where=bytes_ref[1])
    page_length = be_uint_field(where=bytes_ref[2:4],
                                set_before_pack=self_ref._calc_json_length())
    json_data = json_field(where=bytes_ref[4:4 + page_length],
                           unpack_after=page_length)
Beispiel #9
0
class VeritasVPDPageBuffer(Buffer):
    peripheral_device = buffer_field(where=bytes_ref[0:],
                                     type=PeripheralDeviceDataBuffer)
    page_code = be_uint_field(where=bytes_ref[1])
    page_length = be_uint_field(where=bytes_ref[2:4])

    is_thin_lun = be_uint_field(where=bytes_ref[4].bits[0])
    is_snapshot_lun = be_uint_field(where=bytes_ref[4].bits[1])
    is_space_optimized_src = be_uint_field(where=bytes_ref[4].bits[2])
    is_fcdisk_lun = be_uint_field(where=bytes_ref[4].bits[3])
    is_satadisk_lun = be_uint_field(where=bytes_ref[4].bits[4])
    is_replication_src = be_uint_field(where=bytes_ref[4].bits[5])
    is_replication_dst = be_uint_field(where=bytes_ref[4].bits[6])
    raid_type = be_uint_field(where=bytes_ref[5])
Beispiel #10
0
class ReceiveDiagnosticResultCommand(CDBBuffer):
    opcode = be_int_field(where=bytes_ref[0], set_before_pack=CDB_RECEIVE_DIAGNOSTIC_RESULTS)
    pcv = be_int_field(where=bytes_ref[1].bits[0])
    page_code = be_uint_field(where=bytes_ref[2])
    allocation_length = be_int_field(where=bytes_ref[3:5], sign='unsigned')
    control = buffer_field(type=ControlBuffer, where=bytes_ref[5], set_before_pack=DEFAULT_CONTROL_BUFFER)

    def __init__(self, result_class, conf_page, *args, **kwargs):
        super(ReceiveDiagnosticResultCommand, self).__init__(*args, **kwargs)
        self.result_class = result_class
        self.conf_page = conf_page

    def execute(self, executer):
        datagram = self.create_datagram()
        result_datagram = yield executer.call(SCSIReadCommand(bytes(datagram), self.allocation_length))
        result = self.result_class(conf_page=self.conf_page)
        result.unpack(result_datagram)
        yield result
Beispiel #11
0
class BlockLimitsVPDPageBuffer(Buffer):
    peripheral_device = buffer_field(where=bytes_ref[0:],
                                     type=PeripheralDeviceDataBuffer)
    page_code = be_uint_field(where=bytes_ref[1])
    page_length = be_uint_field(where=bytes_ref[2:4])
    wsnz = be_uint_field(where=bytes_ref[4].bits[0])
    maximum_compare_and_write_length = be_uint_field(where=bytes_ref[5])
    optimal_transfer_length_granularity = be_uint_field(where=bytes_ref[6:8])
    maximum_transfer_length = be_uint_field(where=bytes_ref[8:12])
    optimal_transfer_length = be_uint_field(where=bytes_ref[12:16])
    maximum_prefetch_xdread_xdwrite_transfer_length = be_uint_field(
        where=bytes_ref[16:20])
    maximum_unmap_lba_count = be_uint_field(where=bytes_ref[20:24])
    maximum_unmap_block_descriptor_count = be_uint_field(
        where=bytes_ref[24:28])
    optimal_unmap_granularity = be_uint_field(where=bytes_ref[28:32])
    unmap_granularity_alignment = be_uint_field(
        where=(bytes_ref[35] + bytes_ref[34] + bytes_ref[33] +
               bytes_ref[32].bits[0:7]))
    ugavalid = be_uint_field(where=bytes_ref[32].bits[7])
    maximum_write_same_length = be_uint_field(where=bytes_ref[36:44])
Beispiel #12
0
class StatusDescriptor(Buffer):
    def _unpack_status_element(self, buffer, index, **kwargs):
        elem_type = self.type_descriptor_header.element_type
        if elem_type in ELEMENT_TYPE_TO_ELEMENT_INFO:
            return ELEMENT_TYPE_TO_ELEMENT_INFO[elem_type]
        else:
            return GeneralStatusElement

    def _possible_elements_num(self):
        return self.type_descriptor_header.possible_elements_num

    overall_element = buffer_field(where=bytes_ref[0:4],
                                   type=GeneralStatusElement)
    individual_elements = list_field(where=bytes_ref[4:],
                                     type=GeneralStatusElement,
                                     unpack_selector=_unpack_status_element,
                                     n=member_func_ref(_possible_elements_num))

    def unpack(self, buffer, type_descriptor_header):
        self.type_descriptor_header = type_descriptor_header
        return super(StatusDescriptor, self).unpack(buffer)
Beispiel #13
0
class SasExpanderStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=SasExpanderElementInfo)
Beispiel #14
0
class ScsiInitiatorPortStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=ScsiInitiatorPortElementInfo)
Beispiel #15
0
class SimpleSubenclosureStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=SimpleSubenclosureElementInfo)
Beispiel #16
0
class VoltageSensorStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=VoltageSensorElementInfo)
Beispiel #17
0
class CurrentSensorStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=CurrentSensorElementInfo)
Beispiel #18
0
class EnclosureServiceControllerStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=EnclosureServiceControllerElementInfo)
Beispiel #19
0
class CommunicationPortStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=CommunicationPortElementInfo)
Beispiel #20
0
class KeypadStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4], type=KeypadElementInfo)
Beispiel #21
0
class ScsiPortTransceiverStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=ScsiPortTransceiverElementInfo)
Beispiel #22
0
class NonVolotileCacheStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=NonVolotileCacheElementInfo)
Beispiel #23
0
class DisplayStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4], type=DisplayElementInfo)
Beispiel #24
0
class InvalidOpReasonStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=InvalidOpReasonElementInfo)
Beispiel #25
0
class CoolingStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4], type=CoolingElementInfo)
Beispiel #26
0
class SccControllerStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=SccControllerElementInfo)
Beispiel #27
0
class SasConnectorStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=SasConnectorElementInfo)
Beispiel #28
0
class LanguageStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4], type=LanguageElementInfo)
Beispiel #29
0
class UninterruptiblePowerSupplyStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=UninterruptiblePowerSupplyElementInfo)
Beispiel #30
0
class AudibleAlarmStatusElement(BaseStatusElement):
    status_info = buffer_field(where=bytes_ref[1:4],
                               type=AudibleAlarmElementInfo)