/*
Copyright (c) 1997, 1998 Carnegie Mellon University. All Rights
Reserved.
Permission to use, copy, modify, and distribute this
software and its documentation is hereby granted (including for
commercial or for-profit use), provided that both the copyright notice and this permission notice appear in all copies of the software, derivative works, or modified versions, and any portions thereof, and that both notices appear in supporting documentation, and that credit is given to Carnegie Mellon University in all publications reporting on direct or indirect use of this code or its derivatives.
ALL CODE, SOFTWARE, PROTOCOLS, AND ARCHITECTURES DEVELOPED BY THE CMU
MONARCH PROJECT ARE EXPERIMENTAL AND ARE KNOWN TO HAVE BUGS, SOME OF
WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON PROVIDES THIS
SOFTWARE OR OTHER INTELLECTUAL PROPERTY IN ITS ``AS IS'' CONDITION,
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR
INTELLECTUAL PROPERTY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
Carnegie Mellon encourages (but does not require) users of this
software or intellectual property to return any improvements or
extensions that they make, and to grant Carnegie Mellon the rights to redistribute these changes without encumbrance.
The AODV code developed by the CMU/MONARCH group was optimized and tuned by Samir Das and Mahesh Marina, University of Cincinnati. The work was partially done in Sun Microsystems.
*/
#ifndef __aodv_h__
#define __aodv_h__
//#include <agent.h>
//#include <packet.h>
//#include <sys/types.h>
//#include <cmu/list.h>
//#include <scheduler.h>
#include <cmu-trace.h>
#include <priqueue.h>
#include <aodv/aodv_rtable.h>
/*** added for multicast ***/
#include <aodv/aodv_mtable.h>
/**************************/
#include <aodv/aodv_rqueue.h>
//#define DEBUG
/*
Allows local repair of routes
*/
//直接修复断路,重新路由寻找或者多播树的分裂
#define AODV_LOCAL_REPAIR
/*
Allows AODV to use link-layer (802.11) feedback in determining when
links are up/down.
*/
//用802.11MAC层反馈来判断链路是否可用
#define AODV_LINK_LAYER_DETECTION
/*** added for multicast ***/
#define MULTICAST
#define PRUNE_TIMER 2 * RREP_WAIT_TIME //多长时间没有收到RREP就判断该减枝了
/***************************/
/*** added for prediction ***/
//#define IMPROVEMENT
#define PREDICTION
#define PREDICTION_TIME_FOR_MULTICAST 1
#define PREDICTION_TIME_FOR_UNICAST 0.75
/*****************************/
/*** added for upper level agent ***/
//#define UPPER_LEVEL_RECEIVE
//#define UPPER_LEVEL_PORT 100
/***********************************/
/*
Causes AODV to apply a "smoothing"大概是滤波的意思 function to the link layer feedback
that is generated by 802.11. In essence, it requires that RT_MAX_ERROR
errors occurs within a window of RT_MAX_ERROR_TIME before the link
is considered bad.
*/
#define AODV_USE_LL_METRIC
/*
Only applies if AODV_USE_LL_METRIC is defined.
Causes AODV to apply omniscient knowledge to the feedback received
from 802.11. This may be flawed, because it does not account for
congestion.
*/
//#define AODV_USE_GOD_FEEDBACK加入错误概率,更真实
class AODV;
#define MY_ROUTE_TIMEOUT 10 // 100 seconds 路由无效时间
#define ACTIVE_ROUTE_TIMEOUT 10 // 50 seconds
#define REV_ROUTE_LIFE 6 // 5 seconds
#define BCAST_ID_SAVE 6 // 3 seconds
// No. of times to do network-wide search before timing out for
// MAX_RREQ_TIMEOUT sec.
#define RREQ_RETRIES 3 //RREQ重传次数限制
// timeout after doing network-wide search RREQ_RETRIES times
#define MAX_RREQ_TIMEOUT 10.0 //RREQ无效的时限,无效则自己建立多播组,
/* Various constants used for the expanding ring search */
//这里注意一下,扩展环搜索用的就是这里的参数。
#define TTL_START 5
#define TTL_THRESHOLD 7
#define TTL_INCREMENT 2
// This should be somewhat related to arp timeout//
//用于确定RREP的等待时间
#define NODE_TRAVERSAL_TIME 0.03 // 30 ms
#define LOCAL_REPAIR_WAIT_TIME 0.15 //sec
// Should be set by the user using best guess (conservative)
#define NETWORK_DIAMETER 30 // 30 hops网络的直径,保守估计,
// Must be larger than the time difference between a node propagates a route
// request and gets the route reply back.
//RREP_WAIT_TIME必须大于一个节点发送RREQ和接受RREP之间的间隔。下面是两种方案
//#define RREP_WAIT_TIME (3 * NODE_TRAVERSAL_TIME * NETWORK_DIAMETER) // ms
//#define RREP_WAIT_TIME (2 * REV_ROUTE_LIFE) // seconds
/*** modified for multicast ***/
//#define RREP_WAIT_TIME 1.0 // sec
#define RREP_WAIT_TIME 0.5 // sec
/******************************/
#define ID_NOT_FOUND 0x00
#define ID_FOUND 0x01
//#define INFINITY 0xff
// The followings are used for the forward() function. Controls pacing.
//下面的宏用于转发函数,控制速率
#define DELAY 1.0 // random delay
#define NO_DELAY -1.0 // no delay
// think it should be 30 ms
//ARP模块用来将IP地址转换为MAC地址,需要给他设置延迟,如果不延迟就会出现大量丢包现象
#define ARP_DELAY 0.01 // fixed delay to keep arp happy
#define HELLO_INTERVAL 1 //各节点HELLO信息的发送间隔。
/*** added for multicast ***/
#define GROUP_HELLO_INTERVAL 5//GROUP_HELLO发送间隔
/**************************/
#define ALLOWED_HELLO_LOSS 3 // packets
#define BAD_LINK_LIFETIME 3 // 3000 ms
#define MaxHelloInterval (1.25 * HELLO_INTERVAL)//最大值
#define MinHelloInterval (0.75 * HELLO_INTERVAL)//最小值
/*
Timers (Broadcast ID, Hello, Neighbor Cache, Route Cache)
*/
//时间管理器
//都是以AODV类指针来对时间管理器的对象赋初值,都有返回值为空的handle函数,形式参数
//是EVENT类指针。都有两个私有成员:一个AODV类指针,一个EVENT类
//广播时间管理器
class BroadcastTimer : public Handler {
public:
BroadcastTimer(AODV* a) : agent(a) {}//都是以AODV类指针来对时间管理器的对象赋初值
void handle(Event*);
private:
AODV *agent;
Event intr;
};
/*** added for multicast ***/
//数据包时间管理器
class PacketTimer : public Handler {
public:
PacketTimer(AODV* a) : agent(a) {}
void handle(Event*);
private:
AODV *agent;
Event intr;
};
/***************************/
class HelloTimer : public Handler {
public:
HelloTimer(AODV* a) : agent(a) {}
void handle(Event*);
private:
AODV *agent;
Event intr;
};
/*** added for multicast ***/
//group_hello时间管理器
class GroupHelloTimer : public Handler {
public:
GroupHelloTimer(AODV *a) : agent(a){}
void handle(Event*);
private:
AODV *agent;
Event intr;
};
/**************************/
//邻居节点时间管理器
class NeighborTimer : public Handler {
public:
NeighborTimer(AODV* a) : agent(a) {}
void handle(Event*);
private:
AODV *agent;
Event intr;
};
//路由缓存时间管理器
class RouteCacheTimer : public Handler {
public:
RouteCacheTimer(AODV* a) : agent(a) {}
void handle(Event*);
private:
AODV *agent;
Event intr;
};
//本地路由修复时间管理器
class LocalRepairTimer : public Handler {
public:
LocalRepair
aodv.rar_aodv_distance
版权申诉
22 浏览量
2022-09-20
18:03:52
上传
评论
收藏 19KB RAR 举报
朱moyimi
- 粉丝: 61
- 资源: 1万+
最新资源
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- Docker在Ubuntu16.04上安装和部署Apache Storm
- test_kong.zip
- springboot权限验证学习-下
- SeetaFace6人脸质量评估C++代码实现Demo
- OCAuxiliaryTools
- 制药公司QC顶岗实习专题报告
- Rust 全面指南:从基础到高级,一网打尽 Rust 的编程知识
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈