Refactor protocol-specific packet construction into plugins.