Um, so how do you know at compile type what the packet types are, and what the processing should be for each packet? I’m surely misunderstanding you but it sounds like you’re saying something like this, which pattern matches on the header. These can easily be generated at compile time - but you’d still need to know what the processing-per-packet would be?
defmodule Dynamic do
def process_packet(<< 1::integer-little-8, data::bytes >>) do
:do_something_with_1
end
def process_packet(<< 2::integer-little-8, data::bytes >>) do
:do_something_with_2
end
end


















