/* 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$ */ #ifndef lint static char rcsid_ZRetrieveSubscriptions_c[] = "$Header$"; #endif lint #include #include #define MAXSUBPACKETS 200 /* If a person has more than 1000 * subscriptions, he loses! */ #ifdef notdef Code_t ZRetrieveSubscriptions(port,nsubs) u_short port; int *nsubs; { int subscription_pred(); int i,retval,nrecv,totalrecv,npacket,thispacket,returncode,gimmeack; ZNotice_t notice,retnotice; ZPacket_t buffer; char *ptr,*end,*ptr2; char subs_recvd[MAXSUBPACKETS],asciiport[50]; retval = ZFlushSubscriptions(); if (retval != ZERR_NONE && retval != ZERR_NOSUBSCRIPTIONS) return (retval); notice.z_kind = ACKED; notice.z_port = 0; 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_default_format = 0; notice.z_message = asciiport; if ((retval = ZMakeAscii(asciiport,sizeof(asciiport), (unsigned char *)&port, sizeof(u_short))) != ZERR_NONE) return (retval); notice.z_message_len = strlen(asciiport)+1; if ((retval = ZSendNotice(¬ice,ZAUTH)) != ZERR_NONE) return (retval); for (i=0;i MAXSUBPACKETS) { returncode = ZERR_TOOMANYSUBS; totalrecv = MAXSUBPACKETS; } thispacket = atoi(retnotice.z_opcode); if (thispacket > MAXSUBPACKETS) continue; if (subs_recvd[thispacket] == 'y') continue; subs_recvd[thispacket] = 'y'; nrecv++; end = retnotice.z_message+retnotice.z_message_len; npacket = 0; for (ptr=retnotice.z_message;ptr