1RPC_SVC_REG(3)           BSD Library Functions Manual           RPC_SVC_REG(3)
2

NAME

4     rpc_svc_reg, rpc_reg, svc_reg, svc_unreg, svc_auth_reg, xprt_register,
5     xprt_unregister — library routines for registering servers
6

LIBRARY

8     Standard C Library (libc, -lc)
9

SYNOPSIS

11     #include <rpc/rpc.h>
12
13     int
14     rpc_reg(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
15         char *(*procname)(), xdrproc_t inproc, xdrproc_t outproc,
16         char *nettype);
17
18     bool_t
19     svc_reg(SVCXPRT *xprt, const rpcprog_t prognum, const rpcvers_t versnum,
20         void (*dispatch)(struct svc_req *, SVCXPRT *),
21         const struct netconfig *netconf);
22
23     void
24     svc_unreg(const rpcprog_t prognum, const rpcvers_t versnum);
25
26     int
27     svc_auth_reg(int cred_flavor,
28         enum auth_stat (*handler)(struct svc_req *, struct rpc_msg *));
29
30     void
31     xprt_register(SVCXPRT *xprt);
32
33     void
34     xprt_unregister(SVCXPRT *xprt);
35

DESCRIPTION

37     These routines are a part of the RPC library which allows the RPC servers
38     to register themselves with rpcbind (see rpcbind(8)), and associate the
39     given program and version number with the dispatch function.  When the
40     RPC server receives a RPC request, the library invokes the dispatch rou‐
41     tine with the appropriate arguments.
42

Routines

44     See rpc(3) for the definition of the SVCXPRT data structure.
45
46     rpc_reg()
47            Register program prognum, procedure procname, and version versnum
48            with the RPC service package.  If a request arrives for program
49            prognum, version versnum, and procedure procnum, procname is
50            called with a pointer to its argument(s); procname should return a
51            pointer to its static result(s); inproc is the XDR function used
52            to decode the arguments while outproc is the XDR function used to
53            encode the results.  Procedures are registered on all available
54            transports of the class nettype.  See rpc(3).  This routine
55            returns 0 if the registration succeeded, -1 otherwise.
56
57     svc_reg()
58            Associates prognum and versnum with the service dispatch proce‐
59            dure, dispatch.  If netconf is NULL, the service is not registered
60            with the rpcbind(8) service.  If netconf is non-zero, then a map‐
61            ping of the triple [prognum, versnum, netconf->nc_netid] to
62            xprt->xp_ltaddr is established with the local rpcbind service.
63
64            The svc_reg() routine returns 1 if it succeeds, and 0 otherwise.
65
66     svc_unreg()
67            Remove from the rpcbind service, all mappings of the triple
68            [prognum, versnum, all-transports] to network address and all map‐
69            pings within the RPC service package of the double [prognum,
70            versnum] to dispatch routines.
71
72     svc_auth_reg()
73            Registers the service authentication routine handler with the dis‐
74            patch mechanism so that it can be invoked to authenticate RPC
75            requests received with authentication type cred_flavor.  This
76            interface allows developers to add new authentication types to
77            their RPC applications without needing to modify the libraries.
78            Service implementors usually do not need this routine.
79
80            Typical service application would call svc_auth_reg() after regis‐
81            tering the service and prior to calling svc_run().  When needed to
82            process an RPC credential of type cred_flavor, the handler proce‐
83            dure will be called with two arguments, struct svc_req *rqst and
84            struct rpc_msg *msg, and is expected to return a valid enum
85            auth_stat value.  There is no provision to change or delete an
86            authentication handler once registered.
87
88            The svc_auth_reg() routine returns 0 if the registration is suc‐
89            cessful, 1 if cred_flavor already has an authentication handler
90            registered for it, and -1 otherwise.
91
92     xprt_register()
93            After RPC service transport handle xprt is created, it is regis‐
94            tered with the RPC service package.  This routine modifies the
95            global variable svc_fdset (see rpc_svc_calls(3)).  Service imple‐
96            mentors usually do not need this routine.
97
98     xprt_unregister()
99            Before an RPC service transport handle xprt is destroyed, it
100            unregisters itself with the RPC service package.  This routine
101            modifies the global variable svc_fdset (see rpc_svc_calls(3)).
102            Service implementors usually do not need this routine.
103

SEE ALSO

105     select(2), rpc(3), rpcbind(3), rpc_svc_calls(3), rpc_svc_create(3),
106     rpc_svc_err(3), rpcbind(8)
107
108BSD                               May 3, 1993                              BSD
Impressum