xref: /freebsd/lib/libc/rpc/rpc_soc.3 (revision 32eef9aeb1f39a1623cea55da147c89abbd5b9a5)
18360efbdSAlfred Perlstein.\" @(#)rpc.3n	2.4 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
28360efbdSAlfred Perlstein.\" $NetBSD: rpc_soc.3,v 1.2 2000/06/07 13:39:43 simonb Exp $
38360efbdSAlfred Perlstein.\" $FreeBSD$
48360efbdSAlfred Perlstein.\"
523601548SRuslan Ermilov.Dd February 16, 1988
623601548SRuslan Ermilov.Dt RPC_SOC 3
723601548SRuslan Ermilov.Os
823601548SRuslan Ermilov.Sh NAME
923601548SRuslan Ermilov.Nm rpc_soc ,
1023601548SRuslan Ermilov.Nm auth_destroy ,
1123601548SRuslan Ermilov.Nm authnone_create ,
1223601548SRuslan Ermilov.Nm authunix_create ,
1323601548SRuslan Ermilov.Nm authunix_create_default ,
1423601548SRuslan Ermilov.Nm callrpc ,
1523601548SRuslan Ermilov.Nm clnt_broadcast ,
1623601548SRuslan Ermilov.Nm clnt_call ,
1723601548SRuslan Ermilov.Nm clnt_control ,
1823601548SRuslan Ermilov.Nm clnt_create ,
1923601548SRuslan Ermilov.Nm clnt_destroy ,
2023601548SRuslan Ermilov.Nm clnt_freeres ,
2123601548SRuslan Ermilov.Nm clnt_geterr ,
2223601548SRuslan Ermilov.Nm clnt_pcreateerror ,
2323601548SRuslan Ermilov.Nm clnt_perrno ,
2423601548SRuslan Ermilov.Nm clnt_perror ,
2523601548SRuslan Ermilov.Nm clnt_spcreateerror ,
2623601548SRuslan Ermilov.Nm clnt_sperrno ,
2723601548SRuslan Ermilov.Nm clnt_sperror ,
2823601548SRuslan Ermilov.Nm clntraw_create ,
2923601548SRuslan Ermilov.Nm clnttcp_create ,
3023601548SRuslan Ermilov.Nm clntudp_bufcreate ,
3123601548SRuslan Ermilov.Nm clntudp_create ,
3223601548SRuslan Ermilov.Nm get_myaddress ,
3323601548SRuslan Ermilov.Nm pmap_getmaps ,
3423601548SRuslan Ermilov.Nm pmap_getport ,
3523601548SRuslan Ermilov.Nm pmap_rmtcall ,
3623601548SRuslan Ermilov.Nm pmap_set ,
3723601548SRuslan Ermilov.Nm pmap_unset ,
3823601548SRuslan Ermilov.Nm registerrpc ,
3923601548SRuslan Ermilov.Nm rpc_createerr ,
4023601548SRuslan Ermilov.Nm svc_destroy ,
4123601548SRuslan Ermilov.Nm svc_fds ,
4223601548SRuslan Ermilov.Nm svc_fdset ,
4323601548SRuslan Ermilov.Nm svc_getargs ,
4423601548SRuslan Ermilov.Nm svc_getcaller ,
4523601548SRuslan Ermilov.Nm svc_getreq ,
4623601548SRuslan Ermilov.Nm svc_getreqset ,
4723601548SRuslan Ermilov.Nm svc_register ,
4823601548SRuslan Ermilov.Nm svc_run ,
4923601548SRuslan Ermilov.Nm svc_sendreply ,
5023601548SRuslan Ermilov.Nm svc_unregister ,
5123601548SRuslan Ermilov.Nm svcerr_auth ,
5223601548SRuslan Ermilov.Nm svcerr_decode ,
5323601548SRuslan Ermilov.Nm svcerr_noproc ,
5423601548SRuslan Ermilov.Nm svcerr_noprog ,
5523601548SRuslan Ermilov.Nm svcerr_progvers ,
5623601548SRuslan Ermilov.Nm svcerr_systemerr ,
5723601548SRuslan Ermilov.Nm svcerr_weakauth ,
5823601548SRuslan Ermilov.Nm svcfd_create ,
5923601548SRuslan Ermilov.Nm svcraw_create ,
6023601548SRuslan Ermilov.Nm xdr_accepted_reply ,
6123601548SRuslan Ermilov.Nm xdr_authunix_parms ,
6223601548SRuslan Ermilov.Nm xdr_callhdr ,
6323601548SRuslan Ermilov.Nm xdr_callmsg ,
6423601548SRuslan Ermilov.Nm xdr_opaque_auth ,
6523601548SRuslan Ermilov.Nm xdr_pmap ,
6623601548SRuslan Ermilov.Nm xdr_pmaplist ,
6723601548SRuslan Ermilov.Nm xdr_rejected_reply ,
6823601548SRuslan Ermilov.Nm xdr_replymsg ,
6923601548SRuslan Ermilov.Nm xprt_register ,
7023601548SRuslan Ermilov.Nm xprt_unregister
7123601548SRuslan Ermilov.Nd "library routines for remote procedure calls"
7223601548SRuslan Ermilov.Sh LIBRARY
7323601548SRuslan Ermilov.Lb libc
7423601548SRuslan Ermilov.Sh SYNOPSIS
7532eef9aeSRuslan Ermilov.In rpc/rpc.h
7623601548SRuslan Ermilov.Pp
7723601548SRuslan ErmilovSee
7823601548SRuslan Ermilov.Sx DESCRIPTION
7923601548SRuslan Ermilovfor function declarations.
8023601548SRuslan Ermilov.Sh DESCRIPTION
8123601548SRuslan Ermilov.Bf -symbolic
8223601548SRuslan ErmilovThe
8323601548SRuslan Ermilov.Fn svc_*
8423601548SRuslan Ermilovand
8523601548SRuslan Ermilov.Fn clnt_*
8623601548SRuslan Ermilovfunctions described in this page are the old, TS-RPC
8723601548SRuslan Ermilovinterface to the XDR and RPC library, and exist for backward compatibility.
8823601548SRuslan ErmilovThe new interface is described in the pages
8923601548SRuslan Ermilovreferenced from
9023601548SRuslan Ermilov.Xr rpc 3 .
9123601548SRuslan Ermilov.Ef
9223601548SRuslan Ermilov.Pp
938360efbdSAlfred PerlsteinThese routines allow C programs to make procedure
948360efbdSAlfred Perlsteincalls on other machines across the network.
958360efbdSAlfred PerlsteinFirst, the client calls a procedure to send a
968360efbdSAlfred Perlsteindata packet to the server.
978360efbdSAlfred PerlsteinUpon receipt of the packet, the server calls a dispatch routine
988360efbdSAlfred Perlsteinto perform the requested service, and then sends back a
998360efbdSAlfred Perlsteinreply.
1008360efbdSAlfred PerlsteinFinally, the procedure call returns to the client.
10123601548SRuslan Ermilov.Pp
10223601548SRuslan ErmilovRoutines that are used for Secure
10323601548SRuslan Ermilov.Tn RPC ( DES
10423601548SRuslan Ermilovauthentication) are described in
10523601548SRuslan Ermilov.Xr rpc_secure 3 .
10623601548SRuslan ErmilovSecure
10723601548SRuslan Ermilov.Tn RPC
10823601548SRuslan Ermilovcan be used only if
10923601548SRuslan Ermilov.Tn DES
11023601548SRuslan Ermilovencryption is available.
11123601548SRuslan Ermilov.Bl -tag -width indent -compact
11223601548SRuslan Ermilov.Pp
11323601548SRuslan Ermilov.It Xo
11423601548SRuslan Ermilov.Ft void
11523601548SRuslan Ermilov.Xc
11623601548SRuslan Ermilov.It Xo
11723601548SRuslan Ermilov.Fn auth_destroy "AUTH *auth"
11823601548SRuslan Ermilov.Xc
11923601548SRuslan Ermilov.Pp
1208360efbdSAlfred PerlsteinA macro that destroys the authentication information associated with
12123601548SRuslan Ermilov.Fa auth .
1228360efbdSAlfred PerlsteinDestruction usually involves deallocation of private data
12323601548SRuslan Ermilovstructures.
12423601548SRuslan ErmilovThe use of
12523601548SRuslan Ermilov.Fa auth
1268360efbdSAlfred Perlsteinis undefined after calling
12723601548SRuslan Ermilov.Fn auth_destroy .
12823601548SRuslan Ermilov.Pp
12923601548SRuslan Ermilov.It Xo
13023601548SRuslan Ermilov.Ft "AUTH *"
13123601548SRuslan Ermilov.Xc
13223601548SRuslan Ermilov.It Xo
13323601548SRuslan Ermilov.Fn authnone_create
13423601548SRuslan Ermilov.Xc
13523601548SRuslan Ermilov.Pp
1368360efbdSAlfred PerlsteinCreate and return an
13723601548SRuslan Ermilov.Tn RPC
13823601548SRuslan Ermilovauthentication handle that passes nonusable authentication
13923601548SRuslan Ermilovinformation with each remote procedure call.
14023601548SRuslan ErmilovThis is the
14123601548SRuslan Ermilovdefault authentication used by
14223601548SRuslan Ermilov.Tn RPC .
14323601548SRuslan Ermilov.Pp
14423601548SRuslan Ermilov.It Xo
14523601548SRuslan Ermilov.Ft "AUTH *"
14623601548SRuslan Ermilov.Xc
14723601548SRuslan Ermilov.It Xo
14823601548SRuslan Ermilov.Fn authunix_create "char *host" "int uid" "int gid" "int len" "int *aup_gids"
14923601548SRuslan Ermilov.Xc
15023601548SRuslan Ermilov.Pp
15123601548SRuslan ErmilovCreate and return an
15223601548SRuslan Ermilov.Tn RPC
1538360efbdSAlfred Perlsteinauthentication handle that contains
15423601548SRuslan Ermilov.Ux
1558360efbdSAlfred Perlsteinauthentication information.
1568360efbdSAlfred PerlsteinThe parameter
15723601548SRuslan Ermilov.Fa host
1588360efbdSAlfred Perlsteinis the name of the machine on which the information was
1598360efbdSAlfred Perlsteincreated;
16023601548SRuslan Ermilov.Fa uid
16123601548SRuslan Ermilovis the user's user ID;
16223601548SRuslan Ermilov.Fa gid
16323601548SRuslan Ermilovis the user's current group ID;
16423601548SRuslan Ermilov.Fa len
1658360efbdSAlfred Perlsteinand
16623601548SRuslan Ermilov.Fa aup_gids
1678360efbdSAlfred Perlsteinrefer to a counted array of groups to which the user belongs.
1688360efbdSAlfred PerlsteinIt is easy to impersonate a user.
16923601548SRuslan Ermilov.Pp
17023601548SRuslan Ermilov.It Xo
17123601548SRuslan Ermilov.Ft "AUTH *"
17223601548SRuslan Ermilov.Xc
17323601548SRuslan Ermilov.It Xo
17423601548SRuslan Ermilov.Fn authunix_create_default
17523601548SRuslan Ermilov.Xc
17623601548SRuslan Ermilov.Pp
1778360efbdSAlfred PerlsteinCalls
17823601548SRuslan Ermilov.Fn authunix_create
1798360efbdSAlfred Perlsteinwith the appropriate parameters.
18023601548SRuslan Ermilov.Pp
18123601548SRuslan Ermilov.It Xo
18223601548SRuslan Ermilov.Fo callrpc
18323601548SRuslan Ermilov.Fa "char *host"
18423601548SRuslan Ermilov.Fa "u_long prognum"
18523601548SRuslan Ermilov.Fa "u_long versnum"
18623601548SRuslan Ermilov.Fa "u_long procnum"
18723601548SRuslan Ermilov.Fa "xdrproc_t inproc"
188cc74aaddSAlfred Perlstein.Fa "void *in"
18923601548SRuslan Ermilov.Fa "xdrproc_t outproc"
190cc74aaddSAlfred Perlstein.Fa "void *out"
19123601548SRuslan Ermilov.Fc
19223601548SRuslan Ermilov.Xc
19323601548SRuslan Ermilov.Pp
1948360efbdSAlfred PerlsteinCall the remote procedure associated with
19523601548SRuslan Ermilov.Fa prognum ,
19623601548SRuslan Ermilov.Fa versnum ,
1978360efbdSAlfred Perlsteinand
19823601548SRuslan Ermilov.Fa procnum
19923601548SRuslan Ermilovon the machine
20023601548SRuslan Ermilov.Fa host .
2018360efbdSAlfred PerlsteinThe parameter
20223601548SRuslan Ermilov.Fa in
2038360efbdSAlfred Perlsteinis the address of the procedure's argument(s), and
20423601548SRuslan Ermilov.Fa out
2058360efbdSAlfred Perlsteinis the address of where to place the result(s);
20623601548SRuslan Ermilov.Fa inproc
2078360efbdSAlfred Perlsteinis used to encode the procedure's parameters, and
20823601548SRuslan Ermilov.Fa outproc
2098360efbdSAlfred Perlsteinis used to decode the procedure's results.
2108360efbdSAlfred PerlsteinThis routine returns zero if it succeeds, or the value of
21123601548SRuslan Ermilov.Vt "enum clnt_stat"
2128360efbdSAlfred Perlsteincast to an integer if it fails.
2138360efbdSAlfred PerlsteinThe routine
21423601548SRuslan Ermilov.Fn clnt_perrno
2158360efbdSAlfred Perlsteinis handy for translating failure statuses into messages.
21623601548SRuslan Ermilov.Pp
2178360efbdSAlfred PerlsteinWarning: calling remote procedures with this routine
2188360efbdSAlfred Perlsteinuses
21923601548SRuslan Ermilov.Tn UDP/IP
2208360efbdSAlfred Perlsteinas a transport; see
22123601548SRuslan Ermilov.Fn clntudp_create
2228360efbdSAlfred Perlsteinfor restrictions.
2238360efbdSAlfred PerlsteinYou do not have control of timeouts or authentication using
2248360efbdSAlfred Perlsteinthis routine.
22523601548SRuslan Ermilov.Pp
22623601548SRuslan Ermilov.It Xo
22723601548SRuslan Ermilov.Ft "enum clnt_stat"
22823601548SRuslan Ermilov.Xc
22923601548SRuslan Ermilov.It Xo
23023601548SRuslan Ermilov.Fo clnt_broadcast
23123601548SRuslan Ermilov.Fa "u_long prognum"
23223601548SRuslan Ermilov.Fa "u_long versnum"
23323601548SRuslan Ermilov.Fa "u_long procnum"
23423601548SRuslan Ermilov.Fa "xdrproc_t inproc"
23523601548SRuslan Ermilov.Fa "char *in"
23623601548SRuslan Ermilov.Fa "xdrproc_t outproc"
23723601548SRuslan Ermilov.Fa "char *out"
23823601548SRuslan Ermilov.Fa "bool_t (*eachresult)(caddr_t, struct sockaddr_in *)"
23923601548SRuslan Ermilov.Fc
24023601548SRuslan Ermilov.Xc
24123601548SRuslan Ermilov.Pp
2428360efbdSAlfred PerlsteinLike
24323601548SRuslan Ermilov.Fn callrpc ,
2448360efbdSAlfred Perlsteinexcept the call message is broadcast to all locally
24523601548SRuslan Ermilovconnected broadcast nets.
24623601548SRuslan ErmilovEach time it receives a
2478360efbdSAlfred Perlsteinresponse, this routine calls
24823601548SRuslan Ermilov.Fn eachresult ,
2498360efbdSAlfred Perlsteinwhose form is:
25023601548SRuslan Ermilov.Bd -ragged -offset indent
25123601548SRuslan Ermilov.Ft bool_t
25223601548SRuslan Ermilov.Fn eachresult "caddr_t out" "struct sockaddr_in *addr"
25323601548SRuslan Ermilov.Ed
25423601548SRuslan Ermilov.Pp
2558360efbdSAlfred Perlsteinwhere
25623601548SRuslan Ermilov.Fa out
2578360efbdSAlfred Perlsteinis the same as
25823601548SRuslan Ermilov.Fa out
2598360efbdSAlfred Perlsteinpassed to
26023601548SRuslan Ermilov.Fn clnt_broadcast ,
2618360efbdSAlfred Perlsteinexcept that the remote procedure's output is decoded there;
26223601548SRuslan Ermilov.Fa addr
2638360efbdSAlfred Perlsteinpoints to the address of the machine that sent the results.
2648360efbdSAlfred PerlsteinIf
26523601548SRuslan Ermilov.Fn eachresult
2668360efbdSAlfred Perlsteinreturns zero,
26723601548SRuslan Ermilov.Fn clnt_broadcast
2688360efbdSAlfred Perlsteinwaits for more replies; otherwise it returns with appropriate
2698360efbdSAlfred Perlsteinstatus.
27023601548SRuslan Ermilov.Pp
2718360efbdSAlfred PerlsteinWarning: broadcast sockets are limited in size to the
27223601548SRuslan Ermilovmaximum transfer unit of the data link.
27323601548SRuslan ErmilovFor ethernet,
2748360efbdSAlfred Perlsteinthis value is 1500 bytes.
27523601548SRuslan Ermilov.Pp
27623601548SRuslan Ermilov.It Xo
27723601548SRuslan Ermilov.Ft "enum clnt_stat"
27823601548SRuslan Ermilov.Xc
27923601548SRuslan Ermilov.It Xo
28023601548SRuslan Ermilov.Fo clnt_call
28123601548SRuslan Ermilov.Fa "CLIENT *clnt"
28223601548SRuslan Ermilov.Fa "u_long procnum"
28323601548SRuslan Ermilov.Fa "xdrproc_t inproc"
28423601548SRuslan Ermilov.Fa "char *in"
28523601548SRuslan Ermilov.Fa "xdrproc_t outproc"
28623601548SRuslan Ermilov.Fa "char *out"
28723601548SRuslan Ermilov.Fa "struct timeval tout"
28823601548SRuslan Ermilov.Fc
28923601548SRuslan Ermilov.Xc
29023601548SRuslan Ermilov.Pp
2918360efbdSAlfred PerlsteinA macro that calls the remote procedure
29223601548SRuslan Ermilov.Fa procnum
2938360efbdSAlfred Perlsteinassociated with the client handle,
29423601548SRuslan Ermilov.Fa clnt ,
2958360efbdSAlfred Perlsteinwhich is obtained with an
29623601548SRuslan Ermilov.Tn RPC
2978360efbdSAlfred Perlsteinclient creation routine such as
29823601548SRuslan Ermilov.Fn clnt_create .
2998360efbdSAlfred PerlsteinThe parameter
30023601548SRuslan Ermilov.Fa in
3018360efbdSAlfred Perlsteinis the address of the procedure's argument(s), and
30223601548SRuslan Ermilov.Fa out
3038360efbdSAlfred Perlsteinis the address of where to place the result(s);
30423601548SRuslan Ermilov.Fa inproc
3058360efbdSAlfred Perlsteinis used to encode the procedure's parameters, and
30623601548SRuslan Ermilov.Fa outproc
3078360efbdSAlfred Perlsteinis used to decode the procedure's results;
30823601548SRuslan Ermilov.Fa tout
3098360efbdSAlfred Perlsteinis the time allowed for results to come back.
31023601548SRuslan Ermilov.Pp
31123601548SRuslan Ermilov.It Xo
31223601548SRuslan Ermilov.Ft void
31323601548SRuslan Ermilov.Fn clnt_destroy "CLIENT *clnt"
31423601548SRuslan Ermilov.Xc
31523601548SRuslan Ermilov.Pp
3168360efbdSAlfred PerlsteinA macro that destroys the client's
31723601548SRuslan Ermilov.Tn RPC
31823601548SRuslan Ermilovhandle.
31923601548SRuslan ErmilovDestruction usually involves deallocation
3208360efbdSAlfred Perlsteinof private data structures, including
32123601548SRuslan Ermilov.Fa clnt
32223601548SRuslan Ermilovitself.
32323601548SRuslan ErmilovUse of
32423601548SRuslan Ermilov.Fa clnt
3258360efbdSAlfred Perlsteinis undefined after calling
32623601548SRuslan Ermilov.Fn clnt_destroy .
3278360efbdSAlfred PerlsteinIf the
32823601548SRuslan Ermilov.Tn RPC
3298360efbdSAlfred Perlsteinlibrary opened the associated socket, it will close it also.
3308360efbdSAlfred PerlsteinOtherwise, the socket remains open.
33123601548SRuslan Ermilov.Pp
33223601548SRuslan Ermilov.It Xo
33323601548SRuslan Ermilov.Ft CLIENT *
33423601548SRuslan Ermilov.Xc
33523601548SRuslan Ermilov.It Xo
33623601548SRuslan Ermilov.Fn clnt_create "char *host" "u_long prog" "u_long vers" "char *proto"
33723601548SRuslan Ermilov.Xc
33823601548SRuslan Ermilov.Pp
3398360efbdSAlfred PerlsteinGeneric client creation routine.
34023601548SRuslan Ermilov.Fa host
3418360efbdSAlfred Perlsteinidentifies the name of the remote host where the server
3428360efbdSAlfred Perlsteinis located.
34323601548SRuslan Ermilov.Fa proto
34423601548SRuslan Ermilovindicates which kind of transport protocol to use.
34523601548SRuslan ErmilovThe
34623601548SRuslan Ermilovcurrently supported values for this field are
34723601548SRuslan Ermilov.Qq Li udp
34823601548SRuslan Ermilovand
34923601548SRuslan Ermilov.Qq Li tcp .
3508360efbdSAlfred PerlsteinDefault timeouts are set, but can be modified using
35123601548SRuslan Ermilov.Fn clnt_control .
35223601548SRuslan Ermilov.Pp
3538360efbdSAlfred PerlsteinWarning: Using
35423601548SRuslan Ermilov.Tn UDP
35523601548SRuslan Ermilovhas its shortcomings.
35623601548SRuslan ErmilovSince
35723601548SRuslan Ermilov.Tn UDP Ns \-based
35823601548SRuslan Ermilov.Tn RPC
3598360efbdSAlfred Perlsteinmessages can only hold up to 8 Kbytes of encoded data,
3608360efbdSAlfred Perlsteinthis transport cannot be used for procedures that take
3618360efbdSAlfred Perlsteinlarge arguments or return huge results.
36223601548SRuslan Ermilov.Pp
36323601548SRuslan Ermilov.It Xo
36423601548SRuslan Ermilov.Ft bool_t
36523601548SRuslan Ermilov.Xc
36623601548SRuslan Ermilov.It Xo
36723601548SRuslan Ermilov.Fn clnt_control "CLIENT *cl" "u_int req" "char *info"
36823601548SRuslan Ermilov.Xc
36923601548SRuslan Ermilov.Pp
3708360efbdSAlfred PerlsteinA macro used to change or retrieve various information
3718360efbdSAlfred Perlsteinabout a client object.
37223601548SRuslan Ermilov.Fa req
3738360efbdSAlfred Perlsteinindicates the type of operation, and
37423601548SRuslan Ermilov.Fa info
37523601548SRuslan Ermilovis a pointer to the information.
37623601548SRuslan ErmilovFor both
37723601548SRuslan Ermilov.Tn UDP
3788360efbdSAlfred Perlsteinand
37923601548SRuslan Ermilov.Tn TCP ,
3808360efbdSAlfred Perlsteinthe supported values of
38123601548SRuslan Ermilov.Fa req
3828360efbdSAlfred Perlsteinand their argument types and what they do are:
38323601548SRuslan Ermilov.Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
38423601548SRuslan Ermilov.It Dv CLSET_TIMEOUT Ta Xo
38523601548SRuslan Ermilov.Vt "struct timeval" Ta "set total timeout"
38623601548SRuslan Ermilov.Xc
38723601548SRuslan Ermilov.It Dv CLGET_TIMEOUT Ta Xo
38823601548SRuslan Ermilov.Vt "struct timeval" Ta "get total timeout"
38923601548SRuslan Ermilov.Xc
39023601548SRuslan Ermilov.El
39123601548SRuslan Ermilov.Pp
3928360efbdSAlfred PerlsteinNote: if you set the timeout using
39323601548SRuslan Ermilov.Fn clnt_control ,
3948360efbdSAlfred Perlsteinthe timeout parameter passed to
39523601548SRuslan Ermilov.Fn clnt_call
3968360efbdSAlfred Perlsteinwill be ignored in all future calls.
39723601548SRuslan Ermilov.Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
39823601548SRuslan Ermilov.It Dv CLGET_SERVER_ADDR Ta Xo
39923601548SRuslan Ermilov.Vt "struct sockaddr_in" Ta "get server's address"
40023601548SRuslan Ermilov.Xc
40123601548SRuslan Ermilov.El
40223601548SRuslan Ermilov.Pp
4038360efbdSAlfred PerlsteinThe following operations are valid for
40423601548SRuslan Ermilov.Tn UDP
4058360efbdSAlfred Perlsteinonly:
40623601548SRuslan Ermilov.Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
40723601548SRuslan Ermilov.It Dv CLSET_RETRY_TIMEOUT Ta Xo
40823601548SRuslan Ermilov.Vt "struct timeval" Ta "set the retry timeout"
40923601548SRuslan Ermilov.Xc
41023601548SRuslan Ermilov.It Dv CLGET_RETRY_TIMEOUT Ta Xo
41123601548SRuslan Ermilov.Vt "struct timeval" Ta "get the retry timeout"
41223601548SRuslan Ermilov.Xc
41323601548SRuslan Ermilov.El
41423601548SRuslan Ermilov.Pp
4158360efbdSAlfred PerlsteinThe retry timeout is the time that
41623601548SRuslan Ermilov.Tn "UDP RPC"
4178360efbdSAlfred Perlsteinwaits for the server to reply before
4188360efbdSAlfred Perlsteinretransmitting the request.
41923601548SRuslan Ermilov.Pp
42023601548SRuslan Ermilov.It Xo
42123601548SRuslan Ermilov.Ft bool_t
42223601548SRuslan Ermilov.Fn clnt_freeres "CLIENT *clnt" "xdrproc_t outproc" "char *out"
42323601548SRuslan Ermilov.Xc
42423601548SRuslan Ermilov.Pp
4258360efbdSAlfred PerlsteinA macro that frees any data allocated by the
42623601548SRuslan Ermilov.Tn RPC/XDR
4278360efbdSAlfred Perlsteinsystem when it decoded the results of an
42823601548SRuslan Ermilov.Tn RPC
42923601548SRuslan Ermilovcall.
43023601548SRuslan ErmilovThe parameter
43123601548SRuslan Ermilov.Fa out
4328360efbdSAlfred Perlsteinis the address of the results, and
43323601548SRuslan Ermilov.Fa outproc
4348360efbdSAlfred Perlsteinis the
43523601548SRuslan Ermilov.Tn XDR
4368360efbdSAlfred Perlsteinroutine describing the results.
4378360efbdSAlfred PerlsteinThis routine returns one if the results were successfully
4388360efbdSAlfred Perlsteinfreed,
4398360efbdSAlfred Perlsteinand zero otherwise.
44023601548SRuslan Ermilov.Pp
44123601548SRuslan Ermilov.It Xo
44223601548SRuslan Ermilov.Ft void
44323601548SRuslan Ermilov.Xc
44423601548SRuslan Ermilov.It Xo
44523601548SRuslan Ermilov.Fn clnt_geterr "CLIENT *clnt" "struct rpc_err *errp"
44623601548SRuslan Ermilov.Xc
44723601548SRuslan Ermilov.Pp
4488360efbdSAlfred PerlsteinA macro that copies the error structure out of the client
4498360efbdSAlfred Perlsteinhandle
4508360efbdSAlfred Perlsteinto the structure at address
45123601548SRuslan Ermilov.Fa errp .
45223601548SRuslan Ermilov.Pp
45323601548SRuslan Ermilov.It Xo
45423601548SRuslan Ermilov.Ft void
45523601548SRuslan Ermilov.Xc
45623601548SRuslan Ermilov.It Xo
45723601548SRuslan Ermilov.Fn clnt_pcreateerror "char *s"
45823601548SRuslan Ermilov.Xc
45923601548SRuslan Ermilov.Pp
46023601548SRuslan Ermilovprints a message to standard error indicating
4618360efbdSAlfred Perlsteinwhy a client
46223601548SRuslan Ermilov.Tn RPC
4638360efbdSAlfred Perlsteinhandle could not be created.
4648360efbdSAlfred PerlsteinThe message is prepended with string
46523601548SRuslan Ermilov.Fa s
4668360efbdSAlfred Perlsteinand a colon.
46723601548SRuslan ErmilovA newline is appended at the end of the message.
4688360efbdSAlfred PerlsteinUsed when a
46923601548SRuslan Ermilov.Fn clnt_create ,
47023601548SRuslan Ermilov.Fn clntraw_create ,
47123601548SRuslan Ermilov.Fn clnttcp_create ,
4728360efbdSAlfred Perlsteinor
47323601548SRuslan Ermilov.Fn clntudp_create
4748360efbdSAlfred Perlsteincall fails.
47523601548SRuslan Ermilov.Pp
47623601548SRuslan Ermilov.It Xo
47723601548SRuslan Ermilov.Ft void
47823601548SRuslan Ermilov.Xc
47923601548SRuslan Ermilov.It Xo
48023601548SRuslan Ermilov.Fn clnt_perrno "enum clnt_stat stat"
48123601548SRuslan Ermilov.Xc
48223601548SRuslan Ermilov.Pp
4838360efbdSAlfred PerlsteinPrint a message to standard error corresponding
4848360efbdSAlfred Perlsteinto the condition indicated by
48523601548SRuslan Ermilov.Fa stat .
48623601548SRuslan ErmilovA newline is appended at the end of the message.
4878360efbdSAlfred PerlsteinUsed after
48823601548SRuslan Ermilov.Fn callrpc .
48923601548SRuslan Ermilov.Pp
49023601548SRuslan Ermilov.It Xo
49123601548SRuslan Ermilov.Ft void
49223601548SRuslan Ermilov.Fn clnt_perror "CLIENT *clnt" "char *s"
49323601548SRuslan Ermilov.Xc
49423601548SRuslan Ermilov.Pp
4958360efbdSAlfred PerlsteinPrint a message to standard error indicating why an
49623601548SRuslan Ermilov.Tn RPC
4978360efbdSAlfred Perlsteincall failed;
49823601548SRuslan Ermilov.Fa clnt
4998360efbdSAlfred Perlsteinis the handle used to do the call.
5008360efbdSAlfred PerlsteinThe message is prepended with string
50123601548SRuslan Ermilov.Fa s
5028360efbdSAlfred Perlsteinand a colon.
50323601548SRuslan ErmilovA newline is appended at the end of the message.
5048360efbdSAlfred PerlsteinUsed after
50523601548SRuslan Ermilov.Fn clnt_call .
50623601548SRuslan Ermilov.Pp
50723601548SRuslan Ermilov.It Xo
50823601548SRuslan Ermilov.Ft "char *"
50923601548SRuslan Ermilov.Xc
51023601548SRuslan Ermilov.It Xo
51123601548SRuslan Ermilov.Fn clnt_spcreateerror "char *s"
51223601548SRuslan Ermilov.Xc
51323601548SRuslan Ermilov.Pp
5148360efbdSAlfred PerlsteinLike
51523601548SRuslan Ermilov.Fn clnt_pcreateerror ,
5168360efbdSAlfred Perlsteinexcept that it returns a string
5178360efbdSAlfred Perlsteininstead of printing to the standard error.
51823601548SRuslan Ermilov.Pp
5198360efbdSAlfred PerlsteinBugs: returns pointer to static data that is overwritten
5208360efbdSAlfred Perlsteinon each call.
52123601548SRuslan Ermilov.Pp
52223601548SRuslan Ermilov.It Xo
52323601548SRuslan Ermilov.Ft "char *"
52423601548SRuslan Ermilov.Xc
52523601548SRuslan Ermilov.It Xo
52623601548SRuslan Ermilov.Fn clnt_sperrno "enum clnt_stat stat"
52723601548SRuslan Ermilov.Xc
52823601548SRuslan Ermilov.Pp
5298360efbdSAlfred PerlsteinTake the same arguments as
53023601548SRuslan Ermilov.Fn clnt_perrno ,
5318360efbdSAlfred Perlsteinbut instead of sending a message to the standard error
5328360efbdSAlfred Perlsteinindicating why an
53323601548SRuslan Ermilov.Tn RPC
5348360efbdSAlfred Perlsteincall failed, return a pointer to a string which contains
5358360efbdSAlfred Perlsteinthe message.
53623601548SRuslan Ermilov.Pp
53723601548SRuslan Ermilov.Fn clnt_sperrno
5388360efbdSAlfred Perlsteinis used instead of
53923601548SRuslan Ermilov.Fn clnt_perrno
5408360efbdSAlfred Perlsteinif the program does not have a standard error (as a program
5418360efbdSAlfred Perlsteinrunning as a server quite likely does not), or if the
5428360efbdSAlfred Perlsteinprogrammer
5438360efbdSAlfred Perlsteindoes not want the message to be output with
54423601548SRuslan Ermilov.Fn printf ,
54523601548SRuslan Ermilovor if a message format different from that supported by
54623601548SRuslan Ermilov.Fn clnt_perrno
5478360efbdSAlfred Perlsteinis to be used.
54823601548SRuslan Ermilov.Pp
5498360efbdSAlfred PerlsteinNote: unlike
55023601548SRuslan Ermilov.Fn clnt_sperror
5518360efbdSAlfred Perlsteinand
55223601548SRuslan Ermilov.Fn clnt_spcreateerror ,
55323601548SRuslan Ermilov.Fn clnt_sperrno
5548360efbdSAlfred Perlsteinreturns pointer to static data, but the
5558360efbdSAlfred Perlsteinresult will not get overwritten on each call.
55623601548SRuslan Ermilov.Pp
55723601548SRuslan Ermilov.It Xo
55823601548SRuslan Ermilov.Ft "char *"
55923601548SRuslan Ermilov.Xc
56023601548SRuslan Ermilov.It Xo
56123601548SRuslan Ermilov.Fn clnt_sperror "CLIENT *rpch" "char *s"
56223601548SRuslan Ermilov.Xc
56323601548SRuslan Ermilov.Pp
5648360efbdSAlfred PerlsteinLike
56523601548SRuslan Ermilov.Fn clnt_perror ,
5668360efbdSAlfred Perlsteinexcept that (like
56723601548SRuslan Ermilov.Fn clnt_sperrno )
5688360efbdSAlfred Perlsteinit returns a string instead of printing to standard error.
56923601548SRuslan Ermilov.Pp
5708360efbdSAlfred PerlsteinBugs: returns pointer to static data that is overwritten
5718360efbdSAlfred Perlsteinon each call.
57223601548SRuslan Ermilov.Pp
57323601548SRuslan Ermilov.It Xo
57423601548SRuslan Ermilov.Ft "CLIENT *"
57523601548SRuslan Ermilov.Xc
57623601548SRuslan Ermilov.It Xo
57723601548SRuslan Ermilov.Fn clntraw_create "u_long prognum" "u_long versnum"
57823601548SRuslan Ermilov.Xc
57923601548SRuslan Ermilov.Pp
5808360efbdSAlfred PerlsteinThis routine creates a toy
58123601548SRuslan Ermilov.Tn RPC
5828360efbdSAlfred Perlsteinclient for the remote program
58323601548SRuslan Ermilov.Fa prognum ,
5848360efbdSAlfred Perlsteinversion
58523601548SRuslan Ermilov.Fa versnum .
5868360efbdSAlfred PerlsteinThe transport used to pass messages to the service is
5878360efbdSAlfred Perlsteinactually a buffer within the process's address space, so the
5888360efbdSAlfred Perlsteincorresponding
58923601548SRuslan Ermilov.Tn RPC
5908360efbdSAlfred Perlsteinserver should live in the same address space; see
59123601548SRuslan Ermilov.Fn svcraw_create .
5928360efbdSAlfred PerlsteinThis allows simulation of
59323601548SRuslan Ermilov.Tn RPC
5948360efbdSAlfred Perlsteinand acquisition of
59523601548SRuslan Ermilov.Tn RPC
5968360efbdSAlfred Perlsteinoverheads, such as round trip times, without any
59723601548SRuslan Ermilovkernel interference.
59823601548SRuslan ErmilovThis routine returns
59923601548SRuslan Ermilov.Dv NULL
6008360efbdSAlfred Perlsteinif it fails.
60123601548SRuslan Ermilov.Pp
60223601548SRuslan Ermilov.It Xo
60323601548SRuslan Ermilov.Ft "CLIENT *"
60423601548SRuslan Ermilov.Xc
60523601548SRuslan Ermilov.It Xo
60623601548SRuslan Ermilov.Fo clnttcp_create
60723601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
60823601548SRuslan Ermilov.Fa "u_long prognum"
60923601548SRuslan Ermilov.Fa "u_long versnum"
61023601548SRuslan Ermilov.Fa "int *sockp"
61123601548SRuslan Ermilov.Fa "u_int sendsz"
61223601548SRuslan Ermilov.Fa "u_int recvsz"
61323601548SRuslan Ermilov.Fc
61423601548SRuslan Ermilov.Xc
61523601548SRuslan Ermilov.Pp
6168360efbdSAlfred PerlsteinThis routine creates an
61723601548SRuslan Ermilov.Tn RPC
6188360efbdSAlfred Perlsteinclient for the remote program
61923601548SRuslan Ermilov.Fa prognum ,
6208360efbdSAlfred Perlsteinversion
62123601548SRuslan Ermilov.Fa versnum ;
6228360efbdSAlfred Perlsteinthe client uses
62323601548SRuslan Ermilov.Tn TCP/IP
62423601548SRuslan Ermilovas a transport.
62523601548SRuslan ErmilovThe remote program is located at Internet
6268360efbdSAlfred Perlsteinaddress
62723601548SRuslan Ermilov.Fa addr .
6288360efbdSAlfred PerlsteinIf
62923601548SRuslan Ermilov.Fa addr\->sin_port
6308360efbdSAlfred Perlsteinis zero, then it is set to the actual port that the remote
6318360efbdSAlfred Perlsteinprogram is listening on (the remote
6328657581bSMaxim Sobolev.Xr rpcbind 8
63323601548SRuslan Ermilovservice is consulted for this information).
63423601548SRuslan ErmilovThe parameter
63523601548SRuslan Ermilov.Fa sockp
6368360efbdSAlfred Perlsteinis a socket; if it is
63723601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
6388360efbdSAlfred Perlsteinthen this routine opens a new one and sets
63923601548SRuslan Ermilov.Fa sockp .
6408360efbdSAlfred PerlsteinSince
64123601548SRuslan Ermilov.Tn TCP Ns \-based
64223601548SRuslan Ermilov.Tn RPC
6438360efbdSAlfred Perlsteinuses buffered
64423601548SRuslan Ermilov.Tn I/O ,
6458360efbdSAlfred Perlsteinthe user may specify the size of the send and receive buffers
6468360efbdSAlfred Perlsteinwith the parameters
64723601548SRuslan Ermilov.Fa sendsz
6488360efbdSAlfred Perlsteinand
64923601548SRuslan Ermilov.Fa recvsz ;
6508360efbdSAlfred Perlsteinvalues of zero choose suitable defaults.
6518360efbdSAlfred PerlsteinThis routine returns
65223601548SRuslan Ermilov.Dv NULL
6538360efbdSAlfred Perlsteinif it fails.
65423601548SRuslan Ermilov.Pp
65523601548SRuslan Ermilov.It Xo
65623601548SRuslan Ermilov.Ft "CLIENT *"
65723601548SRuslan Ermilov.Xc
65823601548SRuslan Ermilov.It Xo
65923601548SRuslan Ermilov.Fo clntudp_create
66023601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
66123601548SRuslan Ermilov.Fa "u_long prognum"
66223601548SRuslan Ermilov.Fa "u_long versnum"
66323601548SRuslan Ermilov.Fa "struct timeval wait"
66423601548SRuslan Ermilov.Fa "int *sockp"
66523601548SRuslan Ermilov.Fc
66623601548SRuslan Ermilov.Xc
66723601548SRuslan Ermilov.Pp
6688360efbdSAlfred PerlsteinThis routine creates an
66923601548SRuslan Ermilov.Tn RPC
6708360efbdSAlfred Perlsteinclient for the remote program
67123601548SRuslan Ermilov.Fa prognum ,
6728360efbdSAlfred Perlsteinversion
67323601548SRuslan Ermilov.Fa versnum ;
67423601548SRuslan Ermilovthe client uses
67523601548SRuslan Ermilov.Tn UDP/IP
67623601548SRuslan Ermilovas a transport.
67723601548SRuslan ErmilovThe remote program is located at Internet
6788360efbdSAlfred Perlsteinaddress
67923601548SRuslan Ermilov.Fa addr .
6808360efbdSAlfred PerlsteinIf
68123601548SRuslan Ermilov.Fa addr\->sin_port
6828360efbdSAlfred Perlsteinis zero, then it is set to actual port that the remote
6838360efbdSAlfred Perlsteinprogram is listening on (the remote
6848657581bSMaxim Sobolev.Xr rpcbind 8
68523601548SRuslan Ermilovservice is consulted for this information).
68623601548SRuslan ErmilovThe parameter
68723601548SRuslan Ermilov.Fa sockp
6888360efbdSAlfred Perlsteinis a socket; if it is
68923601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
6908360efbdSAlfred Perlsteinthen this routine opens a new one and sets
69123601548SRuslan Ermilov.Fa sockp .
6928360efbdSAlfred PerlsteinThe
69323601548SRuslan Ermilov.Tn UDP
6948360efbdSAlfred Perlsteintransport resends the call message in intervals of
69523601548SRuslan Ermilov.Fa wait
6968360efbdSAlfred Perlsteintime until a response is received or until the call times
6978360efbdSAlfred Perlsteinout.
6988360efbdSAlfred PerlsteinThe total time for the call to time out is specified by
69923601548SRuslan Ermilov.Fn clnt_call .
70023601548SRuslan Ermilov.Pp
7018360efbdSAlfred PerlsteinWarning: since
70223601548SRuslan Ermilov.Tn UDP Ns \-based
70323601548SRuslan Ermilov.Tn RPC
7048360efbdSAlfred Perlsteinmessages can only hold up to 8 Kbytes
7058360efbdSAlfred Perlsteinof encoded data, this transport cannot be used for procedures
7068360efbdSAlfred Perlsteinthat take large arguments or return huge results.
70723601548SRuslan Ermilov.Pp
70823601548SRuslan Ermilov.It Xo
70923601548SRuslan Ermilov.Ft "CLIENT *"
71023601548SRuslan Ermilov.Xc
71123601548SRuslan Ermilov.It Xo
71223601548SRuslan Ermilov.Fo clntudp_bufcreate
71323601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
71423601548SRuslan Ermilov.Fa "u_long prognum"
71523601548SRuslan Ermilov.Fa "u_long versnum"
71623601548SRuslan Ermilov.Fa "struct timeval wait"
71723601548SRuslan Ermilov.Fa "int *sockp"
71823601548SRuslan Ermilov.Fa "unsigned int sendsize"
71923601548SRuslan Ermilov.Fa "unsigned int recosize"
72023601548SRuslan Ermilov.Fc
72123601548SRuslan Ermilov.Xc
72223601548SRuslan Ermilov.Pp
7238360efbdSAlfred PerlsteinThis routine creates an
72423601548SRuslan Ermilov.Tn RPC
7258360efbdSAlfred Perlsteinclient for the remote program
72623601548SRuslan Ermilov.Fa prognum ,
7278360efbdSAlfred Perlsteinon
72823601548SRuslan Ermilov.Fa versnum ;
72923601548SRuslan Ermilovthe client uses
73023601548SRuslan Ermilov.Tn UDP/IP
73123601548SRuslan Ermilovas a transport.
73223601548SRuslan ErmilovThe remote program is located at Internet
7338360efbdSAlfred Perlsteinaddress
73423601548SRuslan Ermilov.Fa addr .
7358360efbdSAlfred PerlsteinIf
73623601548SRuslan Ermilov.Fa addr\->sin_port
7378360efbdSAlfred Perlsteinis zero, then it is set to actual port that the remote
7388360efbdSAlfred Perlsteinprogram is listening on (the remote
7398657581bSMaxim Sobolev.Xr rpcbind 8
74023601548SRuslan Ermilovservice is consulted for this information).
74123601548SRuslan ErmilovThe parameter
74223601548SRuslan Ermilov.Fa sockp
7438360efbdSAlfred Perlsteinis a socket; if it is
74423601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
7458360efbdSAlfred Perlsteinthen this routine opens a new one and sets
74623601548SRuslan Ermilov.Fa sockp .
7478360efbdSAlfred PerlsteinThe
74823601548SRuslan Ermilov.Tn UDP
7498360efbdSAlfred Perlsteintransport resends the call message in intervals of
75023601548SRuslan Ermilov.Fa wait
7518360efbdSAlfred Perlsteintime until a response is received or until the call times
7528360efbdSAlfred Perlsteinout.
7538360efbdSAlfred PerlsteinThe total time for the call to time out is specified by
75423601548SRuslan Ermilov.Fn clnt_call .
75523601548SRuslan Ermilov.Pp
75623601548SRuslan ErmilovThis allows the user to specify the maximum packet size
75723601548SRuslan Ermilovfor sending and receiving
75823601548SRuslan Ermilov.Tn UDP Ns \-based
75923601548SRuslan Ermilov.Tn RPC
7608360efbdSAlfred Perlsteinmessages.
76123601548SRuslan Ermilov.Pp
76223601548SRuslan Ermilov.It Xo
76323601548SRuslan Ermilov.Ft int
76423601548SRuslan Ermilov.Xc
76523601548SRuslan Ermilov.It Xo
76623601548SRuslan Ermilov.Fn get_myaddress "struct sockaddr_in *addr"
76723601548SRuslan Ermilov.Xc
76823601548SRuslan Ermilov.Pp
7698360efbdSAlfred PerlsteinStuff the machine's
77023601548SRuslan Ermilov.Tn IP
7718360efbdSAlfred Perlsteinaddress into
77223601548SRuslan Ermilov.Fa addr ,
7738360efbdSAlfred Perlsteinwithout consulting the library routines that deal with
77423601548SRuslan Ermilov.Pa /etc/hosts .
7758360efbdSAlfred PerlsteinThe port number is always set to
77623601548SRuslan Ermilov.Fn htons PMAPPORT .
7778360efbdSAlfred PerlsteinReturns zero on success, non-zero on failure.
77823601548SRuslan Ermilov.Pp
77923601548SRuslan Ermilov.It Xo
78023601548SRuslan Ermilov.Ft "struct pmaplist *"
78123601548SRuslan Ermilov.Xc
78223601548SRuslan Ermilov.It Xo
78323601548SRuslan Ermilov.Fn pmap_getmaps "struct sockaddr_in *addr"
78423601548SRuslan Ermilov.Xc
78523601548SRuslan Ermilov.Pp
7868360efbdSAlfred PerlsteinA user interface to the
7878657581bSMaxim Sobolev.Xr rpcbind 8
7888360efbdSAlfred Perlsteinservice, which returns a list of the current
78923601548SRuslan Ermilov.Tn RPC
79023601548SRuslan Ermilovprogram\-to\-port mappings
7918360efbdSAlfred Perlsteinon the host located at
79223601548SRuslan Ermilov.Tn IP
7938360efbdSAlfred Perlsteinaddress
79423601548SRuslan Ermilov.Fa addr .
7958360efbdSAlfred PerlsteinThis routine can return
79623601548SRuslan Ermilov.Dv NULL .
7978360efbdSAlfred PerlsteinThe command
79823601548SRuslan Ermilov.Dq Nm rpcinfo Fl p
7998360efbdSAlfred Perlsteinuses this routine.
80023601548SRuslan Ermilov.Pp
80123601548SRuslan Ermilov.It Xo
80223601548SRuslan Ermilov.Ft u_short
80323601548SRuslan Ermilov.Xc
80423601548SRuslan Ermilov.It Xo
80523601548SRuslan Ermilov.Fo pmap_getport
80623601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
80723601548SRuslan Ermilov.Fa "u_long prognum"
80823601548SRuslan Ermilov.Fa "u_long versnum"
80923601548SRuslan Ermilov.Fa "u_long protocol"
81023601548SRuslan Ermilov.Fc
81123601548SRuslan Ermilov.Xc
81223601548SRuslan Ermilov.Pp
8138360efbdSAlfred PerlsteinA user interface to the
8148657581bSMaxim Sobolev.Xr rpcbind 8
8158360efbdSAlfred Perlsteinservice, which returns the port number
8168360efbdSAlfred Perlsteinon which waits a service that supports program number
81723601548SRuslan Ermilov.Fa prognum ,
8188360efbdSAlfred Perlsteinversion
81923601548SRuslan Ermilov.Fa versnum ,
8208360efbdSAlfred Perlsteinand speaks the transport protocol associated with
82123601548SRuslan Ermilov.Fa protocol .
8228360efbdSAlfred PerlsteinThe value of
82323601548SRuslan Ermilov.Fa protocol
8248360efbdSAlfred Perlsteinis most likely
82523601548SRuslan Ermilov.Dv IPPROTO_UDP
8268360efbdSAlfred Perlsteinor
82723601548SRuslan Ermilov.Dv IPPROTO_TCP .
8288360efbdSAlfred PerlsteinA return value of zero means that the mapping does not exist
8298360efbdSAlfred Perlsteinor that
8308360efbdSAlfred Perlsteinthe
83123601548SRuslan Ermilov.Tn RPC
83223601548SRuslan Ermilovsystem failed to contact the remote
8338657581bSMaxim Sobolev.Xr rpcbind 8
83423601548SRuslan Ermilovservice.
83523601548SRuslan ErmilovIn the latter case, the global variable
83623601548SRuslan Ermilov.Va rpc_createerr
8378360efbdSAlfred Perlsteincontains the
83823601548SRuslan Ermilov.Tn RPC
8398360efbdSAlfred Perlsteinstatus.
84023601548SRuslan Ermilov.Pp
84123601548SRuslan Ermilov.It Xo
84223601548SRuslan Ermilov.Ft "enum clnt_stat"
84323601548SRuslan Ermilov.Xc
84423601548SRuslan Ermilov.It Xo
84523601548SRuslan Ermilov.Fo pmap_rmtcall
84623601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
84723601548SRuslan Ermilov.Fa "u_long prognum"
84823601548SRuslan Ermilov.Fa "u_long versnum"
84923601548SRuslan Ermilov.Fa "u_long procnum"
85023601548SRuslan Ermilov.Fa "xdrproc_t inproc"
85123601548SRuslan Ermilov.Fa "char *in"
85223601548SRuslan Ermilov.Fa "xdrproc_t outproc"
85323601548SRuslan Ermilov.Fa "char *out"
85423601548SRuslan Ermilov.Fa "struct timeval tout"
85523601548SRuslan Ermilov.Fa "u_long *portp"
85623601548SRuslan Ermilov.Fc
85723601548SRuslan Ermilov.Xc
85823601548SRuslan Ermilov.Pp
8598360efbdSAlfred PerlsteinA user interface to the
8608657581bSMaxim Sobolev.Xr rpcbind 8
8618360efbdSAlfred Perlsteinservice, which instructs
8628657581bSMaxim Sobolev.Xr rpcbind 8
8638360efbdSAlfred Perlsteinon the host at
86423601548SRuslan Ermilov.Tn IP
8658360efbdSAlfred Perlsteinaddress
86623601548SRuslan Ermilov.Fa addr
8678360efbdSAlfred Perlsteinto make an
86823601548SRuslan Ermilov.Tn RPC
8698360efbdSAlfred Perlsteincall on your behalf to a procedure on that host.
8708360efbdSAlfred PerlsteinThe parameter
87123601548SRuslan Ermilov.Fa portp
8728360efbdSAlfred Perlsteinwill be modified to the program's port number if the
8738360efbdSAlfred Perlsteinprocedure
87423601548SRuslan Ermilovsucceeds.
87523601548SRuslan ErmilovThe definitions of other parameters are discussed
8768360efbdSAlfred Perlsteinin
87723601548SRuslan Ermilov.Fn callrpc
8788360efbdSAlfred Perlsteinand
87923601548SRuslan Ermilov.Fn clnt_call .
88023601548SRuslan ErmilovThis procedure should be used for a
88123601548SRuslan Ermilov.Dq ping
88223601548SRuslan Ermilovand nothing
8838360efbdSAlfred Perlsteinelse.
8848360efbdSAlfred PerlsteinSee also
88523601548SRuslan Ermilov.Fn clnt_broadcast .
88623601548SRuslan Ermilov.Pp
88723601548SRuslan Ermilov.It Xo
88823601548SRuslan Ermilov.Ft bool_t
88923601548SRuslan Ermilov.Fn pmap_set "u_long prognum" "u_long versnum" "u_long protocol" "u_short port"
89023601548SRuslan Ermilov.Xc
89123601548SRuslan Ermilov.Pp
8928360efbdSAlfred PerlsteinA user interface to the
8938657581bSMaxim Sobolev.Xr rpcbind 8
8948360efbdSAlfred Perlsteinservice, which establishes a mapping between the triple
89523601548SRuslan Ermilov.Pq Fa prognum , versnum , protocol
8968360efbdSAlfred Perlsteinand
89723601548SRuslan Ermilov.Fa port
8988360efbdSAlfred Perlsteinon the machine's
8998657581bSMaxim Sobolev.Xr rpcbind 8
90023601548SRuslan Ermilovservice.
90123601548SRuslan ErmilovThe value of
90223601548SRuslan Ermilov.Fa protocol
9038360efbdSAlfred Perlsteinis most likely
90423601548SRuslan Ermilov.Dv IPPROTO_UDP
9058360efbdSAlfred Perlsteinor
90623601548SRuslan Ermilov.Dv IPPROTO_TCP .
9078360efbdSAlfred PerlsteinThis routine returns one if it succeeds, zero otherwise.
9088360efbdSAlfred PerlsteinAutomatically done by
90923601548SRuslan Ermilov.Fn svc_register .
91023601548SRuslan Ermilov.Pp
91123601548SRuslan Ermilov.It Xo
91223601548SRuslan Ermilov.Ft bool_t
91323601548SRuslan Ermilov.Fn pmap_unset "u_long prognum" "u_long versnum"
91423601548SRuslan Ermilov.Xc
91523601548SRuslan Ermilov.Pp
9168360efbdSAlfred PerlsteinA user interface to the
9178657581bSMaxim Sobolev.Xr rpcbind 8
9188360efbdSAlfred Perlsteinservice, which destroys all mapping between the triple
91923601548SRuslan Ermilov.Pq Fa prognum , versnum , *
9208360efbdSAlfred Perlsteinand
92123601548SRuslan Ermilov.Fa ports
9228360efbdSAlfred Perlsteinon the machine's
9238657581bSMaxim Sobolev.Xr rpcbind 8
92423601548SRuslan Ermilovservice.
92523601548SRuslan ErmilovThis routine returns one if it succeeds, zero
9268360efbdSAlfred Perlsteinotherwise.
92723601548SRuslan Ermilov.Pp
92823601548SRuslan Ermilov.It Xo
92923601548SRuslan Ermilov.Ft bool_t
93023601548SRuslan Ermilov.Fo registerrpc
93123601548SRuslan Ermilov.Fa "u_long prognum"
93223601548SRuslan Ermilov.Fa "u_long versnum"
93323601548SRuslan Ermilov.Fa "u_long procnum"
93423601548SRuslan Ermilov.Fa "char *(*procname)(void)"
93523601548SRuslan Ermilov.Fa "xdrproc_t inproc"
93623601548SRuslan Ermilov.Fa "xdrproc_t outproc"
93723601548SRuslan Ermilov.Fc
93823601548SRuslan Ermilov.Xc
93923601548SRuslan Ermilov.Pp
9408360efbdSAlfred PerlsteinRegister procedure
94123601548SRuslan Ermilov.Fa procname
9428360efbdSAlfred Perlsteinwith the
94323601548SRuslan Ermilov.Tn RPC
94423601548SRuslan Ermilovservice package.
94523601548SRuslan ErmilovIf a request arrives for program
94623601548SRuslan Ermilov.Fa prognum ,
9478360efbdSAlfred Perlsteinversion
94823601548SRuslan Ermilov.Fa versnum ,
9498360efbdSAlfred Perlsteinand procedure
95023601548SRuslan Ermilov.Fa procnum ,
95123601548SRuslan Ermilov.Fa procname
9528360efbdSAlfred Perlsteinis called with a pointer to its parameter(s);
95323601548SRuslan Ermilov.Fa progname
9548360efbdSAlfred Perlsteinshould return a pointer to its static result(s);
95523601548SRuslan Ermilov.Fa inproc
9568360efbdSAlfred Perlsteinis used to decode the parameters while
95723601548SRuslan Ermilov.Fa outproc
9588360efbdSAlfred Perlsteinis used to encode the results.
9598360efbdSAlfred PerlsteinThis routine returns zero if the registration succeeded, \-1
9608360efbdSAlfred Perlsteinotherwise.
96123601548SRuslan Ermilov.Pp
9628360efbdSAlfred PerlsteinWarning: remote procedures registered in this form
9638360efbdSAlfred Perlsteinare accessed using the
96423601548SRuslan Ermilov.Tn UDP/IP
9658360efbdSAlfred Perlsteintransport; see
96623601548SRuslan Ermilov.Fn svcudp_create
9678360efbdSAlfred Perlsteinfor restrictions.
96823601548SRuslan Ermilov.Pp
96923601548SRuslan Ermilov.It Xo
97023601548SRuslan Ermilov.Vt "struct rpc_createerr" rpc_createerr ;
97123601548SRuslan Ermilov.Xc
97223601548SRuslan Ermilov.Pp
9738360efbdSAlfred PerlsteinA global variable whose value is set by any
97423601548SRuslan Ermilov.Tn RPC
9758360efbdSAlfred Perlsteinclient creation routine
97623601548SRuslan Ermilovthat does not succeed.
97723601548SRuslan ErmilovUse the routine
97823601548SRuslan Ermilov.Fn clnt_pcreateerror
9798360efbdSAlfred Perlsteinto print the reason why.
98023601548SRuslan Ermilov.Pp
98123601548SRuslan Ermilov.It Xo
98223601548SRuslan Ermilov.Ft bool_t
98323601548SRuslan Ermilov.Fn svc_destroy "SVCXPRT * xprt"
98423601548SRuslan Ermilov.Xc
98523601548SRuslan Ermilov.Pp
9868360efbdSAlfred PerlsteinA macro that destroys the
98723601548SRuslan Ermilov.Tn RPC
9888360efbdSAlfred Perlsteinservice transport handle,
98923601548SRuslan Ermilov.Fa xprt .
9908360efbdSAlfred PerlsteinDestruction usually involves deallocation
9918360efbdSAlfred Perlsteinof private data structures, including
99223601548SRuslan Ermilov.Fa xprt
99323601548SRuslan Ermilovitself.
99423601548SRuslan ErmilovUse of
99523601548SRuslan Ermilov.Fa xprt
9968360efbdSAlfred Perlsteinis undefined after calling this routine.
99723601548SRuslan Ermilov.Pp
99823601548SRuslan Ermilov.It Xo
99923601548SRuslan Ermilov.Vt fd_set svc_fdset ;
100023601548SRuslan Ermilov.Xc
100123601548SRuslan Ermilov.Pp
10028360efbdSAlfred PerlsteinA global variable reflecting the
100323601548SRuslan Ermilov.Tn RPC
10048360efbdSAlfred Perlsteinservice side's
100523601548SRuslan Ermilovread file descriptor bit mask; it is suitable as a template parameter
10068360efbdSAlfred Perlsteinto the
100723601548SRuslan Ermilov.Xr select 2
100823601548SRuslan Ermilovsystem call.
100923601548SRuslan ErmilovThis is only of interest
10108360efbdSAlfred Perlsteinif a service implementor does not call
101123601548SRuslan Ermilov.Fn svc_run ,
10128360efbdSAlfred Perlsteinbut rather does his own asynchronous event processing.
101323601548SRuslan ErmilovThis variable is read\-only (do not pass its address to
101423601548SRuslan Ermilov.Xr select 2 ! ) ,
10158360efbdSAlfred Perlsteinyet it may change after calls to
101623601548SRuslan Ermilov.Fn svc_getreqset
10178360efbdSAlfred Perlsteinor any creation routines.
101823601548SRuslan ErmilovAs well, note that if the process has descriptor limits
101923601548SRuslan Ermilovwhich are extended beyond
102023601548SRuslan Ermilov.Dv FD_SETSIZE ,
102123601548SRuslan Ermilovthis variable will only be usable for the first
102223601548SRuslan Ermilov.Dv FD_SETSIZE
102323601548SRuslan Ermilovdescriptors.
102423601548SRuslan Ermilov.Pp
102523601548SRuslan Ermilov.It Xo
102623601548SRuslan Ermilov.Vt int svc_fds ;
102723601548SRuslan Ermilov.Xc
102823601548SRuslan Ermilov.Pp
10298360efbdSAlfred PerlsteinSimilar to
103023601548SRuslan Ermilov.Va svc_fdset ,
103123601548SRuslan Ermilovbut limited to 32 descriptors.
103223601548SRuslan ErmilovThis
10338360efbdSAlfred Perlsteininterface is obsoleted by
103423601548SRuslan Ermilov.Va svc_fdset .
103523601548SRuslan Ermilov.Pp
103623601548SRuslan Ermilov.It Xo
103723601548SRuslan Ermilov.Ft bool_t
103823601548SRuslan Ermilov.Fn svc_freeargs "SVCXPRT *xprt" "xdrproc_t inproc" "char *in"
103923601548SRuslan Ermilov.Xc
104023601548SRuslan Ermilov.Pp
10418360efbdSAlfred PerlsteinA macro that frees any data allocated by the
104223601548SRuslan Ermilov.Tn RPC/XDR
10438360efbdSAlfred Perlsteinsystem when it decoded the arguments to a service procedure
10448360efbdSAlfred Perlsteinusing
104523601548SRuslan Ermilov.Fn svc_getargs .
10468360efbdSAlfred PerlsteinThis routine returns 1 if the results were successfully
10478360efbdSAlfred Perlsteinfreed,
10488360efbdSAlfred Perlsteinand zero otherwise.
104923601548SRuslan Ermilov.Pp
105023601548SRuslan Ermilov.It Xo
105123601548SRuslan Ermilov.Ft bool_t
105223601548SRuslan Ermilov.Fn svc_getargs "SVCXPRT *xprt" "xdrproc_t inproc" "char *in"
105323601548SRuslan Ermilov.Xc
105423601548SRuslan Ermilov.Pp
10558360efbdSAlfred PerlsteinA macro that decodes the arguments of an
105623601548SRuslan Ermilov.Tn RPC
10578360efbdSAlfred Perlsteinrequest
10588360efbdSAlfred Perlsteinassociated with the
105923601548SRuslan Ermilov.Tn RPC
10608360efbdSAlfred Perlsteinservice transport handle,
106123601548SRuslan Ermilov.Fa xprt .
10628360efbdSAlfred PerlsteinThe parameter
106323601548SRuslan Ermilov.Fa in
10648360efbdSAlfred Perlsteinis the address where the arguments will be placed;
106523601548SRuslan Ermilov.Fa inproc
10668360efbdSAlfred Perlsteinis the
106723601548SRuslan Ermilov.Tn XDR
10688360efbdSAlfred Perlsteinroutine used to decode the arguments.
10698360efbdSAlfred PerlsteinThis routine returns one if decoding succeeds, and zero
10708360efbdSAlfred Perlsteinotherwise.
107123601548SRuslan Ermilov.Pp
107223601548SRuslan Ermilov.It Xo
107323601548SRuslan Ermilov.Ft "struct sockaddr_in *"
107423601548SRuslan Ermilov.Xc
107523601548SRuslan Ermilov.It Xo
107623601548SRuslan Ermilov.Fn svc_getcaller "SVCXPRT *xprt"
107723601548SRuslan Ermilov.Xc
107823601548SRuslan Ermilov.Pp
10798360efbdSAlfred PerlsteinThe approved way of getting the network address of the caller
10808360efbdSAlfred Perlsteinof a procedure associated with the
108123601548SRuslan Ermilov.Tn RPC
10828360efbdSAlfred Perlsteinservice transport handle,
108323601548SRuslan Ermilov.Fa xprt .
108423601548SRuslan Ermilov.Pp
108523601548SRuslan Ermilov.It Xo
108623601548SRuslan Ermilov.Ft void
108723601548SRuslan Ermilov.Fn svc_getreqset "fd_set *rdfds"
108823601548SRuslan Ermilov.Xc
108923601548SRuslan Ermilov.Pp
10908360efbdSAlfred PerlsteinThis routine is only of interest if a service implementor
10918360efbdSAlfred Perlsteindoes not call
109223601548SRuslan Ermilov.Fn svc_run ,
10938360efbdSAlfred Perlsteinbut instead implements custom asynchronous event processing.
10948360efbdSAlfred PerlsteinIt is called when the
109523601548SRuslan Ermilov.Xr select 2
10968360efbdSAlfred Perlsteinsystem call has determined that an
109723601548SRuslan Ermilov.Tn RPC
10988360efbdSAlfred Perlsteinrequest has arrived on some
109923601548SRuslan Ermilov.Tn RPC
110023601548SRuslan Ermilovsocket(s);
110123601548SRuslan Ermilov.Fa rdfds
11028360efbdSAlfred Perlsteinis the resultant read file descriptor bit mask.
11038360efbdSAlfred PerlsteinThe routine returns when all sockets associated with the
11048360efbdSAlfred Perlsteinvalue of
110523601548SRuslan Ermilov.Fa rdfds
11068360efbdSAlfred Perlsteinhave been serviced.
110723601548SRuslan Ermilov.Pp
110823601548SRuslan Ermilov.It Xo
110923601548SRuslan Ermilov.Ft void
111023601548SRuslan Ermilov.Fn svc_getreq "int rdfds"
111123601548SRuslan Ermilov.Xc
111223601548SRuslan Ermilov.Pp
11138360efbdSAlfred PerlsteinSimilar to
111423601548SRuslan Ermilov.Fn svc_getreqset ,
111523601548SRuslan Ermilovbut limited to 32 descriptors.
111623601548SRuslan ErmilovThis interface is obsoleted by
111723601548SRuslan Ermilov.Fn svc_getreqset .
111823601548SRuslan Ermilov.Pp
111923601548SRuslan Ermilov.It Xo
112023601548SRuslan Ermilov.Ft bool_t
112123601548SRuslan Ermilov.Fo svc_register
112223601548SRuslan Ermilov.Fa "SVCXPRT *xprt"
112323601548SRuslan Ermilov.Fa "u_long prognum"
112423601548SRuslan Ermilov.Fa "u_long versnum"
112523601548SRuslan Ermilov.Fa "void (*dispatch)(struct svc_req *, SVCXPRT *)"
112623601548SRuslan Ermilov.Fa "int protocol"
112723601548SRuslan Ermilov.Fc
112823601548SRuslan Ermilov.Xc
112923601548SRuslan Ermilov.Pp
11308360efbdSAlfred PerlsteinAssociates
113123601548SRuslan Ermilov.Fa prognum
11328360efbdSAlfred Perlsteinand
113323601548SRuslan Ermilov.Fa versnum
11348360efbdSAlfred Perlsteinwith the service dispatch procedure,
113523601548SRuslan Ermilov.Fn dispatch .
11368360efbdSAlfred PerlsteinIf
113723601548SRuslan Ermilov.Fa protocol
11388360efbdSAlfred Perlsteinis zero, the service is not registered with the
11398657581bSMaxim Sobolev.Xr rpcbind 8
114023601548SRuslan Ermilovservice.
114123601548SRuslan ErmilovIf
114223601548SRuslan Ermilov.Fa protocol
11438360efbdSAlfred Perlsteinis non-zero, then a mapping of the triple
114423601548SRuslan Ermilov.Pq Fa prognum , versnum , protocol
11458360efbdSAlfred Perlsteinto
114623601548SRuslan Ermilov.Fa xprt\->xp_port
11478360efbdSAlfred Perlsteinis established with the local
11488657581bSMaxim Sobolev.Xr rpcbind 8
11498360efbdSAlfred Perlsteinservice (generally
115023601548SRuslan Ermilov.Fa protocol
11518360efbdSAlfred Perlsteinis zero,
115223601548SRuslan Ermilov.Dv IPPROTO_UDP
11538360efbdSAlfred Perlsteinor
115423601548SRuslan Ermilov.Dv IPPROTO_TCP ) .
11558360efbdSAlfred PerlsteinThe procedure
115623601548SRuslan Ermilov.Fn dispatch
11578360efbdSAlfred Perlsteinhas the following form:
115823601548SRuslan Ermilov.Bd -ragged -offset indent
115923601548SRuslan Ermilov.Ft bool_t
116023601548SRuslan Ermilov.Fn dispatch "struct svc_req *request" "SVCXPRT *xprt"
116123601548SRuslan Ermilov.Ed
116223601548SRuslan Ermilov.Pp
11638360efbdSAlfred PerlsteinThe
116423601548SRuslan Ermilov.Fn svc_register
11658360efbdSAlfred Perlsteinroutine returns one if it succeeds, and zero otherwise.
116623601548SRuslan Ermilov.Pp
116723601548SRuslan Ermilov.It Xo
116823601548SRuslan Ermilov.Fn svc_run
116923601548SRuslan Ermilov.Xc
117023601548SRuslan Ermilov.Pp
117123601548SRuslan ErmilovThis routine never returns.
117223601548SRuslan ErmilovIt waits for
117323601548SRuslan Ermilov.Tn RPC
11748360efbdSAlfred Perlsteinrequests to arrive, and calls the appropriate service
11758360efbdSAlfred Perlsteinprocedure using
117623601548SRuslan Ermilov.Fn svc_getreq
117723601548SRuslan Ermilovwhen one arrives.
117823601548SRuslan ErmilovThis procedure is usually waiting for a
117923601548SRuslan Ermilov.Xr select 2
11808360efbdSAlfred Perlsteinsystem call to return.
118123601548SRuslan Ermilov.Pp
118223601548SRuslan Ermilov.It Xo
118323601548SRuslan Ermilov.Ft bool_t
118423601548SRuslan Ermilov.Fn svc_sendreply "SVCXPRT *xprt" "xdrproc_t outproc" "char *out"
118523601548SRuslan Ermilov.Xc
118623601548SRuslan Ermilov.Pp
11878360efbdSAlfred PerlsteinCalled by an
118823601548SRuslan Ermilov.Tn RPC
11898360efbdSAlfred Perlsteinservice's dispatch routine to send the results of a
119023601548SRuslan Ermilovremote procedure call.
119123601548SRuslan ErmilovThe parameter
119223601548SRuslan Ermilov.Fa xprt
11938360efbdSAlfred Perlsteinis the request's associated transport handle;
119423601548SRuslan Ermilov.Fa outproc
11958360efbdSAlfred Perlsteinis the
119623601548SRuslan Ermilov.Tn XDR
11978360efbdSAlfred Perlsteinroutine which is used to encode the results; and
119823601548SRuslan Ermilov.Fa out
11998360efbdSAlfred Perlsteinis the address of the results.
12008360efbdSAlfred PerlsteinThis routine returns one if it succeeds, zero otherwise.
120123601548SRuslan Ermilov.Pp
120223601548SRuslan Ermilov.It Xo
120323601548SRuslan Ermilov.Ft void
120423601548SRuslan Ermilov.Xc
120523601548SRuslan Ermilov.It Xo
120623601548SRuslan Ermilov.Fn svc_unregister "u_long prognum" "u_long versnum"
120723601548SRuslan Ermilov.Xc
120823601548SRuslan Ermilov.Pp
12098360efbdSAlfred PerlsteinRemove all mapping of the double
121023601548SRuslan Ermilov.Pq Fa prognum , versnum
12118360efbdSAlfred Perlsteinto dispatch routines, and of the triple
121223601548SRuslan Ermilov.Pq Fa prognum , versnum , *
12138360efbdSAlfred Perlsteinto port number.
121423601548SRuslan Ermilov.Pp
121523601548SRuslan Ermilov.It Xo
121623601548SRuslan Ermilov.Ft void
121723601548SRuslan Ermilov.Xc
121823601548SRuslan Ermilov.It Xo
121923601548SRuslan Ermilov.Fn svcerr_auth "SVCXPRT *xprt" "enum auth_stat why"
122023601548SRuslan Ermilov.Xc
122123601548SRuslan Ermilov.Pp
12228360efbdSAlfred PerlsteinCalled by a service dispatch routine that refuses to perform
12238360efbdSAlfred Perlsteina remote procedure call due to an authentication error.
122423601548SRuslan Ermilov.Pp
122523601548SRuslan Ermilov.It Xo
122623601548SRuslan Ermilov.Ft void
122723601548SRuslan Ermilov.Xc
122823601548SRuslan Ermilov.It Xo
122923601548SRuslan Ermilov.Fn svcerr_decode "SVCXPRT *xprt"
123023601548SRuslan Ermilov.Xc
123123601548SRuslan Ermilov.Pp
12328360efbdSAlfred PerlsteinCalled by a service dispatch routine that cannot successfully
123323601548SRuslan Ermilovdecode its parameters.
123423601548SRuslan ErmilovSee also
123523601548SRuslan Ermilov.Fn svc_getargs .
123623601548SRuslan Ermilov.Pp
123723601548SRuslan Ermilov.It Xo
123823601548SRuslan Ermilov.Ft void
123923601548SRuslan Ermilov.Xc
124023601548SRuslan Ermilov.It Xo
124123601548SRuslan Ermilov.Fn svcerr_noproc "SVCXPRT *xprt"
124223601548SRuslan Ermilov.Xc
124323601548SRuslan Ermilov.Pp
12448360efbdSAlfred PerlsteinCalled by a service dispatch routine that does not implement
12458360efbdSAlfred Perlsteinthe procedure number that the caller requests.
124623601548SRuslan Ermilov.Pp
124723601548SRuslan Ermilov.It Xo
124823601548SRuslan Ermilov.Ft void
124923601548SRuslan Ermilov.Xc
125023601548SRuslan Ermilov.It Xo
125123601548SRuslan Ermilov.Fn svcerr_noprog "SVCXPRT *xprt"
125223601548SRuslan Ermilov.Xc
125323601548SRuslan Ermilov.Pp
12548360efbdSAlfred PerlsteinCalled when the desired program is not registered with the
125523601548SRuslan Ermilov.Tn RPC
125623601548SRuslan Ermilovpackage.
125723601548SRuslan ErmilovService implementors usually do not need this routine.
125823601548SRuslan Ermilov.Pp
125923601548SRuslan Ermilov.It Xo
126023601548SRuslan Ermilov.Ft void
126123601548SRuslan Ermilov.Xc
126223601548SRuslan Ermilov.It Xo
126323601548SRuslan Ermilov.Fn svcerr_progvers "SVCXPRT *xprt" "u_long low_vers" "u_long high_vers"
126423601548SRuslan Ermilov.Xc
126523601548SRuslan Ermilov.Pp
12668360efbdSAlfred PerlsteinCalled when the desired version of a program is not registered
12678360efbdSAlfred Perlsteinwith the
126823601548SRuslan Ermilov.Tn RPC
126923601548SRuslan Ermilovpackage.
127023601548SRuslan ErmilovService implementors usually do not need this routine.
127123601548SRuslan Ermilov.Pp
127223601548SRuslan Ermilov.It Xo
127323601548SRuslan Ermilov.Ft void
127423601548SRuslan Ermilov.Xc
127523601548SRuslan Ermilov.It Xo
127623601548SRuslan Ermilov.Fn svcerr_systemerr "SVCXPRT *xprt"
127723601548SRuslan Ermilov.Xc
127823601548SRuslan Ermilov.Pp
12798360efbdSAlfred PerlsteinCalled by a service dispatch routine when it detects a system
12808360efbdSAlfred Perlsteinerror
12818360efbdSAlfred Perlsteinnot covered by any particular protocol.
12828360efbdSAlfred PerlsteinFor example, if a service can no longer allocate storage,
12838360efbdSAlfred Perlsteinit may call this routine.
128423601548SRuslan Ermilov.Pp
128523601548SRuslan Ermilov.It Xo
128623601548SRuslan Ermilov.Ft void
128723601548SRuslan Ermilov.Xc
128823601548SRuslan Ermilov.It Xo
128923601548SRuslan Ermilov.Fn svcerr_weakauth "SVCXPRT *xprt"
129023601548SRuslan Ermilov.Xc
129123601548SRuslan Ermilov.Pp
12928360efbdSAlfred PerlsteinCalled by a service dispatch routine that refuses to perform
12938360efbdSAlfred Perlsteina remote procedure call due to insufficient
129423601548SRuslan Ermilovauthentication parameters.
129523601548SRuslan ErmilovThe routine calls
129623601548SRuslan Ermilov.Fn svcerr_auth xprt AUTH_TOOWEAK .
129723601548SRuslan Ermilov.Pp
129823601548SRuslan Ermilov.It Xo
129923601548SRuslan Ermilov.Ft "SVCXPRT *"
130023601548SRuslan Ermilov.Xc
130123601548SRuslan Ermilov.It Xo
130223601548SRuslan Ermilov.Fn svcraw_create void
130323601548SRuslan Ermilov.Xc
130423601548SRuslan Ermilov.Pp
13058360efbdSAlfred PerlsteinThis routine creates a toy
130623601548SRuslan Ermilov.Tn RPC
130723601548SRuslan Ermilovservice transport, to which it returns a pointer.
130823601548SRuslan ErmilovThe transport
13098360efbdSAlfred Perlsteinis really a buffer within the process's address space,
13108360efbdSAlfred Perlsteinso the corresponding
131123601548SRuslan Ermilov.Tn RPC
13128360efbdSAlfred Perlsteinclient should live in the same
13138360efbdSAlfred Perlsteinaddress space;
13148360efbdSAlfred Perlsteinsee
131523601548SRuslan Ermilov.Fn clntraw_create .
13168360efbdSAlfred PerlsteinThis routine allows simulation of
131723601548SRuslan Ermilov.Tn RPC
13188360efbdSAlfred Perlsteinand acquisition of
131923601548SRuslan Ermilov.Tn RPC
13208360efbdSAlfred Perlsteinoverheads (such as round trip times), without any kernel
13218360efbdSAlfred Perlsteininterference.
13228360efbdSAlfred PerlsteinThis routine returns
132323601548SRuslan Ermilov.Dv NULL
13248360efbdSAlfred Perlsteinif it fails.
132523601548SRuslan Ermilov.Pp
132623601548SRuslan Ermilov.It Xo
132723601548SRuslan Ermilov.Ft "SVCXPRT *"
132823601548SRuslan Ermilov.Xc
132923601548SRuslan Ermilov.It Xo
133023601548SRuslan Ermilov.Fn svctcp_create "int sock" "u_int send_buf_size" "u_int recv_buf_size"
133123601548SRuslan Ermilov.Xc
133223601548SRuslan Ermilov.Pp
13338360efbdSAlfred PerlsteinThis routine creates a
133423601548SRuslan Ermilov.Tn TCP/IP Ns \-based
133523601548SRuslan Ermilov.Tn RPC
13368360efbdSAlfred Perlsteinservice transport, to which it returns a pointer.
13378360efbdSAlfred PerlsteinThe transport is associated with the socket
133823601548SRuslan Ermilov.Fa sock ,
13398360efbdSAlfred Perlsteinwhich may be
134023601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
13418360efbdSAlfred Perlsteinin which case a new socket is created.
13428360efbdSAlfred PerlsteinIf the socket is not bound to a local
134323601548SRuslan Ermilov.Tn TCP
134423601548SRuslan Ermilovport, then this routine binds it to an arbitrary port.
134523601548SRuslan ErmilovUpon completion,
134623601548SRuslan Ermilov.Fa xprt\->xp_fd
13478360efbdSAlfred Perlsteinis the transport's socket descriptor, and
134823601548SRuslan Ermilov.Fa xprt\->xp_port
13498360efbdSAlfred Perlsteinis the transport's port number.
13508360efbdSAlfred PerlsteinThis routine returns
135123601548SRuslan Ermilov.Dv NULL
135223601548SRuslan Ermilovif it fails.
135323601548SRuslan ErmilovSince
135423601548SRuslan Ermilov.Tn TCP Ns \-based
135523601548SRuslan Ermilov.Tn RPC
13568360efbdSAlfred Perlsteinuses buffered
135723601548SRuslan Ermilov.Tn I/O ,
13588360efbdSAlfred Perlsteinusers may specify the size of buffers; values of zero
13598360efbdSAlfred Perlsteinchoose suitable defaults.
136023601548SRuslan Ermilov.Pp
136123601548SRuslan Ermilov.It Xo
136223601548SRuslan Ermilov.Ft "SVCXPRT *"
136323601548SRuslan Ermilov.Xc
136423601548SRuslan Ermilov.It Xo
136523601548SRuslan Ermilov.Fn svcfd_create "int fd" "u_int sendsize" "u_int recvsize"
136623601548SRuslan Ermilov.Xc
136723601548SRuslan Ermilov.Pp
136823601548SRuslan ErmilovCreate a service on top of any open descriptor.
136923601548SRuslan ErmilovTypically,
13708360efbdSAlfred Perlsteinthis
13718360efbdSAlfred Perlsteindescriptor is a connected socket for a stream protocol such
13728360efbdSAlfred Perlsteinas
137323601548SRuslan Ermilov.Tn TCP .
137423601548SRuslan Ermilov.Fa sendsize
13758360efbdSAlfred Perlsteinand
137623601548SRuslan Ermilov.Fa recvsize
137723601548SRuslan Ermilovindicate sizes for the send and receive buffers.
137823601548SRuslan ErmilovIf they are
13798360efbdSAlfred Perlsteinzero, a reasonable default is chosen.
138023601548SRuslan Ermilov.Pp
138123601548SRuslan Ermilov.It Xo
138223601548SRuslan Ermilov.Ft "SVCXPRT *"
138323601548SRuslan Ermilov.Xc
138423601548SRuslan Ermilov.It Xo
138523601548SRuslan Ermilov.Fn svcudp_bufcreate "int sock" "u_int sendsize" "u_int recvsize"
138623601548SRuslan Ermilov.Xc
138723601548SRuslan Ermilov.Pp
13888360efbdSAlfred PerlsteinThis routine creates a
138923601548SRuslan Ermilov.Tn UDP/IP Ns \-based
139023601548SRuslan Ermilov.Tn RPC
13918360efbdSAlfred Perlsteinservice transport, to which it returns a pointer.
13928360efbdSAlfred PerlsteinThe transport is associated with the socket
139323601548SRuslan Ermilov.Fa sock ,
13948360efbdSAlfred Perlsteinwhich may be
139523601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
13968360efbdSAlfred Perlsteinin which case a new socket is created.
13978360efbdSAlfred PerlsteinIf the socket is not bound to a local
139823601548SRuslan Ermilov.Tn UDP
139923601548SRuslan Ermilovport, then this routine binds it to an arbitrary port.
140023601548SRuslan ErmilovUpon
14018360efbdSAlfred Perlsteincompletion,
140223601548SRuslan Ermilov.Fa xprt\->xp_fd
14038360efbdSAlfred Perlsteinis the transport's socket descriptor, and
140423601548SRuslan Ermilov.Fa xprt\->xp_port
14058360efbdSAlfred Perlsteinis the transport's port number.
14068360efbdSAlfred PerlsteinThis routine returns
140723601548SRuslan Ermilov.Dv NULL
14088360efbdSAlfred Perlsteinif it fails.
140923601548SRuslan Ermilov.Pp
14108360efbdSAlfred PerlsteinThis allows the user to specify the maximum packet size for sending and
14118360efbdSAlfred Perlsteinreceiving
141223601548SRuslan Ermilov.Tn UDP Ns \-based
141323601548SRuslan Ermilov.Tn RPC
141423601548SRuslan Ermilovmessages.
141523601548SRuslan Ermilov.Pp
141623601548SRuslan Ermilov.It Xo
141723601548SRuslan Ermilov.Ft bool_t
141823601548SRuslan Ermilov.Fn xdr_accepted_reply "XDR *xdrs" "struct accepted_reply *ar"
141923601548SRuslan Ermilov.Xc
142023601548SRuslan Ermilov.Pp
14218360efbdSAlfred PerlsteinUsed for encoding
142223601548SRuslan Ermilov.Tn RPC
142323601548SRuslan Ermilovreply messages.
142423601548SRuslan ErmilovThis routine is useful for users who
14258360efbdSAlfred Perlsteinwish to generate
142623601548SRuslan Ermilov.Tn RPC Ns \-style
14278360efbdSAlfred Perlsteinmessages without using the
142823601548SRuslan Ermilov.Tn RPC
14298360efbdSAlfred Perlsteinpackage.
143023601548SRuslan Ermilov.Pp
143123601548SRuslan Ermilov.It Xo
143223601548SRuslan Ermilov.Ft bool_t
143323601548SRuslan Ermilov.Fn xdr_authunix_parms "XDR *xdrs" "struct authunix_parms *aupp"
143423601548SRuslan Ermilov.Xc
143523601548SRuslan Ermilov.Pp
14368360efbdSAlfred PerlsteinUsed for describing
143723601548SRuslan Ermilov.Ux
143823601548SRuslan Ermilovcredentials.
143923601548SRuslan ErmilovThis routine is useful for users
14408360efbdSAlfred Perlsteinwho wish to generate these credentials without using the
144123601548SRuslan Ermilov.Tn RPC
14428360efbdSAlfred Perlsteinauthentication package.
144323601548SRuslan Ermilov.Pp
144423601548SRuslan Ermilov.It Xo
144523601548SRuslan Ermilov.Ft void
144623601548SRuslan Ermilov.Xc
144723601548SRuslan Ermilov.It Xo
144823601548SRuslan Ermilov.Ft bool_t
144923601548SRuslan Ermilov.Fn xdr_callhdr "XDR *xdrs" "struct rpc_msg *chdr"
145023601548SRuslan Ermilov.Xc
145123601548SRuslan Ermilov.Pp
14528360efbdSAlfred PerlsteinUsed for describing
145323601548SRuslan Ermilov.Tn RPC
14548360efbdSAlfred Perlsteincall header messages.
14558360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
145623601548SRuslan Ermilov.Tn RPC Ns \-style
14578360efbdSAlfred Perlsteinmessages without using the
145823601548SRuslan Ermilov.Tn RPC
14598360efbdSAlfred Perlsteinpackage.
146023601548SRuslan Ermilov.Pp
146123601548SRuslan Ermilov.It Xo
146223601548SRuslan Ermilov.Ft bool_t
146323601548SRuslan Ermilov.Fn xdr_callmsg "XDR *xdrs" "struct rpc_msg *cmsg"
146423601548SRuslan Ermilov.Xc
146523601548SRuslan Ermilov.Pp
14668360efbdSAlfred PerlsteinUsed for describing
146723601548SRuslan Ermilov.Tn RPC
14688360efbdSAlfred Perlsteincall messages.
14698360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
147023601548SRuslan Ermilov.Tn RPC Ns \-style
14718360efbdSAlfred Perlsteinmessages without using the
147223601548SRuslan Ermilov.Tn RPC
14738360efbdSAlfred Perlsteinpackage.
147423601548SRuslan Ermilov.Pp
147523601548SRuslan Ermilov.It Xo
147623601548SRuslan Ermilov.Ft bool_t
147723601548SRuslan Ermilov.Fn xdr_opaque_auth "XDR *xdrs" "struct opaque_auth *ap"
147823601548SRuslan Ermilov.Xc
147923601548SRuslan Ermilov.Pp
14808360efbdSAlfred PerlsteinUsed for describing
148123601548SRuslan Ermilov.Tn RPC
14828360efbdSAlfred Perlsteinauthentication information messages.
14838360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
148423601548SRuslan Ermilov.Tn RPC Ns \-style
14858360efbdSAlfred Perlsteinmessages without using the
148623601548SRuslan Ermilov.Tn RPC
14878360efbdSAlfred Perlsteinpackage.
148823601548SRuslan Ermilov.Pp
148923601548SRuslan Ermilov.It Xo
149023601548SRuslan Ermilov.Vt struct pmap ;
149123601548SRuslan Ermilov.Xc
149223601548SRuslan Ermilov.It Xo
149323601548SRuslan Ermilov.Ft bool_t
149423601548SRuslan Ermilov.Fn xdr_pmap "XDR *xdrs" "struct pmap *regs"
149523601548SRuslan Ermilov.Xc
149623601548SRuslan Ermilov.Pp
14978360efbdSAlfred PerlsteinUsed for describing parameters to various
14988657581bSMaxim Sobolev.Xr rpcbind 8
14998360efbdSAlfred Perlsteinprocedures, externally.
15008360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
15018360efbdSAlfred Perlsteinthese parameters without using the
150223601548SRuslan Ermilov.Fn pmap_*
15038360efbdSAlfred Perlsteininterface.
150423601548SRuslan Ermilov.Pp
150523601548SRuslan Ermilov.It Xo
150623601548SRuslan Ermilov.Ft bool_t
150723601548SRuslan Ermilov.Fn xdr_pmaplist "XDR *xdrs" "struct pmaplist **rp"
150823601548SRuslan Ermilov.Xc
150923601548SRuslan Ermilov.Pp
15108360efbdSAlfred PerlsteinUsed for describing a list of port mappings, externally.
15118360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
15128360efbdSAlfred Perlsteinthese parameters without using the
151323601548SRuslan Ermilov.Fn pmap_*
15148360efbdSAlfred Perlsteininterface.
151523601548SRuslan Ermilov.Pp
151623601548SRuslan Ermilov.It Xo
151723601548SRuslan Ermilov.Ft bool_t
151823601548SRuslan Ermilov.Fn xdr_rejected_reply "XDR *xdrs" "struct rejected_reply *rr"
151923601548SRuslan Ermilov.Xc
152023601548SRuslan Ermilov.Pp
15218360efbdSAlfred PerlsteinUsed for describing
152223601548SRuslan Ermilov.Tn RPC
15238360efbdSAlfred Perlsteinreply messages.
15248360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
152523601548SRuslan Ermilov.Tn RPC Ns \-style
15268360efbdSAlfred Perlsteinmessages without using the
152723601548SRuslan Ermilov.Tn RPC
15288360efbdSAlfred Perlsteinpackage.
152923601548SRuslan Ermilov.Pp
153023601548SRuslan Ermilov.It Xo
153123601548SRuslan Ermilov.Ft bool_t
153223601548SRuslan Ermilov.Fn xdr_replymsg "XDR *xdrs" "struct rpc_msg *rmsg"
153323601548SRuslan Ermilov.Xc
153423601548SRuslan Ermilov.Pp
15358360efbdSAlfred PerlsteinUsed for describing
153623601548SRuslan Ermilov.Tn RPC
15378360efbdSAlfred Perlsteinreply messages.
15388360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
153923601548SRuslan Ermilov.Tn RPC
15408360efbdSAlfred Perlsteinstyle messages without using the
154123601548SRuslan Ermilov.Tn RPC
15428360efbdSAlfred Perlsteinpackage.
154323601548SRuslan Ermilov.Pp
154423601548SRuslan Ermilov.It Xo
154523601548SRuslan Ermilov.Ft void
154623601548SRuslan Ermilov.Xc
154723601548SRuslan Ermilov.It Xo
154823601548SRuslan Ermilov.Fn xprt_register "SVCXPRT *xprt"
154923601548SRuslan Ermilov.Xc
155023601548SRuslan Ermilov.Pp
15518360efbdSAlfred PerlsteinAfter
155223601548SRuslan Ermilov.Tn RPC
15538360efbdSAlfred Perlsteinservice transport handles are created,
15548360efbdSAlfred Perlsteinthey should register themselves with the
155523601548SRuslan Ermilov.Tn RPC
15568360efbdSAlfred Perlsteinservice package.
15578360efbdSAlfred PerlsteinThis routine modifies the global variable
155823601548SRuslan Ermilov.Va svc_fds .
15598360efbdSAlfred PerlsteinService implementors usually do not need this routine.
156023601548SRuslan Ermilov.Pp
156123601548SRuslan Ermilov.It Xo
156223601548SRuslan Ermilov.Ft void
156323601548SRuslan Ermilov.Xc
156423601548SRuslan Ermilov.It Xo
156523601548SRuslan Ermilov.Fn xprt_unregister "SVCXPRT *xprt"
156623601548SRuslan Ermilov.Xc
156723601548SRuslan Ermilov.Pp
15688360efbdSAlfred PerlsteinBefore an
156923601548SRuslan Ermilov.Tn RPC
15708360efbdSAlfred Perlsteinservice transport handle is destroyed,
15718360efbdSAlfred Perlsteinit should unregister itself with the
157223601548SRuslan Ermilov.Tn RPC
15738360efbdSAlfred Perlsteinservice package.
15748360efbdSAlfred PerlsteinThis routine modifies the global variable
157523601548SRuslan Ermilov.Va svc_fds .
15768360efbdSAlfred PerlsteinService implementors usually do not need this routine.
157723601548SRuslan Ermilov.El
157823601548SRuslan Ermilov.Sh SEE ALSO
157923601548SRuslan Ermilov.Xr rpc_secure 3 ,
158023601548SRuslan Ermilov.Xr xdr 3
158123601548SRuslan Ermilov.Rs
158223601548SRuslan Ermilov.%T "Remote Procedure Calls: Protocol Specification"
158323601548SRuslan Ermilov.Re
158423601548SRuslan Ermilov.Rs
158523601548SRuslan Ermilov.%T "Remote Procedure Call Programming Guide"
158623601548SRuslan Ermilov.Re
158723601548SRuslan Ermilov.Rs
158823601548SRuslan Ermilov.%T "rpcgen Programming Guide"
158923601548SRuslan Ermilov.Re
159023601548SRuslan Ermilov.Rs
159123601548SRuslan Ermilov.%T "RPC: Remote Procedure Call Protocol Specification"
159223601548SRuslan Ermilov.%O RFC1050
159323601548SRuslan Ermilov.%Q "Sun Microsystems, Inc., USC-ISI"
159423601548SRuslan Ermilov.Re
1595