/* file: main.h */ /* * Tom Laramee * ECE 671 - Simulation #2 - Selective Repeat * * main.h - header file */ #define TRUE 1 #define FALSE 0 #define YES 1 #define NO 0 #define OLD 0 #define NEW 1 #define fatal(F,M) { printf ("\nFatal!\n%s\n%s\n\n", F, M); exit(-1); } #define MAX(x, y) (x>=y)?x:y /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~ types of events ~~~~~~~~~~~~~~~~~~~~ */ #define FrameArrival 0 #define AckArrival 1 #define Departure 2 #define ChksumErr 3 #define TimeOut 4 #define NodeFree 5 #define printEVENT(x) (x==FrameArrival) ?"FrameArrival ": \ (x==AckArrival) ?"AckArrival ": \ (x==Departure) ?"Departure ": \ (x==ChksumErr) ?"ChksumErr ": \ (x==TimeOut) ?"TimeOut ": \ (x==NodeFree) ?"NodeFree ": \ "OTHER" /* ~~~~~~~~~~~~~~~~~~~~~~~ prototypes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* -------------------- pre-simulation functions */ short initParams(int argc, char * argv[]); void initAll( void ); /* void showParameters(FILE * fp); */ /* --------------------------------debugging aids */ void printQueue( int node ); /* void showCurrentEvent(FILE * fp); */ /* void showEventList(FILE * fp); */ void queueItUp( int node ); /* ----------------------event generation functions */ void gen_arrival(int node); void gen_ackarrival(int node); void gen_depart(int node); void gen_nodefree(int node); void gen_timeout(int node, short kind); /* ---------------------event processing functions */ void processFrameArrival( void ); void processAckArrival( void ); void processDeparture( void ); void processNodeFree( void ); void processTimeOut( void );