home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Id: pmap_getmaps.c,v 4.2 1994/09/29 23:48:50 jraja Exp $
- *
- * Client interface to pmap rpc service.
- * Contains pmap_getmaps(), which is only tcp service involved
- *
- * Copyright © 1994 AmiTCP/IP Group,
- * Network Solutions Development Inc.
- * All rights reserved.
- */
-
- /* @(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC */
- #if !defined(lint) && defined(SCCSIDS)
- static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
- #endif
-
- /*
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
- #include <sys/param.h>
- #include <rpc/rpc.h>
- #include <rpc/pmap_prot.h>
- #include <rpc/pmap_clnt.h>
- #include <sys/socket.h>
- #include <netdb.h>
- #include <stdio.h>
- #include <errno.h>
- #include <net/if.h>
- #include <sys/ioctl.h>
- #define NAMELEN 255
- #define MAX_BROADCAST_SIZE 1400
-
- /*
- * Get a copy of the current port maps.
- * Calls the pmap service remotely to do get the maps.
- */
- struct pmaplist *
- pmap_getmaps(address)
- struct sockaddr_in *address;
- {
- struct pmaplist *head = (struct pmaplist *)NULL;
- int socket = -1;
- struct timeval minutetimeout;
- register CLIENT *client;
-
- minutetimeout.tv_sec = 60;
- minutetimeout.tv_usec = 0;
- address->sin_port = htons(PMAPPORT);
- client = clnttcp_create(address, PMAPPROG,
- PMAPVERS, &socket, 50, 500);
- if (client != (CLIENT *)NULL) {
- if (CLNT_CALL(client, PMAPPROC_DUMP, xdr_void, NULL, xdr_pmaplist,
- &head, minutetimeout) != RPC_SUCCESS) {
- clnt_perror(client, "pmap_getmaps rpc problem");
- }
- CLNT_DESTROY(client);
- }
- #ifdef AMITCP
- (void)CloseSocket(socket);
- #else
- (void)close(socket);
- #endif
- address->sin_port = 0;
- return (head);
- }
-