Patchwork [RFC,v6,18/23] virtagent: add va.hello RPC

login
register
mail settings
Submitter Michael Roth
Date Jan. 17, 2011, 1:15 p.m.
Message ID <1295270117-24760-19-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/79169/
State New
Headers show

Comments

Michael Roth - Jan. 17, 2011, 1:15 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 ab8994b..b7e51ed 100644
--- a/virtagent-server.c
+++ b/virtagent-server.c
@@ -232,6 +232,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 *params,
+                                   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;
@@ -251,6 +271,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 }
 };