2010-12-01 16:35:50 +00:00
|
|
|
/*
|
|
|
|
* virnetclient.h: generic network RPC client
|
|
|
|
*
|
2011-11-14 15:12:53 +00:00
|
|
|
* Copyright (C) 2006-2012 Red Hat, Inc.
|
2010-12-01 16:35:50 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-12-01 16:35:50 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-18 16:12:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-01-22 16:21:35 +00:00
|
|
|
#include "virnettlscontext.h"
|
2019-06-18 16:12:39 +00:00
|
|
|
#include "virnetmessage.h"
|
|
|
|
#ifdef WITH_SASL
|
|
|
|
# include "virnetsaslcontext.h"
|
|
|
|
#endif
|
|
|
|
#include "virnetclientprogram.h"
|
|
|
|
#include "virnetclientstream.h"
|
|
|
|
#include "virobject.h"
|
|
|
|
#include "viruri.h"
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2020-07-08 16:03:38 +00:00
|
|
|
typedef enum {
|
|
|
|
VIR_NET_CLIENT_PROXY_AUTO,
|
|
|
|
VIR_NET_CLIENT_PROXY_NETCAT,
|
|
|
|
VIR_NET_CLIENT_PROXY_NATIVE,
|
|
|
|
|
|
|
|
VIR_NET_CLIENT_PROXY_LAST,
|
|
|
|
} virNetClientProxy;
|
|
|
|
|
|
|
|
VIR_ENUM_DECL(virNetClientProxy);
|
|
|
|
|
2020-02-11 19:05:53 +00:00
|
|
|
char *
|
2020-07-08 16:03:38 +00:00
|
|
|
virNetClientSSHHelperCommand(virNetClientProxy proxy,
|
|
|
|
const char *netcatPath,
|
|
|
|
const char *socketPath,
|
|
|
|
const char *driverURI,
|
|
|
|
bool readonly);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virNetClient *virNetClientNewUNIX(const char *path,
|
2021-05-24 14:07:19 +00:00
|
|
|
const char *spawnDaemonPath);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virNetClient *virNetClientNewTCP(const char *nodename,
|
2015-05-21 14:51:28 +00:00
|
|
|
const char *service,
|
|
|
|
int family);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virNetClient *virNetClientNewSSH(const char *nodename,
|
2010-12-01 16:35:50 +00:00
|
|
|
const char *service,
|
|
|
|
const char *binary,
|
|
|
|
const char *username,
|
|
|
|
bool noTTY,
|
2011-07-11 19:50:31 +00:00
|
|
|
bool noVerify,
|
2011-07-19 17:52:21 +00:00
|
|
|
const char *keyfile,
|
2020-07-08 16:03:38 +00:00
|
|
|
virNetClientProxy proxy,
|
|
|
|
const char *netcatPath,
|
|
|
|
const char *socketPath,
|
|
|
|
const char *driverURI,
|
|
|
|
bool readonly);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virNetClient *virNetClientNewLibSSH2(const char *host,
|
2011-11-14 15:12:53 +00:00
|
|
|
const char *port,
|
2015-05-21 14:51:28 +00:00
|
|
|
int family,
|
2011-11-14 15:12:53 +00:00
|
|
|
const char *username,
|
|
|
|
const char *privkeyPath,
|
|
|
|
const char *knownHostsPath,
|
|
|
|
const char *knownHostsVerify,
|
|
|
|
const char *authMethods,
|
2020-07-08 16:03:38 +00:00
|
|
|
virNetClientProxy proxy,
|
2011-11-14 15:12:53 +00:00
|
|
|
const char *netcatPath,
|
|
|
|
const char *socketPath,
|
2020-07-08 16:03:38 +00:00
|
|
|
const char *driverURI,
|
|
|
|
bool readonly,
|
2013-07-09 14:46:32 +00:00
|
|
|
virConnectAuthPtr authPtr,
|
2021-03-11 07:16:13 +00:00
|
|
|
virURI *uri);
|
2011-11-14 15:12:53 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virNetClient *virNetClientNewLibssh(const char *host,
|
2016-11-09 14:28:36 +00:00
|
|
|
const char *port,
|
|
|
|
int family,
|
|
|
|
const char *username,
|
|
|
|
const char *privkeyPath,
|
|
|
|
const char *knownHostsPath,
|
|
|
|
const char *knownHostsVerify,
|
|
|
|
const char *authMethods,
|
2020-07-08 16:03:38 +00:00
|
|
|
virNetClientProxy proxy,
|
2016-11-09 14:28:36 +00:00
|
|
|
const char *netcatPath,
|
|
|
|
const char *socketPath,
|
2020-07-08 16:03:38 +00:00
|
|
|
const char *driverURI,
|
|
|
|
bool readonly,
|
2016-11-09 14:28:36 +00:00
|
|
|
virConnectAuthPtr authPtr,
|
2021-03-11 07:16:13 +00:00
|
|
|
virURI *uri);
|
2016-11-09 14:28:36 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virNetClient *virNetClientNewExternal(const char **cmdargv);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientRegisterAsyncIO(virNetClient *client);
|
|
|
|
int virNetClientRegisterKeepAlive(virNetClient *client);
|
2012-08-07 11:09:51 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
typedef void (*virNetClientCloseFunc)(virNetClient *client,
|
2012-07-18 16:10:22 +00:00
|
|
|
int reason,
|
|
|
|
void *opaque);
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
void virNetClientSetCloseCallback(virNetClient *client,
|
2012-07-18 16:10:22 +00:00
|
|
|
virNetClientCloseFunc cb,
|
|
|
|
void *opaque,
|
|
|
|
virFreeCallback ff);
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientGetFD(virNetClient *client);
|
|
|
|
int virNetClientDupFD(virNetClient *client, bool cloexec);
|
2011-07-07 14:17:21 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
bool virNetClientHasPassFD(virNetClient *client);
|
2011-10-21 10:48:03 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientAddProgram(virNetClient *client,
|
|
|
|
virNetClientProgram *prog);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientAddStream(virNetClient *client,
|
|
|
|
virNetClientStream *st);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
void virNetClientRemoveStream(virNetClient *client,
|
|
|
|
virNetClientStream *st);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientSendWithReply(virNetClient *client,
|
|
|
|
virNetMessage *msg);
|
2011-11-11 15:42:46 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientSendNonBlock(virNetClient *client,
|
|
|
|
virNetMessage *msg);
|
2011-11-08 09:13:27 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientSendStream(virNetClient *client,
|
|
|
|
virNetMessage *msg,
|
|
|
|
virNetClientStream *st);
|
2011-11-08 09:13:27 +00:00
|
|
|
|
2019-06-18 16:12:39 +00:00
|
|
|
#ifdef WITH_SASL
|
2021-03-11 07:16:13 +00:00
|
|
|
void virNetClientSetSASLSession(virNetClient *client,
|
|
|
|
virNetSASLSession *sasl);
|
2019-06-18 16:12:39 +00:00
|
|
|
#endif
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientSetTLSSession(virNetClient *client,
|
|
|
|
virNetTLSContext *tls);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
bool virNetClientIsEncrypted(virNetClient *client);
|
|
|
|
bool virNetClientIsOpen(virNetClient *client);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
const char *virNetClientLocalAddrStringSASL(virNetClient *client);
|
|
|
|
const char *virNetClientRemoteAddrStringSASL(virNetClient *client);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virNetClientGetTLSKeySize(virNetClient *client);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
void virNetClientClose(virNetClient *client);
|
2010-12-01 16:35:50 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
bool virNetClientKeepAliveIsSupported(virNetClient *client);
|
|
|
|
int virNetClientKeepAliveStart(virNetClient *client,
|
2011-09-22 12:59:06 +00:00
|
|
|
int interval,
|
|
|
|
unsigned int count);
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
void virNetClientKeepAliveStop(virNetClient *client);
|