#ifndef lint static char rcs_id[] = {"$Header: pmap_getmaps.c,v 1.1 86/09/05 09:16:52 tadl Exp $"}; #endif not lint /* * RCS Info * $Locker: tadl $ */ /* NFSSRC @(#)pmap_getmaps.c 2.1 86/04/14 */ #ifndef lint static char sccsid[] = "@(#)pmap_getmaps.c 1.1 86/02/03 Copyr 1984 Sun Micro"; #endif /* * pmap_getmap.c * Client interface to pmap rpc service. * contains pmap_getmaps, which is only tcp service involved * * Copyright (C) 1984, Sun Microsystems, Inc. */ #include "types.h" #include <netinet/in.h> #include "xdr.h" #include "auth.h" #include "clnt.h" #include "rpc_msg.h" #include "pmap_prot.h" #include "pmap_clnt.h" #include <sys/socket.h> #include <sys/time.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 extern int errno; static struct sockaddr_in myaddress; /* * 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); } (void)close(socket); address->sin_port = 0; return (head); }