The pmap_getmaps() call returns a list of current program-to-port mappings on a specified remote host's Portmapper.
Syntax
#include <rpc\rpc.h> struct pmaplist * pmap_getmaps(addr) struct sockaddr_in *addr;
Parameters
addr
Description
The pmap_getmaps() call returns a list of current program-to-port mappings on the remote host's Portmapper specified by addr.
Examples
struct hostent *hp;struct sockaddr_in pmapper_addr;
struct pmaplist *my_pmaplist = NULL;
if ((hp = gethostbyname("PMAP_HOST") == NULL)
{
fprintf(stderr,"Can't get address for %s\n","PMAP_HOST");
exit (-1);
}
bcopy(hp->h_addr, (caddr_t)&pmapper_addr.sin_addr.s_addr, hp->h_length);
pmapper_addr.sin_family = AF_INET;
pmapper_addr.sin_port = 0;
/*
* get the list of program, version, protocol and port number
* from remote portmapper
*
* struct pmap {
* long unsigned pm_prog;
* long unsigned pm_vers;
* long unsigned pm_prot;
* long unsigned pm_port;
* };
* struct pmaplist {
* struct pmap pml_map;
* struct pmaplist *pml_next;
* };
*/
my_pmaplist = pmap_getmaps(&pmapper_addr);
...
Related Calls