A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
dsr-gratuitous-reply-table.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Yufei Cheng
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Yufei Cheng <yfcheng@ittc.ku.edu>
18
*
19
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
20
* ResiliNets Research Group https://resilinets.org/
21
* Information and Telecommunication Technology Center (ITTC)
22
* and Department of Electrical Engineering and Computer Science
23
* The University of Kansas Lawrence, KS USA.
24
*
25
* Work supported in part by NSF FIND (Future Internet Design) Program
26
* under grant CNS-0626918 (Postmodern Internet Architecture),
27
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
28
* US Department of Defense (DoD), and ITTC at The University of Kansas.
29
*/
30
31
#ifndef DSR_GRATUITOUS_REPLY_TABLE_H
32
#define DSR_GRATUITOUS_REPLY_TABLE_H
33
34
#include "ns3/callback.h"
35
#include "ns3/ipv4-address.h"
36
#include "ns3/simulator.h"
37
#include "ns3/timer.h"
38
39
#include <vector>
40
41
namespace
ns3
42
{
43
namespace
dsr
44
{
50
struct
GraReplyEntry
51
{
52
Ipv4Address
m_replyTo
;
53
Ipv4Address
m_hearFrom
;
54
Time
m_gratReplyHoldoff
;
55
63
GraReplyEntry
(
Ipv4Address
t,
Ipv4Address
f
,
Time
h)
64
:
m_replyTo
(t),
65
m_hearFrom
(
f
),
66
m_gratReplyHoldoff
(h)
67
{
68
}
69
};
70
75
class
DsrGraReply
:
public
Object
76
{
77
public
:
82
static
TypeId
GetTypeId
();
83
84
DsrGraReply
();
85
~DsrGraReply
()
override
;
86
89
void
SetGraTableSize
(uint32_t g)
90
{
91
GraReplyTableSize
= g;
92
}
93
96
uint32_t
GetGraTableSize
()
const
97
{
98
return
GraReplyTableSize
;
99
}
100
104
bool
AddEntry
(
GraReplyEntry
& graTableEntry);
110
bool
FindAndUpdate
(
Ipv4Address
replyTo,
Ipv4Address
replyFrom,
Time
gratReplyHoldoff);
112
void
Purge
();
113
115
void
Clear
()
116
{
117
m_graReply
.clear();
118
}
119
120
private
:
122
std::vector<GraReplyEntry>
m_graReply
;
124
uint32_t
GraReplyTableSize
;
125
127
struct
IsExpired
128
{
135
bool
operator()
(
const
GraReplyEntry
& b)
const
136
{
137
return
(b.
m_gratReplyHoldoff
<
Simulator::Now
());
138
}
139
};
140
};
141
}
// namespace dsr
142
}
// namespace ns3
143
144
#endif
/* DSR_GRATUITOUS_REPLY_TABLE_H */
f
double f(double x, void *params)
Definition:
80211b.c:70
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:42
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::Simulator::Now
static Time Now()
Return the current simulation virtual time.
Definition:
simulator.cc:208
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::dsr::DsrGraReply
maintain the gratuitous reply
Definition:
dsr-gratuitous-reply-table.h:76
ns3::dsr::DsrGraReply::AddEntry
bool AddEntry(GraReplyEntry &graTableEntry)
Add a new gratuitous reply entry.
Definition:
dsr-gratuitous-reply-table.cc:84
ns3::dsr::DsrGraReply::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
dsr-gratuitous-reply-table.cc:48
ns3::dsr::DsrGraReply::m_graReply
std::vector< GraReplyEntry > m_graReply
Vector of entries.
Definition:
dsr-gratuitous-reply-table.h:122
ns3::dsr::DsrGraReply::GraReplyTableSize
uint32_t GraReplyTableSize
The max # of gratuitous reply entries to hold.
Definition:
dsr-gratuitous-reply-table.h:124
ns3::dsr::DsrGraReply::DsrGraReply
DsrGraReply()
Definition:
dsr-gratuitous-reply-table.cc:57
ns3::dsr::DsrGraReply::SetGraTableSize
void SetGraTableSize(uint32_t g)
Set the gratuitous reply table size.
Definition:
dsr-gratuitous-reply-table.h:89
ns3::dsr::DsrGraReply::~DsrGraReply
~DsrGraReply() override
Definition:
dsr-gratuitous-reply-table.cc:61
ns3::dsr::DsrGraReply::Purge
void Purge()
Remove all expired entries.
Definition:
dsr-gratuitous-reply-table.cc:91
ns3::dsr::DsrGraReply::GetGraTableSize
uint32_t GetGraTableSize() const
Get the gratuitous reply table size.
Definition:
dsr-gratuitous-reply-table.h:96
ns3::dsr::DsrGraReply::FindAndUpdate
bool FindAndUpdate(Ipv4Address replyTo, Ipv4Address replyFrom, Time gratReplyHoldoff)
Update the route entry if found.
Definition:
dsr-gratuitous-reply-table.cc:67
ns3::dsr::DsrGraReply::Clear
void Clear()
Remove all entries.
Definition:
dsr-gratuitous-reply-table.h:115
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::dsr::DsrGraReply::IsExpired
Check if the entry is expired or not.
Definition:
dsr-gratuitous-reply-table.h:128
ns3::dsr::DsrGraReply::IsExpired::operator()
bool operator()(const GraReplyEntry &b) const
Check if the entry is expired.
Definition:
dsr-gratuitous-reply-table.h:135
ns3::dsr::GraReplyEntry
The gratuitous table entries, it maintains the already sent gratuitous route reply entries.
Definition:
dsr-gratuitous-reply-table.h:51
ns3::dsr::GraReplyEntry::GraReplyEntry
GraReplyEntry(Ipv4Address t, Ipv4Address f, Time h)
Constructor.
Definition:
dsr-gratuitous-reply-table.h:63
ns3::dsr::GraReplyEntry::m_gratReplyHoldoff
Time m_gratReplyHoldoff
gratuitous reply holdoff time
Definition:
dsr-gratuitous-reply-table.h:54
ns3::dsr::GraReplyEntry::m_replyTo
Ipv4Address m_replyTo
reply to address
Definition:
dsr-gratuitous-reply-table.h:52
ns3::dsr::GraReplyEntry::m_hearFrom
Ipv4Address m_hearFrom
heard from address
Definition:
dsr-gratuitous-reply-table.h:53
src
dsr
model
dsr-gratuitous-reply-table.h
Generated on Sun Mar 3 2024 17:10:56 for ns-3 by
1.9.1