cleanup:
return ret;
}
+
+virNetServerPtr
+adminConnectLookupServer(virNetDaemonPtr dmn,
+ const char *name,
+ unsigned int flags)
+{
+ virCheckFlags(flags, NULL);
+
+ return virNetDaemonGetServer(dmn, name);
+}
# define __LIBVIRTD_ADMIN_SERVER_H__
# include "rpc/virnetdaemon.h"
+# include "rpc/virnetserver.h"
int adminConnectListServers(virNetDaemonPtr dmn,
virNetServerPtr **servers,
unsigned int flags);
+virNetServerPtr adminConnectLookupServer(virNetDaemonPtr dmn,
+ const char *name,
+ unsigned int flags);
+
#endif /* __LIBVIRTD_ADMIN_SERVER_H__ */
const char *virAdmServerGetName(virAdmServerPtr srv);
+virAdmServerPtr virAdmConnectLookupServer(virAdmConnectPtr conn,
+ const char *name,
+ unsigned int flags);
+
# ifdef __cplusplus
}
# endif
unsigned int ret;
};
+struct admin_connect_lookup_server_args {
+ admin_nonnull_string name;
+ unsigned int flags;
+};
+
+struct admin_connect_lookup_server_ret {
+ admin_nonnull_server srv;
+};
+
/* Define the program number, protocol version and procedure numbers here. */
const ADMIN_PROGRAM = 0x06900690;
const ADMIN_PROTOCOL_VERSION = 1;
/**
* @generate: both
*/
- ADMIN_PROC_CONNECT_LIST_SERVERS = 4
+ ADMIN_PROC_CONNECT_LIST_SERVERS = 4,
+
+ /**
+ * @generate: both
+ */
+ ADMIN_PROC_CONNECT_LOOKUP_SERVER = 5
};
} servers;
u_int ret;
};
+struct admin_connect_lookup_server_args {
+ admin_nonnull_string name;
+ u_int flags;
+};
+struct admin_connect_lookup_server_ret {
+ admin_nonnull_server srv;
+};
enum admin_procedure {
ADMIN_PROC_CONNECT_OPEN = 1,
ADMIN_PROC_CONNECT_CLOSE = 2,
ADMIN_PROC_CONNECT_GET_LIB_VERSION = 3,
ADMIN_PROC_CONNECT_LIST_SERVERS = 4,
+ ADMIN_PROC_CONNECT_LOOKUP_SERVER = 5,
};
virDispatchError(NULL);
return -1;
}
+
+/**
+ * virAdmConnectLookupServer:
+ * @conn: daemon connection reference
+ * @name: name of the server too lookup
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Try to lookup a server on the given daemon based on @name.
+ *
+ * virAdmServerFree() should be used to free the resources after the
+ * server object is no longer needed.
+ *
+ * Returns the requested server or NULL in case of failure. If the
+ * server cannot be found, then VIR_ERR_NO_SERVER error is raised.
+ */
+virAdmServerPtr
+virAdmConnectLookupServer(virAdmConnectPtr conn,
+ const char *name,
+ unsigned int flags)
+{
+ virAdmServerPtr ret = NULL;
+
+ VIR_DEBUG("conn=%p, name=%s, flags=%x", conn, NULLSTR(name), flags);
+ virResetLastError();
+
+ virCheckAdmConnectGoto(conn, cleanup);
+ virCheckNonNullArgGoto(name, cleanup);
+ virCheckFlagsGoto(0, cleanup);
+
+ ret = remoteAdminConnectLookupServer(conn, name, flags);
+ cleanup:
+ if (!ret)
+ virDispatchError(NULL);
+ return ret;
+}
xdr_admin_connect_get_lib_version_ret;
xdr_admin_connect_list_servers_args;
xdr_admin_connect_list_servers_ret;
+xdr_admin_connect_lookup_server_args;
+xdr_admin_connect_lookup_server_ret;
xdr_admin_connect_open_args;
# datatypes.h
virAdmConnectListServers;
virAdmServerGetName;
virAdmServerFree;
+ virAdmConnectLookupServer;
};