/* file: main.h */ /* * Tom Laramee 12/95 * HW #4 * Sim of Wireless LAN protocol for MAC * */ #define TRUE 1 #define FALSE 0 /* Types of events */ #define ARRIVAL 0 #define X_SUCCESSFUL 1 #define X_unSUCCESSFUL 2 #define RE_ARRIVAL 3 #define printEVENT(x) (x==ARRIVAL) ?"ARRIVAL ": \ (x==X_SUCCESSFUL) ?"X_SUCCESSFUL ": \ (x==X_unSUCCESSFUL)?"X_unSUCCESSFUL": \ (x==RE_ARRIVAL) ?"RE_ARRIVAL ": \ "OTHER" #define fatal(F, M) { printf ("\nFatal error!"); \ printf ("\nProcedure: %s", F); \ printf ("\nMessage : %s\n\n", M); \ printf ("\n\n"); \ exit(-1); } /* ~~~~~~~~~~~~~~~~~~ Prototypes ~~~~~~~~~~~~~~~~~~~~~~ */ /* initialize stuff */ short initParams(int argc, char * argv[]); void initAll(void); /* display information */ void showParams(FILE * fp); void showCurrentEvent(FILE * fp); void showEventList(FILE * fp); void showReport(FILE * fp); /* Generate event functions */ void gen_arrival( int node ); void gen_re_arrival( int node ); void gen_x_successful( int node ); void gen_x_unsuccessful( void ); /* Process EVENTS */ short processArrival( void ); short processXSuccessful( void ); short processXunSuccessful( void ); short processReArrival( void ); /* Utility functions */ void queueItUp( int node ); int getNumCompeting( void ); short Prob( void );