1rpc_svc_reg(3NSL)    Networking Services Library Functions   rpc_svc_reg(3NSL)
2
3
4

NAME

6       rpc_svc_reg,  rpc_reg, svc_reg, svc_unreg, svc_auth_reg, xprt_register,
7       xprt_unregister - library routines for registering servers
8

DESCRIPTION

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

ATTRIBUTES

102       See attributes(5) for descriptions of the following attributes:
103
104
105
106
107       ┌─────────────────────────────┬─────────────────────────────┐
108       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
109       ├─────────────────────────────┼─────────────────────────────┤
110       │MT-Level                     │MT-Safe                      │
111       └─────────────────────────────┴─────────────────────────────┘
112

SEE ALSO

114       inetd(1M), rpcbind(1M),  rpc(3NSL),  rpc_svc_calls(3NSL),  rpc_svc_cre‐
115       ate(3NSL), rpc_svc_err(3NSL), rpcbind(3NSL), select(3C), attributes(5)
116
117
118
119SunOS 5.11                        20 Feb 1998                rpc_svc_reg(3NSL)
Impressum