xref: /freebsd/lib/libc/rpc/rpc_soc.3 (revision db7534cfa2712206e9b34c8a1ff4cee917c6c6f0)
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
182db7534cfSBruce Evans.Ft int
18323601548SRuslan Ermilov.Fo callrpc
18423601548SRuslan Ermilov.Fa "char *host"
18523601548SRuslan Ermilov.Fa "u_long prognum"
18623601548SRuslan Ermilov.Fa "u_long versnum"
18723601548SRuslan Ermilov.Fa "u_long procnum"
18823601548SRuslan Ermilov.Fa "xdrproc_t inproc"
189cc74aaddSAlfred Perlstein.Fa "void *in"
19023601548SRuslan Ermilov.Fa "xdrproc_t outproc"
191cc74aaddSAlfred Perlstein.Fa "void *out"
19223601548SRuslan Ermilov.Fc
19323601548SRuslan Ermilov.Xc
19423601548SRuslan Ermilov.Pp
1958360efbdSAlfred PerlsteinCall the remote procedure associated with
19623601548SRuslan Ermilov.Fa prognum ,
19723601548SRuslan Ermilov.Fa versnum ,
1988360efbdSAlfred Perlsteinand
19923601548SRuslan Ermilov.Fa procnum
20023601548SRuslan Ermilovon the machine
20123601548SRuslan Ermilov.Fa host .
2028360efbdSAlfred PerlsteinThe parameter
20323601548SRuslan Ermilov.Fa in
2048360efbdSAlfred Perlsteinis the address of the procedure's argument(s), and
20523601548SRuslan Ermilov.Fa out
2068360efbdSAlfred Perlsteinis the address of where to place the result(s);
20723601548SRuslan Ermilov.Fa inproc
2088360efbdSAlfred Perlsteinis used to encode the procedure's parameters, and
20923601548SRuslan Ermilov.Fa outproc
2108360efbdSAlfred Perlsteinis used to decode the procedure's results.
2118360efbdSAlfred PerlsteinThis routine returns zero if it succeeds, or the value of
21223601548SRuslan Ermilov.Vt "enum clnt_stat"
2138360efbdSAlfred Perlsteincast to an integer if it fails.
2148360efbdSAlfred PerlsteinThe routine
21523601548SRuslan Ermilov.Fn clnt_perrno
2168360efbdSAlfred Perlsteinis handy for translating failure statuses into messages.
21723601548SRuslan Ermilov.Pp
2188360efbdSAlfred PerlsteinWarning: calling remote procedures with this routine
2198360efbdSAlfred Perlsteinuses
22023601548SRuslan Ermilov.Tn UDP/IP
2218360efbdSAlfred Perlsteinas a transport; see
22223601548SRuslan Ermilov.Fn clntudp_create
2238360efbdSAlfred Perlsteinfor restrictions.
2248360efbdSAlfred PerlsteinYou do not have control of timeouts or authentication using
2258360efbdSAlfred Perlsteinthis routine.
22623601548SRuslan Ermilov.Pp
22723601548SRuslan Ermilov.It Xo
22823601548SRuslan Ermilov.Ft "enum clnt_stat"
22923601548SRuslan Ermilov.Xc
23023601548SRuslan Ermilov.It Xo
23123601548SRuslan Ermilov.Fo clnt_broadcast
23223601548SRuslan Ermilov.Fa "u_long prognum"
23323601548SRuslan Ermilov.Fa "u_long versnum"
23423601548SRuslan Ermilov.Fa "u_long procnum"
23523601548SRuslan Ermilov.Fa "xdrproc_t inproc"
23623601548SRuslan Ermilov.Fa "char *in"
23723601548SRuslan Ermilov.Fa "xdrproc_t outproc"
23823601548SRuslan Ermilov.Fa "char *out"
23923601548SRuslan Ermilov.Fa "bool_t (*eachresult)(caddr_t, struct sockaddr_in *)"
24023601548SRuslan Ermilov.Fc
24123601548SRuslan Ermilov.Xc
24223601548SRuslan Ermilov.Pp
2438360efbdSAlfred PerlsteinLike
24423601548SRuslan Ermilov.Fn callrpc ,
2458360efbdSAlfred Perlsteinexcept the call message is broadcast to all locally
24623601548SRuslan Ermilovconnected broadcast nets.
24723601548SRuslan ErmilovEach time it receives a
2488360efbdSAlfred Perlsteinresponse, this routine calls
24923601548SRuslan Ermilov.Fn eachresult ,
2508360efbdSAlfred Perlsteinwhose form is:
25123601548SRuslan Ermilov.Bd -ragged -offset indent
25223601548SRuslan Ermilov.Ft bool_t
25323601548SRuslan Ermilov.Fn eachresult "caddr_t out" "struct sockaddr_in *addr"
25423601548SRuslan Ermilov.Ed
25523601548SRuslan Ermilov.Pp
2568360efbdSAlfred Perlsteinwhere
25723601548SRuslan Ermilov.Fa out
2588360efbdSAlfred Perlsteinis the same as
25923601548SRuslan Ermilov.Fa out
2608360efbdSAlfred Perlsteinpassed to
26123601548SRuslan Ermilov.Fn clnt_broadcast ,
2628360efbdSAlfred Perlsteinexcept that the remote procedure's output is decoded there;
26323601548SRuslan Ermilov.Fa addr
2648360efbdSAlfred Perlsteinpoints to the address of the machine that sent the results.
2658360efbdSAlfred PerlsteinIf
26623601548SRuslan Ermilov.Fn eachresult
2678360efbdSAlfred Perlsteinreturns zero,
26823601548SRuslan Ermilov.Fn clnt_broadcast
2698360efbdSAlfred Perlsteinwaits for more replies; otherwise it returns with appropriate
2708360efbdSAlfred Perlsteinstatus.
27123601548SRuslan Ermilov.Pp
2728360efbdSAlfred PerlsteinWarning: broadcast sockets are limited in size to the
27323601548SRuslan Ermilovmaximum transfer unit of the data link.
27423601548SRuslan ErmilovFor ethernet,
2758360efbdSAlfred Perlsteinthis value is 1500 bytes.
27623601548SRuslan Ermilov.Pp
27723601548SRuslan Ermilov.It Xo
27823601548SRuslan Ermilov.Ft "enum clnt_stat"
27923601548SRuslan Ermilov.Xc
28023601548SRuslan Ermilov.It Xo
28123601548SRuslan Ermilov.Fo clnt_call
28223601548SRuslan Ermilov.Fa "CLIENT *clnt"
28323601548SRuslan Ermilov.Fa "u_long procnum"
28423601548SRuslan Ermilov.Fa "xdrproc_t inproc"
28523601548SRuslan Ermilov.Fa "char *in"
28623601548SRuslan Ermilov.Fa "xdrproc_t outproc"
28723601548SRuslan Ermilov.Fa "char *out"
28823601548SRuslan Ermilov.Fa "struct timeval tout"
28923601548SRuslan Ermilov.Fc
29023601548SRuslan Ermilov.Xc
29123601548SRuslan Ermilov.Pp
2928360efbdSAlfred PerlsteinA macro that calls the remote procedure
29323601548SRuslan Ermilov.Fa procnum
2948360efbdSAlfred Perlsteinassociated with the client handle,
29523601548SRuslan Ermilov.Fa clnt ,
2968360efbdSAlfred Perlsteinwhich is obtained with an
29723601548SRuslan Ermilov.Tn RPC
2988360efbdSAlfred Perlsteinclient creation routine such as
29923601548SRuslan Ermilov.Fn clnt_create .
3008360efbdSAlfred PerlsteinThe parameter
30123601548SRuslan Ermilov.Fa in
3028360efbdSAlfred Perlsteinis the address of the procedure's argument(s), and
30323601548SRuslan Ermilov.Fa out
3048360efbdSAlfred Perlsteinis the address of where to place the result(s);
30523601548SRuslan Ermilov.Fa inproc
3068360efbdSAlfred Perlsteinis used to encode the procedure's parameters, and
30723601548SRuslan Ermilov.Fa outproc
3088360efbdSAlfred Perlsteinis used to decode the procedure's results;
30923601548SRuslan Ermilov.Fa tout
3108360efbdSAlfred Perlsteinis the time allowed for results to come back.
31123601548SRuslan Ermilov.Pp
31223601548SRuslan Ermilov.It Xo
31323601548SRuslan Ermilov.Ft void
31423601548SRuslan Ermilov.Fn clnt_destroy "CLIENT *clnt"
31523601548SRuslan Ermilov.Xc
31623601548SRuslan Ermilov.Pp
3178360efbdSAlfred PerlsteinA macro that destroys the client's
31823601548SRuslan Ermilov.Tn RPC
31923601548SRuslan Ermilovhandle.
32023601548SRuslan ErmilovDestruction usually involves deallocation
3218360efbdSAlfred Perlsteinof private data structures, including
32223601548SRuslan Ermilov.Fa clnt
32323601548SRuslan Ermilovitself.
32423601548SRuslan ErmilovUse of
32523601548SRuslan Ermilov.Fa clnt
3268360efbdSAlfred Perlsteinis undefined after calling
32723601548SRuslan Ermilov.Fn clnt_destroy .
3288360efbdSAlfred PerlsteinIf the
32923601548SRuslan Ermilov.Tn RPC
3308360efbdSAlfred Perlsteinlibrary opened the associated socket, it will close it also.
3318360efbdSAlfred PerlsteinOtherwise, the socket remains open.
33223601548SRuslan Ermilov.Pp
33323601548SRuslan Ermilov.It Xo
33423601548SRuslan Ermilov.Ft CLIENT *
33523601548SRuslan Ermilov.Xc
33623601548SRuslan Ermilov.It Xo
33723601548SRuslan Ermilov.Fn clnt_create "char *host" "u_long prog" "u_long vers" "char *proto"
33823601548SRuslan Ermilov.Xc
33923601548SRuslan Ermilov.Pp
3408360efbdSAlfred PerlsteinGeneric client creation routine.
34123601548SRuslan Ermilov.Fa host
3428360efbdSAlfred Perlsteinidentifies the name of the remote host where the server
3438360efbdSAlfred Perlsteinis located.
34423601548SRuslan Ermilov.Fa proto
34523601548SRuslan Ermilovindicates which kind of transport protocol to use.
34623601548SRuslan ErmilovThe
34723601548SRuslan Ermilovcurrently supported values for this field are
34823601548SRuslan Ermilov.Qq Li udp
34923601548SRuslan Ermilovand
35023601548SRuslan Ermilov.Qq Li tcp .
3518360efbdSAlfred PerlsteinDefault timeouts are set, but can be modified using
35223601548SRuslan Ermilov.Fn clnt_control .
35323601548SRuslan Ermilov.Pp
3548360efbdSAlfred PerlsteinWarning: Using
35523601548SRuslan Ermilov.Tn UDP
35623601548SRuslan Ermilovhas its shortcomings.
35723601548SRuslan ErmilovSince
35823601548SRuslan Ermilov.Tn UDP Ns \-based
35923601548SRuslan Ermilov.Tn RPC
3608360efbdSAlfred Perlsteinmessages can only hold up to 8 Kbytes of encoded data,
3618360efbdSAlfred Perlsteinthis transport cannot be used for procedures that take
3628360efbdSAlfred Perlsteinlarge arguments or return huge results.
36323601548SRuslan Ermilov.Pp
36423601548SRuslan Ermilov.It Xo
36523601548SRuslan Ermilov.Ft bool_t
36623601548SRuslan Ermilov.Xc
36723601548SRuslan Ermilov.It Xo
36823601548SRuslan Ermilov.Fn clnt_control "CLIENT *cl" "u_int req" "char *info"
36923601548SRuslan Ermilov.Xc
37023601548SRuslan Ermilov.Pp
3718360efbdSAlfred PerlsteinA macro used to change or retrieve various information
3728360efbdSAlfred Perlsteinabout a client object.
37323601548SRuslan Ermilov.Fa req
3748360efbdSAlfred Perlsteinindicates the type of operation, and
37523601548SRuslan Ermilov.Fa info
37623601548SRuslan Ermilovis a pointer to the information.
37723601548SRuslan ErmilovFor both
37823601548SRuslan Ermilov.Tn UDP
3798360efbdSAlfred Perlsteinand
38023601548SRuslan Ermilov.Tn TCP ,
3818360efbdSAlfred Perlsteinthe supported values of
38223601548SRuslan Ermilov.Fa req
3838360efbdSAlfred Perlsteinand their argument types and what they do are:
38423601548SRuslan Ermilov.Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
38523601548SRuslan Ermilov.It Dv CLSET_TIMEOUT Ta Xo
38623601548SRuslan Ermilov.Vt "struct timeval" Ta "set total timeout"
38723601548SRuslan Ermilov.Xc
38823601548SRuslan Ermilov.It Dv CLGET_TIMEOUT Ta Xo
38923601548SRuslan Ermilov.Vt "struct timeval" Ta "get total timeout"
39023601548SRuslan Ermilov.Xc
39123601548SRuslan Ermilov.El
39223601548SRuslan Ermilov.Pp
3938360efbdSAlfred PerlsteinNote: if you set the timeout using
39423601548SRuslan Ermilov.Fn clnt_control ,
3958360efbdSAlfred Perlsteinthe timeout parameter passed to
39623601548SRuslan Ermilov.Fn clnt_call
3978360efbdSAlfred Perlsteinwill be ignored in all future calls.
39823601548SRuslan Ermilov.Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
39923601548SRuslan Ermilov.It Dv CLGET_SERVER_ADDR Ta Xo
40023601548SRuslan Ermilov.Vt "struct sockaddr_in" Ta "get server's address"
40123601548SRuslan Ermilov.Xc
40223601548SRuslan Ermilov.El
40323601548SRuslan Ermilov.Pp
4048360efbdSAlfred PerlsteinThe following operations are valid for
40523601548SRuslan Ermilov.Tn UDP
4068360efbdSAlfred Perlsteinonly:
40723601548SRuslan Ermilov.Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
40823601548SRuslan Ermilov.It Dv CLSET_RETRY_TIMEOUT Ta Xo
40923601548SRuslan Ermilov.Vt "struct timeval" Ta "set the retry timeout"
41023601548SRuslan Ermilov.Xc
41123601548SRuslan Ermilov.It Dv CLGET_RETRY_TIMEOUT Ta Xo
41223601548SRuslan Ermilov.Vt "struct timeval" Ta "get the retry timeout"
41323601548SRuslan Ermilov.Xc
41423601548SRuslan Ermilov.El
41523601548SRuslan Ermilov.Pp
4168360efbdSAlfred PerlsteinThe retry timeout is the time that
41723601548SRuslan Ermilov.Tn "UDP RPC"
4188360efbdSAlfred Perlsteinwaits for the server to reply before
4198360efbdSAlfred Perlsteinretransmitting the request.
42023601548SRuslan Ermilov.Pp
42123601548SRuslan Ermilov.It Xo
42223601548SRuslan Ermilov.Ft bool_t
42323601548SRuslan Ermilov.Fn clnt_freeres "CLIENT *clnt" "xdrproc_t outproc" "char *out"
42423601548SRuslan Ermilov.Xc
42523601548SRuslan Ermilov.Pp
4268360efbdSAlfred PerlsteinA macro that frees any data allocated by the
42723601548SRuslan Ermilov.Tn RPC/XDR
4288360efbdSAlfred Perlsteinsystem when it decoded the results of an
42923601548SRuslan Ermilov.Tn RPC
43023601548SRuslan Ermilovcall.
43123601548SRuslan ErmilovThe parameter
43223601548SRuslan Ermilov.Fa out
4338360efbdSAlfred Perlsteinis the address of the results, and
43423601548SRuslan Ermilov.Fa outproc
4358360efbdSAlfred Perlsteinis the
43623601548SRuslan Ermilov.Tn XDR
4378360efbdSAlfred Perlsteinroutine describing the results.
4388360efbdSAlfred PerlsteinThis routine returns one if the results were successfully
4398360efbdSAlfred Perlsteinfreed,
4408360efbdSAlfred Perlsteinand zero otherwise.
44123601548SRuslan Ermilov.Pp
44223601548SRuslan Ermilov.It Xo
44323601548SRuslan Ermilov.Ft void
44423601548SRuslan Ermilov.Xc
44523601548SRuslan Ermilov.It Xo
44623601548SRuslan Ermilov.Fn clnt_geterr "CLIENT *clnt" "struct rpc_err *errp"
44723601548SRuslan Ermilov.Xc
44823601548SRuslan Ermilov.Pp
4498360efbdSAlfred PerlsteinA macro that copies the error structure out of the client
4508360efbdSAlfred Perlsteinhandle
4518360efbdSAlfred Perlsteinto the structure at address
45223601548SRuslan Ermilov.Fa errp .
45323601548SRuslan Ermilov.Pp
45423601548SRuslan Ermilov.It Xo
45523601548SRuslan Ermilov.Ft void
45623601548SRuslan Ermilov.Xc
45723601548SRuslan Ermilov.It Xo
45823601548SRuslan Ermilov.Fn clnt_pcreateerror "char *s"
45923601548SRuslan Ermilov.Xc
46023601548SRuslan Ermilov.Pp
46123601548SRuslan Ermilovprints a message to standard error indicating
4628360efbdSAlfred Perlsteinwhy a client
46323601548SRuslan Ermilov.Tn RPC
4648360efbdSAlfred Perlsteinhandle could not be created.
4658360efbdSAlfred PerlsteinThe message is prepended with string
46623601548SRuslan Ermilov.Fa s
4678360efbdSAlfred Perlsteinand a colon.
46823601548SRuslan ErmilovA newline is appended at the end of the message.
4698360efbdSAlfred PerlsteinUsed when a
47023601548SRuslan Ermilov.Fn clnt_create ,
47123601548SRuslan Ermilov.Fn clntraw_create ,
47223601548SRuslan Ermilov.Fn clnttcp_create ,
4738360efbdSAlfred Perlsteinor
47423601548SRuslan Ermilov.Fn clntudp_create
4758360efbdSAlfred Perlsteincall fails.
47623601548SRuslan Ermilov.Pp
47723601548SRuslan Ermilov.It Xo
47823601548SRuslan Ermilov.Ft void
47923601548SRuslan Ermilov.Xc
48023601548SRuslan Ermilov.It Xo
48123601548SRuslan Ermilov.Fn clnt_perrno "enum clnt_stat stat"
48223601548SRuslan Ermilov.Xc
48323601548SRuslan Ermilov.Pp
4848360efbdSAlfred PerlsteinPrint a message to standard error corresponding
4858360efbdSAlfred Perlsteinto the condition indicated by
48623601548SRuslan Ermilov.Fa stat .
48723601548SRuslan ErmilovA newline is appended at the end of the message.
4888360efbdSAlfred PerlsteinUsed after
48923601548SRuslan Ermilov.Fn callrpc .
49023601548SRuslan Ermilov.Pp
49123601548SRuslan Ermilov.It Xo
49223601548SRuslan Ermilov.Ft void
49323601548SRuslan Ermilov.Fn clnt_perror "CLIENT *clnt" "char *s"
49423601548SRuslan Ermilov.Xc
49523601548SRuslan Ermilov.Pp
4968360efbdSAlfred PerlsteinPrint a message to standard error indicating why an
49723601548SRuslan Ermilov.Tn RPC
4988360efbdSAlfred Perlsteincall failed;
49923601548SRuslan Ermilov.Fa clnt
5008360efbdSAlfred Perlsteinis the handle used to do the call.
5018360efbdSAlfred PerlsteinThe message is prepended with string
50223601548SRuslan Ermilov.Fa s
5038360efbdSAlfred Perlsteinand a colon.
50423601548SRuslan ErmilovA newline is appended at the end of the message.
5058360efbdSAlfred PerlsteinUsed after
50623601548SRuslan Ermilov.Fn clnt_call .
50723601548SRuslan Ermilov.Pp
50823601548SRuslan Ermilov.It Xo
50923601548SRuslan Ermilov.Ft "char *"
51023601548SRuslan Ermilov.Xc
51123601548SRuslan Ermilov.It Xo
51223601548SRuslan Ermilov.Fn clnt_spcreateerror "char *s"
51323601548SRuslan Ermilov.Xc
51423601548SRuslan Ermilov.Pp
5158360efbdSAlfred PerlsteinLike
51623601548SRuslan Ermilov.Fn clnt_pcreateerror ,
5178360efbdSAlfred Perlsteinexcept that it returns a string
5188360efbdSAlfred Perlsteininstead of printing to the standard error.
51923601548SRuslan Ermilov.Pp
5208360efbdSAlfred PerlsteinBugs: returns pointer to static data that is overwritten
5218360efbdSAlfred Perlsteinon each call.
52223601548SRuslan Ermilov.Pp
52323601548SRuslan Ermilov.It Xo
52423601548SRuslan Ermilov.Ft "char *"
52523601548SRuslan Ermilov.Xc
52623601548SRuslan Ermilov.It Xo
52723601548SRuslan Ermilov.Fn clnt_sperrno "enum clnt_stat stat"
52823601548SRuslan Ermilov.Xc
52923601548SRuslan Ermilov.Pp
5308360efbdSAlfred PerlsteinTake the same arguments as
53123601548SRuslan Ermilov.Fn clnt_perrno ,
5328360efbdSAlfred Perlsteinbut instead of sending a message to the standard error
5338360efbdSAlfred Perlsteinindicating why an
53423601548SRuslan Ermilov.Tn RPC
5358360efbdSAlfred Perlsteincall failed, return a pointer to a string which contains
5368360efbdSAlfred Perlsteinthe message.
53723601548SRuslan Ermilov.Pp
53823601548SRuslan Ermilov.Fn clnt_sperrno
5398360efbdSAlfred Perlsteinis used instead of
54023601548SRuslan Ermilov.Fn clnt_perrno
5418360efbdSAlfred Perlsteinif the program does not have a standard error (as a program
5428360efbdSAlfred Perlsteinrunning as a server quite likely does not), or if the
5438360efbdSAlfred Perlsteinprogrammer
5448360efbdSAlfred Perlsteindoes not want the message to be output with
54523601548SRuslan Ermilov.Fn printf ,
54623601548SRuslan Ermilovor if a message format different from that supported by
54723601548SRuslan Ermilov.Fn clnt_perrno
5488360efbdSAlfred Perlsteinis to be used.
54923601548SRuslan Ermilov.Pp
5508360efbdSAlfred PerlsteinNote: unlike
55123601548SRuslan Ermilov.Fn clnt_sperror
5528360efbdSAlfred Perlsteinand
55323601548SRuslan Ermilov.Fn clnt_spcreateerror ,
55423601548SRuslan Ermilov.Fn clnt_sperrno
5558360efbdSAlfred Perlsteinreturns pointer to static data, but the
5568360efbdSAlfred Perlsteinresult will not get overwritten on each call.
55723601548SRuslan Ermilov.Pp
55823601548SRuslan Ermilov.It Xo
55923601548SRuslan Ermilov.Ft "char *"
56023601548SRuslan Ermilov.Xc
56123601548SRuslan Ermilov.It Xo
56223601548SRuslan Ermilov.Fn clnt_sperror "CLIENT *rpch" "char *s"
56323601548SRuslan Ermilov.Xc
56423601548SRuslan Ermilov.Pp
5658360efbdSAlfred PerlsteinLike
56623601548SRuslan Ermilov.Fn clnt_perror ,
5678360efbdSAlfred Perlsteinexcept that (like
56823601548SRuslan Ermilov.Fn clnt_sperrno )
5698360efbdSAlfred Perlsteinit returns a string instead of printing to standard error.
57023601548SRuslan Ermilov.Pp
5718360efbdSAlfred PerlsteinBugs: returns pointer to static data that is overwritten
5728360efbdSAlfred Perlsteinon each call.
57323601548SRuslan Ermilov.Pp
57423601548SRuslan Ermilov.It Xo
57523601548SRuslan Ermilov.Ft "CLIENT *"
57623601548SRuslan Ermilov.Xc
57723601548SRuslan Ermilov.It Xo
57823601548SRuslan Ermilov.Fn clntraw_create "u_long prognum" "u_long versnum"
57923601548SRuslan Ermilov.Xc
58023601548SRuslan Ermilov.Pp
5818360efbdSAlfred PerlsteinThis routine creates a toy
58223601548SRuslan Ermilov.Tn RPC
5838360efbdSAlfred Perlsteinclient for the remote program
58423601548SRuslan Ermilov.Fa prognum ,
5858360efbdSAlfred Perlsteinversion
58623601548SRuslan Ermilov.Fa versnum .
5878360efbdSAlfred PerlsteinThe transport used to pass messages to the service is
5888360efbdSAlfred Perlsteinactually a buffer within the process's address space, so the
5898360efbdSAlfred Perlsteincorresponding
59023601548SRuslan Ermilov.Tn RPC
5918360efbdSAlfred Perlsteinserver should live in the same address space; see
59223601548SRuslan Ermilov.Fn svcraw_create .
5938360efbdSAlfred PerlsteinThis allows simulation of
59423601548SRuslan Ermilov.Tn RPC
5958360efbdSAlfred Perlsteinand acquisition of
59623601548SRuslan Ermilov.Tn RPC
5978360efbdSAlfred Perlsteinoverheads, such as round trip times, without any
59823601548SRuslan Ermilovkernel interference.
59923601548SRuslan ErmilovThis routine returns
60023601548SRuslan Ermilov.Dv NULL
6018360efbdSAlfred Perlsteinif it fails.
60223601548SRuslan Ermilov.Pp
60323601548SRuslan Ermilov.It Xo
60423601548SRuslan Ermilov.Ft "CLIENT *"
60523601548SRuslan Ermilov.Xc
60623601548SRuslan Ermilov.It Xo
60723601548SRuslan Ermilov.Fo clnttcp_create
60823601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
60923601548SRuslan Ermilov.Fa "u_long prognum"
61023601548SRuslan Ermilov.Fa "u_long versnum"
61123601548SRuslan Ermilov.Fa "int *sockp"
61223601548SRuslan Ermilov.Fa "u_int sendsz"
61323601548SRuslan Ermilov.Fa "u_int recvsz"
61423601548SRuslan Ermilov.Fc
61523601548SRuslan Ermilov.Xc
61623601548SRuslan Ermilov.Pp
6178360efbdSAlfred PerlsteinThis routine creates an
61823601548SRuslan Ermilov.Tn RPC
6198360efbdSAlfred Perlsteinclient for the remote program
62023601548SRuslan Ermilov.Fa prognum ,
6218360efbdSAlfred Perlsteinversion
62223601548SRuslan Ermilov.Fa versnum ;
6238360efbdSAlfred Perlsteinthe client uses
62423601548SRuslan Ermilov.Tn TCP/IP
62523601548SRuslan Ermilovas a transport.
62623601548SRuslan ErmilovThe remote program is located at Internet
6278360efbdSAlfred Perlsteinaddress
62823601548SRuslan Ermilov.Fa addr .
6298360efbdSAlfred PerlsteinIf
63023601548SRuslan Ermilov.Fa addr\->sin_port
6318360efbdSAlfred Perlsteinis zero, then it is set to the actual port that the remote
6328360efbdSAlfred Perlsteinprogram is listening on (the remote
6338657581bSMaxim Sobolev.Xr rpcbind 8
63423601548SRuslan Ermilovservice is consulted for this information).
63523601548SRuslan ErmilovThe parameter
63623601548SRuslan Ermilov.Fa sockp
6378360efbdSAlfred Perlsteinis a socket; if it is
63823601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
6398360efbdSAlfred Perlsteinthen this routine opens a new one and sets
64023601548SRuslan Ermilov.Fa sockp .
6418360efbdSAlfred PerlsteinSince
64223601548SRuslan Ermilov.Tn TCP Ns \-based
64323601548SRuslan Ermilov.Tn RPC
6448360efbdSAlfred Perlsteinuses buffered
64523601548SRuslan Ermilov.Tn I/O ,
6468360efbdSAlfred Perlsteinthe user may specify the size of the send and receive buffers
6478360efbdSAlfred Perlsteinwith the parameters
64823601548SRuslan Ermilov.Fa sendsz
6498360efbdSAlfred Perlsteinand
65023601548SRuslan Ermilov.Fa recvsz ;
6518360efbdSAlfred Perlsteinvalues of zero choose suitable defaults.
6528360efbdSAlfred PerlsteinThis routine returns
65323601548SRuslan Ermilov.Dv NULL
6548360efbdSAlfred Perlsteinif it fails.
65523601548SRuslan Ermilov.Pp
65623601548SRuslan Ermilov.It Xo
65723601548SRuslan Ermilov.Ft "CLIENT *"
65823601548SRuslan Ermilov.Xc
65923601548SRuslan Ermilov.It Xo
66023601548SRuslan Ermilov.Fo clntudp_create
66123601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
66223601548SRuslan Ermilov.Fa "u_long prognum"
66323601548SRuslan Ermilov.Fa "u_long versnum"
66423601548SRuslan Ermilov.Fa "struct timeval wait"
66523601548SRuslan Ermilov.Fa "int *sockp"
66623601548SRuslan Ermilov.Fc
66723601548SRuslan Ermilov.Xc
66823601548SRuslan Ermilov.Pp
6698360efbdSAlfred PerlsteinThis routine creates an
67023601548SRuslan Ermilov.Tn RPC
6718360efbdSAlfred Perlsteinclient for the remote program
67223601548SRuslan Ermilov.Fa prognum ,
6738360efbdSAlfred Perlsteinversion
67423601548SRuslan Ermilov.Fa versnum ;
67523601548SRuslan Ermilovthe client uses
67623601548SRuslan Ermilov.Tn UDP/IP
67723601548SRuslan Ermilovas a transport.
67823601548SRuslan ErmilovThe remote program is located at Internet
6798360efbdSAlfred Perlsteinaddress
68023601548SRuslan Ermilov.Fa addr .
6818360efbdSAlfred PerlsteinIf
68223601548SRuslan Ermilov.Fa addr\->sin_port
6838360efbdSAlfred Perlsteinis zero, then it is set to actual port that the remote
6848360efbdSAlfred Perlsteinprogram is listening on (the remote
6858657581bSMaxim Sobolev.Xr rpcbind 8
68623601548SRuslan Ermilovservice is consulted for this information).
68723601548SRuslan ErmilovThe parameter
68823601548SRuslan Ermilov.Fa sockp
6898360efbdSAlfred Perlsteinis a socket; if it is
69023601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
6918360efbdSAlfred Perlsteinthen this routine opens a new one and sets
69223601548SRuslan Ermilov.Fa sockp .
6938360efbdSAlfred PerlsteinThe
69423601548SRuslan Ermilov.Tn UDP
6958360efbdSAlfred Perlsteintransport resends the call message in intervals of
69623601548SRuslan Ermilov.Fa wait
6978360efbdSAlfred Perlsteintime until a response is received or until the call times
6988360efbdSAlfred Perlsteinout.
6998360efbdSAlfred PerlsteinThe total time for the call to time out is specified by
70023601548SRuslan Ermilov.Fn clnt_call .
70123601548SRuslan Ermilov.Pp
7028360efbdSAlfred PerlsteinWarning: since
70323601548SRuslan Ermilov.Tn UDP Ns \-based
70423601548SRuslan Ermilov.Tn RPC
7058360efbdSAlfred Perlsteinmessages can only hold up to 8 Kbytes
7068360efbdSAlfred Perlsteinof encoded data, this transport cannot be used for procedures
7078360efbdSAlfred Perlsteinthat take large arguments or return huge results.
70823601548SRuslan Ermilov.Pp
70923601548SRuslan Ermilov.It Xo
71023601548SRuslan Ermilov.Ft "CLIENT *"
71123601548SRuslan Ermilov.Xc
71223601548SRuslan Ermilov.It Xo
71323601548SRuslan Ermilov.Fo clntudp_bufcreate
71423601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
71523601548SRuslan Ermilov.Fa "u_long prognum"
71623601548SRuslan Ermilov.Fa "u_long versnum"
71723601548SRuslan Ermilov.Fa "struct timeval wait"
71823601548SRuslan Ermilov.Fa "int *sockp"
71923601548SRuslan Ermilov.Fa "unsigned int sendsize"
72023601548SRuslan Ermilov.Fa "unsigned int recosize"
72123601548SRuslan Ermilov.Fc
72223601548SRuslan Ermilov.Xc
72323601548SRuslan Ermilov.Pp
7248360efbdSAlfred PerlsteinThis routine creates an
72523601548SRuslan Ermilov.Tn RPC
7268360efbdSAlfred Perlsteinclient for the remote program
72723601548SRuslan Ermilov.Fa prognum ,
7288360efbdSAlfred Perlsteinon
72923601548SRuslan Ermilov.Fa versnum ;
73023601548SRuslan Ermilovthe client uses
73123601548SRuslan Ermilov.Tn UDP/IP
73223601548SRuslan Ermilovas a transport.
73323601548SRuslan ErmilovThe remote program is located at Internet
7348360efbdSAlfred Perlsteinaddress
73523601548SRuslan Ermilov.Fa addr .
7368360efbdSAlfred PerlsteinIf
73723601548SRuslan Ermilov.Fa addr\->sin_port
7388360efbdSAlfred Perlsteinis zero, then it is set to actual port that the remote
7398360efbdSAlfred Perlsteinprogram is listening on (the remote
7408657581bSMaxim Sobolev.Xr rpcbind 8
74123601548SRuslan Ermilovservice is consulted for this information).
74223601548SRuslan ErmilovThe parameter
74323601548SRuslan Ermilov.Fa sockp
7448360efbdSAlfred Perlsteinis a socket; if it is
74523601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
7468360efbdSAlfred Perlsteinthen this routine opens a new one and sets
74723601548SRuslan Ermilov.Fa sockp .
7488360efbdSAlfred PerlsteinThe
74923601548SRuslan Ermilov.Tn UDP
7508360efbdSAlfred Perlsteintransport resends the call message in intervals of
75123601548SRuslan Ermilov.Fa wait
7528360efbdSAlfred Perlsteintime until a response is received or until the call times
7538360efbdSAlfred Perlsteinout.
7548360efbdSAlfred PerlsteinThe total time for the call to time out is specified by
75523601548SRuslan Ermilov.Fn clnt_call .
75623601548SRuslan Ermilov.Pp
75723601548SRuslan ErmilovThis allows the user to specify the maximum packet size
75823601548SRuslan Ermilovfor sending and receiving
75923601548SRuslan Ermilov.Tn UDP Ns \-based
76023601548SRuslan Ermilov.Tn RPC
7618360efbdSAlfred Perlsteinmessages.
76223601548SRuslan Ermilov.Pp
76323601548SRuslan Ermilov.It Xo
76423601548SRuslan Ermilov.Ft int
76523601548SRuslan Ermilov.Xc
76623601548SRuslan Ermilov.It Xo
76723601548SRuslan Ermilov.Fn get_myaddress "struct sockaddr_in *addr"
76823601548SRuslan Ermilov.Xc
76923601548SRuslan Ermilov.Pp
7708360efbdSAlfred PerlsteinStuff the machine's
77123601548SRuslan Ermilov.Tn IP
7728360efbdSAlfred Perlsteinaddress into
77323601548SRuslan Ermilov.Fa addr ,
7748360efbdSAlfred Perlsteinwithout consulting the library routines that deal with
77523601548SRuslan Ermilov.Pa /etc/hosts .
7768360efbdSAlfred PerlsteinThe port number is always set to
77723601548SRuslan Ermilov.Fn htons PMAPPORT .
7788360efbdSAlfred PerlsteinReturns zero on success, non-zero on failure.
77923601548SRuslan Ermilov.Pp
78023601548SRuslan Ermilov.It Xo
78123601548SRuslan Ermilov.Ft "struct pmaplist *"
78223601548SRuslan Ermilov.Xc
78323601548SRuslan Ermilov.It Xo
78423601548SRuslan Ermilov.Fn pmap_getmaps "struct sockaddr_in *addr"
78523601548SRuslan Ermilov.Xc
78623601548SRuslan Ermilov.Pp
7878360efbdSAlfred PerlsteinA user interface to the
7888657581bSMaxim Sobolev.Xr rpcbind 8
7898360efbdSAlfred Perlsteinservice, which returns a list of the current
79023601548SRuslan Ermilov.Tn RPC
79123601548SRuslan Ermilovprogram\-to\-port mappings
7928360efbdSAlfred Perlsteinon the host located at
79323601548SRuslan Ermilov.Tn IP
7948360efbdSAlfred Perlsteinaddress
79523601548SRuslan Ermilov.Fa addr .
7968360efbdSAlfred PerlsteinThis routine can return
79723601548SRuslan Ermilov.Dv NULL .
7988360efbdSAlfred PerlsteinThe command
79923601548SRuslan Ermilov.Dq Nm rpcinfo Fl p
8008360efbdSAlfred Perlsteinuses this routine.
80123601548SRuslan Ermilov.Pp
80223601548SRuslan Ermilov.It Xo
80323601548SRuslan Ermilov.Ft u_short
80423601548SRuslan Ermilov.Xc
80523601548SRuslan Ermilov.It Xo
80623601548SRuslan Ermilov.Fo pmap_getport
80723601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
80823601548SRuslan Ermilov.Fa "u_long prognum"
80923601548SRuslan Ermilov.Fa "u_long versnum"
81023601548SRuslan Ermilov.Fa "u_long protocol"
81123601548SRuslan Ermilov.Fc
81223601548SRuslan Ermilov.Xc
81323601548SRuslan Ermilov.Pp
8148360efbdSAlfred PerlsteinA user interface to the
8158657581bSMaxim Sobolev.Xr rpcbind 8
8168360efbdSAlfred Perlsteinservice, which returns the port number
8178360efbdSAlfred Perlsteinon which waits a service that supports program number
81823601548SRuslan Ermilov.Fa prognum ,
8198360efbdSAlfred Perlsteinversion
82023601548SRuslan Ermilov.Fa versnum ,
8218360efbdSAlfred Perlsteinand speaks the transport protocol associated with
82223601548SRuslan Ermilov.Fa protocol .
8238360efbdSAlfred PerlsteinThe value of
82423601548SRuslan Ermilov.Fa protocol
8258360efbdSAlfred Perlsteinis most likely
82623601548SRuslan Ermilov.Dv IPPROTO_UDP
8278360efbdSAlfred Perlsteinor
82823601548SRuslan Ermilov.Dv IPPROTO_TCP .
8298360efbdSAlfred PerlsteinA return value of zero means that the mapping does not exist
8308360efbdSAlfred Perlsteinor that
8318360efbdSAlfred Perlsteinthe
83223601548SRuslan Ermilov.Tn RPC
83323601548SRuslan Ermilovsystem failed to contact the remote
8348657581bSMaxim Sobolev.Xr rpcbind 8
83523601548SRuslan Ermilovservice.
83623601548SRuslan ErmilovIn the latter case, the global variable
83723601548SRuslan Ermilov.Va rpc_createerr
8388360efbdSAlfred Perlsteincontains the
83923601548SRuslan Ermilov.Tn RPC
8408360efbdSAlfred Perlsteinstatus.
84123601548SRuslan Ermilov.Pp
84223601548SRuslan Ermilov.It Xo
84323601548SRuslan Ermilov.Ft "enum clnt_stat"
84423601548SRuslan Ermilov.Xc
84523601548SRuslan Ermilov.It Xo
84623601548SRuslan Ermilov.Fo pmap_rmtcall
84723601548SRuslan Ermilov.Fa "struct sockaddr_in *addr"
84823601548SRuslan Ermilov.Fa "u_long prognum"
84923601548SRuslan Ermilov.Fa "u_long versnum"
85023601548SRuslan Ermilov.Fa "u_long procnum"
85123601548SRuslan Ermilov.Fa "xdrproc_t inproc"
85223601548SRuslan Ermilov.Fa "char *in"
85323601548SRuslan Ermilov.Fa "xdrproc_t outproc"
85423601548SRuslan Ermilov.Fa "char *out"
85523601548SRuslan Ermilov.Fa "struct timeval tout"
85623601548SRuslan Ermilov.Fa "u_long *portp"
85723601548SRuslan Ermilov.Fc
85823601548SRuslan Ermilov.Xc
85923601548SRuslan Ermilov.Pp
8608360efbdSAlfred PerlsteinA user interface to the
8618657581bSMaxim Sobolev.Xr rpcbind 8
8628360efbdSAlfred Perlsteinservice, which instructs
8638657581bSMaxim Sobolev.Xr rpcbind 8
8648360efbdSAlfred Perlsteinon the host at
86523601548SRuslan Ermilov.Tn IP
8668360efbdSAlfred Perlsteinaddress
86723601548SRuslan Ermilov.Fa addr
8688360efbdSAlfred Perlsteinto make an
86923601548SRuslan Ermilov.Tn RPC
8708360efbdSAlfred Perlsteincall on your behalf to a procedure on that host.
8718360efbdSAlfred PerlsteinThe parameter
87223601548SRuslan Ermilov.Fa portp
8738360efbdSAlfred Perlsteinwill be modified to the program's port number if the
8748360efbdSAlfred Perlsteinprocedure
87523601548SRuslan Ermilovsucceeds.
87623601548SRuslan ErmilovThe definitions of other parameters are discussed
8778360efbdSAlfred Perlsteinin
87823601548SRuslan Ermilov.Fn callrpc
8798360efbdSAlfred Perlsteinand
88023601548SRuslan Ermilov.Fn clnt_call .
88123601548SRuslan ErmilovThis procedure should be used for a
88223601548SRuslan Ermilov.Dq ping
88323601548SRuslan Ermilovand nothing
8848360efbdSAlfred Perlsteinelse.
8858360efbdSAlfred PerlsteinSee also
88623601548SRuslan Ermilov.Fn clnt_broadcast .
88723601548SRuslan Ermilov.Pp
88823601548SRuslan Ermilov.It Xo
88923601548SRuslan Ermilov.Ft bool_t
89023601548SRuslan Ermilov.Fn pmap_set "u_long prognum" "u_long versnum" "u_long protocol" "u_short port"
89123601548SRuslan Ermilov.Xc
89223601548SRuslan Ermilov.Pp
8938360efbdSAlfred PerlsteinA user interface to the
8948657581bSMaxim Sobolev.Xr rpcbind 8
8958360efbdSAlfred Perlsteinservice, which establishes a mapping between the triple
89623601548SRuslan Ermilov.Pq Fa prognum , versnum , protocol
8978360efbdSAlfred Perlsteinand
89823601548SRuslan Ermilov.Fa port
8998360efbdSAlfred Perlsteinon the machine's
9008657581bSMaxim Sobolev.Xr rpcbind 8
90123601548SRuslan Ermilovservice.
90223601548SRuslan ErmilovThe value of
90323601548SRuslan Ermilov.Fa protocol
9048360efbdSAlfred Perlsteinis most likely
90523601548SRuslan Ermilov.Dv IPPROTO_UDP
9068360efbdSAlfred Perlsteinor
90723601548SRuslan Ermilov.Dv IPPROTO_TCP .
9088360efbdSAlfred PerlsteinThis routine returns one if it succeeds, zero otherwise.
9098360efbdSAlfred PerlsteinAutomatically done by
91023601548SRuslan Ermilov.Fn svc_register .
91123601548SRuslan Ermilov.Pp
91223601548SRuslan Ermilov.It Xo
91323601548SRuslan Ermilov.Ft bool_t
91423601548SRuslan Ermilov.Fn pmap_unset "u_long prognum" "u_long versnum"
91523601548SRuslan Ermilov.Xc
91623601548SRuslan Ermilov.Pp
9178360efbdSAlfred PerlsteinA user interface to the
9188657581bSMaxim Sobolev.Xr rpcbind 8
9198360efbdSAlfred Perlsteinservice, which destroys all mapping between the triple
92023601548SRuslan Ermilov.Pq Fa prognum , versnum , *
9218360efbdSAlfred Perlsteinand
92223601548SRuslan Ermilov.Fa ports
9238360efbdSAlfred Perlsteinon the machine's
9248657581bSMaxim Sobolev.Xr rpcbind 8
92523601548SRuslan Ermilovservice.
92623601548SRuslan ErmilovThis routine returns one if it succeeds, zero
9278360efbdSAlfred Perlsteinotherwise.
92823601548SRuslan Ermilov.Pp
92923601548SRuslan Ermilov.It Xo
93023601548SRuslan Ermilov.Ft bool_t
93123601548SRuslan Ermilov.Fo registerrpc
93223601548SRuslan Ermilov.Fa "u_long prognum"
93323601548SRuslan Ermilov.Fa "u_long versnum"
93423601548SRuslan Ermilov.Fa "u_long procnum"
93523601548SRuslan Ermilov.Fa "char *(*procname)(void)"
93623601548SRuslan Ermilov.Fa "xdrproc_t inproc"
93723601548SRuslan Ermilov.Fa "xdrproc_t outproc"
93823601548SRuslan Ermilov.Fc
93923601548SRuslan Ermilov.Xc
94023601548SRuslan Ermilov.Pp
9418360efbdSAlfred PerlsteinRegister procedure
94223601548SRuslan Ermilov.Fa procname
9438360efbdSAlfred Perlsteinwith the
94423601548SRuslan Ermilov.Tn RPC
94523601548SRuslan Ermilovservice package.
94623601548SRuslan ErmilovIf a request arrives for program
94723601548SRuslan Ermilov.Fa prognum ,
9488360efbdSAlfred Perlsteinversion
94923601548SRuslan Ermilov.Fa versnum ,
9508360efbdSAlfred Perlsteinand procedure
95123601548SRuslan Ermilov.Fa procnum ,
95223601548SRuslan Ermilov.Fa procname
9538360efbdSAlfred Perlsteinis called with a pointer to its parameter(s);
95423601548SRuslan Ermilov.Fa progname
9558360efbdSAlfred Perlsteinshould return a pointer to its static result(s);
95623601548SRuslan Ermilov.Fa inproc
9578360efbdSAlfred Perlsteinis used to decode the parameters while
95823601548SRuslan Ermilov.Fa outproc
9598360efbdSAlfred Perlsteinis used to encode the results.
9608360efbdSAlfred PerlsteinThis routine returns zero if the registration succeeded, \-1
9618360efbdSAlfred Perlsteinotherwise.
96223601548SRuslan Ermilov.Pp
9638360efbdSAlfred PerlsteinWarning: remote procedures registered in this form
9648360efbdSAlfred Perlsteinare accessed using the
96523601548SRuslan Ermilov.Tn UDP/IP
9668360efbdSAlfred Perlsteintransport; see
96723601548SRuslan Ermilov.Fn svcudp_create
9688360efbdSAlfred Perlsteinfor restrictions.
96923601548SRuslan Ermilov.Pp
97023601548SRuslan Ermilov.It Xo
97123601548SRuslan Ermilov.Vt "struct rpc_createerr" rpc_createerr ;
97223601548SRuslan Ermilov.Xc
97323601548SRuslan Ermilov.Pp
9748360efbdSAlfred PerlsteinA global variable whose value is set by any
97523601548SRuslan Ermilov.Tn RPC
9768360efbdSAlfred Perlsteinclient creation routine
97723601548SRuslan Ermilovthat does not succeed.
97823601548SRuslan ErmilovUse the routine
97923601548SRuslan Ermilov.Fn clnt_pcreateerror
9808360efbdSAlfred Perlsteinto print the reason why.
98123601548SRuslan Ermilov.Pp
98223601548SRuslan Ermilov.It Xo
98323601548SRuslan Ermilov.Ft bool_t
98423601548SRuslan Ermilov.Fn svc_destroy "SVCXPRT * xprt"
98523601548SRuslan Ermilov.Xc
98623601548SRuslan Ermilov.Pp
9878360efbdSAlfred PerlsteinA macro that destroys the
98823601548SRuslan Ermilov.Tn RPC
9898360efbdSAlfred Perlsteinservice transport handle,
99023601548SRuslan Ermilov.Fa xprt .
9918360efbdSAlfred PerlsteinDestruction usually involves deallocation
9928360efbdSAlfred Perlsteinof private data structures, including
99323601548SRuslan Ermilov.Fa xprt
99423601548SRuslan Ermilovitself.
99523601548SRuslan ErmilovUse of
99623601548SRuslan Ermilov.Fa xprt
9978360efbdSAlfred Perlsteinis undefined after calling this routine.
99823601548SRuslan Ermilov.Pp
99923601548SRuslan Ermilov.It Xo
100023601548SRuslan Ermilov.Vt fd_set svc_fdset ;
100123601548SRuslan Ermilov.Xc
100223601548SRuslan Ermilov.Pp
10038360efbdSAlfred PerlsteinA global variable reflecting the
100423601548SRuslan Ermilov.Tn RPC
10058360efbdSAlfred Perlsteinservice side's
100623601548SRuslan Ermilovread file descriptor bit mask; it is suitable as a template parameter
10078360efbdSAlfred Perlsteinto the
100823601548SRuslan Ermilov.Xr select 2
100923601548SRuslan Ermilovsystem call.
101023601548SRuslan ErmilovThis is only of interest
10118360efbdSAlfred Perlsteinif a service implementor does not call
101223601548SRuslan Ermilov.Fn svc_run ,
10138360efbdSAlfred Perlsteinbut rather does his own asynchronous event processing.
101423601548SRuslan ErmilovThis variable is read\-only (do not pass its address to
101523601548SRuslan Ermilov.Xr select 2 ! ) ,
10168360efbdSAlfred Perlsteinyet it may change after calls to
101723601548SRuslan Ermilov.Fn svc_getreqset
10188360efbdSAlfred Perlsteinor any creation routines.
101923601548SRuslan ErmilovAs well, note that if the process has descriptor limits
102023601548SRuslan Ermilovwhich are extended beyond
102123601548SRuslan Ermilov.Dv FD_SETSIZE ,
102223601548SRuslan Ermilovthis variable will only be usable for the first
102323601548SRuslan Ermilov.Dv FD_SETSIZE
102423601548SRuslan Ermilovdescriptors.
102523601548SRuslan Ermilov.Pp
102623601548SRuslan Ermilov.It Xo
102723601548SRuslan Ermilov.Vt int svc_fds ;
102823601548SRuslan Ermilov.Xc
102923601548SRuslan Ermilov.Pp
10308360efbdSAlfred PerlsteinSimilar to
103123601548SRuslan Ermilov.Va svc_fdset ,
103223601548SRuslan Ermilovbut limited to 32 descriptors.
103323601548SRuslan ErmilovThis
10348360efbdSAlfred Perlsteininterface is obsoleted by
103523601548SRuslan Ermilov.Va svc_fdset .
103623601548SRuslan Ermilov.Pp
103723601548SRuslan Ermilov.It Xo
103823601548SRuslan Ermilov.Ft bool_t
103923601548SRuslan Ermilov.Fn svc_freeargs "SVCXPRT *xprt" "xdrproc_t inproc" "char *in"
104023601548SRuslan Ermilov.Xc
104123601548SRuslan Ermilov.Pp
10428360efbdSAlfred PerlsteinA macro that frees any data allocated by the
104323601548SRuslan Ermilov.Tn RPC/XDR
10448360efbdSAlfred Perlsteinsystem when it decoded the arguments to a service procedure
10458360efbdSAlfred Perlsteinusing
104623601548SRuslan Ermilov.Fn svc_getargs .
10478360efbdSAlfred PerlsteinThis routine returns 1 if the results were successfully
10488360efbdSAlfred Perlsteinfreed,
10498360efbdSAlfred Perlsteinand zero otherwise.
105023601548SRuslan Ermilov.Pp
105123601548SRuslan Ermilov.It Xo
105223601548SRuslan Ermilov.Ft bool_t
105323601548SRuslan Ermilov.Fn svc_getargs "SVCXPRT *xprt" "xdrproc_t inproc" "char *in"
105423601548SRuslan Ermilov.Xc
105523601548SRuslan Ermilov.Pp
10568360efbdSAlfred PerlsteinA macro that decodes the arguments of an
105723601548SRuslan Ermilov.Tn RPC
10588360efbdSAlfred Perlsteinrequest
10598360efbdSAlfred Perlsteinassociated with the
106023601548SRuslan Ermilov.Tn RPC
10618360efbdSAlfred Perlsteinservice transport handle,
106223601548SRuslan Ermilov.Fa xprt .
10638360efbdSAlfred PerlsteinThe parameter
106423601548SRuslan Ermilov.Fa in
10658360efbdSAlfred Perlsteinis the address where the arguments will be placed;
106623601548SRuslan Ermilov.Fa inproc
10678360efbdSAlfred Perlsteinis the
106823601548SRuslan Ermilov.Tn XDR
10698360efbdSAlfred Perlsteinroutine used to decode the arguments.
10708360efbdSAlfred PerlsteinThis routine returns one if decoding succeeds, and zero
10718360efbdSAlfred Perlsteinotherwise.
107223601548SRuslan Ermilov.Pp
107323601548SRuslan Ermilov.It Xo
107423601548SRuslan Ermilov.Ft "struct sockaddr_in *"
107523601548SRuslan Ermilov.Xc
107623601548SRuslan Ermilov.It Xo
107723601548SRuslan Ermilov.Fn svc_getcaller "SVCXPRT *xprt"
107823601548SRuslan Ermilov.Xc
107923601548SRuslan Ermilov.Pp
10808360efbdSAlfred PerlsteinThe approved way of getting the network address of the caller
10818360efbdSAlfred Perlsteinof a procedure associated with the
108223601548SRuslan Ermilov.Tn RPC
10838360efbdSAlfred Perlsteinservice transport handle,
108423601548SRuslan Ermilov.Fa xprt .
108523601548SRuslan Ermilov.Pp
108623601548SRuslan Ermilov.It Xo
108723601548SRuslan Ermilov.Ft void
108823601548SRuslan Ermilov.Fn svc_getreqset "fd_set *rdfds"
108923601548SRuslan Ermilov.Xc
109023601548SRuslan Ermilov.Pp
10918360efbdSAlfred PerlsteinThis routine is only of interest if a service implementor
10928360efbdSAlfred Perlsteindoes not call
109323601548SRuslan Ermilov.Fn svc_run ,
10948360efbdSAlfred Perlsteinbut instead implements custom asynchronous event processing.
10958360efbdSAlfred PerlsteinIt is called when the
109623601548SRuslan Ermilov.Xr select 2
10978360efbdSAlfred Perlsteinsystem call has determined that an
109823601548SRuslan Ermilov.Tn RPC
10998360efbdSAlfred Perlsteinrequest has arrived on some
110023601548SRuslan Ermilov.Tn RPC
110123601548SRuslan Ermilovsocket(s);
110223601548SRuslan Ermilov.Fa rdfds
11038360efbdSAlfred Perlsteinis the resultant read file descriptor bit mask.
11048360efbdSAlfred PerlsteinThe routine returns when all sockets associated with the
11058360efbdSAlfred Perlsteinvalue of
110623601548SRuslan Ermilov.Fa rdfds
11078360efbdSAlfred Perlsteinhave been serviced.
110823601548SRuslan Ermilov.Pp
110923601548SRuslan Ermilov.It Xo
111023601548SRuslan Ermilov.Ft void
111123601548SRuslan Ermilov.Fn svc_getreq "int rdfds"
111223601548SRuslan Ermilov.Xc
111323601548SRuslan Ermilov.Pp
11148360efbdSAlfred PerlsteinSimilar to
111523601548SRuslan Ermilov.Fn svc_getreqset ,
111623601548SRuslan Ermilovbut limited to 32 descriptors.
111723601548SRuslan ErmilovThis interface is obsoleted by
111823601548SRuslan Ermilov.Fn svc_getreqset .
111923601548SRuslan Ermilov.Pp
112023601548SRuslan Ermilov.It Xo
112123601548SRuslan Ermilov.Ft bool_t
112223601548SRuslan Ermilov.Fo svc_register
112323601548SRuslan Ermilov.Fa "SVCXPRT *xprt"
112423601548SRuslan Ermilov.Fa "u_long prognum"
112523601548SRuslan Ermilov.Fa "u_long versnum"
112623601548SRuslan Ermilov.Fa "void (*dispatch)(struct svc_req *, SVCXPRT *)"
112723601548SRuslan Ermilov.Fa "int protocol"
112823601548SRuslan Ermilov.Fc
112923601548SRuslan Ermilov.Xc
113023601548SRuslan Ermilov.Pp
11318360efbdSAlfred PerlsteinAssociates
113223601548SRuslan Ermilov.Fa prognum
11338360efbdSAlfred Perlsteinand
113423601548SRuslan Ermilov.Fa versnum
11358360efbdSAlfred Perlsteinwith the service dispatch procedure,
113623601548SRuslan Ermilov.Fn dispatch .
11378360efbdSAlfred PerlsteinIf
113823601548SRuslan Ermilov.Fa protocol
11398360efbdSAlfred Perlsteinis zero, the service is not registered with the
11408657581bSMaxim Sobolev.Xr rpcbind 8
114123601548SRuslan Ermilovservice.
114223601548SRuslan ErmilovIf
114323601548SRuslan Ermilov.Fa protocol
11448360efbdSAlfred Perlsteinis non-zero, then a mapping of the triple
114523601548SRuslan Ermilov.Pq Fa prognum , versnum , protocol
11468360efbdSAlfred Perlsteinto
114723601548SRuslan Ermilov.Fa xprt\->xp_port
11488360efbdSAlfred Perlsteinis established with the local
11498657581bSMaxim Sobolev.Xr rpcbind 8
11508360efbdSAlfred Perlsteinservice (generally
115123601548SRuslan Ermilov.Fa protocol
11528360efbdSAlfred Perlsteinis zero,
115323601548SRuslan Ermilov.Dv IPPROTO_UDP
11548360efbdSAlfred Perlsteinor
115523601548SRuslan Ermilov.Dv IPPROTO_TCP ) .
11568360efbdSAlfred PerlsteinThe procedure
115723601548SRuslan Ermilov.Fn dispatch
11588360efbdSAlfred Perlsteinhas the following form:
115923601548SRuslan Ermilov.Bd -ragged -offset indent
116023601548SRuslan Ermilov.Ft bool_t
116123601548SRuslan Ermilov.Fn dispatch "struct svc_req *request" "SVCXPRT *xprt"
116223601548SRuslan Ermilov.Ed
116323601548SRuslan Ermilov.Pp
11648360efbdSAlfred PerlsteinThe
116523601548SRuslan Ermilov.Fn svc_register
11668360efbdSAlfred Perlsteinroutine returns one if it succeeds, and zero otherwise.
116723601548SRuslan Ermilov.Pp
116823601548SRuslan Ermilov.It Xo
116923601548SRuslan Ermilov.Fn svc_run
117023601548SRuslan Ermilov.Xc
117123601548SRuslan Ermilov.Pp
117223601548SRuslan ErmilovThis routine never returns.
117323601548SRuslan ErmilovIt waits for
117423601548SRuslan Ermilov.Tn RPC
11758360efbdSAlfred Perlsteinrequests to arrive, and calls the appropriate service
11768360efbdSAlfred Perlsteinprocedure using
117723601548SRuslan Ermilov.Fn svc_getreq
117823601548SRuslan Ermilovwhen one arrives.
117923601548SRuslan ErmilovThis procedure is usually waiting for a
118023601548SRuslan Ermilov.Xr select 2
11818360efbdSAlfred Perlsteinsystem call to return.
118223601548SRuslan Ermilov.Pp
118323601548SRuslan Ermilov.It Xo
118423601548SRuslan Ermilov.Ft bool_t
118523601548SRuslan Ermilov.Fn svc_sendreply "SVCXPRT *xprt" "xdrproc_t outproc" "char *out"
118623601548SRuslan Ermilov.Xc
118723601548SRuslan Ermilov.Pp
11888360efbdSAlfred PerlsteinCalled by an
118923601548SRuslan Ermilov.Tn RPC
11908360efbdSAlfred Perlsteinservice's dispatch routine to send the results of a
119123601548SRuslan Ermilovremote procedure call.
119223601548SRuslan ErmilovThe parameter
119323601548SRuslan Ermilov.Fa xprt
11948360efbdSAlfred Perlsteinis the request's associated transport handle;
119523601548SRuslan Ermilov.Fa outproc
11968360efbdSAlfred Perlsteinis the
119723601548SRuslan Ermilov.Tn XDR
11988360efbdSAlfred Perlsteinroutine which is used to encode the results; and
119923601548SRuslan Ermilov.Fa out
12008360efbdSAlfred Perlsteinis the address of the results.
12018360efbdSAlfred PerlsteinThis routine returns one if it succeeds, zero otherwise.
120223601548SRuslan Ermilov.Pp
120323601548SRuslan Ermilov.It Xo
120423601548SRuslan Ermilov.Ft void
120523601548SRuslan Ermilov.Xc
120623601548SRuslan Ermilov.It Xo
120723601548SRuslan Ermilov.Fn svc_unregister "u_long prognum" "u_long versnum"
120823601548SRuslan Ermilov.Xc
120923601548SRuslan Ermilov.Pp
12108360efbdSAlfred PerlsteinRemove all mapping of the double
121123601548SRuslan Ermilov.Pq Fa prognum , versnum
12128360efbdSAlfred Perlsteinto dispatch routines, and of the triple
121323601548SRuslan Ermilov.Pq Fa prognum , versnum , *
12148360efbdSAlfred Perlsteinto port number.
121523601548SRuslan Ermilov.Pp
121623601548SRuslan Ermilov.It Xo
121723601548SRuslan Ermilov.Ft void
121823601548SRuslan Ermilov.Xc
121923601548SRuslan Ermilov.It Xo
122023601548SRuslan Ermilov.Fn svcerr_auth "SVCXPRT *xprt" "enum auth_stat why"
122123601548SRuslan Ermilov.Xc
122223601548SRuslan Ermilov.Pp
12238360efbdSAlfred PerlsteinCalled by a service dispatch routine that refuses to perform
12248360efbdSAlfred Perlsteina remote procedure call due to an authentication error.
122523601548SRuslan Ermilov.Pp
122623601548SRuslan Ermilov.It Xo
122723601548SRuslan Ermilov.Ft void
122823601548SRuslan Ermilov.Xc
122923601548SRuslan Ermilov.It Xo
123023601548SRuslan Ermilov.Fn svcerr_decode "SVCXPRT *xprt"
123123601548SRuslan Ermilov.Xc
123223601548SRuslan Ermilov.Pp
12338360efbdSAlfred PerlsteinCalled by a service dispatch routine that cannot successfully
123423601548SRuslan Ermilovdecode its parameters.
123523601548SRuslan ErmilovSee also
123623601548SRuslan Ermilov.Fn svc_getargs .
123723601548SRuslan Ermilov.Pp
123823601548SRuslan Ermilov.It Xo
123923601548SRuslan Ermilov.Ft void
124023601548SRuslan Ermilov.Xc
124123601548SRuslan Ermilov.It Xo
124223601548SRuslan Ermilov.Fn svcerr_noproc "SVCXPRT *xprt"
124323601548SRuslan Ermilov.Xc
124423601548SRuslan Ermilov.Pp
12458360efbdSAlfred PerlsteinCalled by a service dispatch routine that does not implement
12468360efbdSAlfred Perlsteinthe procedure number that the caller requests.
124723601548SRuslan Ermilov.Pp
124823601548SRuslan Ermilov.It Xo
124923601548SRuslan Ermilov.Ft void
125023601548SRuslan Ermilov.Xc
125123601548SRuslan Ermilov.It Xo
125223601548SRuslan Ermilov.Fn svcerr_noprog "SVCXPRT *xprt"
125323601548SRuslan Ermilov.Xc
125423601548SRuslan Ermilov.Pp
12558360efbdSAlfred PerlsteinCalled when the desired program is not registered with the
125623601548SRuslan Ermilov.Tn RPC
125723601548SRuslan Ermilovpackage.
125823601548SRuslan ErmilovService implementors usually do not need this routine.
125923601548SRuslan Ermilov.Pp
126023601548SRuslan Ermilov.It Xo
126123601548SRuslan Ermilov.Ft void
126223601548SRuslan Ermilov.Xc
126323601548SRuslan Ermilov.It Xo
126423601548SRuslan Ermilov.Fn svcerr_progvers "SVCXPRT *xprt" "u_long low_vers" "u_long high_vers"
126523601548SRuslan Ermilov.Xc
126623601548SRuslan Ermilov.Pp
12678360efbdSAlfred PerlsteinCalled when the desired version of a program is not registered
12688360efbdSAlfred Perlsteinwith the
126923601548SRuslan Ermilov.Tn RPC
127023601548SRuslan Ermilovpackage.
127123601548SRuslan ErmilovService implementors usually do not need this routine.
127223601548SRuslan Ermilov.Pp
127323601548SRuslan Ermilov.It Xo
127423601548SRuslan Ermilov.Ft void
127523601548SRuslan Ermilov.Xc
127623601548SRuslan Ermilov.It Xo
127723601548SRuslan Ermilov.Fn svcerr_systemerr "SVCXPRT *xprt"
127823601548SRuslan Ermilov.Xc
127923601548SRuslan Ermilov.Pp
12808360efbdSAlfred PerlsteinCalled by a service dispatch routine when it detects a system
12818360efbdSAlfred Perlsteinerror
12828360efbdSAlfred Perlsteinnot covered by any particular protocol.
12838360efbdSAlfred PerlsteinFor example, if a service can no longer allocate storage,
12848360efbdSAlfred Perlsteinit may call this routine.
128523601548SRuslan Ermilov.Pp
128623601548SRuslan Ermilov.It Xo
128723601548SRuslan Ermilov.Ft void
128823601548SRuslan Ermilov.Xc
128923601548SRuslan Ermilov.It Xo
129023601548SRuslan Ermilov.Fn svcerr_weakauth "SVCXPRT *xprt"
129123601548SRuslan Ermilov.Xc
129223601548SRuslan Ermilov.Pp
12938360efbdSAlfred PerlsteinCalled by a service dispatch routine that refuses to perform
12948360efbdSAlfred Perlsteina remote procedure call due to insufficient
129523601548SRuslan Ermilovauthentication parameters.
129623601548SRuslan ErmilovThe routine calls
129723601548SRuslan Ermilov.Fn svcerr_auth xprt AUTH_TOOWEAK .
129823601548SRuslan Ermilov.Pp
129923601548SRuslan Ermilov.It Xo
130023601548SRuslan Ermilov.Ft "SVCXPRT *"
130123601548SRuslan Ermilov.Xc
130223601548SRuslan Ermilov.It Xo
130323601548SRuslan Ermilov.Fn svcraw_create void
130423601548SRuslan Ermilov.Xc
130523601548SRuslan Ermilov.Pp
13068360efbdSAlfred PerlsteinThis routine creates a toy
130723601548SRuslan Ermilov.Tn RPC
130823601548SRuslan Ermilovservice transport, to which it returns a pointer.
130923601548SRuslan ErmilovThe transport
13108360efbdSAlfred Perlsteinis really a buffer within the process's address space,
13118360efbdSAlfred Perlsteinso the corresponding
131223601548SRuslan Ermilov.Tn RPC
13138360efbdSAlfred Perlsteinclient should live in the same
13148360efbdSAlfred Perlsteinaddress space;
13158360efbdSAlfred Perlsteinsee
131623601548SRuslan Ermilov.Fn clntraw_create .
13178360efbdSAlfred PerlsteinThis routine allows simulation of
131823601548SRuslan Ermilov.Tn RPC
13198360efbdSAlfred Perlsteinand acquisition of
132023601548SRuslan Ermilov.Tn RPC
13218360efbdSAlfred Perlsteinoverheads (such as round trip times), without any kernel
13228360efbdSAlfred Perlsteininterference.
13238360efbdSAlfred PerlsteinThis routine returns
132423601548SRuslan Ermilov.Dv NULL
13258360efbdSAlfred Perlsteinif it fails.
132623601548SRuslan Ermilov.Pp
132723601548SRuslan Ermilov.It Xo
132823601548SRuslan Ermilov.Ft "SVCXPRT *"
132923601548SRuslan Ermilov.Xc
133023601548SRuslan Ermilov.It Xo
133123601548SRuslan Ermilov.Fn svctcp_create "int sock" "u_int send_buf_size" "u_int recv_buf_size"
133223601548SRuslan Ermilov.Xc
133323601548SRuslan Ermilov.Pp
13348360efbdSAlfred PerlsteinThis routine creates a
133523601548SRuslan Ermilov.Tn TCP/IP Ns \-based
133623601548SRuslan Ermilov.Tn RPC
13378360efbdSAlfred Perlsteinservice transport, to which it returns a pointer.
13388360efbdSAlfred PerlsteinThe transport is associated with the socket
133923601548SRuslan Ermilov.Fa sock ,
13408360efbdSAlfred Perlsteinwhich may be
134123601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
13428360efbdSAlfred Perlsteinin which case a new socket is created.
13438360efbdSAlfred PerlsteinIf the socket is not bound to a local
134423601548SRuslan Ermilov.Tn TCP
134523601548SRuslan Ermilovport, then this routine binds it to an arbitrary port.
134623601548SRuslan ErmilovUpon completion,
134723601548SRuslan Ermilov.Fa xprt\->xp_fd
13488360efbdSAlfred Perlsteinis the transport's socket descriptor, and
134923601548SRuslan Ermilov.Fa xprt\->xp_port
13508360efbdSAlfred Perlsteinis the transport's port number.
13518360efbdSAlfred PerlsteinThis routine returns
135223601548SRuslan Ermilov.Dv NULL
135323601548SRuslan Ermilovif it fails.
135423601548SRuslan ErmilovSince
135523601548SRuslan Ermilov.Tn TCP Ns \-based
135623601548SRuslan Ermilov.Tn RPC
13578360efbdSAlfred Perlsteinuses buffered
135823601548SRuslan Ermilov.Tn I/O ,
13598360efbdSAlfred Perlsteinusers may specify the size of buffers; values of zero
13608360efbdSAlfred Perlsteinchoose suitable defaults.
136123601548SRuslan Ermilov.Pp
136223601548SRuslan Ermilov.It Xo
136323601548SRuslan Ermilov.Ft "SVCXPRT *"
136423601548SRuslan Ermilov.Xc
136523601548SRuslan Ermilov.It Xo
136623601548SRuslan Ermilov.Fn svcfd_create "int fd" "u_int sendsize" "u_int recvsize"
136723601548SRuslan Ermilov.Xc
136823601548SRuslan Ermilov.Pp
136923601548SRuslan ErmilovCreate a service on top of any open descriptor.
137023601548SRuslan ErmilovTypically,
13718360efbdSAlfred Perlsteinthis
13728360efbdSAlfred Perlsteindescriptor is a connected socket for a stream protocol such
13738360efbdSAlfred Perlsteinas
137423601548SRuslan Ermilov.Tn TCP .
137523601548SRuslan Ermilov.Fa sendsize
13768360efbdSAlfred Perlsteinand
137723601548SRuslan Ermilov.Fa recvsize
137823601548SRuslan Ermilovindicate sizes for the send and receive buffers.
137923601548SRuslan ErmilovIf they are
13808360efbdSAlfred Perlsteinzero, a reasonable default is chosen.
138123601548SRuslan Ermilov.Pp
138223601548SRuslan Ermilov.It Xo
138323601548SRuslan Ermilov.Ft "SVCXPRT *"
138423601548SRuslan Ermilov.Xc
138523601548SRuslan Ermilov.It Xo
138623601548SRuslan Ermilov.Fn svcudp_bufcreate "int sock" "u_int sendsize" "u_int recvsize"
138723601548SRuslan Ermilov.Xc
138823601548SRuslan Ermilov.Pp
13898360efbdSAlfred PerlsteinThis routine creates a
139023601548SRuslan Ermilov.Tn UDP/IP Ns \-based
139123601548SRuslan Ermilov.Tn RPC
13928360efbdSAlfred Perlsteinservice transport, to which it returns a pointer.
13938360efbdSAlfred PerlsteinThe transport is associated with the socket
139423601548SRuslan Ermilov.Fa sock ,
13958360efbdSAlfred Perlsteinwhich may be
139623601548SRuslan Ermilov.Dv RPC_ANYSOCK ,
13978360efbdSAlfred Perlsteinin which case a new socket is created.
13988360efbdSAlfred PerlsteinIf the socket is not bound to a local
139923601548SRuslan Ermilov.Tn UDP
140023601548SRuslan Ermilovport, then this routine binds it to an arbitrary port.
140123601548SRuslan ErmilovUpon
14028360efbdSAlfred Perlsteincompletion,
140323601548SRuslan Ermilov.Fa xprt\->xp_fd
14048360efbdSAlfred Perlsteinis the transport's socket descriptor, and
140523601548SRuslan Ermilov.Fa xprt\->xp_port
14068360efbdSAlfred Perlsteinis the transport's port number.
14078360efbdSAlfred PerlsteinThis routine returns
140823601548SRuslan Ermilov.Dv NULL
14098360efbdSAlfred Perlsteinif it fails.
141023601548SRuslan Ermilov.Pp
14118360efbdSAlfred PerlsteinThis allows the user to specify the maximum packet size for sending and
14128360efbdSAlfred Perlsteinreceiving
141323601548SRuslan Ermilov.Tn UDP Ns \-based
141423601548SRuslan Ermilov.Tn RPC
141523601548SRuslan Ermilovmessages.
141623601548SRuslan Ermilov.Pp
141723601548SRuslan Ermilov.It Xo
141823601548SRuslan Ermilov.Ft bool_t
141923601548SRuslan Ermilov.Fn xdr_accepted_reply "XDR *xdrs" "struct accepted_reply *ar"
142023601548SRuslan Ermilov.Xc
142123601548SRuslan Ermilov.Pp
14228360efbdSAlfred PerlsteinUsed for encoding
142323601548SRuslan Ermilov.Tn RPC
142423601548SRuslan Ermilovreply messages.
142523601548SRuslan ErmilovThis routine is useful for users who
14268360efbdSAlfred Perlsteinwish to generate
142723601548SRuslan Ermilov.Tn RPC Ns \-style
14288360efbdSAlfred Perlsteinmessages without using the
142923601548SRuslan Ermilov.Tn RPC
14308360efbdSAlfred Perlsteinpackage.
143123601548SRuslan Ermilov.Pp
143223601548SRuslan Ermilov.It Xo
143323601548SRuslan Ermilov.Ft bool_t
143423601548SRuslan Ermilov.Fn xdr_authunix_parms "XDR *xdrs" "struct authunix_parms *aupp"
143523601548SRuslan Ermilov.Xc
143623601548SRuslan Ermilov.Pp
14378360efbdSAlfred PerlsteinUsed for describing
143823601548SRuslan Ermilov.Ux
143923601548SRuslan Ermilovcredentials.
144023601548SRuslan ErmilovThis routine is useful for users
14418360efbdSAlfred Perlsteinwho wish to generate these credentials without using the
144223601548SRuslan Ermilov.Tn RPC
14438360efbdSAlfred Perlsteinauthentication package.
144423601548SRuslan Ermilov.Pp
144523601548SRuslan Ermilov.It Xo
144623601548SRuslan Ermilov.Ft void
144723601548SRuslan Ermilov.Xc
144823601548SRuslan Ermilov.It Xo
144923601548SRuslan Ermilov.Ft bool_t
145023601548SRuslan Ermilov.Fn xdr_callhdr "XDR *xdrs" "struct rpc_msg *chdr"
145123601548SRuslan Ermilov.Xc
145223601548SRuslan Ermilov.Pp
14538360efbdSAlfred PerlsteinUsed for describing
145423601548SRuslan Ermilov.Tn RPC
14558360efbdSAlfred Perlsteincall header messages.
14568360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
145723601548SRuslan Ermilov.Tn RPC Ns \-style
14588360efbdSAlfred Perlsteinmessages without using the
145923601548SRuslan Ermilov.Tn RPC
14608360efbdSAlfred Perlsteinpackage.
146123601548SRuslan Ermilov.Pp
146223601548SRuslan Ermilov.It Xo
146323601548SRuslan Ermilov.Ft bool_t
146423601548SRuslan Ermilov.Fn xdr_callmsg "XDR *xdrs" "struct rpc_msg *cmsg"
146523601548SRuslan Ermilov.Xc
146623601548SRuslan Ermilov.Pp
14678360efbdSAlfred PerlsteinUsed for describing
146823601548SRuslan Ermilov.Tn RPC
14698360efbdSAlfred Perlsteincall messages.
14708360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
147123601548SRuslan Ermilov.Tn RPC Ns \-style
14728360efbdSAlfred Perlsteinmessages without using the
147323601548SRuslan Ermilov.Tn RPC
14748360efbdSAlfred Perlsteinpackage.
147523601548SRuslan Ermilov.Pp
147623601548SRuslan Ermilov.It Xo
147723601548SRuslan Ermilov.Ft bool_t
147823601548SRuslan Ermilov.Fn xdr_opaque_auth "XDR *xdrs" "struct opaque_auth *ap"
147923601548SRuslan Ermilov.Xc
148023601548SRuslan Ermilov.Pp
14818360efbdSAlfred PerlsteinUsed for describing
148223601548SRuslan Ermilov.Tn RPC
14838360efbdSAlfred Perlsteinauthentication information messages.
14848360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
148523601548SRuslan Ermilov.Tn RPC Ns \-style
14868360efbdSAlfred Perlsteinmessages without using the
148723601548SRuslan Ermilov.Tn RPC
14888360efbdSAlfred Perlsteinpackage.
148923601548SRuslan Ermilov.Pp
149023601548SRuslan Ermilov.It Xo
149123601548SRuslan Ermilov.Vt struct pmap ;
149223601548SRuslan Ermilov.Xc
149323601548SRuslan Ermilov.It Xo
149423601548SRuslan Ermilov.Ft bool_t
149523601548SRuslan Ermilov.Fn xdr_pmap "XDR *xdrs" "struct pmap *regs"
149623601548SRuslan Ermilov.Xc
149723601548SRuslan Ermilov.Pp
14988360efbdSAlfred PerlsteinUsed for describing parameters to various
14998657581bSMaxim Sobolev.Xr rpcbind 8
15008360efbdSAlfred Perlsteinprocedures, externally.
15018360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
15028360efbdSAlfred Perlsteinthese parameters without using the
150323601548SRuslan Ermilov.Fn pmap_*
15048360efbdSAlfred Perlsteininterface.
150523601548SRuslan Ermilov.Pp
150623601548SRuslan Ermilov.It Xo
150723601548SRuslan Ermilov.Ft bool_t
150823601548SRuslan Ermilov.Fn xdr_pmaplist "XDR *xdrs" "struct pmaplist **rp"
150923601548SRuslan Ermilov.Xc
151023601548SRuslan Ermilov.Pp
15118360efbdSAlfred PerlsteinUsed for describing a list of port mappings, externally.
15128360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
15138360efbdSAlfred Perlsteinthese parameters without using the
151423601548SRuslan Ermilov.Fn pmap_*
15158360efbdSAlfred Perlsteininterface.
151623601548SRuslan Ermilov.Pp
151723601548SRuslan Ermilov.It Xo
151823601548SRuslan Ermilov.Ft bool_t
151923601548SRuslan Ermilov.Fn xdr_rejected_reply "XDR *xdrs" "struct rejected_reply *rr"
152023601548SRuslan Ermilov.Xc
152123601548SRuslan Ermilov.Pp
15228360efbdSAlfred PerlsteinUsed for describing
152323601548SRuslan Ermilov.Tn RPC
15248360efbdSAlfred Perlsteinreply messages.
15258360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
152623601548SRuslan Ermilov.Tn RPC Ns \-style
15278360efbdSAlfred Perlsteinmessages without using the
152823601548SRuslan Ermilov.Tn RPC
15298360efbdSAlfred Perlsteinpackage.
153023601548SRuslan Ermilov.Pp
153123601548SRuslan Ermilov.It Xo
153223601548SRuslan Ermilov.Ft bool_t
153323601548SRuslan Ermilov.Fn xdr_replymsg "XDR *xdrs" "struct rpc_msg *rmsg"
153423601548SRuslan Ermilov.Xc
153523601548SRuslan Ermilov.Pp
15368360efbdSAlfred PerlsteinUsed for describing
153723601548SRuslan Ermilov.Tn RPC
15388360efbdSAlfred Perlsteinreply messages.
15398360efbdSAlfred PerlsteinThis routine is useful for users who wish to generate
154023601548SRuslan Ermilov.Tn RPC
15418360efbdSAlfred Perlsteinstyle messages without using the
154223601548SRuslan Ermilov.Tn RPC
15438360efbdSAlfred Perlsteinpackage.
154423601548SRuslan Ermilov.Pp
154523601548SRuslan Ermilov.It Xo
154623601548SRuslan Ermilov.Ft void
154723601548SRuslan Ermilov.Xc
154823601548SRuslan Ermilov.It Xo
154923601548SRuslan Ermilov.Fn xprt_register "SVCXPRT *xprt"
155023601548SRuslan Ermilov.Xc
155123601548SRuslan Ermilov.Pp
15528360efbdSAlfred PerlsteinAfter
155323601548SRuslan Ermilov.Tn RPC
15548360efbdSAlfred Perlsteinservice transport handles are created,
15558360efbdSAlfred Perlsteinthey should register themselves with the
155623601548SRuslan Ermilov.Tn RPC
15578360efbdSAlfred Perlsteinservice package.
15588360efbdSAlfred PerlsteinThis routine modifies the global variable
155923601548SRuslan Ermilov.Va svc_fds .
15608360efbdSAlfred PerlsteinService implementors usually do not need this routine.
156123601548SRuslan Ermilov.Pp
156223601548SRuslan Ermilov.It Xo
156323601548SRuslan Ermilov.Ft void
156423601548SRuslan Ermilov.Xc
156523601548SRuslan Ermilov.It Xo
156623601548SRuslan Ermilov.Fn xprt_unregister "SVCXPRT *xprt"
156723601548SRuslan Ermilov.Xc
156823601548SRuslan Ermilov.Pp
15698360efbdSAlfred PerlsteinBefore an
157023601548SRuslan Ermilov.Tn RPC
15718360efbdSAlfred Perlsteinservice transport handle is destroyed,
15728360efbdSAlfred Perlsteinit should unregister itself with the
157323601548SRuslan Ermilov.Tn RPC
15748360efbdSAlfred Perlsteinservice package.
15758360efbdSAlfred PerlsteinThis routine modifies the global variable
157623601548SRuslan Ermilov.Va svc_fds .
15778360efbdSAlfred PerlsteinService implementors usually do not need this routine.
157823601548SRuslan Ermilov.El
157923601548SRuslan Ermilov.Sh SEE ALSO
158023601548SRuslan Ermilov.Xr rpc_secure 3 ,
158123601548SRuslan Ermilov.Xr xdr 3
158223601548SRuslan Ermilov.Rs
158323601548SRuslan Ermilov.%T "Remote Procedure Calls: Protocol Specification"
158423601548SRuslan Ermilov.Re
158523601548SRuslan Ermilov.Rs
158623601548SRuslan Ermilov.%T "Remote Procedure Call Programming Guide"
158723601548SRuslan Ermilov.Re
158823601548SRuslan Ermilov.Rs
158923601548SRuslan Ermilov.%T "rpcgen Programming Guide"
159023601548SRuslan Ermilov.Re
159123601548SRuslan Ermilov.Rs
159223601548SRuslan Ermilov.%T "RPC: Remote Procedure Call Protocol Specification"
159323601548SRuslan Ermilov.%O RFC1050
159423601548SRuslan Ermilov.%Q "Sun Microsystems, Inc., USC-ISI"
159523601548SRuslan Ermilov.Re
1596