Rewrite the PROTOCOL module type as a concrete type

Instead of storing global state in the PROTOCOL modules, each protocol
now defines make_protocol_reader and make_protocol_writer. Per-reader or
per-writer state can be set up in these functions, and referenced from
the returned functions.

n.b. the writer functions for both protocols are currently stateless.

Signed-off-by: John Else <john.else@citrix.com>
Raise a better exception if the data length parsing fails
Check that the checksum has changed since the last reading