⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.h

📁 经典的数据链路层协议P1~P6的模拟器源代码和文档。最好在Linux下运行
💻 H
字号:
/* 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -