Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class d_str32(summaryStructure):
type = 0b11011011
_fields_ = [
(pint.uint32_t, 'Length'),
(lambda s: dyn.clone(pstr.string, length=s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_bin8(summaryStructure):
type = 0b11000100
_fields_ = [
(pint.uint8_t, 'Length'),
(lambda s: dyn.block(s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_bin16(summaryStructure):
type = 0b11000101
_fields_ = [
(pint.uint16_t, 'Length'),
(lambda s: dyn.block(s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_bin32(summaryStructure):
type = 0b11000110
_fields_ = [
(pint.uint32_t, 'Length'),
(lambda s: dyn.block(s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_fixarray(summaryStructure):
type = 0b10010000
_fields_ = [(pint.uint8_t,'Value')]
@d_packet.define
class d_uint16(summaryStructure):
type = 0b11001101
_fields_ = [(pint.uint16_t,'Value')]
@d_packet.define
class d_uint32(summaryStructure):
type = 0b11001110
_fields_ = [(pint.uint32_t,'Value')]
@d_packet.define
class d_uint64(summaryStructure):
type = 0b11001111
_fields_ = [(pint.uint64_t,'Value')]
@d_packet.define
class d_int8(summaryStructure):
type = 0b11010000
_fields_ = [(pint.int8_t,'Value')]
@d_packet.define
class d_int16(pstruct.type):
type = 0b11010001
_fields_ = [(pint.int16_t,'Value')]
@d_packet.define
class d_int32(pstruct.type):
type = 0b11010010
_fields_ = [(pint.int32_t,'Value')]
@d_packet.define
class d_int64(pstruct.type):
type = 0b11010011
_fields_ = [(pint.int64_t,'Value')]
@d_packet.define
@d_packet.define
class d_fixarray(summaryStructure):
type = 0b10010000
_fields_ = [
(PackedIntegerHolder, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_array16(summaryStructure):
type = 0b11011100
_fields_ = [
(pint.uint16_t, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_array32(summaryStructure):
type = 0b11011101
_fields_ = [
(pint.uint32_t, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_fixmap(summaryStructure):
type = 0b10000000
_fields_ = [
(PackedIntegerHolder, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()*2), 'Value'),
]
def Data(self):
p = self.getparent(packet)
return p['type'].PackedValue()
_fields_ = [
(PackedIntegerHolder, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()*2), 'Value'),
]
def Data(self):
p = self.getparent(packet)
return p['type'].PackedValue()
@d_packet.define
class d_map16(summaryStructure):
type = 0b11011110
_fields_ = [
(pint.uint16_t, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()*2), 'Value'),
]
@d_packet.define
class d_map32(summaryStructure):
type = 0b11011111
_fields_ = [
(pint.uint32_t, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()*2), 'Value'),
]
@d_packet.define
class d_fixext1(summaryStructure):
type = 0b11010100
_fields_ = [
(pint.sint8_t, 'Type'),
(dyn.array(pint.uint8_t, 1), 'Value'),
]
@d_packet.define
class d_fixext2(summaryStructure):
type = 0b11010101
if res.name() != 'value':
raise AssertionError
return res.set(value)
@d_packet.define
class d_nil(summaryStructure):
type = 0b11000000
class _ConstantHolderNone(ConstantHolder): constant = None
_fields_ = [(_ConstantHolderNone, 'Value')]
@d_packet.define
class d_true(summaryStructure):
type = 0b11000010
class _ConstantHolderTrue(ConstantHolder): constant = True
_fields_ = [(_ConstantHolderTrue, 'Value')]
@d_packet.define
class d_false(summaryStructure):
type = 0b11000011
class _ConstantHolderFalse(ConstantHolder): constant = False
_fields_ = [(_ConstantHolderFalse, 'Value')]
@d_packet.define
class d_positive_fixint(summaryStructure):
type = 0b00000000
_fields_ = [(PackedIntegerHolder, 'Value')]
@d_packet.define
class d_negative_fixint(summaryStructure):
type = 0b11100000
class _PackedSignedIntegerHolder(PackedIntegerHolder):
def get(self):
return -0x20 + super(d_negative_fixint._PackedSignedIntegerHolder, self).get()
_fields_ = [(_PackedSignedIntegerHolder, 'Value')]
type = 0b11011000
_fields_ = [
(pint.sint8_t, 'Type'),
(dyn.array(pint.uint8_t, 16), 'Value'),
]
@d_packet.define
class d_ext8(summaryStructure):
type = 0b11000111
_fields_ = [(pint.uint8_t, 'Value'), (pint.sint8_t, 'Type')]
@d_packet.define
class d_ext16(summaryStructure):
type = 0b11001000
_fields_ = [(pint.uint16_t, 'Value'), (pint.sint8_t, 'Type')]
@d_packet.define
class d_ext32(summaryStructure):
type = 0b11001001
_fields_ = [(pint.uint32_t, 'Value'), (pint.sint8_t, 'Type')]
if __name__ == '__main__':
import types
import operator,functools,itertools
res = [130,196,4,116,121,112,101,196,7,119,111,114,107,101,114,115, 196,4,100,97,116,97,145,130,196,8,119,111,114,107,101,114,105,100, 196,5,115,116,100,46,49,196,5,115,108,111,116,115,160]
res = str().join(map(chr,res))
# https://github.com/msgpack/msgpack-python/blob/master/test/test_format.py
#res = b"\x96" b"\xde\x00\x00" b"\xde\x00\x01\xc0\xc2" b"\xde\x00\x02\xc0\xc2\xc3\xc2" b"\xdf\x00\x00\x00\x00" b"\xdf\x00\x00\x00\x01\xc0\xc2" b"\xdf\x00\x00\x00\x02\xc0\xc2\xc3\xc2"
_fixnum = res = b"\x92\x93\x00\x40\x7f\x93\xe0\xf0\xff"
_fixarray = res = b"\x92\x90\x91\x91\xc0"
_fixraw = res = b"\x94\xa0\xa1a\xa2bc\xa3def"
_fixmap = res = b"\x82\xc2\x81\xc0\xc0\xc3\x81\xc0\x80"
@d_packet.define
class d_str8(summaryStructure):
type = 0b11011001
_fields_ = [
(pint.uint8_t, 'Length'),
(lambda s: dyn.clone(pstr.string, length=s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_str16(summaryStructure):
type = 0b11011010
_fields_ = [
(pint.uint16_t, 'Length'),
(lambda s: dyn.clone(pstr.string, length=s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_str32(summaryStructure):
type = 0b11011011
_fields_ = [
(pint.uint32_t, 'Length'),
(lambda s: dyn.clone(pstr.string, length=s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_bin8(summaryStructure):
type = 0b11000100
_fields_ = [
(pint.uint8_t, 'Length'),
(lambda s: dyn.block(s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_bin16(summaryStructure):
type = 0b11000101
class d_bin16(summaryStructure):
type = 0b11000101
_fields_ = [
(pint.uint16_t, 'Length'),
(lambda s: dyn.block(s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_bin32(summaryStructure):
type = 0b11000110
_fields_ = [
(pint.uint32_t, 'Length'),
(lambda s: dyn.block(s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_fixarray(summaryStructure):
type = 0b10010000
_fields_ = [
(PackedIntegerHolder, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_array16(summaryStructure):
type = 0b11011100
_fields_ = [
(pint.uint16_t, 'Length'),
(lambda s: dyn.array(packet, s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_array32(summaryStructure):
type = 0b11011101
_fields_ = [
@d_packet.define
class d_fixstr(summaryStructure):
type = 0b10100000
_fields_ = [
(PackedIntegerHolder, 'Length'),
(lambda s: dyn.clone(pstr.string, length=s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_str8(summaryStructure):
type = 0b11011001
_fields_ = [
(pint.uint8_t, 'Length'),
(lambda s: dyn.clone(pstr.string, length=s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_str16(summaryStructure):
type = 0b11011010
_fields_ = [
(pint.uint16_t, 'Length'),
(lambda s: dyn.clone(pstr.string, length=s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_str32(summaryStructure):
type = 0b11011011
_fields_ = [
(pint.uint32_t, 'Length'),
(lambda s: dyn.clone(pstr.string, length=s['Length'].li.get()), 'Value'),
]
@d_packet.define
class d_bin8(summaryStructure):
type = 0b11000100
class d_fixext8(summaryStructure):
type = 0b11010111
_fields_ = [
(pint.sint8_t, 'Type'),
(dyn.array(pint.uint8_t, 8), 'Value'),
]
@d_packet.define
class d_fixext16(summaryStructure):
type = 0b11011000
_fields_ = [
(pint.sint8_t, 'Type'),
(dyn.array(pint.uint8_t, 16), 'Value'),
]
@d_packet.define
class d_ext8(summaryStructure):
type = 0b11000111
_fields_ = [(pint.uint8_t, 'Value'), (pint.sint8_t, 'Type')]
@d_packet.define
class d_ext16(summaryStructure):
type = 0b11001000
_fields_ = [(pint.uint16_t, 'Value'), (pint.sint8_t, 'Type')]
@d_packet.define
class d_ext32(summaryStructure):
type = 0b11001001
_fields_ = [(pint.uint32_t, 'Value'), (pint.sint8_t, 'Type')]
if __name__ == '__main__':
import types
import operator,functools,itertools
res = [130,196,4,116,121,112,101,196,7,119,111,114,107,101,114,115, 196,4,100,97,116,97,145,130,196,8,119,111,114,107,101,114,105,100, 196,5,115,116,100,46,49,196,5,115,108,111,116,115,160]