rpc_misc, auth_destroy, authnone_create, authunix_create,
authunix_create_default, get_myaddress, getnetname,
host2netname, netname2host, netname2user, pmap_getmaps,
pmap_getport, pmap_rmtcall, pmap_set, pmap_unset, registerrpc,
rpc_createrr, usr2netname, xprt_register,
xprt_unregister - miscellaneous library routines for ONC
remote procedure calls
#include <rpc/rpc.h>
void auth_destroy(
AUTH *auth ); AUTH *authnone_create(
void ); AUTH *authunix_create(
char *host,
int uid,
int gid,
int len,
int *aup.gids ); AUTH *authunix_create_default(
void ); void get_myaddress(
struct sockaddr_in *addr ); getnetname(
char name [MAXNETNAMELEN] ); host2netname(
char *name,
char *host,
char *domain ); netname2host(
char *name,
char *host,
int hostlen ); netname2user(
char **name,
int *uidp,
int *gidp,
int *gidlenp,
int *gidlist ); struct pmaplist *pmap_getmaps(
struct sockaddr_in *addr ); u_short pmap_getport(
struct sockaddr_in *addr,
u_int prognum,
u_int versnum,
u_int protocol ); enum clnt_stat pmap_rmtcall(
struct sockaddr_in *addr,
u_int prognum,
u_int versnum,
u_int procnum,
xdrproc_t inproc,
char *in,
xdrproc_t outproc,
char *out,
struct timeval tout,
u_int *portp ); pmap_set(
u_int prognum,
u_int versnum,
u_int protocol,
u_short port ); pmap_unset(
u_int prognum,
u_int versnum ); registerrpc(
u_int prognum,
u_int versnum,
u_int procnum,
char *(*procname) (),
xdrproc_t inproc,
xdrproc_t outproc ); struct rpc_createerr rpc_createerr;
user2netname(
char *name,
int uid,
char *domain ); void xprt_register(
SVCXPRT *xprt ); void xprt_unregister(
SVCXPRT *xprt );
The RPC routines allow C programs to make procedure calls
on other machines across the network. First, the client
calls a procedure to send a data packet to the server.
Upon receipt of the packet, the server calls a dispatch
routine to perform the requested service, and then sends
back a reply. Finally, the procedure call returns to the
client.
Unless otherwise indicated, the routines described in this
reference page are thread safe (that is, they can be used
safely in a multithreaded environment). Routines that are
not thread safe are flagged as such.
A macro that destroys the authentication information associated
with auth. Destruction usually involves deallocation
of private data structures. The use of auth is undefined
after calling auth_destroy(). Creates and returns
an RPC authentication handle that passes nonusable authentication
information with each remote procedure call. This
is the default authentication used by ONC RPC. Creates
and returns an ONC RPC authentication handle that contains
authentication information. The host parameter is the name
of the machine on which the information was created; uid
is the user's user ID; gid is the user's current group ID;
len and aup_gids refer to a counted array of groups to
which the user belongs. Calls authunix_create() with the
appropriate parameters. Places the machine's IP address
into *addr, without consulting the library routines that
deal with /etc/hosts. The port number is always set to
htons(PMAPPORT). Installs the unique, operating-system
independent network name of the caller in the fixed-length
array name. Returns TRUE if it succeeds and FALSE if it
fails. Converts from a domain-specific host name to an
operating-system independent network name. Return TRUE if
it succeeds and FALSE if it fails. Inverse of netname2host().
Converts from an operating-system independent
network name to a domain-specific host name. Returns
TRUE if it succeeds and FALSE if it fails. Inverse of
host2netname(). Converts from an operating-system independent
network name to a domain-specific user ID. Returns
TRUE if it succeeds and FALSE if it fails. Inverse of
user2netname(). A user interface to the portmap service,
which returns a list of the current RPC program-to-port
mappings on the host located at IP address *addr. This
routine can return NULL. The rpcinfo -p command uses this
routine. A user interface to the portmap service, which
returns the port number on which waits a service that supports
program number prognum, version versnum, and speaks
the transport protocol associated with protocol. The
value of protocol is most likely IPPROTO_UDP or
IPPROTO_TCP. A return value of zero means that the mapping
does not exist or that the RPC system failed to contact
the remote portmap service. In the latter case, the global
variable rpc_createerr contains the RPC status. A user
interface to the portmap service, which instructs portmap
on the host at IP address *addr to make an RPC call on
your behalf to a procedure on that host. The *portp parameter
will be modified to the program's port number if the
procedure succeeds. The definitions of other parameters
are provided in callrpc() and clnt_call() (see
rpc_clnt(3)). This procedure should be used for a ping and
nothing else. See also clnt_broadcast(). A user interface
to the portmap service, which establishes a mapping
between the triple [prognum,versnum,protocol] and port on
the machine's portmap service. The value of protocol can
be either IPPROTO_UDP or IPPROTO_TCP. This routine returns
one (1) if it succeeds, zero (0) otherwise. Automatically
done by svc_register(). A user interface to the portmap
service, which destroys all mapping between the triple
[prognum,versnum,*] and ports on the machine's portmap
service. This routine returns one (1) if it succeeds, zero
(0) otherwise. [Not Thread Safe] Registers procname procedure
with the RPC service package. If a request arrives
for prognum program, versnum version, and procnum procedure,
procname is called with a pointer to its parameter(s);
progname should return a pointer to its static
result(s); inproc is used to decode the parameters while
outproc is used to encode the results. This routine
returns zero (0) if the registration succeeded, -1 otherwise.
Warning: Remote procedures registered in this form
are accessed using the UDP/IP transport; see
svcudp_create() for restrictions. A global variable
whose value is set by any RPC client creation
routine that does not succeed. Use the clnt_pcreateerror()
routine to print the reason for the
error. Converts from a domain-specific user name
to an operating-system independent network name.
Returns TRUE if it succeeds and FALSE if it fails.
Inverse of netname2user(). [Not Thread
Safe] After RPC service transport handles are created,
they should register themselves with the RPC
service package. This routine modifies the global
variable svc_fds. Service implementors usually do
not need this routine. [Not Thread Safe] Before
an RPC service transport handle is destroyed, it
should unregister itself with the RPC service package.
This routine modifies the global variable
svc_fds. Service implementors usually do not need
this routine.
rpc_clnt(3), rpc_svc(3), rpc_xdr(3), xdr(3)
Remote Procedure Calls: Protocol Specification -- RFC 1050
rpc_misc(3)
[ Back ] |