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
dsdv-routing-protocol.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 Hemanth Narra, 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: Hemanth Narra <hemanth@ittc.ku.com>
19
* Author: Yufei Cheng <yfcheng@ittc.ku.edu>
20
*
21
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
22
* ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
23
* Information and Telecommunication Technology Center (ITTC)
24
* and Department of Electrical Engineering and Computer Science
25
* The University of Kansas Lawrence, KS USA.
26
*
27
* Work supported in part by NSF FIND (Future Internet Design) Program
28
* under grant CNS-0626918 (Postmodern Internet Architecture),
29
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
30
* US Department of Defense (DoD), and ITTC at The University of Kansas.
31
*/
32
33
#ifndef DSDV_ROUTING_PROTOCOL_H
34
#define DSDV_ROUTING_PROTOCOL_H
35
36
#include "
dsdv-rtable.h
"
37
#include "
dsdv-packet-queue.h
"
38
#include "
dsdv-packet.h
"
39
#include "ns3/node.h"
40
#include "ns3/random-variable-stream.h"
41
#include "ns3/ipv4-routing-protocol.h"
42
#include "ns3/ipv4-interface.h"
43
#include "ns3/ipv4-l3-protocol.h"
44
#include "ns3/output-stream-wrapper.h"
45
46
namespace
ns3 {
47
namespace
dsdv {
48
53
class
RoutingProtocol
:
public
Ipv4RoutingProtocol
54
{
55
public
:
56
static
TypeId
57
GetTypeId
(
void
);
58
static
const
uint32_t
DSDV_PORT
;
59
61
RoutingProtocol
();
62
virtual
63
~RoutingProtocol
();
64
virtual
void
65
DoDispose
();
66
68
// \{
69
Ptr<Ipv4Route>
RouteOutput
(
Ptr<Packet>
p,
const
Ipv4Header
&header,
Ptr<NetDevice>
oif,
Socket::SocketErrno
&sockerr);
70
bool
RouteInput
(
Ptr<const Packet>
p,
const
Ipv4Header
&header,
Ptr<const NetDevice>
idev,
UnicastForwardCallback
ucb,
71
MulticastForwardCallback
mcb,
LocalDeliverCallback
lcb,
ErrorCallback
ecb);
72
virtual
void
PrintRoutingTable
(
Ptr<OutputStreamWrapper>
stream)
const
;
73
virtual
void
NotifyInterfaceUp
(uint32_t interface);
74
virtual
void
NotifyInterfaceDown
(uint32_t interface);
75
virtual
void
NotifyAddAddress
(uint32_t interface,
Ipv4InterfaceAddress
address);
76
virtual
void
NotifyRemoveAddress
(uint32_t interface,
Ipv4InterfaceAddress
address);
77
virtual
void
SetIpv4
(
Ptr<Ipv4>
ipv4);
78
// \}
80
// \{
81
void
SetEnableBufferFlag
(
bool
f);
82
bool
GetEnableBufferFlag
()
const
;
83
void
SetWSTFlag
(
bool
f);
84
bool
GetWSTFlag
()
const
;
85
void
SetEnableRAFlag
(
bool
f);
86
bool
GetEnableRAFlag
()
const
;
87
// \}
88
97
int64_t
AssignStreams
(int64_t stream);
98
99
private
:
101
// \{
105
uint32_t
Holdtimes
;
108
Time
m_periodicUpdateInterval
;
111
Time
m_settlingTime
;
113
Ipv4Address
m_mainAddress
;
115
Ptr<Ipv4>
m_ipv4
;
117
std::map<Ptr<Socket>,
Ipv4InterfaceAddress
>
m_socketAddresses
;
119
Ptr<NetDevice>
m_lo
;
121
RoutingTable
m_routingTable
;
123
RoutingTable
m_advRoutingTable
;
125
uint32_t
m_maxQueueLen
;
127
uint32_t
m_maxQueuedPacketsPerDst
;
129
Time
m_maxQueueTime
;
131
PacketQueue
m_queue
;
133
bool
EnableBuffering
;
135
bool
EnableWST
;
137
double
m_weightedFactor
;
140
bool
EnableRouteAggregation
;
142
Time
m_routeAggregationTime
;
144
UnicastForwardCallback
m_scb
;
146
ErrorCallback
m_ecb
;
147
// \}
148
149
private
:
151
void
152
Start
();
154
void
155
DeferredRouteOutput
(
Ptr<const Packet>
p,
const
Ipv4Header
& header,
UnicastForwardCallback
ucb,
ErrorCallback
ecb);
157
void
158
LookForQueuedPackets
(
void
);
164
void
165
SendPacketFromQueue
(
Ipv4Address
dst,
Ptr<Ipv4Route>
route);
167
Ptr<Socket>
168
FindSocketWithInterfaceAddress
(
Ipv4InterfaceAddress
iface)
const
;
170
// \{
172
void
173
RecvDsdv
(
Ptr<Socket>
socket);
174
// \}
175
void
176
Send
(
Ptr<Ipv4Route>
,
Ptr<const Packet>
,
const
Ipv4Header
&);
178
Ptr<Ipv4Route>
179
LoopbackRoute
(
const
Ipv4Header
& header,
Ptr<NetDevice>
oif)
const
;
185
Time
186
GetSettlingTime
(
Ipv4Address
dst);
188
void
189
SendTriggeredUpdate
();
191
void
192
SendPeriodicUpdate
();
193
void
194
MergeTriggerPeriodicUpdates
();
196
void
197
Drop
(
Ptr<const Packet>
,
const
Ipv4Header
&,
Socket::SocketErrno
);
199
Timer
m_periodicUpdateTimer
;
201
Timer
m_triggeredExpireTimer
;
202
204
Ptr<UniformRandomVariable>
m_uniformRandomVariable
;
205
};
206
207
}
208
}
209
210
#endif
/* DSDV_ROUTING_PROTOCOL_H */
src
dsdv
model
dsdv-routing-protocol.h
Generated on Tue Nov 13 2012 10:32:12 for ns-3 by
1.8.1.2