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

SYNOPSIS

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

DESCRIPTION

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

Routines

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

AVAILABILITY

185     These functions are part of libtirpc.
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