File: rpcdispatch.h

package info (click to toggle)
nfs-utils 1%3A1.0.6-3.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,532 kB
  • ctags: 1,845
  • sloc: ansic: 16,107; sh: 3,129; makefile: 272
file content (57 lines) | stat: -rw-r--r-- 1,364 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 *	nlm_dispatch	This is a generic RPC call dispatcher.
 *			It is loosely based on the dispatch mechanism I
 *			first encountered in the UNFSD source.
 *
 *	Cyopright (C) 1995, Olaf Kirch <okir@monad.swb.de>
 *
 *	24.05.95	okir
 *
 */

#ifndef RPCDISPATCH_H
#define RPCDISPATCH_H

#include <rpc/rpc.h>

#ifdef __STDC__
#   define CONCAT(a,b)		a##b
#   define CONCAT3(a,b,c)	a##b##c
#   define STRING(a)		#a
#else
#   define CONCAT(a,b)		a/**/b
#   define CONCAT3(a,b,c)	a/**/b/**/c
#   define STRING(a)		"a"
#endif

#ifdef __STDC__
typedef bool_t	(*rpcsvc_fn_t)(struct svc_req *, void *argp, void *resp);
#else
typedef bool_t	(*rpcsvc_fn_t)();
#endif

#define table_ent(func, vers, arg_type, res_type) \
	{	STRING(func), \
		(rpcsvc_fn_t)CONCAT(func,_svc), vers,\
		(xdrproc_t)CONCAT(xdr_, arg_type), sizeof(arg_type), \
		(xdrproc_t)CONCAT(xdr_, res_type), sizeof(res_type), \
	}
#define nlm_undef_svc	NULL
#define xdr_nlm_void	xdr_void

struct dispatch_entry {
	const char	*name;
	rpcsvc_fn_t	func;
	unsigned int	versions;		/* bitmap of versions */
	xdrproc_t	xdr_arg_fn;		/* argument XDR */
	size_t		xdr_arg_size;
	xdrproc_t	xdr_res_fn;		/* result XDR */
	size_t		xdr_res_size;
};

void	rpc_dispatch(struct svc_req *rq, SVCXPRT *tp,
			struct dispatch_entry *dtable, int nproc,
			void *argp, void *resp);
void	rpc_svcrun(void);

#endif /* RPCDISPATCH_H */