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
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)
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)