/* [file: conference.pr, started: 19-May-98] * * DESCRIPTION * First attempt to specify the TAP Conference Protocol in Promela. * * When running the SPIN verifier, check: * "A full queue looses new messages". * * NOTES * o SOURCE. See the reader [Pires 1997], i.e. * "Protocol Implementation" by Luis Pires, 1995-1997 * for details on the Conference Protocol. * * o NUMBER OF USERS. The current default for the number of users N * is set to 2. You can also set it to 3. Greater values of N are * *not* supported by the current specification. * * Convince yourself that the protocol is working for two users, and * then set N to 3 to test the protocol more thoroughly. * * The following sections are affected by changes of N (these are * all marked with the directive "#if N==2"): * * definition of ASET_ALL * headers of all proctype definitions * proctype MultiCast_PE * startup of processes in init * * !! I KNOW THAT THIS "#if N==2" HACKING IS UGLY. BUT FOR DEBUGGING * !! THE SPECIFICATION IT PROBABLY WILL PROVE USEFUL. FOR THE * !! "TAP TELEMATICA COURSE" THIS HACKING SHOULD BE REMOVED... * * TODO * o LITERATE MODEL. The Promela model of the conference protocol * should be specified as a literate program. * * CHANGES * 98.05.19 ruys Started. * 98.05.26 ruys First version that can be simulated with Spin v3.2.0. * 98.06.03 ruys Changes: * - Several errors have been removed. * - The operations on set of addresses (T_AddressSet) * are now implemented by macros. * - The specification is heavily parameterized by N, * the number of Users. * Currently N can be either 2 or 3. * 98.06.xx ruys Changes: * - TODO: MOST CHANGES NEEDS SOME COMMENTS * - Various optimizations: * - removed redundant parameters from messages * - added atomic clauses * - added xs/xr declarations * - made User() process finite * - Splitted User() process into * UserSend() and UserRecv() process. * 98.08.17 de vries Changes: * - draft version for trojka application * - isolate the protocol entity (multicast + conference) */ /* ------------------------------ constants ------------------------------- */ #define N 3 /* Number of participants to CS */ #define ZZ 0 /* Null message */ /* -------------------------------- macros -------------------------------- */ #define IF if :: #define FI :: else fi /* -------------------------- user defined types -------------------------- */ #define T_Msg byte #define T_Address byte mtype = { JOIN, LEAVE, DREQ, DIND, /* Conference Service - SP's */ MC_DREQ, MC_DIND, /* Multicast Service - SP's */ PDU_JOIN, PDU_LEAVE, PDU_DATA, PDU_ANSWER /* PDU Types */ } ; /* NOTE: The distinction between JOIN and PDU_JOIN, etc. only serves to */ /* make the 'Conf_PE' process more readable. */ /* ----------------------------- T_AddressSet ----------------------------- */ /* T_AddressSet * An T_Address of a SAP (or PE) is modelled by a * byte (i.e. 0, 1, 2, 3, etc.) * * A set of addresses is implemented as a bit-set and mapped upon * a single byte. An address is a member of a set if the position in * corresponding bit-set is set. The position is counted from the * right side (least significant bit) of the bit-set. * So, a set consisting of a single address 'i' is represented * by 2**i or as a bit-operation: 1<