1RPC_SVC_REG(3) BSD Library Functions Manual RPC_SVC_REG(3)
2
4 rpc_svc_reg, rpc_reg, svc_reg, svc_unreg, svc_auth_reg, xprt_register,
5 xprt_unregister — library routines for registering servers
6
8 #include <rpc/rpc.h>
9
10 int
11 rpc_reg(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
12 char *(*procname)(), xdrproc_t inproc, xdrproc_t outproc,
13 char *nettype);
14
15 bool_t
16 svc_reg(SVCXPRT *xprt, const rpcprog_t prognum, const rpcvers_t versnum,
17 void (*dispatch)(struct svc_req *, SVCXPRT *),
18 const struct netconfig *netconf);
19
20 void
21 svc_unreg(const rpcprog_t prognum, const rpcvers_t versnum);
22
23 int
24 svc_auth_reg(int cred_flavor,
25 enum auth_stat (*handler)(struct svc_req *, struct rpc_msg *));
26
27 void
28 xprt_register(SVCXPRT *xprt);
29
30 void
31 xprt_unregister(SVCXPRT *xprt);
32
34 These routines are a part of the RPC library which allows the RPC servers
35 to register themselves with rpcbind (see rpcbind(8)), and associate the
36 given program and version number with the dispatch function. When the
37 RPC server receives a RPC request, the library invokes the dispatch rou‐
38 tine with the appropriate arguments.
39
41 See rpc(3) for the definition of the SVCXPRT data structure.
42
43 rpc_reg()
44 Register program prognum, procedure procname, and version versnum
45 with the RPC service package. If a request arrives for program
46 prognum, version versnum, and procedure procnum, procname is
47 called with a pointer to its argument(s); procname should return a
48 pointer to its static result(s); inproc is the XDR function used
49 to decode the arguments while outproc is the XDR function used to
50 encode the results. Procedures are registered on all available
51 transports of the class nettype. See rpc(3). This routine
52 returns 0 if the registration succeeded, -1 otherwise.
53
54 svc_reg()
55 Associates prognum and versnum with the service dispatch proce‐
56 dure, dispatch. If netconf is NULL, the service is not registered
57 with the rpcbind(8) service. If netconf is non-zero, then a map‐
58 ping of the triple [prognum, versnum, netconf->nc_netid] to
59 xprt->xp_ltaddr is established with the local rpcbind service.
60
61 The svc_reg() routine returns 1 if it succeeds, and 0 otherwise.
62
63 svc_unreg()
64 Remove from the rpcbind service, all mappings of the triple
65 [prognum, versnum, all-transports] to network address and all map‐
66 pings within the RPC service package of the double [prognum,
67 versnum] to dispatch routines.
68
69 svc_auth_reg()
70 Registers the service authentication routine handler with the dis‐
71 patch mechanism so that it can be invoked to authenticate RPC
72 requests received with authentication type cred_flavor. This
73 interface allows developers to add new authentication types to
74 their RPC applications without needing to modify the libraries.
75 Service implementors usually do not need this routine.
76
77 Typical service application would call svc_auth_reg() after regis‐
78 tering the service and prior to calling svc_run(). When needed to
79 process an RPC credential of type cred_flavor, the handler proce‐
80 dure will be called with two arguments, struct svc_req *rqst and
81 struct rpc_msg *msg, and is expected to return a valid enum
82 auth_stat value. There is no provision to change or delete an
83 authentication handler once registered.
84
85 The svc_auth_reg() routine returns 0 if the registration is suc‐
86 cessful, 1 if cred_flavor already has an authentication handler
87 registered for it, and -1 otherwise.
88
89 xprt_register()
90 After RPC service transport handle xprt is created, it is regis‐
91 tered with the RPC service package. This routine modifies the
92 global variable svc_fdset (see rpc_svc_calls(3)). Service imple‐
93 mentors usually do not need this routine.
94
95 xprt_unregister()
96 Before an RPC service transport handle xprt is destroyed, it
97 unregisters itself with the RPC service package. This routine
98 modifies the global variable svc_fdset (see rpc_svc_calls(3)).
99 Service implementors usually do not need this routine.
100
102 These functions are part of libtirpc.
103
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