This is just a helper function that takes in a length value,
encodes it into XDR and sends to client.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/libvirt_remote.syms | 1 +
src/rpc/virnetserverprogram.c | 35 +++++++++++++++++++++++++++++++++++
src/rpc/virnetserverprogram.h | 8 ++++++++
3 files changed, 44 insertions(+)
diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index ca1f3ac86..bb6a8d465 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -178,6 +178,7 @@ virNetServerProgramNew;
virNetServerProgramSendReplyError;
virNetServerProgramSendStreamData;
virNetServerProgramSendStreamError;
+virNetServerProgramSendStreamHole;
virNetServerProgramUnknownError;
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index d1597f438..556c91605 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -548,6 +548,41 @@ int virNetServerProgramSendStreamData(virNetServerProgramPtr prog,
}
+int virNetServerProgramSendStreamHole(virNetServerProgramPtr prog,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg,
+ int procedure,
+ unsigned int serial,
+ long long length,
+ unsigned int flags)
+{
+ virNetStreamHole data;
+
+ VIR_DEBUG("client=%p msg=%p length=%lld", client, msg, length);
+
+ memset(&data, 0, sizeof(data));
+ data.length = length;
+ data.flags = flags;
+
+ msg->header.prog = prog->program;
+ msg->header.vers = prog->version;
+ msg->header.proc = procedure;
+ msg->header.type = VIR_NET_STREAM_HOLE;
+ msg->header.serial = serial;
+ msg->header.status = VIR_NET_CONTINUE;
+
+ if (virNetMessageEncodeHeader(msg) < 0)
+ return -1;
+
+ if (virNetMessageEncodePayload(msg,
+ (xdrproc_t) xdr_virNetStreamHole,
+ &data) < 0)
+ return -1;
+
+ return virNetServerClientSendMessage(client, msg);
+}
+
+
void virNetServerProgramDispose(void *obj ATTRIBUTE_UNUSED)
{
}
diff --git a/src/rpc/virnetserverprogram.h b/src/rpc/virnetserverprogram.h
index 531fca024..1731c9e1d 100644
--- a/src/rpc/virnetserverprogram.h
+++ b/src/rpc/virnetserverprogram.h
@@ -104,4 +104,12 @@ int virNetServerProgramSendStreamData(virNetServerProgramPtr prog,
const char *data,
size_t len);
+int virNetServerProgramSendStreamHole(virNetServerProgramPtr prog,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg,
+ int procedure,
+ unsigned int serial,
+ long long length,
+ unsigned int flags);
+
#endif /* __VIR_NET_SERVER_PROGRAM_H__ */
--
2.13.0