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
dsr-gratuitous-reply-table.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Yufei Cheng
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
* Author: Yufei Cheng <yfcheng@ittc.ku.edu>
19
*
20
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
21
* ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
22
* Information and Telecommunication Technology Center (ITTC)
23
* and Department of Electrical Engineering and Computer Science
24
* The University of Kansas Lawrence, KS USA.
25
*
26
* Work supported in part by NSF FIND (Future Internet Design) Program
27
* under grant CNS-0626918 (Postmodern Internet Architecture),
28
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
29
* US Department of Defense (DoD), and ITTC at The University of Kansas.
30
*/
31
32
#ifndef DSR_GRATUITOUS_REPLY_TABLE_H
33
#define DSR_GRATUITOUS_REPLY_TABLE_H
34
35
#include "ns3/simulator.h"
36
#include "ns3/timer.h"
37
#include "ns3/ipv4-address.h"
38
#include "ns3/callback.h"
39
#include <vector>
40
41
namespace
ns3 {
42
namespace
dsr {
43
/*
44
* The gratuitous table entries, it maintains the already sent gratuitous route reply entries.
45
* When the node "promiscuously" received a packet destined for other nodes, and inferred a shorter
46
* route for the data packet, it will construct a route reply and send back to the source
47
*/
48
struct
GraReplyEntry
49
{
50
Ipv4Address
m_replyTo
;
51
Ipv4Address
m_hearFrom
;
52
Time
m_gratReplyHoldoff
;
53
54
GraReplyEntry
(
Ipv4Address
t,
Ipv4Address
f,
Time
h)
55
:
m_replyTo
(t),
56
m_hearFrom
(f),
57
m_gratReplyHoldoff
(h)
58
{
59
}
60
};
65
class
GraReply
:
public
Object
66
{
67
public
:
68
69
static
TypeId
GetTypeId
();
70
71
GraReply
();
72
virtual
~GraReply
();
73
75
void
SetGraTableSize
(uint32_t g)
76
{
77
GraReplyTableSize
= g;
78
}
80
uint32_t
GetGraTableSize
()
const
81
{
82
return
GraReplyTableSize
;
83
}
85
bool
AddEntry
(
GraReplyEntry
& graTableEntry);
87
bool
FindAndUpdate
(
Ipv4Address
replyTo,
Ipv4Address
replyFrom,
Time
gratReplyHoldoff);
89
void
Purge
();
91
void
Clear
()
92
{
93
m_graReply
.clear ();
94
}
95
96
private
:
98
std::vector<GraReplyEntry>
m_graReply
;
100
uint32_t
GraReplyTableSize
;
101
103
struct
IsExpired
104
{
105
bool
operator()
(
const
struct
GraReplyEntry
& b)
const
106
{
107
return
(b.
m_gratReplyHoldoff
<
Simulator::Now
());
108
}
109
};
110
};
111
}
// namespace dsr
112
}
// namespace ns3
113
114
#endif
/* DSR_GRATUITOUS_REPLY_TABLE_H */
ns3::dsr::GraReply::~GraReply
virtual ~GraReply()
Definition:
dsr-gratuitous-reply-table.cc:57
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::dsr::GraReplyEntry::m_gratReplyHoldoff
Time m_gratReplyHoldoff
Definition:
dsr-gratuitous-reply-table.h:52
ns3::dsr::GraReplyEntry::m_hearFrom
Ipv4Address m_hearFrom
Definition:
dsr-gratuitous-reply-table.h:51
ns3::dsr::GraReply::GetGraTableSize
uint32_t GetGraTableSize() const
Get the gratuitous reply table size.
Definition:
dsr-gratuitous-reply-table.h:80
ns3::dsr::GraReply::GraReplyTableSize
uint32_t GraReplyTableSize
The max # of gratuitous reply entries to hold.
Definition:
dsr-gratuitous-reply-table.h:100
ns3::dsr::GraReply::IsExpired
Check if the entry is expired or not.
Definition:
dsr-gratuitous-reply-table.h:103
ns3::dsr::GraReply::GraReply
GraReply()
Definition:
dsr-gratuitous-reply-table.cc:53
ns3::dsr::GraReply::SetGraTableSize
void SetGraTableSize(uint32_t g)
Set the gratuitous reply table size.
Definition:
dsr-gratuitous-reply-table.h:75
ns3::dsr::GraReplyEntry::GraReplyEntry
GraReplyEntry(Ipv4Address t, Ipv4Address f, Time h)
Definition:
dsr-gratuitous-reply-table.h:54
ns3::dsr::GraReply::m_graReply
std::vector< GraReplyEntry > m_graReply
Vector of entries.
Definition:
dsr-gratuitous-reply-table.h:98
ns3::dsr::GraReply::IsExpired::operator()
bool operator()(const struct GraReplyEntry &b) const
Definition:
dsr-gratuitous-reply-table.h:105
ns3::dsr::GraReplyEntry
Definition:
dsr-gratuitous-reply-table.h:48
ns3::Simulator::Now
static Time Now(void)
Return the "current simulation time".
Definition:
simulator.cc:180
ns3::dsr::GraReply::FindAndUpdate
bool FindAndUpdate(Ipv4Address replyTo, Ipv4Address replyFrom, Time gratReplyHoldoff)
Update the route entry if found, create a new one if not.
Definition:
dsr-gratuitous-reply-table.cc:63
ns3::dsr::GraReply::GetTypeId
static TypeId GetTypeId()
Definition:
dsr-gratuitous-reply-table.cc:44
ns3::dsr::GraReply::Clear
void Clear()
Remove all entries.
Definition:
dsr-gratuitous-reply-table.h:91
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:38
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
ns3::dsr::GraReplyEntry::m_replyTo
Ipv4Address m_replyTo
Definition:
dsr-gratuitous-reply-table.h:50
ns3::dsr::GraReply::AddEntry
bool AddEntry(GraReplyEntry &graTableEntry)
Add a new gratuitous reply entry.
Definition:
dsr-gratuitous-reply-table.cc:80
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::dsr::GraReply
maintain the gratuitous reply
Definition:
dsr-gratuitous-reply-table.h:65
ns3::dsr::GraReply::Purge
void Purge()
Remove all expired entries.
Definition:
dsr-gratuitous-reply-table.cc:87
src
dsr
model
dsr-gratuitous-reply-table.h
Generated on Sat Apr 19 2014 14:06:53 for ns-3 by
1.8.6