- 0
- 0
- 约1.77万字
- 约 12页
- 2026-01-28 发布于北京
- 举报
RIP协议实验报告
任计332013011333
实验思路及实现方式报告详见代码注释。#includesysinclude.h#includecstdio#
includeiostream#defineUDPPORT520//RIP协议的UDP端口#define
MAXSIZE504//RIP分组的最大长度(不包括UDP头)为4+25*20usingnamespace
_
std;externvoidripsendIpPkt(unsignedchar*pData,UINT16len,unsigned
_
shortdstPort,UINT8iNo);externvoidipDiscardPkt(char*pBuffer,inttype);
______
externstructstudriproutenode*griproutetable;//RIP路由表/*typedef
___
structstudriproutenode{unsignedintdest;unsignedintmask;unsignedi
____
ntnexthop;unsignedintmetric;unsignedintifno;structstudriproute
___
node*next;}*griproutetable;*/
/*一个RIPv2分组包括一个RIP头部(rip_head)和最多25个RIP路由表项(rip_send)组成。
*/structrip_head{//RIP头部charcommand;//请求1,响应2char
version;//版本信息,值为2shortzero;//取值为0};
structrip_msg{//路由项信息
unsignedintdest;//路由信息对应的目的地址
unsignedintmask;//子网掩码
unsignedintnexthop;//下一跳IP地址
unsignedintmetric;//距离值
};
structrip_send{//RIP路由项
RIP协议实验报告
任计332013011333
实验思路及实现方式报告详见代码注释。
#includesysinclude.h
#includecstdio
#includeiostream
#defineUDPPORT520//RIP协议的UDP端口
#defineMAXSIZE504//RIP分组的最大长度(不包括UDP头)为4+25*20
usingnamespacestd;
externvoidrip_sendIpPkt(unsignedchar*pData,UINT16len,unsignedshort
dstPort,UINT8iNo);
externvoidip_DiscardPkt(char*pBuffer,inttype);
externstructstud_rip_route_node*g_rip_route_table;
原创力文档

文档评论(0)