Give the RPC and replay buffers different types

The aim is to avoid errors in which I assign one to the wrong field,
since they are the same declared type. The solution is:
 - give each a nominal type (alias)
 - factor all the operations on them into typed functions

Dialyzer is not so good with nominal types: it has `opaque` types,
which are kind of nominal types but only from other modules. It has
problems if the opaque type is in the same
module. http://erlang.org/pipermail/erlang-questions/2011-May/058423.html
suggests using tags to get around this, which is what I've done (with
the help of a couple of macros).

During this qork I noticed that the only replayed frames are those for
publish frame originating at the client; so, there's no need to
distinguish between local and remote IDs.