#include /* standard C i/o facilities */ #include /* need for call to pipe() */ /* Netprog 99 project 1 test support code DLH 1/11/1999 Layer 0 expects the cid to reference a pair of pipes descriptors, there is a global array of these maintained by the function create_communication_id */ #define MAXCIDS 10 int pipes[MAXCIDS*2]; /* the array of file (pipe) descriptors */ int cids[MAXCIDS]; /* keeps track of used cids */ int initflag=0; /* a cid references two file descriptors (pipes): pipes[cid*2] is the reading end pipes[cid*2+1] is the writing end. */ /* This reserves slots in the pipes array (if there is room left) and establishes the pipes[cid*2] as the reading end and pipes[cid*2+1] as the writing end. Layer 0 uses this information. */ int create_communication_id( read_pipeid, write_pipeid) { int i; if (! initflag) { /* first time called - initialize everything */ for (i=0;i