Portmapper routines allow C programs to access the Portmapper network service. Important: In order to maintain uniqueness for the OpenVMS HELP utility, some XDR routines have a "_#" appended at the end. Do not use the "_#" when coding the routine in a program.
1 – pmap_getmaps_#
Returns a copy of the current port mappings on a remote host. Format #include <rpc/pmap_clnt.h> struct pmaplist *pmap_getmaps(struct sockaddr_in *addr);
1.1 – Arguments
addr A pointer to a sockaddr_in structure containing the Internet address of the host whose Portmapper you want to call.
1.2 – Description
A client interface to the Portmapper, which returns a list of the current ONC RPC program-to-port mappings on the host located at the Internet address addr. The SHOW PORTMAPPER management command uses this routine.
1.3 – Return Values
struct pmaplist * A pointer to the returned list of server-to- port mappings on host addr. NULL Indicates failure.
2 – pmap_getmaps_vms
Returns a copy of the current port mappings on a remote host running TCP/IP Services software. Format #include <rpc/pmap_clnt.h> struct pmaplist_vms *pmap_getmaps_vms(struct sockaddr_in *addr);
2.1 – Arguments
addr A pointer to a sockaddr_in structure containing the Internet address of the host whose Portmapper you wish to call.
2.2 – Description
This routine is similar to the pmap_getmaps routine. However, pmap_getmaps_vms also returns the process identifiers (PIDs) that are required for mapping requests to TCP/IP Services hosts.
2.3 – Return Values
struct pmaplist * A pointer to the returned list of server-to- port mappings on host addr. NULL Indicates failure.
3 – pmap_getport
Returns the port number on which the specified service is waiting. Format #include <rpc/pmap_clnt.h> u_short pmap_getport(struct sockaddr_in *addr, u_long prognum, u_long versnum, u_long protocol );
3.1 – Arguments
addr A pointer to a sockaddr_in structure containing the Internet address of the host where the remote Portmapper resides. prognum The program number associated with the remote procedure. versnum The version number associated with the remote procedure. protocol The transport protocol that the remote procedure uses. Specify either IPPROTO_UDP or IPPROTO_TCP.
3.2 – Description
A client interface to the Portmapper. This routine returns the port number on which waits a server that supports program number prognum, version versnum, and speaks the transport protocol associated with protocol (IPPROTO_UDP or IPPROTO_TCP). NOTES If the requested version is not available, but at least the requested program is registered, the routine returns a port number. The pmap_getport routine returns the port number in host byte order not network byte order. For certain routines you may need to convert this value to network byte order using the htons routine. For example, the sockaddr_in structure requires that the port number be in network byte order.
3.3 – Return Values
x The port number of the service on the remote system. 0 No mapping exists or RPC could not contact the remote Portmapper service. In the latter case, the global variable rpc_createerr.cf_error contains the ONC RPC status.
4 – pmap_rmtcall
The client interface to the Portmapper service for a remote call and broadcast service. This routine allows a program to do a lookup and call in one step. Format #include <rpc/pmap_clnt.h> enum clnt_stat pmap_rmtcall(struct sockaddr_in *addr, u_long prognum, u_long versnum, u_long procnum, xdrproc_t inproc, char * in xdrproc_t outproc, char * out, struct timeval timeout, u_long *port );
4.1 – Arguments
addr A pointer to a sockaddr_in structure containing the Internet address of the host where the remote Portmapper resides. prognum The program number associated with the remote procedure. versnum The version number associated with the remote procedure. procnum The procedure number associated with the remote procedure. inproc The XDR routine used to encode the remote procedure's arguments. in A pointer to the remote procedure's arguments. outproc The XDR routine used to decode the remote procedure's results. out A pointer to the remote procedure's results. timeout A timeval structure describing the time allowed for the results to return to the client. port A pointer to a location for the returned port number. Modified to the remote program's port number if the pmap_rmtcall routine succeeds.
4.2 – Description
A client interface to the Portmapper, which instructs the Portmapper on the host at the Internet address *addr to make a call on your behalf to a procedure on that host. Use this procedure for a ping operation and nothing else. You can use the clnt_perrno routine to print any error message. NOTE If the requested procedure is not registered with the remote Portmapper, the remote Portmapper does not reply to the request. The call to pmap_rmtcall will eventually time out. The pmap_rmtcall does not perform authentication.
4.3 – Return Values
enum clnt_stat Returns the buffer containing the status of the operation.
5 – pmap_set
Called by the server procedure to have the Portmapper create a mapping of the procedure's program and version number. Format #include <rpc/pmap_clnt.h> bool_t pmap_set(u_long prognum, u_long versnum, u_long protocol, u_short port);
5.1 – Arguments
prognum The program number associated with the server procedure. versnum The version number associated with the server procedure. protocol The transport protocol that the server procedure uses. Specify either IPPROTO_UDP or IPPROTO_TCP. port The port number associated with the server program.
5.2 – Description
A server interface to the Portmapper, which establishes a mapping between the triple [prognum,versnum,protocol] and port on the server's Portmapper service. The svc_register routine calls this routine to register the server with the local Portmapper.
5.3 – Return Values
TRUE Indicates success. FALSE Indicates failure.
6 – pmap_unset
Called by the server procedure to have the Portmapper delete a mapping of the procedure's program and version number. Format #include <rpc/pmap_clnt.h> bool_t pmap_unset(u_long prognum, u_long versnum);
6.1 – Arguments
prognum The program number associated with the server procedure. versnum The version number associated with the server procedure.
6.2 – Description
A server interface to the Portmapper, which destroys all mapping between the triple [prognum, versnum, *] and ports on the local host's Portmapper.
6.3 – Return Values
TRUE Indicates success. FALSE Indicates failure.