Next stage of new protocol implementation

Here are two self-contained parts to add to the new protocol implementation, ready for review. [Lots more](https://github.com/special/ricochet/compare/protocol) is written, it just needs the last bits of polish before it's submitted.

The previous PR led to decisions to use smart pointers much more frequently, and to replace error messages in protocol with better enums. Neither of those changes is visible yet here.
Didn't this already go in?

(https://github.com/special/ricochet/commit/ec55cb736ca05d42e0d426cf312bfc0fbf273713)