common.h

来自「ARQ协议的实现 从单工停等到滑动窗口协议的实现」· C头文件 代码 · 共 33 行

H
33
字号
/* 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;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?