Пример #1
0
 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)
Пример #2
0
    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")
Пример #3
0
 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
Пример #4
0
 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)
Пример #5
0
 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"
Пример #6
0
 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"
Пример #7
0
 def __init__(self, name, default):
     Field.__init__(self, name, None, "8B")
Пример #8
0
 def __init__(self, name, default):
     Field.__init__(self, name, default, fmt="6s")
Пример #9
0
 def __init__(self, name, default):
     Field.__init__(self, name, default, "h")
Пример #10
0
 def __init__(self, name, default, length_from):
     Field.__init__(self, name, default)
     self.length_from= length_from
Пример #11
0
 def __init__(self, name, default, length_from):
     Field.__init__(self, name, default)
     self.length_from = length_from
Пример #12
0
 def __init__(self, name, entity_class="entity_class"):
     Field.__init__(self, name=name, default=None, fmt='s')
     self._entity_class = entity_class
Пример #13
0
 def getfield(self, pkt, x):
     if len(x) == 2:
         Field.__init__(self, self.name, self.default, fmt="!H")
     return Field.getfield(self, pkt, x)
Пример #14
0
 def __init__(self, name, default, endianType):
     _repr = {0: 'bigEndian', 1: 'littleEndian'}
     Field.__init__(self, name, default, "16s")
     self.endianType = _repr[endianType]
Пример #15
0
 def __init__(self, name, pad_to):
     Field.__init__(self, name, 0, 'B')
     self._pad_to = pad_to
     self._omci_hdr_len = 4
Пример #16
0
 def __init__(self, name, default):
     Field.__init__(self, name, default, "!I")
     self.sz = 3
Пример #17
0
 def __init__(self, name, default, endianType):
     _repr = {0: 'bigEndian', 1: 'littleEndian'}
     Field.__init__(self, name, default, "16s")
     self.endianType = _repr[endianType]
Пример #18
0
 def __init__(self, name, default, length_of=None):
     Field.__init__(self, name, default, ">H")
     self.length_of = length_of
Пример #19
0
 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)
Пример #20
0
 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
Пример #21
0
 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)
Пример #22
0
	def __init__(self, name, default):
		Field.__init__(self, name, None, "8B")
Пример #23
0
 def __init__(self, name):
     Field.__init__(self, name, None, "H")
Пример #24
0
 def __init__(self, name):
     Field.__init__(self, name, None, '!')
Пример #25
0
 def __init__(self, name, default, count=None):
     Field.__init__(self, name, default, '<' + 'B' * count)
     self.count = count
Пример #26
0
 def __init__(self, name, default):
     Field.__init__(self, name, default, "!I")
     self.sz = 3
Пример #27
0
 def __init__(self, name, default):
     Field.__init__(self, name, default, "@H")
Пример #28
0
 def __init__(self, name, entity_class="entity_class"):
     Field.__init__(self, name=name, default=None, fmt='s')
     self._entity_class = entity_class
Пример #29
0
 def __init__(self, name, default):
     Field.__init__(self, name, default, '<h')
Пример #30
0
 def getfield(self, pkt, x):
     if len(x) == 2:
         Field.__init__(self, self.name, self.default, fmt="!H")
     return Field.getfield(self, pkt, x)