class BoxedGreedy(Structure): sof = Magic(b'\xAA') a = LengthField(UBInt8()) b = UBInt8() payload = Payload() c = UBInt16() d = VariableRawPayload(a) eof = Magic(b'\xbb')
class MyTargetMessage(Structure): # inherited from the parent message _length = LengthField(DependentField('length')) payload = VariableRawPayload(_length)
class MyVarSeqMessage(Structure): s = VariableRawPayload(None) b = UBInt8Sequence(None)
class SuperChild(Structure): options = DependentField('options') ubseq = DependentField('ubseq') length = LengthField(DependentField('submessage_length')) remaining = VariableRawPayload(length)
class MyLengthyMessage(Structure): length = LengthField(UBInt16()) payload = VariableRawPayload(length)
class MyMuiltipliedLengthMessage(Structure): length = LengthField(UBInt8(), multiplier=8) payload = VariableRawPayload(length)
class UDPFrame(Structure): source_port = UBInt16() destination_port = UBInt16() length = LengthField(UBInt16()) checksum = UBInt16() data = VariableRawPayload(length)