-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.h
32 lines (24 loc) · 999 Bytes
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Data structures. */
typedef enum {frame_arrival, cksum_err, timeout, network_layer_ready, ack_timeout} event_type;
#include "protocol.h"
typedef unsigned long bigint; /* bigint integer type available */
/* General constants */
#define TICK_SIZE (sizeof(tick))
#define DELTA 10 /* must be greater than NR_TIMERS so each
* timer can go off at a separate tick.
*/
/* Reply codes sent by workers back to main. */
#define OK 1 /* normal response */
#define NOTHING 2 /* worker did nothing */
/* Simulation parameters. */
int protocol; /* protocol we are simulating */
bigint timeout_interval; /* timeout interval in ticks */
int pkt_loss; /* controls packet loss rate: 0 to 990 */
int garbled; /* control cksum error rate: 0 to 990 */
int debug_flags; /* debug flags */
/* File descriptors for pipes. */
int r1, w1, r2, w2, r3, w3, r4, w4, r5, w5, r6, w6;
/* Filled in by main to tell each worker its id. */
int id; /* 0 or 1 */
bigint zero;
int mrfd, mwfd, prfd;