aboutsummaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorOsier Yang <jyang@redhat.com>2012-09-05 14:02:04 +0800
committerOsier Yang <jyang@redhat.com>2012-09-17 12:36:29 +0800
commit3f47ff8bb5b3482c0482395403cc6922ef1b4846 (patch)
treef0bf44a2fce75e71b0621fd603e120127b0d51e4 /daemon
parentlist: Define new API virConnectListAllNWFilters (diff)
downloadlibvirt-3f47ff8bb5b3482c0482395403cc6922ef1b4846.tar.gz
libvirt-3f47ff8bb5b3482c0482395403cc6922ef1b4846.tar.bz2
libvirt-3f47ff8bb5b3482c0482395403cc6922ef1b4846.zip
list: Implement RPC calls for virConnectListAllNWFilters
The RPC generator doesn't support returning list of object yet, this patch do the work manually. * daemon/remote.c: Implemente the server side handler remoteDispatchConnectListAllNWFilters. * src/remote/remote_driver.c: Add remote driver handler remoteConnectListAllNWFilters. * src/remote/remote_protocol.x: New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS and structs to represent the args and ret for it. * src/remote_protocol-structs: Likewise.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/remote.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/daemon/remote.c b/daemon/remote.c
index c6805efab..abd7edf0f 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -4375,6 +4375,60 @@ cleanup:
return rv;
}
+static int
+remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_connect_list_all_nwfilters_args *args,
+ remote_connect_list_all_nwfilters_ret *ret)
+{
+ virNWFilterPtr *filters = NULL;
+ int nfilters = 0;
+ int i;
+ int rv = -1;
+ struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
+
+ if (!priv->conn) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ goto cleanup;
+ }
+
+ if ((nfilters = virConnectListAllNWFilters(priv->conn,
+ args->need_results ? &filters : NULL,
+ args->flags)) < 0)
+ goto cleanup;
+
+ if (filters && nfilters) {
+ if (VIR_ALLOC_N(ret->filters.filters_val, nfilters) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ ret->filters.filters_len = nfilters;
+
+ for (i = 0; i < nfilters; i++)
+ make_nonnull_nwfilter(ret->filters.filters_val + i, filters[i]);
+ } else {
+ ret->filters.filters_len = 0;
+ ret->filters.filters_val = NULL;
+ }
+
+ ret->ret = nfilters;
+
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ virNetMessageSaveError(rerr);
+ if (filters) {
+ for (i = 0; i < nfilters; i++)
+ virNWFilterFree(filters[i]);
+ VIR_FREE(filters);
+ }
+ return rv;
+}
+
/*----- Helpers. -----*/
/* get_nonnull_domain and get_nonnull_network turn an on-wire