home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / comm / tcp / amitcp-sdk / src / rpclib / pmap_getmaps.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-29  |  1.6 KB  |  67 lines

  1. /*
  2.  *      $Id: pmap_getmaps.c,v 4.2 1994/09/29 23:48:50 jraja Exp $
  3.  *
  4.  *      Client interface to pmap rpc service.
  5.  *      Contains pmap_getmaps(), which is only tcp service involved
  6.  *
  7.  *      Copyright © 1994 AmiTCP/IP Group,
  8.  *                       Network Solutions Development Inc.
  9.  *                       All rights reserved. 
  10.  */
  11.  
  12. /* @(#)pmap_getmaps.c    2.2 88/08/01 4.0 RPCSRC */
  13. #if !defined(lint) && defined(SCCSIDS)
  14. static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
  15. #endif
  16.  
  17. /*
  18.  * Copyright (C) 1984, Sun Microsystems, Inc.
  19.  */
  20.  
  21. #include <sys/param.h>
  22. #include <rpc/rpc.h>
  23. #include <rpc/pmap_prot.h>
  24. #include <rpc/pmap_clnt.h>
  25. #include <sys/socket.h>
  26. #include <netdb.h>
  27. #include <stdio.h>
  28. #include <errno.h>
  29. #include <net/if.h>
  30. #include <sys/ioctl.h>
  31. #define NAMELEN 255
  32. #define MAX_BROADCAST_SIZE 1400
  33.  
  34. /*
  35.  * Get a copy of the current port maps.
  36.  * Calls the pmap service remotely to do get the maps.
  37.  */
  38. struct pmaplist *
  39. pmap_getmaps(address)
  40.      struct sockaddr_in *address;
  41. {
  42.     struct pmaplist *head = (struct pmaplist *)NULL;
  43.     int socket = -1;
  44.     struct timeval minutetimeout;
  45.     register CLIENT *client;
  46.  
  47.     minutetimeout.tv_sec = 60;
  48.     minutetimeout.tv_usec = 0;
  49.     address->sin_port = htons(PMAPPORT);
  50.     client = clnttcp_create(address, PMAPPROG,
  51.         PMAPVERS, &socket, 50, 500);
  52.     if (client != (CLIENT *)NULL) {
  53.         if (CLNT_CALL(client, PMAPPROC_DUMP, xdr_void, NULL, xdr_pmaplist,
  54.             &head, minutetimeout) != RPC_SUCCESS) {
  55.             clnt_perror(client, "pmap_getmaps rpc problem");
  56.         }
  57.         CLNT_DESTROY(client);
  58.     }
  59. #ifdef AMITCP
  60.     (void)CloseSocket(socket);
  61. #else
  62.     (void)close(socket);
  63. #endif
  64.     address->sin_port = 0;
  65.     return (head);
  66. }
  67.