资源简介
完整的AODV协议代码,包括头文件,main.c和Makefile文件等。
代码片段和文件信息
/*****************************************************************************
*
* Copyright (C) 2001 Uppsala University and Ericsson AB.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
*
* Authors: Erik Nordstr鰉
*
*
*****************************************************************************/
#ifdef NS_PORT
#include “ns-2/aodv-uu.h“
#else
#include
#include “aodv_hello.h“
#include “aodv_timeout.h“
#include “aodv_rrep.h“
#include “aodv_rreq.h“
#include “routing_table.h“
#include “timer_queue.h“
#include “params.h“
#include “aodv_socket.h“
#include “defs.h“
#include “debug.h“
extern int unidir_hack receive_n_hellos hello_jittering optimized_hellos;
static struct timer hello_timer;
#endif
/* #define DEBUG_HELLO */
long NS_CLASS hello_jitter()
{
if (hello_jittering) {
#ifdef NS_PORT
return (long) (((float) Random::integer(RAND_MAX + 1) / RAND_MAX - 0.5)
* JITTER_INTERVAL);
#else
return (long) (((float) random() / RAND_MAX - 0.5) * JITTER_INTERVAL);
#endif
} else
return 0;
}
void NS_CLASS hello_start()
{
if (hello_timer.used)
return;
gettimeofday(&this_host.fwd_time NULL);
DEBUG(LOG_DEBUG 0 “Starting to send HELLOs!“);
timer_init(&hello_timer &NS_CLASS hello_send NULL);
hello_send(NULL);
}
void NS_CLASS hello_stop()
{
DEBUG(LOG_DEBUG 0
“No active forwarding routes - stopped sending HELLOs!“);
timer_remove(&hello_timer);
}
void NS_CLASS hello_send(void *arg)
{
RREP *rrep;
AODV_ext *ext = NULL;
u_int8_t flags = 0;
struct in_addr dest;
long time_diff jitter;
struct timeval now;
int msg_size = RREP_SIZE;
int i;
gettimeofday(&now NULL);
if (optimized_hellos &&
timeval_diff(&now &this_host.fwd_time) > ACTIVE_ROUTE_TIMEOUT) {
hello_stop();
return;
}
time_diff = timeval_diff(&now &this_host.bcast_time);
jitter = hello_jitter();
/* This check will ensure we don‘t send unnecessary hello msgs in case
we have sent other bcast msgs within HELLO_INTERVAL */
if (time_diff >= HELLO_INTERVAL) {
for (i = 0; i < MAX_NR_INTERFACES; i++) {
if (!DEV_NR(i).enabled)
continue;
#ifdef DEBUG_HELLO
DEBUG(LOG_DEBUG 0 “sending Hello to 255.255.255.255“);
#endif
rrep = rrep_create(flags 0 0 DEV
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-10-28 19:38 AODV-master\
文件 10159 2013-10-28 19:38 AODV-master\ChangeLog
文件 17992 2013-10-28 19:38 AODV-master\GPL
文件 6937 2013-10-28 19:38 AODV-master\Makefile
文件 6732 2013-10-28 19:38 AODV-master\MakefileBK
文件 11133 2013-10-28 19:38 AODV-master\README
文件 0 2013-10-28 19:38 AODV-master\README.md
文件 15077 2013-10-28 19:38 AODV-master\README.ns
文件 13232 2013-10-28 19:38 AODV-master\TAGS
文件 107 2013-10-28 19:38 AODV-master\TODO
文件 7904 2013-10-28 19:38 AODV-master\aodv_hello.c
文件 1705 2013-10-28 19:38 AODV-master\aodv_hello.h
文件 5900 2013-10-28 19:38 AODV-master\aodv_neighbor.c
文件 1385 2013-10-28 19:38 AODV-master\aodv_neighbor.h
文件 6180 2013-10-28 19:38 AODV-master\aodv_rerr.c
文件 2416 2013-10-28 19:38 AODV-master\aodv_rerr.h
文件 13066 2013-10-28 19:38 AODV-master\aodv_rrep.c
文件 2692 2013-10-28 19:38 AODV-master\aodv_rrep.h
文件 17878 2013-10-28 19:38 AODV-master\aodv_rreq.c
文件 3493 2013-10-28 19:38 AODV-master\aodv_rreq.h
文件 15088 2013-10-28 19:38 AODV-master\aodv_socket.c
文件 2389 2013-10-28 19:38 AODV-master\aodv_socket.h
文件 7537 2013-10-28 19:38 AODV-master\aodv_timeout.c
文件 1559 2013-10-28 19:38 AODV-master\aodv_timeout.h
文件 11233 2013-10-28 19:38 AODV-master\debug.c
文件 1892 2013-10-28 19:38 AODV-master\debug.h
文件 6484 2013-10-28 19:38 AODV-master\defs.h
文件 1746 2013-10-28 19:38 AODV-master\endian.c
文件 1842 2013-10-28 19:38 AODV-master\list.c
文件 1994 2013-10-28 19:38 AODV-master\list.h
文件 10128 2013-10-28 19:38 AODV-master\llf.c
............此处省略40个文件信息
相关资源
- 福建农林大学计科linux复习
- cuda_8.0.61_375.26_linux.run
- 基于linux系统的ftp服务器
- cadence安装方法 linux
- Linux下安装Intel无线网卡
- openssh-8.2.tar.gz
- Linux常用命令全集260354
- smartctl源码
- Linux命令大全完整版.pdf
- Linux ATM取款机简单实现附详细说明-
- 2018年最新全套linux视频教程源码笔记
- 华中科技大学计算机学院操作系统一
- linux使用规范
- libsigar-amd64-linux.so以及libsigar-x86-linu
- linux哲学家就餐3种方法代码实现
- centos 7的telnet安装包.zip
- Linux版本浙江闪讯拨号连接
- Linux 下多线程数字排序
- pcap 在linux简单实现网络的抓包程序
- 在Linux环境下模拟实现命令解释器--操
- linux 线程池封装类
- 嵌入式linux 应用程序开发框架之模块
- linux 常用压测命令
- linux下shell编程
- linux usb hid device端测试程序
- 用qml简单的文本编辑器,可以跨平台
- LINUX下的一个多线程的服务器和客户端
- tcpdump-4.9.0-5.el7.x86_64.rpm
- Linux C利用多进程或多线程模拟实现生
- linux下用freetype2显示汉字
评论
共有 条评论