UDP Header

[1]:
from byteclasses.handlers.network.udp_hdr import UDPHdr
from byteclasses.print import byteclass_inspect, collection_table, byteclass_info
[2]:
udp_hdr = UDPHdr()
data = bytearray(b"\x80\x00\x04\xd2\x00\x00\x38\x45")
udp_hdr.attach(memoryview(data))
[3]:
byteclass_info(udp_hdr)
                                                Byteclass Info                                                
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Property ┃ Value                                                                                           ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ type()   │ UDPHdr                                                                                          │
│ mro      │ UDPHdr -> object                                                                                │
│ len()    │ 8                                                                                               │
│ str()    │ UDPHdr(src_port=UInt16(32768), dst_port=UInt16(1234), length=UInt16(0), checksum=UInt16(14405)) │
│ repr()   │ UDPHdr(src_port=UInt16(32768), dst_port=UInt16(1234), length=UInt16(0), checksum=UInt16(14405)) │
│ .data    │ bytearray(b'\x80\x00\x04\xd2\x00\x008E')                                                        │
└──────────┴─────────────────────────────────────────────────────────────────────────────────────────────────┘
[4]:
byteclass_inspect(udp_hdr)
╭───────────────────────────────────────── Byteclass Inspect ──────────────────────────────────────────╮
│     00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f  │
│ ---------------------------------------------------------------------------------------------------  │
│ 0x0 80 0004 d200 0038 45                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯
       Legend       
┏━━━━━━━━━━┳━━━━━━━┓
┃ Member   ┃ Value ┃
┡━━━━━━━━━━╇━━━━━━━┩
│ src_port │ 32768 │
│ dst_port │ 1234  │
│ length   │ 0     │
│ checksum │ 14405 │
└──────────┴───────┘
[5]:
collection_table(udp_hdr)
              UDPHdr              
┏━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━┓
┃ Member   ┃ Value ┃ Data        ┃
┡━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━┩
│ src_port │ 32768 │ b'\x80\x00' │
│ dst_port │ 1234  │ b'\x04\xd2' │
│ length   │ 0     │ b'\x00\x00' │
│ checksum │ 14405 │ b'8E'       │
└──────────┴───────┴─────────────┘