/* This file is part of the Project Athena Zephyr Notification System. * It contains source for the ZRetrieveSubscriptions function. * * Created by: Robert French * * $Source$ * $Author$ * * Copyright (c) 1987 by the Massachusetts Institute of Technology. * For copying and distribution information, see the file * "mit-copyright.h". */ /* $Header$ */ #include #include Code_t ZRetrieveSubscriptions(port,nsubs) u_short port; int *nsubs; { int subscription_pred(); int i,retval; ZNotice_t notice,retnotice; ZPacket_t buffer; char *ptr,*end; retval = ZFlushSubscriptions(); if (retval != ZERR_NONE && retval != ZERR_NOSUBSCRIPTIONS) return (retval); notice.z_kind = ACKED; notice.z_port = port; notice.z_class = ZEPHYR_CTL_CLASS; notice.z_class_inst = ZEPHYR_CTL_CLIENT; notice.z_opcode = CLIENT_GIMMESUBS; notice.z_sender = 0; notice.z_recipient = ""; notice.z_message_len = 0; if ((retval = ZSendNotice(¬ice,ZAUTH)) != ZERR_NONE) return (retval); if ((retval = Z_NoAuthIfNotice(buffer,sizeof buffer,&retnotice, ZCompareUIDPred,(char *)¬ice.z_uid)) != ZERR_NONE) return (retval); if (retnotice.z_kind == SERVNAK) return (ZERR_SERVNAK); if (retnotice.z_kind != SERVACK) return (ZERR_INTERNAL); end = retnotice.z_message+retnotice.z_message_len; __subscriptions_num = 0; for (ptr=retnotice.z_message;ptr