资源简介
完整的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个文件信息
相关资源
- GNU/Linux系统开发者需要从桌面突破
- the_definitive_guide_to_linux_network_programm
- linux-shell脚本命令:grep命令简介
- Learning Linux Binary Analysis
- 蓝牙源代码应用于LINUX
- uboot到linux logo显示不间断 补丁
- UNIX/LINUX编程实践教程的源码
- Linux任务管理器
- linux应用层的华容道游戏源代码
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- 操作系统实验——虚存管理实验
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- linux C 电梯程序练习
- linux下用多进程同步方法解决生产者
- Linux 操作系统实验(全)
- Linux From Scratch 中文手册
- linux 网络实验 ftp程序
- Linux命令大全离线版&在线版
- 操作系统共享内存实验
- dos 下运行Linux 命令--gnu_utils
- linux 0.12内核源代码
- linux简易shell C实现
- linux实验报告及心得体会
- 基于GTK的Linux环境下的简易任务管理器
- linux扫雷游戏代码
- CAN Linux驱动代码
评论
共有 条评论