Beispiel #1
0
 def __init__(self, ustr):
     super().__init__(ustr)
     try:
         DecimalConstant(ustr)
         i = int(ustr)
         self.__value = iton(i)
     except TypeError:
         try:
             HexConstant(ustr)
             i = int(ustr, 16)
             self.__value = iton(i)
         except TypeError:
             Base64Constant(ustr)
             self.__value = base64.b64decode(bytes(ustr[2:], "utf8"))
     if len(self.__value) > 8:
         raise TypeError
Beispiel #2
0
 def InitiatorTaskTag(self, itt):
     if itt > 0xFFFFFFFF or itt < 0:
         self.logger.warn("InitiatorTaskTag(%d) is bigger than 4 bytes" %
                          itt)
     self.__data[16:20] = iton(itt, 4)
Beispiel #3
0
 def DataSegmentLength(self, dsl):
     if dsl > 0xFFFFFF or dsl < 0:
         self.logger.warn("DataSegmentLength(%d) is bigger than 3 bytes" %
                          dsl)
     self.__data[5:8] = iton(dsl, 3)
Beispiel #4
0
 def InitiatorTaskTag(self, itt):
     if itt > 0xFFFFFFFF or itt < 0:
         self.logger.warn("InitiatorTaskTag(%d) is bigger than 4 bytes" % itt)
     self.__data[16:20] = iton(itt, 4)
Beispiel #5
0
 def DataSegmentLength(self, dsl):
     if dsl > 0xFFFFFF or dsl < 0:
         self.logger.warn("DataSegmentLength(%d) is bigger than 3 bytes" % dsl)
     self.__data[5:8] = iton(dsl, 3)