These routines allow client C programs to make procedure calls to the RPC binder service. portmap.1 maintains a list of mappings between programs and their universal addresses.
#include <rpc/rpc.h>
struct pmaplist * pmap_getmaps(addr) struct sockaddr_in *addr;
Return a list of the current
RPC
program-to-address mappings
on the host located at
IP
address
*addr.
This routine returns
NULL
if the remote portmap service could not be contacted.
The command
`rpcinfo -p'
uses this routine
(see
rpcinfo.8c
u_short pmap_getport(addr, prognum, versnum, protocol) struct sockaddr_in *addr; u_long prognum, versnum, protocol;
Return the port number
on which waits a service that supports program number
prognum,
version
versnum,
and speaks the transport protocol
protocol.
The address is returned in
addr,
which should be preallocated.
The value of
protocol
can be either
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_createer
(see
rpc_clnt_create.3n
contains the
RPC
status.
If the requested version number is not registered, but
at least a version number is registered for the given program
number, the call returns a port number.
Note:
pmap_getport()
returns the port number in host byte order.
Some other network routines may require
the port number in network byte order.
For example, if the port number is used as part of the
sockaddr_in
structure,
then it should be converted to
network byte order using
htons.3n
enum clnt_stat pmap_rmtcall(addr, prognum, versnum, procnum, inproc, in, outproc, out, timeout, portp) struct sockaddr_in *addr; u_long prognum, versnum, procnum; char *in, *out; xdrproc_t inproc, outproc; struct timeval timeout; u_long *portp;
Request that the portmap on the host at IP address *addr make an RPC on the behalf of the caller to a procedure on that host. *portp is modified to the program's port number if the procedure succeeds. The definitions of other parameters are discussed in callrpc() and clnt_call() (see rpc_clnt_calls.3n
Warning:
If the requested remote procedure is not registered with the
remote
portmap
then no error response is returned and the call times out.
Also, no authentication is done.
bool_t pmap_set(prognum, versnum, protocol, port) u_long prognum, versnum; int protocol; u_short port;
Registers a mapping between the triple
[prognum,versnum,protocol]
and
port
on the local machine's
portmap
service. The value of
protocol
can be either
IPPROTO_UDP
or
IPPROTO_TCP.
This routine returns
TRUE
if it succeeds,
FALSE
otherwise.
It is called by servers to register themselves with the local
portmap.
Automatically done by
svc_register().
bool_t pmap_unset(prognum, versnum) u_long prognum, versnum;
Deregisters all mappings between the triple
[prognum,versnum,*]
and ports
on the local machine's
portmap
service.
It is called by servers to deregister themselves with the local
portmap.
This routine returns
TRUE
if it succeeds,
FALSE
otherwise.
bool_t xdr_pmap(xdrs, regp) XDR *xdrs; struct pmap *regp;
Used for creating parameters to various
portmap
procedures, externally.
This routine is useful for users who wish to generate
these parameters without using the
pmap
interface.
This routine returns
TRUE
if it succeeds,
FALSE
otherwise.
bool_t xdr_pmaplist(xdrs, rp) XDR *xdrs; struct pmaplist **rp;
Used for creating a list of port mappings, externally.
This routine is useful for users who wish to generate
these parameters without using the
pmap
interface.
This routine returns
TRUE
if it succeeds,
FALSE
otherwise.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97