def __init__(self,
                 opcode,
                 blocksize,
                 lba,
                 tl,
                 data,
                 **kwargs):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param blocksize: a blocksize
        :param lba: Logical Block Address
        :param tl: transfer length
        :param data: a byte array with data
        :param kwargs: a list of keyword args including wrprotect, dpo, fua and group (all needed in the cdb)
        """
        if blocksize == 0:
            raise SCSICommand.MissingBlocksizeException

        SCSICommand.__init__(self,
                             opcode,
                             blocksize * tl,
                             0)
        self.dataout = data
        self.cdb = self.build_cdb(lba,
                                  tl,
                                  **kwargs)
 def __init__(self, scsi, lba, nb, data, wrprotect=0, anchor=False,
              unmap=False, ndob=False, group=0):
     SCSICommand.__init__(self, scsi, 0 if ndob else scsi.blocksize, 0)
     self.dataout = None if ndob else data
     self.cdb = self.build_cdb(lba, nb, wrprotect, anchor, unmap,
                               ndob, group)
     self.execute()
Esempio n. 3
0
    def __init__(self, scsi, lba, tl, **kwargs):
        if scsi.blocksize == 0:
            raise SCSICommand.MissingBlocksizeException

        SCSICommand.__init__(self, scsi, 0, scsi.blocksize * tl)
        self.cdb = self.build_cdb(lba, tl, **kwargs)
        self.execute()
    def __init__(self,
                 opcode,
                 data,
                 pf=1,
                 sp=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param data: a dict holding mode page to set
        :param pf: page format value can be 0 or 1
        :param sp: save pages value can be 0 or 1
        """
        _d = ModeSense10.marshall_datain(data)

        SCSICommand.__init__(self,
                             opcode,
                             len(_d),
                             0)
        self.dataout = _d
        self.cdb = self.build_cdb(10,
                                  opcode=self.opcode.value,
                                  pf=pf,
                                  sp=sp,
                                  parameter_list_length=len(_d), )
    def __init__(self,
                 opcode,
                 xfer,
                 source,
                 dest1,
                 dest2,
                 inv1=0,
                 inv2=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param xfer: medium transfer address
        :param source: source address
        :param dest1: first destination address
        :param dest2: second destination address
        :param inv1: value indicating if first destination should be inverted
        :param inv2: value indicating if scond destination should be inverted
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             0)

        self.cdb = self.build_cdb(opcode=self.opcode.value,
                                  medium_transport_address=xfer,
                                  source_address=source,
                                  first_destination_address=dest1,
                                  second_destination_address=dest2,
                                  inv1=inv1,
                                  inv2=inv2)
    def __init__(self,
                 opcode,
                 start,
                 num,
                 element_type=readelementstatus_enums.ELEMENT_TYPE.ALL,
                 voltag=0,
                 curdata=1,
                 dvcid=0,
                 alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param start: first element to return
        :param num: number of elements to return
        :param element_type: type of element to return data for
        :param voltag: volume tag, can have a value of 0 or 1
        :param curdata: current data, can have a value of 0 or 1
        :param dvcid: device id, can have a value of 0 or 1
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             alloclen)

        self.cdb = self.build_cdb(start,
                                  num,
                                  element_type,
                                  voltag,
                                  curdata,
                                  dvcid,
                                  alloclen)
Esempio n. 7
0
    def __init__(self,
                 opcode,
                 start,
                 num,
                 element_type=readelementstatus_enums.ELEMENT_TYPE.ALL,
                 voltag=0,
                 curdata=1,
                 dvcid=0,
                 alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param start: first element to return
        :param num: number of elements to return
        :param element_type: type of element to return data for
        :param voltag: volume tag, can have a value of 0 or 1
        :param curdata: current data, can have a value of 0 or 1
        :param dvcid: device id, can have a value of 0 or 1
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)

        self.cdb = self.build_cdb(start, num, element_type, voltag, curdata,
                                  dvcid, alloclen)
    def __init__(self,
                 opcode,
                 page_code,
                 sub_page_code=0,
                 llbaa=0,
                 dbd=0,
                 pc=0,
                 alloclen=96):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param page_code: the page code for the vpd page
        :param sub_page_code: a integer representing a sub page code
        :param llbaa: long LBA accepted can be 0 or 1
        :param dbd: disable block descriptor can be 0 or 1. If set to 1 server shall not return any block descriptor
        :param pc: page control field, a value between 0 and 3
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             alloclen)
        self.cdb = self.build_cdb(page_code,
                                  sub_page_code,
                                  llbaa,
                                  dbd,
                                  pc,
                                  alloclen)
Esempio n. 9
0
    def __init__(self,
                 opcode,
                 blocksize,
                 lba,
                 tl,
                 data,
                 wrprotect=0,
                 dpo=0,
                 fua=0,
                 group=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param blocksize: a blocksize
        :param lba: Logical Block Address
        :param tl: transfer length
        :param data: a byte array with data
        :param wrprotect=0:
        :param dpo=0:
        :param fua=0:
        :param group=0:
        """
        if blocksize == 0:
            raise SCSICommand.MissingBlocksizeException

        SCSICommand.__init__(self, opcode, blocksize * tl, 0)
        self.dataout = data
        self.cdb = self.build_cdb(opcode=self.opcode.value,
                                  lba=lba,
                                  tl=tl,
                                  wrprotect=wrprotect,
                                  dpo=dpo,
                                  fua=fua,
                                  group=group)
Esempio n. 10
0
    def __init__(self, scsi, lba, tl, **kwargs):
        if scsi.blocksize == 0:
            raise SCSICommand.MissingBlocksizeException

        SCSICommand.__init__(self, scsi, 0, scsi.blocksize * tl)
        self.cdb = self.build_cdb(lba, tl, **kwargs)
        self.execute()
    def __init__(self,
                 opcode,
                 page_code,
                 sub_page_code=0,
                 dbd=0,
                 pc=0,
                 alloclen=96):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param page_code: the page code for the vpd page
        :param sub_page_code: a integer representing a sub page code
        :param dbd: disable block descriptor can be 0 or 1. If set to 1 server shall not
                    return any block descriptor
        :param pc: page control field, a value between 0 and 3
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)
        self.cdb = self.build_cdb(opcode=self.opcode.value,
                                  page_code=page_code,
                                  sub_page_code=sub_page_code,
                                  dbd=dbd,
                                  pc=pc,
                                  alloc_len=alloclen)
Esempio n. 12
0
    def __init__(self,
                 opcode,
                 data,
                 pf=1,
                 sp=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param data: a dict holding mode page to set
        :param pf: page format value can be 0 or 1
        :param sp: save pages value can be 0 or 1
        """
        _d = ModeSense10.marshall_datain(data)

        SCSICommand.__init__(self,
                             opcode,
                             len(_d),
                             0)
        self.dataout = _d
        self.cdb = self.build_cdb(10,
                                  opcode=self.opcode.value,
                                  pf=pf,
                                  sp=sp,
                                  parameter_list_length=len(_d), )
Esempio n. 13
0
    def __init__(self,
                 opcode,
                 blocksize,
                 lba,
                 nb,
                 data,
                 wrprotect=0,
                 anchor=0,
                 unmap=0,
                 group=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param blocksize: a blocksize
        :param lba: logical block address
        :param nb: number of logical blocks
        :param data: a byte array with data
        :param wrprotect: value to specify write protection information
        :param anchor: anchor can have a value of 0 or 1
        :param unmap: unmap can have a value of 0 or 1
        :param group: group number, can be 0 or greater
        """
        if blocksize == 0:
            raise SCSICommand.MissingBlocksizeException

        SCSICommand.__init__(self, opcode, blocksize, 0)
        self.dataout = data
        self.cdb = self.build_cdb(lba, nb, wrprotect, anchor, unmap, group)
Esempio n. 14
0
    def __init__(self,
                 opcode,
                 xfer,
                 elements,
                 rng=0,
                 fast=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param xfer: starting element address
        :param elements: number of elements
        :param rng: range  indicates if all elements should be checked, if set to 1 xfer and elements are ignored
        :param fast: fast , if set to 1 scan for media presence only. If set to 0 scan elements for all relevant
                     status.
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             0)

        self.cdb = self.build_cdb(xfer,
                                  elements,
                                  rng,
                                  fast)
Esempio n. 15
0
 def __init__(self, scsi):
     """
     initialize a new instance
     :param scsi: a SCSI instance
     """
     SCSICommand.__init__(self, scsi, 0, 0)
     self.cdb = self.build_cdb()
     self.execute()
Esempio n. 16
0
    def __init__(self, opcode):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        """
        SCSICommand.__init__(self, opcode, 0, 0)

        self.cdb = self.build_cdb(opcode=self.opcode.value)
    def __init__(self, scsi, xfer, elements, rng=0, fast=0):
        """
        initialize a new instance

        :param scsi:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(xfer, elements, rng, fast)
        self.execute()
    def __init__(self, scsi, xfer, elements, rng=0, fast=0):
        """
        initialize a new instance

        :param scsi:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(xfer, elements, rng, fast)
        self.execute()
    def __init__(self, scsi, alloclen=8):
        """
        initialize a new instance

        :param scsi: a SCSI instance
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, scsi, 0, alloclen)
        self.cdb = self.build_cdb(alloclen)
        self.execute()
Esempio n. 20
0
    def __init__(self, scsi, lba, alloclen=16384):
        """
        initialize a new instance

        :param scsi: a SCSI instance
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, scsi, 0, alloclen)
        self.cdb = self.build_cdb(lba, alloclen)
        self.execute()
Esempio n. 21
0
    def __init__(self, opcode, alloclen=8):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)

        self.cdb = self.build_cdb(opcode=self.opcode.value)
Esempio n. 22
0
    def __init__(self, opcode, lba, alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param lba: a local block address
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)
        self.cdb = self.build_cdb(lba, alloclen)
Esempio n. 23
0
    def __init__(self, scsi, prevent=0):
        """
        initialize a new instance

        :param scsi:
        :param prevent:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(prevent)
        self.execute()
    def __init__(self, scsi, prevent=0):
        """
        initialize a new instance

        :param scsi:
        :param prevent:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(prevent)
        self.execute()
Esempio n. 25
0
    def __init__(self, opcode, xfer, acode, **kwargs):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param xfer: element address
        :param acode: action code
        """
        SCSICommand.__init__(self, opcode, 0, 0)

        self.cdb = self.build_cdb(xfer, acode)
    def __init__(self, scsi, xfer, acode):
        """
        initialize a new instance

        :param scsi:
        :param xfer:
        :param acode:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(xfer, acode)
        self.execute()
    def __init__(self, scsi, xfer, acode):
        """
        initialize a new instance

        :param scsi:
        :param xfer:
        :param acode:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(xfer, acode)
        self.execute()
Esempio n. 28
0
    def __init__(self, opcode, priority=0, alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param priority: specifies information to be returned in data_in buffer
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)

        self.cdb = self.build_cdb(priority, alloclen)
Esempio n. 29
0
    def __init__(self, opcode, xfer, dest, invert=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param xfer: medium transport address
        :param dest: destination address
        :param invert: invert can be 0 or 1
        """
        SCSICommand.__init__(self, opcode, 0, 0)

        self.cdb = self.build_cdb(xfer, dest, invert)
Esempio n. 30
0
    def __init__(self, opcode, evpd=0, page_code=0, alloclen=96):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param evpd: the byte to enable or disable vital product data
        :param page_code: the page code for the vpd page
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)
        self._evpd = evpd
        self.cdb = self.build_cdb(evpd, page_code, alloclen)
Esempio n. 31
0
    def __init__(self, opcode, alloclen=32):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)

        self.cdb = self.build_cdb(
            opcode=self.opcode.value,
            service_action=self.opcode.serviceaction.READ_CAPACITY_16,
            alloc_len=alloclen)
    def __init__(self, scsi, xfer, dest, invert=0):
        """
        initialize a new instance

        :param scsi:
        :param xfer:
        :param source:
        :param dest:
        :param invert:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(xfer, dest, invert)
        self.execute()
Esempio n. 33
0
    def __init__(self, scsi, evpd=0, page_code=0, alloclen=96):
        """
        initialize a new instance

        :param scsi: a SCSI instance
        :param evpd: the byte to enable or disable vital product data
        :param page_code: the page code for the vpd page
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, scsi, 0, alloclen)
        self._evpd = evpd
        self.cdb = self.build_cdb(evpd, page_code, alloclen)
        self.execute()
    def __init__(self,
                 opcode):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             0)

        self.cdb = self.build_cdb()
Esempio n. 35
0
    def __init__(self, opcode, xfer, source, dest1, dest2, inv1=0, inv2=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param xfer: medium transfer address
        :param source: source address
        :param dest1: first destination address
        :param dest2: second destination address
        :param inv1: value indicating if first destination should be inverted
        :param inv2: value indicating if scond destination should be inverted
        """
        SCSICommand.__init__(self, opcode, 0, 0)
        self.cdb = self.build_cdb(xfer, source, dest1, dest2, inv1, inv2)
    def __init__(self, scsi, data, pf=1, sp=0):
        """
        initialize a new instance

        :param scsi: a SCSI instance
        :param data: a dict holding mode page to set
        :param pf:
        :param sp:
        """
        _d = ModeSense6.marshall_datain(data)

        SCSICommand.__init__(self, scsi, len(_d), 0)
        self.dataout = _d
        self.cdb = self.build_cdb(pf, sp, len(_d))
        self.execute()
    def __init__(self, opcode, priority=0, alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param priority: specifies information to be returned in data_in buffer
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)

        self.cdb = self.build_cdb(
            opcode=self.opcode.value,
            service_action=self.opcode.serviceaction.REPORT_PRIORITY,
            priority_reported=priority,
            alloc_len=alloclen)
Esempio n. 38
0
    def __init__(self,
                 opcode,
                 prevent=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param prevent: prevent can have a value between 0 and 3
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             0)

        self.cdb = self.build_cdb(prevent)
    def __init__(self, opcode, lba, alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param lba: a local block address
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, opcode, 0, alloclen)
        self.cdb = self.build_cdb(
            opcode=self.opcode.value,
            service_action=self.opcode.serviceaction.GET_LBA_STATUS,
            lba=lba,
            alloc_len=alloclen,
        )
Esempio n. 40
0
    def __init__(self, scsi, data, pf=1, sp=0):
        """
        initialize a new instance

        :param scsi: a SCSI instance
        :param data: a dict holding mode page to set
        :param pf:
        :param sp:
        """
        _d = ModeSense6.marshall_datain(data)

        SCSICommand.__init__(self, scsi, len(_d), 0)
        self.dataout = _d
        self.cdb = self.build_cdb(pf, sp, len(_d))
        self.execute()
    def __init__(self, scsi, xfer, source, dest1, dest2, inv1=0, inv2=0):
        """
        initialize a new instance

        :param scsi:
        :param xfer:
        :param source:
        :param dest1:
        :param dest2:
        :param inv1:
        :param inv1:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(xfer, source, dest1, dest2, inv1, inv2)
        self.execute()
    def __init__(self, scsi, xfer, source, dest1, dest2, inv1=0, inv2=0):
        """
        initialize a new instance

        :param scsi:
        :param xfer:
        :param source:
        :param dest1:
        :param dest2:
        :param inv1:
        :param inv1:
        """
        SCSICommand.__init__(self, scsi, 0, 0)
        self.cdb = self.build_cdb(xfer, source, dest1, dest2, inv1, inv2)
        self.execute()
    def __init__(self,
                 opcode,
                 alloclen=8):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             alloclen)

        self.cdb = self.build_cdb(opcode=self.opcode.value)
    def __init__(self, scsi, page_code, sub_page_code=0, dbd=0, pc=0,
                 alloclen=96):
        """
        initialize a new instance

        :param scsi: a SCSI instance
        :param page_code: the page code for the vpd page
        :param sub_page_code:
        :param dbd:
        :param pc:
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, scsi, 0, alloclen)
        self.cdb = self.build_cdb(page_code, sub_page_code, dbd, pc,
                                  alloclen)
        self.execute()
Esempio n. 45
0
    def __init__(self, opcode, blocksize, lba, tl, **kwargs):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param blocksize: a blocksize
        :param lba: Logical Block Address
        :param tl: transfer length
        :param kwargs: a list of keyword args including rdprotect, dpo, fua, rarc and group (all needed in the cdb)
        """
        if blocksize == 0:
            raise SCSICommand.MissingBlocksizeException

        SCSICommand.__init__(self, opcode, 0, blocksize * tl)

        self.cdb = self.build_cdb(lba, tl, **kwargs)
Esempio n. 46
0
    def __init__(self, opcode, xfer, source, dest, invert=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param xfer: medium transport address
        :param source: source address
        :param dest: destination address
        :param invert: invert can be 0 or 1
        """
        SCSICommand.__init__(self, opcode, 0, 0)
        self.cdb = self.build_cdb(opcode=self.opcode.value,
                                  medium_transport_address=xfer,
                                  source_address=source,
                                  destination_address=dest,
                                  invert=invert)
    def __init__(self,
                 opcode,
                 lba,
                 alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param lba: a local block address
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             alloclen)
        self.cdb = self.build_cdb(lba,
                                  alloclen)
    def __init__(self,
                 opcode,
                 report=0x00,
                 alloclen=96):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param report: select report field value
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             alloclen)

        self.cdb = self.build_cdb(report,
                                  alloclen)
    def __init__(self, scsi, start, num, element_type=readelementstatus_enums.ELEMENT_TYPE.ALL,
                 voltag=0, curdata=1, dvcid=0, alloclen=16384):
        """
        initialize a new instance

        :param scsi: a SCSI instance
        :param start: first element to return
        :param num: number of elements to return
        :param element_type: type of element to return data for
        :param voltag
        :param curdata
        :param dvcid
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self, scsi, 0, alloclen)
        self.cdb = self.build_cdb(start, num, element_type, voltag, curdata,
                                  dvcid, alloclen)
        self.execute()
    def __init__(self,
                 opcode,
                 priority=0,
                 alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param priority: specifies information to be returned in data_in buffer
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             alloclen)

        self.cdb = self.build_cdb(priority,
                                  alloclen)
Esempio n. 51
0
    def __init__(self,
                 opcode,
                 lba,
                 alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param lba: a local block address
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             alloclen)
        self.cdb = self.build_cdb(opcode=self.opcode.value,
                                  service_action=self.opcode.serviceaction.GET_LBA_STATUS,
                                  lba=lba,
                                  alloc_len=alloclen, )
    def __init__(self,
                 opcode,
                 xfer,
                 acode,
                 **kwargs):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param xfer: element address
        :param acode: action code
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             0)

        self.cdb = self.build_cdb(xfer,
                                  acode)
Esempio n. 53
0
    def __init__(self,
                 opcode,
                 blocksize,
                 lba,
                 nb,
                 data,
                 wrprotect=0,
                 anchor=0,
                 unmap=0,
                 ndob=0,
                 group=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param blocksize: a blocksize
        :param lba: logical block address
        :param nb: number of logical blocks
        :param data: a byte array with data
        :param wrprotect: value to specify write protection information
        :param anchor: anchor can have a value of 0 or 1
        :param unmap: unmap can have a value of 0 or 1
        :param ndob: Value can be 0 or 1, use logical block data from data out buffer
                     (data arg) if set to 1.
        :param group: group number, can be 0 or greater
        """
        if not ndob and blocksize == 0:
            raise SCSICommand.MissingBlocksizeException

        SCSICommand.__init__(self,
                             opcode,
                             0 if ndob else blocksize,
                             0)
        self.dataout = None if ndob else data
        self.cdb = self.build_cdb(opcode=self.opcode.value,
                                  lba=lba,
                                  nb=nb,
                                  wrprotect=wrprotect,
                                  anchor=anchor,
                                  unmap=unmap,
                                  ndob=ndob,
                                  group=group)
    def __init__(self,
                 opcode,
                 priority=0,
                 alloclen=16384):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param priority: specifies information to be returned in data_in buffer
        :param alloclen: the max number of bytes allocated for the data_in buffer
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             alloclen)

        self.cdb = self.build_cdb(opcode=self.opcode.value,
                                  service_action=self.opcode.serviceaction.REPORT_PRIORITY,
                                  priority_reported=priority,
                                  alloc_len=alloclen)
    def __init__(self,
                 opcode,
                 xfer,
                 dest,
                 invert=0):
        """
        initialize a new instance

        :param opcode: a OpCode instance
        :param xfer: medium transport address
        :param dest: destination address
        :param invert: invert can be 0 or 1
        """
        SCSICommand.__init__(self,
                             opcode,
                             0,
                             0)

        self.cdb = self.build_cdb(xfer,
                                  dest,
                                  invert)