rpc_svc_create(3C)
NAME
svc_destroy, svcfd_create, svcraw_create, svctcp_create, svcudp_bufcreate − library routines for dealing with the creation of server handles
SYNOPSIS
#include <rpc/rpc.h>
/* svc_destroy */
void
svc_destroy(xprt)
SVCXPRT *xprt;
/* svcfd_create */
SVCXPRT *
svcfd_create(fd, sendsz, recvsz)
int fd;
u_int sendsz, recvsz;
/* svcraw_create() */
SVCXPRT *
svcraw_create()
/* svctcp_create */
SVCXPRT *
svctcp_create(sock, sendsz, recvsz)
int sock;
u_int sendsz, recvsz;
/* svcudp_bufcreate */
SVCXPRT *
svcudp_bufcreate(sock, sendsz, recvsz)
int sock;
u_int sendsz, recvsz;
DESCRIPTION
RPC routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a request to the server. Upon receipt of the request, the server calls a dispatch routine to perform the requested service, and then sends back a reply. Finally, the procedure call returns to the client.
Routines
To run these routines, the C programs must include the header file, <rpc.h>.
The SVCXPRT data structure is defined in Power Programming with RPC.
svc_destroy Destroy the RPC service transport handle, xprt. Destruction usually involves deallocation of private data structures, including xprt itself. Use of xprt is undefined after calling this routine.
svcfd_create Create a service on top of any open and bound descriptor and return the handle to it. Typically, this descriptor is a connected socket for a stream protocol such as TCP. sendsz and recvsz indicate sizes for the send and receive buffers. If they are zero, a reasonable default is chosen. It returns NULL if it fails.
svcraw_create() Create an RPC service transport, to which it returns a pointer. The transport is a buffer within the process’s address space, so the corresponding RPC client must live in the same address space; see clntraw_create() on rpc_clnt_create(3C). This routine allows simulation of RPC and getting RPC overheads (such as round trip times), without any kernel interference. This routine returns NULL if it fails.
svctcp_create Create a TCP/IP-based RPC service transport, to which it returns a pointer. The transport is associated with the socket sock. If sock is RPC_ANYSOCK, then a new socket is created. If the socket is not bound to a local TCP port, then this routine binds it to an arbitrary port. Upon completion, xprt−>xp_sock is the transport’s socket descriptor, and xprt−>xp_port is the port number on which it is listening. This routine returns NULL if it fails. Since TCP-based RPC uses buffered I/O, users may specify the size of buffers with sendsz and recvsz; values of zero choose defaults.
svcudp_bufcreate Create a UDP/IP-based RPC service transport, to which it returns a pointer. The transport is associated with the socket sock. If sock is RPC_ANYSOCK, a new socket is created. If the socket is not bound to a local UDP port, this routine binds it to an arbitrary port. Upon completion, xprt−>xp_sock is the service’s socket descriptor, and xprt−>xp_port is the service’s port number. This routine returns NULL if it fails.
The user specifies the maximum packet size for sending and receiving UDP-based RPC messages by using the sendsz and recvsz parameters.
AUTHOR
rpc was developed by Sun Microsystems, Inc.
SEE ALSO
portmap(1M), rpc(3C), rpc_clnt_create(3C), rpc_svc_calls(3C), rpc_svc_err(3C), rpc_svc_reg(3C).
Power Programming with RPC
Hewlett-Packard Company — HP-UX Release 10.20: July 1996