A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
aodv-neighbor.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 IITP RAS
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Based on
19
* NS-2 AODV model developed by the CMU/MONARCH group and optimized and
20
* tuned by Samir Das and Mahesh Marina, University of Cincinnati;
21
*
22
* AODV-UU implementation by Erik Nordström of Uppsala University
23
* http://core.it.uu.se/core/index.php/AODV-UU
24
*
25
* Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
26
* Pavel Boyko <boyko@iitp.ru>
27
*/
28
29
#ifndef AODVNEIGHBOR_H
30
#define AODVNEIGHBOR_H
31
32
#include "ns3/simulator.h"
33
#include "ns3/timer.h"
34
#include "ns3/ipv4-address.h"
35
#include "ns3/callback.h"
36
#include "ns3/wifi-mac-header.h"
37
#include "ns3/arp-cache.h"
38
#include <vector>
39
40
namespace
ns3
41
{
42
namespace
aodv
43
{
44
class
RoutingProtocol;
49
class
Neighbors
50
{
51
public
:
53
Neighbors
(
Time
delay);
55
struct
Neighbor
56
{
57
Ipv4Address
m_neighborAddress
;
58
Mac48Address
m_hardwareAddress
;
59
Time
m_expireTime
;
60
bool
close
;
61
62
Neighbor
(
Ipv4Address
ip,
Mac48Address
mac,
Time
t) :
63
m_neighborAddress
(ip),
m_hardwareAddress
(mac),
m_expireTime
(t),
64
close
(false)
65
{
66
}
67
};
69
Time
GetExpireTime
(
Ipv4Address
addr);
71
bool
IsNeighbor
(
Ipv4Address
addr);
73
void
Update
(
Ipv4Address
addr,
Time
expire);
75
void
Purge
();
77
void
ScheduleTimer
();
79
void
Clear
() {
m_nb
.clear (); }
80
82
void
AddArpCache
(
Ptr<ArpCache>
);
84
void
DelArpCache
(
Ptr<ArpCache>
);
86
Callback<void, WifiMacHeader const &>
GetTxErrorCallback
()
const
{
return
m_txErrorCallback
; }
87
89
//\{
90
void
SetCallback
(
Callback<void, Ipv4Address>
cb) {
m_handleLinkFailure
= cb; }
91
Callback<void, Ipv4Address>
GetCallback
()
const
{
return
m_handleLinkFailure
; }
92
//\}
93
private
:
95
Callback<void, Ipv4Address>
m_handleLinkFailure
;
97
Callback<void, WifiMacHeader const &>
m_txErrorCallback
;
99
Timer
m_ntimer
;
101
std::vector<Neighbor>
m_nb
;
103
std::vector<Ptr<ArpCache> >
m_arp
;
104
106
Mac48Address
LookupMacAddress
(
Ipv4Address
);
108
void
ProcessTxError
(
WifiMacHeader
const
&);
109
};
110
111
}
112
}
113
114
#endif
/* AODVNEIGHBOR_H */
src
aodv
model
aodv-neighbor.h
Generated on Tue Oct 9 2012 16:45:32 for ns-3 by
1.8.1.2