2010-12-01 16:36:40 +00:00
|
|
|
/*
|
|
|
|
* virnetserverclient.h: generic network RPC server client
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006-2011 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2006 Daniel P. Berrange
|
|
|
|
*
|
|
|
|
* 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:36:40 +00:00
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_NET_SERVER_CLIENT_H__
|
|
|
|
# define __VIR_NET_SERVER_CLIENT_H__
|
|
|
|
|
2012-01-23 15:05:01 +00:00
|
|
|
# include "viridentity.h"
|
2010-12-01 16:36:40 +00:00
|
|
|
# include "virnetsocket.h"
|
|
|
|
# include "virnetmessage.h"
|
2012-07-11 13:35:52 +00:00
|
|
|
# include "virobject.h"
|
2012-12-12 17:53:50 +00:00
|
|
|
# include "virjson.h"
|
2010-12-01 16:36:40 +00:00
|
|
|
|
|
|
|
typedef struct _virNetServerClient virNetServerClient;
|
|
|
|
typedef virNetServerClient *virNetServerClientPtr;
|
|
|
|
|
|
|
|
typedef int (*virNetServerClientDispatchFunc)(virNetServerClientPtr client,
|
|
|
|
virNetMessagePtr msg,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
typedef int (*virNetServerClientFilterFunc)(virNetServerClientPtr client,
|
|
|
|
virNetMessagePtr msg,
|
|
|
|
void *opaque);
|
|
|
|
|
2012-08-09 11:54:54 +00:00
|
|
|
typedef virJSONValuePtr (*virNetServerClientPrivPreExecRestart)(virNetServerClientPtr client,
|
|
|
|
void *data);
|
|
|
|
typedef void *(*virNetServerClientPrivNewPostExecRestart)(virNetServerClientPtr client,
|
|
|
|
virJSONValuePtr object,
|
|
|
|
void *opaque);
|
2012-08-09 11:31:34 +00:00
|
|
|
typedef void *(*virNetServerClientPrivNew)(virNetServerClientPtr client,
|
|
|
|
void *opaque);
|
|
|
|
|
2010-12-01 16:36:40 +00:00
|
|
|
virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
|
|
|
|
int auth,
|
|
|
|
bool readonly,
|
2011-06-30 10:45:55 +00:00
|
|
|
size_t nrequests_max,
|
2013-01-08 21:02:05 +00:00
|
|
|
# ifdef WITH_GNUTLS
|
2012-08-09 11:31:34 +00:00
|
|
|
virNetTLSContextPtr tls,
|
2013-01-07 14:54:18 +00:00
|
|
|
# endif
|
2012-08-09 11:31:34 +00:00
|
|
|
virNetServerClientPrivNew privNew,
|
2012-08-09 11:54:54 +00:00
|
|
|
virNetServerClientPrivPreExecRestart privPreExecRestart,
|
2012-08-09 11:31:34 +00:00
|
|
|
virFreeCallback privFree,
|
|
|
|
void *privOpaque);
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2012-08-09 11:54:54 +00:00
|
|
|
virNetServerClientPtr virNetServerClientNewPostExecRestart(virJSONValuePtr object,
|
|
|
|
virNetServerClientPrivNewPostExecRestart privNew,
|
|
|
|
virNetServerClientPrivPreExecRestart privPreExecRestart,
|
|
|
|
virFreeCallback privFree,
|
|
|
|
void *privOpaque);
|
|
|
|
|
|
|
|
virJSONValuePtr virNetServerClientPreExecRestart(virNetServerClientPtr client);
|
|
|
|
|
2010-12-01 16:36:40 +00:00
|
|
|
int virNetServerClientAddFilter(virNetServerClientPtr client,
|
|
|
|
virNetServerClientFilterFunc func,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
void virNetServerClientRemoveFilter(virNetServerClientPtr client,
|
|
|
|
int filterID);
|
|
|
|
|
|
|
|
int virNetServerClientGetAuth(virNetServerClientPtr client);
|
2012-01-20 16:56:31 +00:00
|
|
|
void virNetServerClientSetAuth(virNetServerClientPtr client, int auth);
|
2010-12-01 16:36:40 +00:00
|
|
|
bool virNetServerClientGetReadonly(virNetServerClientPtr client);
|
|
|
|
|
2013-01-08 21:02:05 +00:00
|
|
|
# ifdef WITH_GNUTLS
|
2010-12-01 16:36:40 +00:00
|
|
|
bool virNetServerClientHasTLSSession(virNetServerClientPtr client);
|
2012-01-20 17:18:28 +00:00
|
|
|
virNetTLSSessionPtr virNetServerClientGetTLSSession(virNetServerClientPtr client);
|
2010-12-01 16:36:40 +00:00
|
|
|
int virNetServerClientGetTLSKeySize(virNetServerClientPtr client);
|
2013-01-07 14:54:18 +00:00
|
|
|
# endif
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2012-09-20 11:58:29 +00:00
|
|
|
# ifdef WITH_SASL
|
2010-12-01 16:36:40 +00:00
|
|
|
void virNetServerClientSetSASLSession(virNetServerClientPtr client,
|
|
|
|
virNetSASLSessionPtr sasl);
|
2012-01-20 17:18:28 +00:00
|
|
|
virNetSASLSessionPtr virNetServerClientGetSASLSession(virNetServerClientPtr client);
|
2010-12-01 16:36:40 +00:00
|
|
|
# endif
|
|
|
|
|
|
|
|
int virNetServerClientGetFD(virNetServerClientPtr client);
|
|
|
|
|
|
|
|
bool virNetServerClientIsSecure(virNetServerClientPtr client);
|
|
|
|
|
2012-01-20 17:18:28 +00:00
|
|
|
bool virNetServerClientIsLocal(virNetServerClientPtr client);
|
|
|
|
|
2012-01-18 17:41:36 +00:00
|
|
|
int virNetServerClientGetUNIXIdentity(virNetServerClientPtr client,
|
|
|
|
uid_t *uid, gid_t *gid, pid_t *pid);
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2012-01-20 17:18:28 +00:00
|
|
|
int virNetServerClientGetSecurityContext(virNetServerClientPtr client,
|
|
|
|
char **context);
|
|
|
|
|
2012-01-23 15:05:01 +00:00
|
|
|
virIdentityPtr virNetServerClientGetIdentity(virNetServerClientPtr client);
|
|
|
|
|
2010-12-01 16:36:40 +00:00
|
|
|
void *virNetServerClientGetPrivateData(virNetServerClientPtr client);
|
2011-08-14 22:44:45 +00:00
|
|
|
|
|
|
|
typedef void (*virNetServerClientCloseFunc)(virNetServerClientPtr client);
|
|
|
|
|
|
|
|
void virNetServerClientSetCloseHook(virNetServerClientPtr client,
|
|
|
|
virNetServerClientCloseFunc cf);
|
2010-12-01 16:36:40 +00:00
|
|
|
|
|
|
|
void virNetServerClientSetDispatcher(virNetServerClientPtr client,
|
|
|
|
virNetServerClientDispatchFunc func,
|
|
|
|
void *opaque);
|
|
|
|
void virNetServerClientClose(virNetServerClientPtr client);
|
|
|
|
bool virNetServerClientIsClosed(virNetServerClientPtr client);
|
2011-07-08 11:54:29 +00:00
|
|
|
|
|
|
|
void virNetServerClientDelayedClose(virNetServerClientPtr client);
|
|
|
|
void virNetServerClientImmediateClose(virNetServerClientPtr client);
|
2010-12-01 16:36:40 +00:00
|
|
|
bool virNetServerClientWantClose(virNetServerClientPtr client);
|
|
|
|
|
|
|
|
int virNetServerClientInit(virNetServerClientPtr client);
|
|
|
|
|
2011-08-24 13:33:34 +00:00
|
|
|
int virNetServerClientInitKeepAlive(virNetServerClientPtr client,
|
|
|
|
int interval,
|
|
|
|
unsigned int count);
|
|
|
|
bool virNetServerClientCheckKeepAlive(virNetServerClientPtr client,
|
|
|
|
virNetMessagePtr msg);
|
|
|
|
int virNetServerClientStartKeepAlive(virNetServerClientPtr client);
|
|
|
|
|
2010-12-01 16:36:40 +00:00
|
|
|
const char *virNetServerClientLocalAddrString(virNetServerClientPtr client);
|
|
|
|
const char *virNetServerClientRemoteAddrString(virNetServerClientPtr client);
|
|
|
|
|
|
|
|
int virNetServerClientSendMessage(virNetServerClientPtr client,
|
|
|
|
virNetMessagePtr msg);
|
|
|
|
|
|
|
|
bool virNetServerClientNeedAuth(virNetServerClientPtr client);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __VIR_NET_SERVER_CLIENT_H__ */
|