]> git.decadent.org.uk Git - nfs-utils.git/blob - support/include/rpcdispatch.h
fix unexpiring
[nfs-utils.git] / support / include / rpcdispatch.h
1 /*
2  *      nlm_dispatch    This is a generic RPC call dispatcher.
3  *                      It is loosely based on the dispatch mechanism I
4  *                      first encountered in the UNFSD source.
5  *
6  *      Cyopright (C) 1995, Olaf Kirch <okir@monad.swb.de>
7  *
8  *      24.05.95        okir
9  *
10  */
11
12 #ifndef RPCDISPATCH_H
13 #define RPCDISPATCH_H
14
15 #include <rpc/rpc.h>
16
17 #ifdef __STDC__
18 #   define CONCAT(a,b)          a##b
19 #   define CONCAT3(a,b,c)       a##b##c
20 #   define STRING(a)            #a
21 #else
22 #   define CONCAT(a,b)          a/**/b
23 #   define CONCAT3(a,b,c)       a/**/b/**/c
24 #   define STRING(a)            "a"
25 #endif
26
27 #ifdef __STDC__
28 typedef bool_t  (*rpcsvc_fn_t)(struct svc_req *, void *argp, void *resp);
29 #else
30 typedef bool_t  (*rpcsvc_fn_t)();
31 #endif
32
33 #define table_ent(func, vers, arg_type, res_type) \
34         {       STRING(func), \
35                 (rpcsvc_fn_t)CONCAT(func,_svc), vers,\
36                 (xdrproc_t)CONCAT(xdr_, arg_type), sizeof(arg_type), \
37                 (xdrproc_t)CONCAT(xdr_, res_type), sizeof(res_type), \
38         }
39 #define nlm_undef_svc   NULL
40 #define xdr_nlm_void    xdr_void
41
42 struct dispatch_entry {
43         const char      *name;
44         rpcsvc_fn_t     func;
45         unsigned int    versions;               /* bitmap of versions */
46         xdrproc_t       xdr_arg_fn;             /* argument XDR */
47         size_t          xdr_arg_size;
48         xdrproc_t       xdr_res_fn;             /* result XDR */
49         size_t          xdr_res_size;
50 };
51
52 void    rpc_dispatch(struct svc_req *rq, SVCXPRT *tp,
53                         struct dispatch_entry *dtable, int nproc,
54                         void *argp, void *resp);
55 void    rpc_svcrun(void);
56
57 #endif /* RPCDISPATCH_H */