Patchwork [RFC,v5,17/21] virtagent: add va.hello RPC

login
register
mail settings
Submitter Michael Roth
Date Dec. 3, 2010, 6:03 p.m.
Message ID <1291399402-20366-18-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/74182/
State New
Headers show

Comments

Michael Roth - Dec. 3, 2010, 6:03 p.m.
This RPC tells us the guest agent is up and ready, and invokes guest
agent capability negotiation

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 virtagent-server.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

Patch

diff --git a/virtagent-server.c b/virtagent-server.c
index 4a8ce7d..7a1b560 100644
--- a/virtagent-server.c
+++ b/virtagent-server.c
@@ -196,6 +196,26 @@  static xmlrpc_value *va_ping(xmlrpc_env *env,
     return result;
 }
 
+/* va_hello(): handle client startup notification
+ * rpc return values: none
+ */
+
+static xmlrpc_value *va_hello(xmlrpc_env *env,
+                                   xmlrpc_value *param,
+                                   void *user_data)
+{
+    xmlrpc_value *result;
+    int ret;
+    TRACE("called");
+    SLOG("va_hello()");
+    result = xmlrpc_build_value(env, "s", "dummy");
+    ret = va_client_init_capabilities();
+    if (ret < 0) {
+        LOG("error setting initializing client capabilities");
+    }
+    return result;
+}
+
 typedef struct RPCFunction {
     xmlrpc_value *(*func)(xmlrpc_env *env, xmlrpc_value *param, void *unused);
     const char *func_name;
@@ -215,6 +235,8 @@  static RPCFunction guest_functions[] = {
 static RPCFunction host_functions[] = {
     { .func = va_ping,
       .func_name = "va.ping" },
+    { .func = va_hello,
+      .func_name = "va.hello" },
     { NULL, NULL }
 };