Ejemplo n.º 1
0
class Frame(Structure):
    version = UBInt8()
    operation = UBInt8()
    result = UBInt16()
    reserved_0 = Magic('\x00\x00\x00\x00')
    _host_mac = UBInt8Sequence(6)
    host_mac = FieldProperty(_host_mac,
                             onget=lambda v: unpack_mac(''.join(map(chr, v))),
                             onset=lambda v: tuple(map(ord, pack_mac(v))))
    _device_mac = UBInt8Sequence(6)
    device_mac = FieldProperty(
        _device_mac,
        onget=lambda v: unpack_mac(''.join(map(chr, v))),
        onset=lambda v: tuple(map(ord, pack_mac(v))))
    reserved_1 = Magic('\x00\x00')
    sequence = UBInt16()
    signature = Magic('NSDP')
    reserved_2 = Magic('\x00\x00\x00\x00')
    messages = FieldArray(Message)
Ejemplo n.º 2
0
class CommandInfo(Structure):
    commands = FieldArray(SplitCommandInfo)
Ejemplo n.º 3
0
class TypedArray(Structure):
    array = FieldArray(TypedArrayElement)
Ejemplo n.º 4
0
class ConditionalArrayGreedyAfter(Structure):
    length = LengthField(UBInt8())
    array = FieldArray(ConditionalArrayElement, length)
    greedy = Payload()
Ejemplo n.º 5
0
class ConditionalArrayGreedy(Structure):
    array = FieldArray(ConditionalArrayElement)
Ejemplo n.º 6
0
class BasicMessageArrayNumElements(Structure):
    count = LengthField(UBInt8())
    array = FieldArray(BasicMessage, num_elements_provider=count)
Ejemplo n.º 7
0
class BasicMessageArrayAfter(Structure):
    count = LengthField(UBInt8(), multiplier=2)
    array = FieldArray(BasicMessage, count)
    after = UBInt8()