Add encoding/decoding of entire messages

Signed-off-by: John Else <john.else@citrix.com>