Closed iboofkratom closed 1 year ago
I figured that i could put all the packets in one Kaitai file as substructs and then put switch in seq to choose the packet type.
Yes, you also will need a container packet type. Sometimes they are already provided for you, for example protocol
and next_header_type
in IP and ether_type
in Ethernet. TCP and UDP have no built-in field for a protocol, so protocols are usually just prior knowledge, and are usually derived from server ports. But nothing prevents you from adding an own container as simple as a seq
of 2 fields.
Great, thanks!! :)
Hi, I have a problem: I want to use Kaitai for communication between 2 devices. There are multiple types of packets i can receive. What would be the best way to test which packet i received? Obvious answer is to use
contents
to check for signature. But I have hundreds of types of packets I can receive. Calling the parsing function on every one of them and checking if it fails would be just too slow. So i wanted to ask If this is even possible to do in Kaitai and if yes, what is the best way to do it. I figured that i could put all the packets in one Kaitai file as substructs and then put switch inseq
to choose the packet type. But I am just starting with Kaitai, so I'm not sure If this is a supported way of doing this or a hacky workaround. Thanks!!