def __init__(self, name, default, length_of=None, fmt="<H", adjust=None): Field.__init__(self, name, default, fmt) self.length_of = length_of if adjust is not None: self.adjust = adjust else: self.adjust = lambda pkt, x: self.lengthFromAddrMode(pkt, x)
def __init__(self, name, default): # create and compile the regex used to extract the uuid values from str reg = r"^\s*{0}-{1}-{1}-{2}{2}-{2}{2}{2}{2}{2}{2}\s*$".format( "([0-9a-f]{8})", "([0-9a-f]{4})", "([0-9a-f]{2})") self.reg = re.compile(reg, re.I) Field.__init__(self, name, default, fmt="I2H8B")
def __init__(self, name, entity_class="entity_class", attributes_mask="attributes_mask"): Field.__init__(self, name=name, default=None, fmt='s') self._entity_class = entity_class self._attributes_mask = attributes_mask
def __init__(self, name, default, length=11): """Initialize the field with a variable length. The 'machine' representation is a string field and the 'internal' repr. is a numeric value. """ Field.__init__(self, name, default, "%ds" % length) # Stores the length of the field self.length = length # Stores the conversion format between representations self.format = "%" + "%d" % length + "d"
def __init__(self, name, default): Field.__init__(self, name, None, "8B")
def __init__(self, name, default): Field.__init__(self, name, default, fmt="6s")
def __init__(self, name, default): Field.__init__(self, name, default, "h")
def __init__(self, name, default, length_from): Field.__init__(self, name, default) self.length_from= length_from
def __init__(self, name, default, length_from): Field.__init__(self, name, default) self.length_from = length_from
def __init__(self, name, entity_class="entity_class"): Field.__init__(self, name=name, default=None, fmt='s') self._entity_class = entity_class
def getfield(self, pkt, x): if len(x) == 2: Field.__init__(self, self.name, self.default, fmt="!H") return Field.getfield(self, pkt, x)
def __init__(self, name, default, endianType): _repr = {0: 'bigEndian', 1: 'littleEndian'} Field.__init__(self, name, default, "16s") self.endianType = _repr[endianType]
def __init__(self, name, pad_to): Field.__init__(self, name, 0, 'B') self._pad_to = pad_to self._omci_hdr_len = 4
def __init__(self, name, default): Field.__init__(self, name, default, "!I") self.sz = 3
def __init__(self, name, default, length_of=None): Field.__init__(self, name, default, ">H") self.length_of = length_of
def __init__(self, name, default, length, to_str, to_id): self.to_str = to_str self.to_id = to_id self.length = length Field.__init__(self, name, default, "%is" % length)
def __init__(self, name): Field.__init__(self, name, None, "H")
def __init__(self, name): Field.__init__(self, name, None, '!')
def __init__(self, name, default, count=None): Field.__init__(self, name, default, '<' + 'B' * count) self.count = count
def __init__(self, name, default): Field.__init__(self, name, default, "@H")
def __init__(self, name, default): Field.__init__(self, name, default, '<h')