A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
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 <vector>
33
#include "ns3/simulator.h"
34
#include "ns3/timer.h"
35
#include "ns3/ipv4-address.h"
36
#include "ns3/callback.h"
37
#include "ns3/arp-cache.h"
38
39
namespace
ns3
{
40
41
class
WifiMacHeader;
42
43
namespace
aodv {
44
45
class
RoutingProtocol;
46
51
class
Neighbors
52
{
53
public
:
58
Neighbors
(
Time
delay);
60
struct
Neighbor
61
{
63
Ipv4Address
m_neighborAddress
;
65
Mac48Address
m_hardwareAddress
;
67
Time
m_expireTime
;
69
bool
close
;
70
78
Neighbor
(
Ipv4Address
ip,
Mac48Address
mac
,
Time
t)
79
:
m_neighborAddress
(ip),
80
m_hardwareAddress
(
mac
),
81
m_expireTime
(t),
82
close
(false)
83
{
84
}
85
};
91
Time
GetExpireTime
(
Ipv4Address
addr);
97
bool
IsNeighbor
(
Ipv4Address
addr);
103
void
Update
(
Ipv4Address
addr,
Time
expire);
105
void
Purge
();
107
void
ScheduleTimer
();
109
void
Clear
()
110
{
111
m_nb
.clear ();
112
}
113
118
void
AddArpCache
(
Ptr<ArpCache>
a);
123
void
DelArpCache
(
Ptr<ArpCache>
a);
128
Callback<void, WifiMacHeader const &>
GetTxErrorCallback
()
const
129
{
130
return
m_txErrorCallback
;
131
}
132
137
void
SetCallback
(
Callback<void, Ipv4Address>
cb)
138
{
139
m_handleLinkFailure
= cb;
140
}
145
Callback<void, Ipv4Address>
GetCallback
()
const
146
{
147
return
m_handleLinkFailure
;
148
}
149
150
private
:
152
Callback<void, Ipv4Address>
m_handleLinkFailure
;
154
Callback<void, WifiMacHeader const &>
m_txErrorCallback
;
156
Timer
m_ntimer
;
158
std::vector<Neighbor>
m_nb
;
160
std::vector<Ptr<ArpCache> >
m_arp
;
161
168
Mac48Address
LookupMacAddress
(
Ipv4Address
addr);
173
void
ProcessTxError
(
WifiMacHeader
const
&hdr);
174
};
175
176
}
// namespace aodv
177
}
// namespace ns3
178
179
#endif
/* AODVNEIGHBOR_H */
ns3::aodv::Neighbors::Clear
void Clear()
Remove all entries.
Definition:
aodv-neighbor.h:109
ns3::aodv::Neighbors::Update
void Update(Ipv4Address addr, Time expire)
Update expire time for entry with address addr, if it exists, else add new entry.
Definition:
aodv-neighbor.cc:78
ns3::aodv::Neighbors::Neighbors
Neighbors(Time delay)
constructor
Definition:
aodv-neighbor.cc:39
ns3::aodv::Neighbors::ScheduleTimer
void ScheduleTimer()
Schedule m_ntimer.
Definition:
aodv-neighbor.cc:143
ns3::Callback
Callback template class.
Definition:
callback.h:1279
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::aodv::Neighbors::Neighbor::m_neighborAddress
Ipv4Address m_neighborAddress
Neighbor IPv4 address.
Definition:
aodv-neighbor.h:63
ns3::aodv::Neighbors::LookupMacAddress
Mac48Address LookupMacAddress(Ipv4Address addr)
Find MAC address by IP using list of ARP caches.
Definition:
aodv-neighbor.cc:162
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:41
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:44
third.mac
mac
Definition:
third.py:99
ns3::aodv::Neighbors::AddArpCache
void AddArpCache(Ptr< ArpCache > a)
Add ARP cache to be used to allow layer 2 notifications processing.
Definition:
aodv-neighbor.cc:150
ns3::aodv::Neighbors::DelArpCache
void DelArpCache(Ptr< ArpCache > a)
Don't use given ARP cache any more (interface is down)
Definition:
aodv-neighbor.cc:156
ns3::aodv::Neighbors::m_nb
std::vector< Neighbor > m_nb
vector of entries
Definition:
aodv-neighbor.h:158
ns3::aodv::Neighbors::Purge
void Purge()
Remove all expired entries.
Definition:
aodv-neighbor.cc:118
ns3::aodv::Neighbors::Neighbor::close
bool close
Neighbor close indicator.
Definition:
aodv-neighbor.h:69
ns3::Timer
A simple virtual Timer class.
Definition:
timer.h:74
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition:
wifi-mac-header.h:85
ns3::aodv::Neighbors::Neighbor::Neighbor
Neighbor(Ipv4Address ip, Mac48Address mac, Time t)
Neighbor structure constructor.
Definition:
aodv-neighbor.h:78
ns3::Ptr< ArpCache >
ns3::aodv::Neighbors::m_txErrorCallback
Callback< void, WifiMacHeader const & > m_txErrorCallback
TX error callback.
Definition:
aodv-neighbor.h:154
ns3::aodv::Neighbors::IsNeighbor
bool IsNeighbor(Ipv4Address addr)
Check that node with address addr is neighbor.
Definition:
aodv-neighbor.cc:48
ns3::aodv::Neighbors::ProcessTxError
void ProcessTxError(WifiMacHeader const &hdr)
Process layer 2 TX error notification.
Definition:
aodv-neighbor.cc:179
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:104
ns3::aodv::Neighbors::Neighbor::m_expireTime
Time m_expireTime
Neighbor expire time.
Definition:
aodv-neighbor.h:67
ns3::aodv::Neighbors::GetCallback
Callback< void, Ipv4Address > GetCallback() const
Get link failure callback.
Definition:
aodv-neighbor.h:145
ns3::aodv::Neighbors::Neighbor
Neighbor description.
Definition:
aodv-neighbor.h:61
ns3::aodv::Neighbors::GetTxErrorCallback
Callback< void, WifiMacHeader const & > GetTxErrorCallback() const
Get callback to ProcessTxError.
Definition:
aodv-neighbor.h:128
ns3::aodv::Neighbors::m_arp
std::vector< Ptr< ArpCache > > m_arp
list of ARP cached to be used for layer 2 notifications processing
Definition:
aodv-neighbor.h:160
ns3::aodv::Neighbors::m_ntimer
Timer m_ntimer
Timer for neighbor's list. Schedule Purge().
Definition:
aodv-neighbor.h:156
ns3::aodv::Neighbors::SetCallback
void SetCallback(Callback< void, Ipv4Address > cb)
Set link failure callback.
Definition:
aodv-neighbor.h:137
ns3::aodv::Neighbors::Neighbor::m_hardwareAddress
Mac48Address m_hardwareAddress
Neighbor MAC address.
Definition:
aodv-neighbor.h:65
ns3::aodv::Neighbors
maintain list of active neighbors
Definition:
aodv-neighbor.h:52
ns3::aodv::Neighbors::GetExpireTime
Time GetExpireTime(Ipv4Address addr)
Return expire time for neighbor node with address addr, if exists, else return 0.
Definition:
aodv-neighbor.cc:63
ns3::aodv::Neighbors::m_handleLinkFailure
Callback< void, Ipv4Address > m_handleLinkFailure
link failure callback
Definition:
aodv-neighbor.h:152
src
aodv
model
aodv-neighbor.h
Generated on Fri Oct 1 2021 17:02:54 for ns-3 by
1.8.20