计算机网络原理GBN协议代码

C语言实现GBN协议

一、 GBN.h

#pragma once

#include <stdio.h>

//基础功能模块的数据结构声明

#define BIDIRECTIONAL 1 /* change to 1 if you're doing extra credit and write a routine called B_output */

/* a "msg" is the data unit passed from layer 5 (teachers code) to layer 4 (students' code). It contains the data (characters) to be delivered to layer 5 via the students transport level protocol entities. */ struct msg

{ char data[20];

};

/* a packet is the data unit passed from layer 4 (students code) to layer 3 (teachers code). Note the pre-defined packet structure, which all students must follow. */

struct pkt

{

int seqnum;

int acknum;

int checksum;

char payload[20];

};

#define WINDOWSIZE 8

#define MAXBUFSIZE 50

#define RTT 15.0

#define NOTUSED 0

#define NACK -1

#define TRUE 1

#define FALSE 0

#define A 0

#define B 1

//网络仿真部分数据结构声明***********************************************************

struct event

{

float evtime; /* event time */

int evtype; /* event type code */

int eventity; /* entity where event occurs */

struct pkt *pktptr; /* ptr to packet (if any) assoc w/ this event */ struct event *prev;

你可能喜欢

  • 计算机网络实验报告
  • 运动规律
  • 计算机网络原理实验
  • 数据结构实验报告
  • 路由算法
  • 计算机网络实验指导
  • Dijkstra算法
  • 组建局域网

计算机网络原理GBN协议代码相关文档

最新文档

返回顶部