2010-12-01 16:36:40 +00:00
|
|
|
/*
|
|
|
|
* virnetserverprogram.h: generic network RPC server program
|
|
|
|
*
|
|
|
|
* 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 16:30:55 -06:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 18:06:23 +08:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-12-01 16:36:40 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-18 11:12:39 -05:00
|
|
|
#pragma once
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2019-06-18 11:12:39 -05:00
|
|
|
#include "virnetmessage.h"
|
|
|
|
#include "virnetserverclient.h"
|
|
|
|
#include "virobject.h"
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2015-03-16 15:02:41 +01:00
|
|
|
typedef struct _virNetDaemon virNetDaemon;
|
|
|
|
|
2010-12-01 16:36:40 +00:00
|
|
|
typedef struct _virNetServerService virNetServerService;
|
|
|
|
|
|
|
|
typedef struct _virNetServerProgram virNetServerProgram;
|
|
|
|
|
|
|
|
typedef struct _virNetServerProgramProc virNetServerProgramProc;
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
typedef int (*virNetServerProgramDispatchFunc)(virNetServer *server,
|
|
|
|
virNetServerClient *client,
|
|
|
|
virNetMessage *msg,
|
|
|
|
struct virNetMessageError *rerr,
|
2010-12-01 16:36:40 +00:00
|
|
|
void *args,
|
|
|
|
void *ret);
|
|
|
|
|
|
|
|
struct _virNetServerProgramProc {
|
|
|
|
virNetServerProgramDispatchFunc func;
|
|
|
|
size_t arg_len;
|
|
|
|
xdrproc_t arg_filter;
|
|
|
|
size_t ret_len;
|
|
|
|
xdrproc_t ret_filter;
|
|
|
|
bool needAuth;
|
2011-08-12 14:04:31 +02:00
|
|
|
unsigned int priority;
|
2010-12-01 16:36:40 +00:00
|
|
|
};
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
virNetServerProgram *virNetServerProgramNew(unsigned program,
|
2010-12-01 16:36:40 +00:00
|
|
|
unsigned version,
|
2021-03-11 08:16:13 +01:00
|
|
|
virNetServerProgramProc *procs,
|
2010-12-01 16:36:40 +00:00
|
|
|
size_t nprocs);
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virNetServerProgramGetID(virNetServerProgram *prog);
|
|
|
|
int virNetServerProgramGetVersion(virNetServerProgram *prog);
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
unsigned int virNetServerProgramGetPriority(virNetServerProgram *prog,
|
2011-08-12 14:04:31 +02:00
|
|
|
int procedure);
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virNetServerProgramMatches(virNetServerProgram *prog,
|
|
|
|
virNetMessage *msg);
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virNetServerProgramDispatch(virNetServerProgram *prog,
|
|
|
|
virNetServer *server,
|
|
|
|
virNetServerClient *client,
|
|
|
|
virNetMessage *msg);
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virNetServerProgramSendReplyError(virNetServerProgram *prog,
|
|
|
|
virNetServerClient *client,
|
|
|
|
virNetMessage *msg,
|
|
|
|
struct virNetMessageError *rerr,
|
|
|
|
struct virNetMessageHeader *req);
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virNetServerProgramSendStreamError(virNetServerProgram *prog,
|
|
|
|
virNetServerClient *client,
|
|
|
|
virNetMessage *msg,
|
|
|
|
struct virNetMessageError *rerr,
|
2010-12-01 16:36:40 +00:00
|
|
|
int procedure,
|
2016-03-29 17:33:14 +02:00
|
|
|
unsigned int serial);
|
2010-12-01 16:36:40 +00:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virNetServerProgramUnknownError(virNetServerClient *client,
|
|
|
|
virNetMessage *msg,
|
|
|
|
struct virNetMessageHeader *req);
|
2011-08-26 17:11:03 +02:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virNetServerProgramSendStreamData(virNetServerProgram *prog,
|
|
|
|
virNetServerClient *client,
|
|
|
|
virNetMessage *msg,
|
2010-12-01 16:36:40 +00:00
|
|
|
int procedure,
|
2016-03-29 17:33:14 +02:00
|
|
|
unsigned int serial,
|
2010-12-01 16:36:40 +00:00
|
|
|
const char *data,
|
|
|
|
size_t len);
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virNetServerProgramSendStreamHole(virNetServerProgram *prog,
|
|
|
|
virNetServerClient *client,
|
|
|
|
virNetMessage *msg,
|
2016-04-11 11:44:42 +02:00
|
|
|
int procedure,
|
|
|
|
unsigned int serial,
|
|
|
|
long long length,
|
|
|
|
unsigned int flags);
|