/* file: event.h */ /* * Tom Laramee * ECE 671 - Simulation #2 - Selective Repeat * * event.h header file */ #include #include #include extern struct event *evlist; extern struct proc *qptr[]; extern int iseed; /* random number generator seed */ extern double lambda; /* Node arrival rate (main.c) */ extern double timeNextEvent; /* Time of next event */ extern double sysTime; /* Global clock time */ /************************************************************************/ /* global data structures */ /************************************************************************/ struct event { double evtime; /* this field used for insertion into event list */ int evcode; /*==0 => arrival to system, 1 is departure */ int nodecode; /* nodeid at which event takes place */ int status; struct event *next; struct event *prev; }; struct proc { /* structure containing info about a queued job */ long int jobid; /* id of job arriving */ double local_arrival_time; /* arrival time at this queue */ double sys_arrival_time; /* arrival time from the sourse */ double attribute; struct proc *next; struct proc *prev; }; typedef struct proc tProc; typedef struct proc * tProcPtr; typedef struct event tEvent; typedef struct event * tEventPtr; /* ~~~~~~~~~~~~~~~~~~~~~ prototypes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ struct event *alloc_evrec(void); void free_evrec(struct event *evptr); struct event *get_nextevent(void); struct proc *alloc_procrec(void); void free_procrec(struct proc *procptr); struct proc *get_firstproc(int q_id); void insertproc(struct proc *procptr, int q_id); void init_ptrs(void); double uni(void); void nextarrival( void );