/* This file is part of the Project Athena Zephyr Notification System. * It contains the ZhmStat() function. * Created by: Marc Horowitz * Copyright (c) 1996 by the Massachusetts Institute of Technology. * For copying and distribution information, see the file #define INADDR_LOOPBACK 0x7f000001 Code_t ZhmStat(hostaddr, notice) struct in_addr *hostaddr; (void) memset((char *)&sin, 0, sizeof(struct sockaddr_in)); sp = getservbyname(HM_SVCNAME, "udp"); sin.sin_port = (sp) ? sp->s_port : HM_SVC_FALLBACK; sin.sin_family = AF_INET; sin.sin_addr = *hostaddr; sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); (void) memset((char *)&req, 0, sizeof(req)); req.z_class = HM_STAT_CLASS; req.z_class_inst = HM_STAT_CLIENT; req.z_opcode = HM_GIMMESTATS; req.z_default_format = ""; if ((code = ZSetDestAddr(&sin)) != ZERR_NONE) if ((code = ZSendNotice(&req, ZNOAUTH)) != ZERR_NONE) /* Wait up to ten seconds for a response. */ FD_SET(ZGetFD(), &readers); code = select(ZGetFD() + 1, &readers, NULL, NULL, &tv); if (code < 0 && errno != EINTR) if (code == 0 || (code < 0 && errno == EINTR) || ZPending() == 0) return(ZReceiveNotice(notice, (struct sockaddr_in *) 0));