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

[libvirt] Re: [PATCH 04/12] Domain Events - rpc changes



Changes to the RPC protocol

 remote_dispatch_localvars.h   |    3 +++
 remote_dispatch_proc_switch.h |   18 ++++++++++++++++++
 remote_dispatch_prototypes.h  |    3 +++
 remote_protocol.c             |   35 +++++++++++++++++++++++++++++++++++
 remote_protocol.h             |   28 ++++++++++++++++++++++++++++
 remote_protocol.x             |   23 ++++++++++++++++++++++-
 6 files changed, 109 insertions(+), 1 deletion(-)
diff --git a/qemud/remote_dispatch_localvars.h b/qemud/remote_dispatch_localvars.h
index f46b493..df36239 100644
--- a/qemud/remote_dispatch_localvars.h
+++ b/qemud/remote_dispatch_localvars.h
@@ -6,6 +6,7 @@ remote_domain_lookup_by_uuid_args lv_remote_domain_lookup_by_uuid_args;
 remote_domain_lookup_by_uuid_ret lv_remote_domain_lookup_by_uuid_ret;
 remote_storage_pool_list_volumes_args lv_remote_storage_pool_list_volumes_args;
 remote_storage_pool_list_volumes_ret lv_remote_storage_pool_list_volumes_ret;
+remote_domain_events_deregister_args lv_remote_domain_events_deregister_args;
 remote_domain_shutdown_args lv_remote_domain_shutdown_args;
 remote_list_defined_domains_args lv_remote_list_defined_domains_args;
 remote_list_defined_domains_ret lv_remote_list_defined_domains_ret;
@@ -20,6 +21,7 @@ remote_domain_get_autostart_args lv_remote_domain_get_autostart_args;
 remote_domain_get_autostart_ret lv_remote_domain_get_autostart_ret;
 remote_domain_set_vcpus_args lv_remote_domain_set_vcpus_args;
 remote_get_hostname_ret lv_remote_get_hostname_ret;
+remote_domain_events_register_args lv_remote_domain_events_register_args;
 remote_network_undefine_args lv_remote_network_undefine_args;
 remote_domain_create_args lv_remote_domain_create_args;
 remote_network_destroy_args lv_remote_network_destroy_args;
@@ -121,6 +123,7 @@ remote_num_of_defined_storage_pools_ret lv_remote_num_of_defined_storage_pools_r
 remote_domain_core_dump_args lv_remote_domain_core_dump_args;
 remote_list_defined_storage_pools_args lv_remote_list_defined_storage_pools_args;
 remote_list_defined_storage_pools_ret lv_remote_list_defined_storage_pools_ret;
+remote_domain_event_ret lv_remote_domain_event_ret;
 remote_domain_get_max_memory_args lv_remote_domain_get_max_memory_args;
 remote_domain_get_max_memory_ret lv_remote_domain_get_max_memory_ret;
 remote_num_of_domains_ret lv_remote_num_of_domains_ret;
diff --git a/qemud/remote_dispatch_proc_switch.h b/qemud/remote_dispatch_proc_switch.h
index 89296d7..2254a96 100644
--- a/qemud/remote_dispatch_proc_switch.h
+++ b/qemud/remote_dispatch_proc_switch.h
@@ -116,6 +116,24 @@ case REMOTE_PROC_DOMAIN_DUMP_XML:
         ret = (char *) &lv_remote_domain_dump_xml_ret;
         memset (&lv_remote_domain_dump_xml_ret, 0, sizeof lv_remote_domain_dump_xml_ret);
         break;
+case REMOTE_PROC_DOMAIN_EVENT:
+        fn = (dispatch_fn) remoteDispatchDomainEvent;
+        ret_filter = (xdrproc_t) xdr_remote_domain_event_ret;
+        ret = (char *) &lv_remote_domain_event_ret;
+        memset (&lv_remote_domain_event_ret, 0, sizeof lv_remote_domain_event_ret);
+        break;
+case REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER:
+        fn = (dispatch_fn) remoteDispatchDomainEventsDeregister;
+        args_filter = (xdrproc_t) xdr_remote_domain_events_deregister_args;
+        args = (char *) &lv_remote_domain_events_deregister_args;
+        memset (&lv_remote_domain_events_deregister_args, 0, sizeof lv_remote_domain_events_deregister_args);
+        break;
+case REMOTE_PROC_DOMAIN_EVENTS_REGISTER:
+        fn = (dispatch_fn) remoteDispatchDomainEventsRegister;
+        args_filter = (xdrproc_t) xdr_remote_domain_events_register_args;
+        args = (char *) &lv_remote_domain_events_register_args;
+        memset (&lv_remote_domain_events_register_args, 0, sizeof lv_remote_domain_events_register_args);
+        break;
 case REMOTE_PROC_DOMAIN_GET_AUTOSTART:
         fn = (dispatch_fn) remoteDispatchDomainGetAutostart;
         args_filter = (xdrproc_t) xdr_remote_domain_get_autostart_args;
diff --git a/qemud/remote_dispatch_prototypes.h b/qemud/remote_dispatch_prototypes.h
index 3f4eb9f..79e26e3 100644
--- a/qemud/remote_dispatch_prototypes.h
+++ b/qemud/remote_dispatch_prototypes.h
@@ -18,6 +18,9 @@ static int remoteDispatchDomainDefineXml (struct qemud_server *server, struct qe
 static int remoteDispatchDomainDestroy (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_destroy_args *args, void *ret);
 static int remoteDispatchDomainDetachDevice (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_detach_device_args *args, void *ret);
 static int remoteDispatchDomainDumpXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_dump_xml_args *args, remote_domain_dump_xml_ret *ret);
+static int remoteDispatchDomainEvent (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_domain_event_ret *ret);
+static int remoteDispatchDomainEventsDeregister (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_events_deregister_args *args, void *ret);
+static int remoteDispatchDomainEventsRegister (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_events_register_args *args, void *ret);
 static int remoteDispatchDomainGetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_autostart_args *args, remote_domain_get_autostart_ret *ret);
 static int remoteDispatchDomainGetInfo (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_info_args *args, remote_domain_get_info_ret *ret);
 static int remoteDispatchDomainGetMaxMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_max_memory_args *args, remote_domain_get_max_memory_ret *ret);
diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c
index 33a25e1..c7ecbc3 100644
--- a/qemud/remote_protocol.c
+++ b/qemud/remote_protocol.c
@@ -1943,6 +1943,41 @@ xdr_remote_storage_vol_get_path_ret (XDR *xdrs, remote_storage_vol_get_path_ret
 }
 
 bool_t
+xdr_remote_domain_events_register_args (XDR *xdrs, remote_domain_events_register_args *objp)
+{
+
+         if (!xdr_u_long (xdrs, &objp->callback))
+                 return FALSE;
+         if (!xdr_u_long (xdrs, &objp->user_data))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
+xdr_remote_domain_events_deregister_args (XDR *xdrs, remote_domain_events_deregister_args *objp)
+{
+
+         if (!xdr_u_long (xdrs, &objp->callback))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
+xdr_remote_domain_event_ret (XDR *xdrs, remote_domain_event_ret *objp)
+{
+
+         if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+                 return FALSE;
+         if (!xdr_int (xdrs, &objp->event))
+                 return FALSE;
+         if (!xdr_u_long (xdrs, &objp->callback))
+                 return FALSE;
+         if (!xdr_u_long (xdrs, &objp->user_data))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
 xdr_remote_procedure (XDR *xdrs, remote_procedure *objp)
 {
 
diff --git a/qemud/remote_protocol.h b/qemud/remote_protocol.h
index 0bf8b79..5c7cb39 100644
--- a/qemud/remote_protocol.h
+++ b/qemud/remote_protocol.h
@@ -1081,6 +1081,25 @@ struct remote_storage_vol_get_path_ret {
         remote_nonnull_string name;
 };
 typedef struct remote_storage_vol_get_path_ret remote_storage_vol_get_path_ret;
+
+struct remote_domain_events_register_args {
+        u_long callback;
+        u_long user_data;
+};
+typedef struct remote_domain_events_register_args remote_domain_events_register_args;
+
+struct remote_domain_events_deregister_args {
+        u_long callback;
+};
+typedef struct remote_domain_events_deregister_args remote_domain_events_deregister_args;
+
+struct remote_domain_event_ret {
+        remote_nonnull_domain dom;
+        int event;
+        u_long callback;
+        u_long user_data;
+};
+typedef struct remote_domain_event_ret remote_domain_event_ret;
 #define REMOTE_PROGRAM 0x20008086
 #define REMOTE_PROTOCOL_VERSION 1
 
@@ -1189,6 +1208,9 @@ enum remote_procedure {
         REMOTE_PROC_NODE_GET_FREE_MEMORY = 102,
         REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103,
         REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104,
+        REMOTE_PROC_DOMAIN_EVENTS_REGISTER = 105,
+        REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER = 106,
+        REMOTE_PROC_DOMAIN_EVENT = 107,
 };
 typedef enum remote_procedure remote_procedure;
 
@@ -1394,6 +1416,9 @@ extern  bool_t xdr_remote_storage_vol_get_info_args (XDR *, remote_storage_vol_g
 extern  bool_t xdr_remote_storage_vol_get_info_ret (XDR *, remote_storage_vol_get_info_ret*);
 extern  bool_t xdr_remote_storage_vol_get_path_args (XDR *, remote_storage_vol_get_path_args*);
 extern  bool_t xdr_remote_storage_vol_get_path_ret (XDR *, remote_storage_vol_get_path_ret*);
+extern  bool_t xdr_remote_domain_events_register_args (XDR *, remote_domain_events_register_args*);
+extern  bool_t xdr_remote_domain_events_deregister_args (XDR *, remote_domain_events_deregister_args*);
+extern  bool_t xdr_remote_domain_event_ret (XDR *, remote_domain_event_ret*);
 extern  bool_t xdr_remote_procedure (XDR *, remote_procedure*);
 extern  bool_t xdr_remote_message_direction (XDR *, remote_message_direction*);
 extern  bool_t xdr_remote_message_status (XDR *, remote_message_status*);
@@ -1575,6 +1600,9 @@ extern bool_t xdr_remote_storage_vol_get_info_args ();
 extern bool_t xdr_remote_storage_vol_get_info_ret ();
 extern bool_t xdr_remote_storage_vol_get_path_args ();
 extern bool_t xdr_remote_storage_vol_get_path_ret ();
+extern bool_t xdr_remote_domain_events_register_args ();
+extern bool_t xdr_remote_domain_events_deregister_args ();
+extern bool_t xdr_remote_domain_event_ret ();
 extern bool_t xdr_remote_procedure ();
 extern bool_t xdr_remote_message_direction ();
 extern bool_t xdr_remote_message_status ();
diff --git a/qemud/remote_protocol.x b/qemud/remote_protocol.x
index f1bd9ff..5981702 100644
--- a/qemud/remote_protocol.x
+++ b/qemud/remote_protocol.x
@@ -965,6 +965,23 @@ struct remote_storage_vol_get_path_ret {
     remote_nonnull_string name;
 };
 
+/* Events */
+struct remote_domain_events_register_args {
+    unsigned long int callback;      /* To store a client pointer */
+    unsigned long int user_data;     /* For the remote callback opaque data */
+};
+
+struct remote_domain_events_deregister_args {
+    unsigned long int callback;     /* To store a client pointer */
+};
+
+struct remote_domain_event_ret {
+    remote_nonnull_domain dom;
+    int event;
+    unsigned long int callback;
+    unsigned long int user_data;
+};
+
 /*----- Protocol. -----*/
 
 /* Define the program number, protocol version and procedure numbers here. */
@@ -1086,7 +1103,11 @@ enum remote_procedure {
     REMOTE_PROC_NODE_GET_FREE_MEMORY = 102,
 
     REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103,
-    REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104
+    REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104,
+
+    REMOTE_PROC_DOMAIN_EVENTS_REGISTER = 105,
+    REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER = 106,
+    REMOTE_PROC_DOMAIN_EVENT = 107
 };
 
 /* Custom RPC structure. */

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