Finish the protocol part of the client library, in dcpc.c

Test extensively.

