diff options
authorDaniel P. Berrange <>2010-12-06 17:03:22 +0000
committerDaniel P. Berrange <>2011-06-24 11:48:14 +0100
commitceacc1dd4f73c87bc2521bd35dec97a3c4866e78 (patch)
tree8bf6db6f67dc96bf7a295d5ce9655b4a9e5a9467 /tests/testutils.h
parentDefines the basics of a generic RPC protocol in XDR (diff)
Provide a simple object for encoding/decoding RPC messages
This provides a new struct that contains a buffer for the RPC message header+payload, as well as a decoded copy of the message header. There is an API for applying a XDR encoding & decoding of the message headers and payloads. There are also APIs for maintaining a simple FIFO queue of message instances. Expected usage scenarios are: To send a message msg = virNetMessageNew() ...fill in msg->header fields.. virNetMessageEncodeHeader(msg) ...loook at msg->header fields to determine payload filter virNetMessageEncodePayload(msg, xdrfilter, data) ...send msg->bufferLength worth of data from buffer To receive a message msg = virNetMessageNew() VIR_NET_MESSAGE_LEN_MAX of data into buffer virNetMessageDecodeLength(msg) msg->bufferLength-msg->bufferOffset of data into buffer virNetMessageDecodeHeader(msg) ...look at msg->header fields to determine payload filter virNetMessageDecodePayload(msg, xdrfilter, data) payload processor * src/ Add to * src/rpc/virnetmessage.c, src/rpc/virnetmessage.h: Internal message handling API. * testutils.c, testutils.h: Helper for printing binary differences * virnetmessagetest.c: Validate all XDR encoding/decoding
Diffstat (limited to 'tests/testutils.h')
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/testutils.h b/tests/testutils.h
index e8f4153c8..03d8dc688 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -36,6 +36,10 @@ int virtTestClearLineRegex(const char *pattern,
int virtTestDifference(FILE *stream,
const char *expect,
const char *actual);
+int virtTestDifferenceBin(FILE *stream,
+ const char *expect,
+ const char *actual,
+ size_t length);
unsigned int virTestGetDebug(void);
unsigned int virTestGetVerbose(void);