]> git.decadent.org.uk Git - nfs-utils.git/blob - support/include/rpcmisc.h
nfs-utils: remove unused function rpc_logcall()
[nfs-utils.git] / support / include / rpcmisc.h
1 /*
2  * rpcmisc      Support for RPC startup, dispatching and logging.
3  *
4  * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
5  */
6
7 #ifndef RPCMISC_H
8 #define RPCMISC_H
9
10 #include <rpc/rpc.h>
11 #include <rpc/pmap_clnt.h>
12
13 #ifdef __STDC__
14 #   define CONCAT(a,b)          a##b
15 #   define STRING(a)            #a
16 #else
17 #   define CONCAT(a,b)          a/**/b
18 #   define STRING(a)            "a"
19 #endif
20
21 typedef bool_t  (*rpcsvc_fn_t)(struct svc_req *, void *argp, void *resp);
22
23 struct rpc_dentry {
24         const char      *name;
25         rpcsvc_fn_t     func;
26         xdrproc_t       xdr_arg_fn;             /* argument XDR */
27         size_t          xdr_arg_size;
28         xdrproc_t       xdr_res_fn;             /* result XDR */
29         size_t          xdr_res_size;
30 };
31
32 struct rpc_dtable {
33         struct rpc_dentry *entries;
34         int             nproc;
35 };
36
37 #define dtable_ent(func, vers, arg_type, res_type) \
38         {       STRING(func), \
39                 (rpcsvc_fn_t)func##_##vers##_svc, \
40                 (xdrproc_t)xdr_##arg_type, sizeof(arg_type), \
41                 (xdrproc_t)xdr_##res_type, sizeof(res_type), \
42         }
43
44
45 int             makesock(int port, int proto);
46 void            rpc_init(char *name, int prog, int vers,
47                                 void (*dispatch)(struct svc_req *, SVCXPRT *),
48                                 int defport);
49 void            rpc_svcrun(void);
50 void            rpc_dispatch(struct svc_req *rq, SVCXPRT *xprt,
51                                 struct rpc_dtable *dtable, int nvers,
52                                 void *argp, void *resp);
53
54 extern int      _rpcpmstart;
55 extern int      _rpcfdtype;
56 extern int      _rpcsvcdirty;
57
58
59 #endif /* RPCMISC_H */