📄 pmap_getmaps.c
字号:
#if !defined(lint) && defined(SCCSIDS)static char sccsid[] = "@(#)pmap_getmaps.c 1.1 92/07/30 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 <rpc/rpc.h>#include <rpc/pmap_prot.h>#include <rpc/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>#include <sys/syslog.h>#define NAMELEN 255#define MAX_BROADCAST_SIZE 1400extern int errno;/* * 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) { (void) syslog(LOG_ERR, clnt_sperror(client, "pmap_getmaps rpc problem")); } CLNT_DESTROY(client); } (void)close(socket); address->sin_port = 0; return (head);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -