return rv;
}
+static int
+remoteDispatchConnectListAllInterfaces(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_connect_list_all_interfaces_args *args,
+ remote_connect_list_all_interfaces_ret *ret)
+{
+ virInterfacePtr *ifaces = NULL;
+ int nifaces = 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 ((nifaces = virConnectListAllInterfaces(priv->conn,
+ args->need_results ? &ifaces : NULL,
+ args->flags)) < 0)
+ goto cleanup;
+
+ if (ifaces && nifaces) {
+ if (VIR_ALLOC_N(ret->ifaces.ifaces_val, nifaces) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ ret->ifaces.ifaces_len = nifaces;
+
+ for (i = 0; i < nifaces; i++)
+ make_nonnull_interface(ret->ifaces.ifaces_val + i, ifaces[i]);
+ } else {
+ ret->ifaces.ifaces_len = 0;
+ ret->ifaces.ifaces_val = NULL;
+ }
+
+ ret->ret = nifaces;
+
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ virNetMessageSaveError(rerr);
+ if (ifaces) {
+ for (i = 0; i < nifaces; i++)
+ virInterfaceFree(ifaces[i]);
+ VIR_FREE(ifaces);
+ }
+ return rv;
+}
+
/*----- Helpers. -----*/
return rv;
}
+static int
+remoteConnectListAllInterfaces(virConnectPtr conn,
+ virInterfacePtr **ifaces,
+ unsigned int flags)
+{
+ int rv = -1;
+ int i;
+ virInterfacePtr *tmp_ifaces = NULL;
+ remote_connect_list_all_interfaces_args args;
+ remote_connect_list_all_interfaces_ret ret;
+
+ struct private_data *priv = conn->privateData;
+
+ remoteDriverLock(priv);
+
+ args.need_results = !!ifaces;
+ args.flags = flags;
+
+ memset(&ret, 0, sizeof(ret));
+ if (call(conn,
+ priv,
+ 0,
+ REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES,
+ (xdrproc_t) xdr_remote_connect_list_all_interfaces_args,
+ (char *) &args,
+ (xdrproc_t) xdr_remote_connect_list_all_interfaces_ret,
+ (char *) &ret) == -1)
+ goto done;
+
+ if (ifaces) {
+ if (VIR_ALLOC_N(tmp_ifaces, ret.ifaces.ifaces_len + 1) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ for (i = 0; i < ret.ifaces.ifaces_len; i++) {
+ tmp_ifaces[i] = get_nonnull_interface (conn, ret.ifaces.ifaces_val[i]);
+ if (!tmp_ifaces[i]) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ }
+ *ifaces = tmp_ifaces;
+ tmp_ifaces = NULL;
+ }
+
+ rv = ret.ret;
+
+cleanup:
+ if (tmp_ifaces) {
+ for (i = 0; i < ret.ifaces.ifaces_len; i++)
+ if (tmp_ifaces[i])
+ virInterfaceFree(tmp_ifaces[i]);
+ }
+ VIR_FREE(tmp_ifaces);
+
+ xdr_free((xdrproc_t) xdr_remote_connect_list_all_interfaces_ret, (char *) &ret);
+
+done:
+ remoteDriverUnlock(priv);
+ return rv;
+}
+
/*----------------------------------------------------------------------*/
.listInterfaces = remoteListInterfaces, /* 0.7.2 */
.numOfDefinedInterfaces = remoteNumOfDefinedInterfaces, /* 0.7.2 */
.listDefinedInterfaces = remoteListDefinedInterfaces, /* 0.7.2 */
+ .listAllInterfaces = remoteConnectListAllInterfaces, /* 0.10.2 */
.interfaceLookupByName = remoteInterfaceLookupByName, /* 0.7.2 */
.interfaceLookupByMACString = remoteInterfaceLookupByMACString, /* 0.7.2 */
.interfaceGetXMLDesc = remoteInterfaceGetXMLDesc, /* 0.7.2 */
unsigned int ret;
};
+struct remote_connect_list_all_interfaces_args {
+ int need_results;
+ unsigned int flags;
+};
+
+struct remote_connect_list_all_interfaces_ret {
+ remote_nonnull_interface ifaces<>;
+ unsigned int ret;
+};
+
/*----- Protocol. -----*/
/* Define the program number, protocol version and procedure numbers here. */
REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS = 281, /* skipgen skipgen priority:high */
REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES = 282, /* skipgen skipgen priority:high */
- REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS = 283 /* skipgen skipgen priority:high */
+ REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS = 283, /* skipgen skipgen priority:high */
+ REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES = 284 /* skipgen skipgen priority:high */
/*
* Notice how the entries are grouped in sets of 10 ?
} nets;
u_int ret;
};
+struct remote_connect_list_all_interfaces_args {
+ int need_results;
+ u_int flags;
+};
+struct remote_connect_list_all_interfaces_ret {
+ struct {
+ u_int ifaces_len;
+ remote_nonnull_interface * ifaces_val;
+ } ifaces;
+ u_int ret;
+};
enum remote_procedure {
REMOTE_PROC_OPEN = 1,
REMOTE_PROC_CLOSE = 2,
REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS = 281,
REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES = 282,
REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS = 283,
+ REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES = 284,
};