Back to index

glibc  2.9
pm_getmaps.c File Reference
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdio.h>
#include <errno.h>
#include <libintl.h>
#include <unistd.h>

Go to the source code of this file.


struct pmaplistpmap_getmaps (struct sockaddr_in *address)

Function Documentation

struct pmaplist* pmap_getmaps ( struct sockaddr_in address) [read]

Definition at line 59 of file pm_getmaps.c.

  struct pmaplist *head = (struct pmaplist *) NULL;
  struct timeval minutetimeout;
  CLIENT *client;
  bool closeit = false;

  minutetimeout.tv_sec = 60;
  minutetimeout.tv_usec = 0;
  address->sin_port = htons (PMAPPORT);

  /* Don't need a reserved port to get ports from the portmapper.  */
  int socket = __get_socket (address);
  if (socket != -1)
    closeit = true;

  client = INTUSE(clnttcp_create) (address, PMAPPROG,
                               PMAPVERS, &socket, 50, 500);
  if (client != (CLIENT *) NULL)
      if (CLNT_CALL (client, PMAPPROC_DUMP, (xdrproc_t)INTUSE(xdr_void), NULL,
                   (xdrproc_t)INTUSE(xdr_pmaplist), (caddr_t)&head,
                   minutetimeout) != RPC_SUCCESS)
         clnt_perror (client, _("pmap_getmaps.c: rpc problem"));
      CLNT_DESTROY (client);
  /* We only need to close the socket here if we opened  it.  */
  if (closeit)
    (void) __close (socket);
  address->sin_port = 0;
  return head;

Here is the call graph for this function: