An attempt at such may arise from sending a structure intended to be used
as part of other packets, but not a packet on its own.
unsigned Protocol::serialize(const P &pkt, char *buf, unsigned size) const
{
const PacketTypeDef<P> &pdef = get_packet_by_class<P>();
+ if(!pdef.get_id())
+ throw std::invalid_argument("no packet id");
char *ptr = pdef.serialize(pkt, buf+4, buf+size);
size = ptr-buf;
header_def.serialize(PacketHeader(pdef.get_id(), size), buf, buf+4);