예제 #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)
예제 #2
0
class CommandInfo(Structure):
    commands = FieldArray(SplitCommandInfo)
예제 #3
0
class TypedArray(Structure):
    array = FieldArray(TypedArrayElement)
예제 #4
0
class ConditionalArrayGreedyAfter(Structure):
    length = LengthField(UBInt8())
    array = FieldArray(ConditionalArrayElement, length)
    greedy = Payload()
예제 #5
0
class ConditionalArrayGreedy(Structure):
    array = FieldArray(ConditionalArrayElement)
예제 #6
0
class BasicMessageArrayNumElements(Structure):
    count = LengthField(UBInt8())
    array = FieldArray(BasicMessage, num_elements_provider=count)
예제 #7
0
class BasicMessageArrayAfter(Structure):
    count = LengthField(UBInt8(), multiplier=2)
    array = FieldArray(BasicMessage, count)
    after = UBInt8()