mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
39b5e4d4d8
Currently there is a hook function that is invoked when a new client connection comes in, which allows an app to setup private data. This setup will make it difficult to serialize client state during process re-exec(). Change to a model where the app registers a callback when creating the virNetServerPtr instance, which is used to allocate the client private data immediately during virNetClientPtr construction. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
119 lines
4.9 KiB
C
119 lines
4.9 KiB
C
/*
|
|
* 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
|
|
* License along with this library; If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
*/
|
|
|
|
#ifndef __VIR_NET_SERVER_CLIENT_H__
|
|
# define __VIR_NET_SERVER_CLIENT_H__
|
|
|
|
# include "virnetsocket.h"
|
|
# include "virnetmessage.h"
|
|
# include "virobject.h"
|
|
|
|
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);
|
|
|
|
typedef void *(*virNetServerClientPrivNew)(virNetServerClientPtr client,
|
|
void *opaque);
|
|
|
|
virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
|
|
int auth,
|
|
bool readonly,
|
|
size_t nrequests_max,
|
|
virNetTLSContextPtr tls,
|
|
virNetServerClientPrivNew privNew,
|
|
virFreeCallback privFree,
|
|
void *privOpaque);
|
|
|
|
int virNetServerClientAddFilter(virNetServerClientPtr client,
|
|
virNetServerClientFilterFunc func,
|
|
void *opaque);
|
|
|
|
void virNetServerClientRemoveFilter(virNetServerClientPtr client,
|
|
int filterID);
|
|
|
|
int virNetServerClientGetAuth(virNetServerClientPtr client);
|
|
bool virNetServerClientGetReadonly(virNetServerClientPtr client);
|
|
|
|
bool virNetServerClientHasTLSSession(virNetServerClientPtr client);
|
|
int virNetServerClientGetTLSKeySize(virNetServerClientPtr client);
|
|
|
|
# ifdef HAVE_SASL
|
|
void virNetServerClientSetSASLSession(virNetServerClientPtr client,
|
|
virNetSASLSessionPtr sasl);
|
|
# endif
|
|
|
|
int virNetServerClientGetFD(virNetServerClientPtr client);
|
|
|
|
bool virNetServerClientIsSecure(virNetServerClientPtr client);
|
|
|
|
int virNetServerClientSetIdentity(virNetServerClientPtr client,
|
|
const char *identity);
|
|
const char *virNetServerClientGetIdentity(virNetServerClientPtr client);
|
|
|
|
int virNetServerClientGetUNIXIdentity(virNetServerClientPtr client,
|
|
uid_t *uid, gid_t *gid, pid_t *pid);
|
|
|
|
void *virNetServerClientGetPrivateData(virNetServerClientPtr client);
|
|
|
|
typedef void (*virNetServerClientCloseFunc)(virNetServerClientPtr client);
|
|
|
|
void virNetServerClientSetCloseHook(virNetServerClientPtr client,
|
|
virNetServerClientCloseFunc cf);
|
|
|
|
void virNetServerClientSetDispatcher(virNetServerClientPtr client,
|
|
virNetServerClientDispatchFunc func,
|
|
void *opaque);
|
|
void virNetServerClientClose(virNetServerClientPtr client);
|
|
bool virNetServerClientIsClosed(virNetServerClientPtr client);
|
|
|
|
void virNetServerClientDelayedClose(virNetServerClientPtr client);
|
|
void virNetServerClientImmediateClose(virNetServerClientPtr client);
|
|
bool virNetServerClientWantClose(virNetServerClientPtr client);
|
|
|
|
int virNetServerClientInit(virNetServerClientPtr client);
|
|
|
|
int virNetServerClientInitKeepAlive(virNetServerClientPtr client,
|
|
int interval,
|
|
unsigned int count);
|
|
bool virNetServerClientCheckKeepAlive(virNetServerClientPtr client,
|
|
virNetMessagePtr msg);
|
|
int virNetServerClientStartKeepAlive(virNetServerClientPtr client);
|
|
|
|
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__ */
|