copied packet_parser, better debug macros