[PATCH v2 14/32] daemon: Introduce virNetServerProgramSendStreamSkip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/libvirt_remote.syms       |  1 +
 src/rpc/virnetserverprogram.c | 33 +++++++++++++++++++++++++++++++++
 src/rpc/virnetserverprogram.h |  7 +++++++
 3 files changed, 41 insertions(+)

diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index 1a88fff..b97b9b1 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -177,6 +177,7 @@ virNetServerProgramNew;
 virNetServerProgramSendReplyError;
 virNetServerProgramSendStreamData;
 virNetServerProgramSendStreamError;
+virNetServerProgramSendStreamSkip;
 virNetServerProgramUnknownError;
 
 
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index d1597f4..6d84056 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -548,6 +548,39 @@ int virNetServerProgramSendStreamData(virNetServerProgramPtr prog,
 }
 
 
+int virNetServerProgramSendStreamSkip(virNetServerProgramPtr prog,
+                                      virNetServerClientPtr client,
+                                      virNetMessagePtr msg,
+                                      int procedure,
+                                      unsigned int serial,
+                                      unsigned long long length)
+{
+    virNetStreamSkip data;
+
+    VIR_DEBUG("client=%p msg=%p length=%llu", client, msg, length);
+
+    memset(&data, 0, sizeof(data));
+    data.length = length;
+
+    msg->header.prog = prog->program;
+    msg->header.vers = prog->version;
+    msg->header.proc = procedure;
+    msg->header.type = VIR_NET_STREAM_SKIP;
+    msg->header.serial = serial;
+    msg->header.status = VIR_NET_CONTINUE;
+
+    if (virNetMessageEncodeHeader(msg) < 0)
+        return -1;
+
+    if (virNetMessageEncodePayload(msg,
+                                   (xdrproc_t) xdr_virNetStreamSkip,
+                                   &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 531fca0..eba2168 100644
--- a/src/rpc/virnetserverprogram.h
+++ b/src/rpc/virnetserverprogram.h
@@ -104,4 +104,11 @@ int virNetServerProgramSendStreamData(virNetServerProgramPtr prog,
                                       const char *data,
                                       size_t len);
 
+int virNetServerProgramSendStreamSkip(virNetServerProgramPtr prog,
+                                      virNetServerClientPtr client,
+                                      virNetMessagePtr msg,
+                                      int procedure,
+                                      unsigned int serial,
+                                      unsigned long long length);
+
 #endif /* __VIR_NET_SERVER_PROGRAM_H__ */
-- 
2.8.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]