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

NAME

4     rpc_svc_create, svc_control, svc_create, svc_destroy, svc_dg_create,
5     svc_fd_create, svc_raw_create, svc_tli_create, svc_tp_create,
6     svc_vc_create — library routines for the creation of server handles
7

LIBRARY

9     Standard C Library (libc, -lc)
10

SYNOPSIS

12     #include <rpc/rpc.h>
13
14     bool_t
15     svc_control(SVCXPRT *svc, const u_int req, void *info);
16
17     int
18     svc_create(void (*dispatch)(struct svc_req *, SVCXPRT *),
19         const rpcprog_t prognum, const rpcvers_t versnum,
20         const char *nettype);
21
22     SVCXPRT *
23     svc_dg_create(const int fildes, const u_int sendsz, const u_int recvsz);
24
25     void
26     svc_destroy(SVCXPRT *xprt);
27
28     SVCXPRT *
29     svc_fd_create(const int fildes, const u_int sendsz, const u_int recvsz);
30
31     SVCXPRT *
32     svc_raw_create(void);
33
34     SVCXPRT *
35     svc_tli_create(const int fildes, const struct netconfig *netconf,
36         const struct t_bind *bindaddr, const u_int sendsz,
37         const u_int recvsz);
38
39     SVCXPRT *
40     svc_tp_create(void (*dispatch)(struct svc_req *, SVCXPRT *),
41         const rpcprog_t prognum, const rpcvers_t versnum,
42         const struct netconfig *netconf);
43
44     SVCXPRT *
45     svc_vc_create(const int fildes, const u_int sendsz, const u_int recvsz);
46

DESCRIPTION

48     These routines are part of the RPC library which allows C language pro‐
49     grams to make procedure calls on servers across the network.  These rou‐
50     tines deal with the creation of service handles.  Once the handle is cre‐
51     ated, the server can be invoked by calling svc_run().
52

Routines

54     See rpc(3) for the definition of the SVCXPRT data structure.
55
56     svc_control()
57            A function to change or retrieve various information about a ser‐
58            vice object.  The req argument indicates the type of operation and
59            info is a pointer to the information.  The supported values of
60            req, their argument types, and what they do are:
61
62            SVCGET_VERSQUIET
63                        If a request is received for a program number served
64                        by this server but the version number is outside the
65                        range registered with the server, an
66                        RPC_PROGVERSMISMATCH error will normally be returned.
67                        The info argument should be a pointer to an integer.
68                        Upon successful completion of the SVCGET_VERSQUIET
69                        request, *info contains an integer which describes the
70                        server's current behavior: 0 indicates normal server
71                        behavior (that is, an RPC_PROGVERSMISMATCH error will
72                        be returned); 1 indicates that the out of range
73                        request will be silently ignored.
74
75            SVCSET_VERSQUIET
76                        If a request is received for a program number served
77                        by this server but the version number is outside the
78                        range registered with the server, an
79                        RPC_PROGVERSMISMATCH error will normally be returned.
80                        It is sometimes desirable to change this behavior.
81                        The info argument should be a pointer to an integer
82                        which is either 0 (indicating normal server behavior -
83                        an RPC_PROGVERSMISMATCH error will be returned), or 1
84                        (indicating that the out of range request should be
85                        silently ignored).
86
87     svc_create()
88            The svc_create() function creates server handles for all the
89            transports belonging to the class nettype.  The nettype argument
90            defines a class of transports which can be used for a particular
91            application.  The transports are tried in left to right order in
92            NETPATH variable or in top to bottom order in the netconfig data‐
93            base.  If nettype is NULL, it defaults to "netpath".
94
95            The svc_create() function registers itself with the rpcbind ser‐
96            vice (see rpcbind(8)).  The dispatch function is called when there
97            is a remote procedure call for the given prognum and versnum; this
98            requires calling svc_run() (see svc_run() in rpc_svc_reg(3)).  If
99            svc_create() succeeds, it returns the number of server handles it
100            created, otherwise it returns 0 and an error message is logged.
101
102     svc_destroy()
103            A function macro that destroys the RPC service handle xprt.
104            Destruction usually involves deallocation of private data struc‐
105            tures, including xprt itself.  Use of xprt is undefined after
106            calling this routine.
107
108     svc_dg_create()
109            This routine creates a connectionless RPC service handle, and
110            returns a pointer to it.  This routine returns NULL if it fails,
111            and an error message is logged.  The sendsz and recvsz arguments
112            are arguments used to specify the size of the buffers.  If they
113            are 0, suitable defaults are chosen.  The file descriptor fildes
114            should be open and bound.  The server is not registered with
115            rpcbind(8).
116
117            Warning: since connectionless-based RPC messages can only hold
118            limited amount of encoded data, this transport cannot be used for
119            procedures that take large arguments or return huge results.
120
121     svc_fd_create()
122            This routine creates a service on top of an open and bound file
123            descriptor, and returns the handle to it.  Typically, this
124            descriptor is a connected file descriptor for a connection-ori‐
125            ented transport.  The sendsz and recvsz arguments indicate sizes
126            for the send and receive buffers.  If they are 0, reasonable
127            defaults are chosen.  This routine returns NULL if it fails, and
128            an error message is logged.
129
130     svc_raw_create()
131            This routine creates an RPC service handle and returns a pointer
132            to it.  The transport is really a buffer within the process's
133            address space, so the corresponding RPC client should live in the
134            same address space; (see clnt_raw_create() in rpc_clnt_create(3)).
135            This routine allows simulation of RPC and acquisition of RPC over‐
136            heads (such as round trip times), without any kernel and network‐
137            ing interference.  This routine returns NULL if it fails, and an
138            error message is logged.
139
140            Note: svc_run() should not be called when the raw interface is
141            being used.
142
143     svc_tli_create()
144            This routine creates an RPC server handle, and returns a pointer
145            to it.  The fildes argument is the file descriptor on which the
146            service is listening.  If fildes is RPC_ANYFD, it opens a file
147            descriptor on the transport specified by netconf.  If the file
148            descriptor is unbound and bindaddr is not NULL, fildes is bound to
149            the address specified by bindaddr, otherwise fildes is bound to a
150            default address chosen by the transport.
151
152            Note: the t_bind structure comes from the TLI/XTI SysV interface,
153            which NetBSD does not use.  The structure is defined in
154            <rpc/types.h> for compatibility as:
155
156            struct t_bind {
157                struct netbuf addr; /* network address, see rpc(3) */
158                unsigned int  qlen; /* queue length (for listen(2)) */
159            };
160
161            In the case where the default address is chosen, the number of
162            outstanding connect requests is set to 8 for connection-oriented
163            transports.  The user may specify the size of the send and receive
164            buffers with the arguments sendsz and recvsz; values of 0 choose
165            suitable defaults.  This routine returns NULL if it fails, and an
166            error message is logged.  The server is not registered with the
167            rpcbind(8) service.
168
169     svc_tp_create()
170            The svc_tp_create() function creates a server handle for the net‐
171            work specified by netconf, and registers itself with the rpcbind
172            service.  The dispatch function is called when there is a remote
173            procedure call for the given prognum and versnum; this requires
174            calling svc_run().  The svc_tp_create() function returns the ser‐
175            vice handle if it succeeds, otherwise a NULL is returned and an
176            error message is logged.
177
178     svc_vc_create()
179            This routine creates a connection-oriented RPC service and returns
180            a pointer to it.  This routine returns NULL if it fails, and an
181            error message is logged.  The users may specify the size of the
182            send and receive buffers with the arguments sendsz and recvsz;
183            values of 0 choose suitable defaults.  The file descriptor fildes
184            should be open and bound.  The server is not registered with the
185            rpcbind(8) service.
186

SEE ALSO

188     rpc(3), rpc_svc_calls(3), rpc_svc_err(3), rpc_svc_reg(3), rpcbind(8)
189
190BSD                               May 3, 1993                              BSD
Impressum