- 21
- 0
- 约1.14万字
- 约 24页
- 2016-12-06 发布于重庆
- 举报
GPL關于RIP协议的实现代码分析
GPL关于RIP协议的实现代码分析
文档编号:00-6201-100
当前版本:
创建日期:2011-12-22
编写作者:ganjingwei
RIP代码分析
前言 3
关于此文档 3
参考资料 3
第一章 RIP协议报文格式 4
1.1 报文位置 4
1.2 RIP版本1报文 4
1.3 RIP版本2报文 5
第二章 动态学习过程 7
2.1 请求与应答 7
2.1.1 初始化 7
2.1.2 接收到request 7
2.1.3 接收到response 7
2.2 更新 8
2.2.1定期选路更新 8
2.2.2触发更新 8
2.3 其他机制与策略 9
2.3.1 水平分割 9
2.3.2 定时删除 9
前言
关于此文档
此文档是本人这段时间内研究GPL发布的RIP协议源码,总结并且整理出来的文档。供大家参考。
本文档阐述代码相关研究,各章节说明如下:
1 前言,即此章节;
2 重要数据结构
3 接收与发送处理;
4 路由表结构
5 线程机制
6 ripd配置文件
参考资料
网络资源。
源码以linux2.6内核userspace为准。
第一章 数据结构
1.1 收发处理相关
1.1.1 struct rip
struct rip
{
/* RIP socket. */
int sock;
/* Default version of rip instance. */
u_char version;
/* Output buffer of RIP. */
struct stream *obuf;
/* RIP routing information base. */
struct route_table *table;
/* RIP only static routing information. */
struct route_table *route;
/* RIP neighbor. */
struct route_table *neighbor;
/* RIP threads. */
struct thread *t_read;
/* Update and garbage timer. */
struct thread *t_update;
/* Triggered update hack. */
int trigger;
struct thread *t_triggered_update;
struct thread *t_triggered_interval;
/* RIP timer values. */
unsigned long update_time;
unsigned long timeout_time;
unsigned long garbage_time;
/* RIP default metric. */
int default_metric;
/* RIP default-information originate. */
u_char default_information;
char *default_information_route_map;
/* RIP default distance. */
u_char distance;
struct route_table *distance_table;
/* For redistribute route map. */
struct
{
char *name;
struct route_map *map;
int metric_config;
u_int32_t metric;
} route_map[ZEBRA_ROUTE_MAX];
};
这个结构体包含ripd进程的所有信息,一个ripd进程只有一个struct rip对象作为全局变量。struct route_table *table是ripd进程维护的路由表的指针;struct thread *类型的数据为进程中的伪线程链表头指针(下文详细描述);此外还包含其他各种信息。
1.1.2 struct rte
struct rte
{
u_int16_t family; /* Address family of this route. */
u_int16_t tag; /* Route Tag which included in RIP2 packet.
您可能关注的文档
最近下载
- 沈阳铁路局员工合同协议.docx VIP
- 2025年心理咨询师考试题库500道附参考答案【实用】.docx VIP
- 鱼骨图分析法(鱼骨图模板).doc VIP
- 2025年部编版三年级上册语文期末冲刺模拟卷三.docx VIP
- KISSsoft软件教程-Tutorial-016-包络面蜗轮蜗杆的验证.pdf VIP
- 《成人甲状腺功能减退症基层诊疗指南(2025版)》.docx VIP
- 三年级数学特训卷.docx VIP
- 搏击操教案15-16(1)完整版.doc VIP
- 2026年内分泌科糖尿病精细化管理实施方案.docx
- (2026春新版)人教版三年级数学下册《一 生活中的运动现象》PPT课件.pptx
原创力文档

文档评论(0)