virnetclient.h 5.0 KB
Newer Older
1 2 3
/*
 * virnetclient.h: generic network RPC client
 *
4
 * Copyright (C) 2006-2012 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16
 *
 * 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
17
 * License along with this library.  If not, see
O
Osier Yang 已提交
18
 * <http://www.gnu.org/licenses/>.
19 20 21 22 23 24 25
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#ifndef __VIR_NET_CLIENT_H__
# define __VIR_NET_CLIENT_H__

26
# ifdef WITH_GNUTLS
27 28
#  include "virnettlscontext.h"
# endif
29
# include "virnetmessage.h"
30
# ifdef WITH_SASL
31 32 33 34
#  include "virnetsaslcontext.h"
# endif
# include "virnetclientprogram.h"
# include "virnetclientstream.h"
35
# include "virobject.h"
36
# include "viruri.h"
37 38 39 40


virNetClientPtr virNetClientNewUNIX(const char *path,
                                    bool spawnDaemon,
41
                                    const char *binary);
42 43 44 45 46 47 48 49 50

virNetClientPtr virNetClientNewTCP(const char *nodename,
                                   const char *service);

virNetClientPtr virNetClientNewSSH(const char *nodename,
                                   const char *service,
                                   const char *binary,
                                   const char *username,
                                   bool noTTY,
51
                                   bool noVerify,
52
                                   const char *netcat,
53
                                   const char *keyfile,
54 55
                                   const char *path);

56 57 58 59 60 61 62 63 64
virNetClientPtr virNetClientNewLibSSH2(const char *host,
                                       const char *port,
                                       const char *username,
                                       const char *privkeyPath,
                                       const char *knownHostsPath,
                                       const char *knownHostsVerify,
                                       const char *authMethods,
                                       const char *netcatPath,
                                       const char *socketPath,
65 66
                                       virConnectAuthPtr authPtr,
                                       virURIPtr uri);
67

68 69
virNetClientPtr virNetClientNewExternal(const char **cmdargv);

70 71 72
int virNetClientRegisterAsyncIO(virNetClientPtr client);
int virNetClientRegisterKeepAlive(virNetClientPtr client);

73 74 75 76 77 78 79 80 81
typedef void (*virNetClientCloseFunc)(virNetClientPtr client,
                                      int reason,
                                      void *opaque);

void virNetClientSetCloseCallback(virNetClientPtr client,
                                  virNetClientCloseFunc cb,
                                  void *opaque,
                                  virFreeCallback ff);

82 83 84
int virNetClientGetFD(virNetClientPtr client);
int virNetClientDupFD(virNetClientPtr client, bool cloexec);

85 86
bool virNetClientHasPassFD(virNetClientPtr client);

87 88 89 90 91 92 93 94 95
int virNetClientAddProgram(virNetClientPtr client,
                           virNetClientProgramPtr prog);

int virNetClientAddStream(virNetClientPtr client,
                          virNetClientStreamPtr st);

void virNetClientRemoveStream(virNetClientPtr client,
                              virNetClientStreamPtr st);

96 97 98 99 100
int virNetClientSendWithReply(virNetClientPtr client,
                              virNetMessagePtr msg);

int virNetClientSendNoReply(virNetClientPtr client,
                            virNetMessagePtr msg);
101

102 103 104
int virNetClientSendNonBlock(virNetClientPtr client,
                             virNetMessagePtr msg);

M
Michal Privoznik 已提交
105 106 107
int virNetClientSendWithReplyStream(virNetClientPtr client,
                                    virNetMessagePtr msg,
                                    virNetClientStreamPtr st);
108

109
# ifdef WITH_SASL
110 111 112 113
void virNetClientSetSASLSession(virNetClientPtr client,
                                virNetSASLSessionPtr sasl);
# endif

114
# ifdef WITH_GNUTLS
115 116
int virNetClientSetTLSSession(virNetClientPtr client,
                              virNetTLSContextPtr tls);
117
# endif
118 119

bool virNetClientIsEncrypted(virNetClientPtr client);
120
bool virNetClientIsOpen(virNetClientPtr client);
121 122 123 124

const char *virNetClientLocalAddrString(virNetClientPtr client);
const char *virNetClientRemoteAddrString(virNetClientPtr client);

125
# ifdef WITH_GNUTLS
126
int virNetClientGetTLSKeySize(virNetClientPtr client);
127
# endif
128

129
void virNetClientClose(virNetClientPtr client);
130

131 132 133 134 135
bool virNetClientKeepAliveIsSupported(virNetClientPtr client);
int virNetClientKeepAliveStart(virNetClientPtr client,
                               int interval,
                               unsigned int count);

136 137
void virNetClientKeepAliveStop(virNetClientPtr client);

138
#endif /* __VIR_NET_CLIENT_H__ */