|
|
| 120 |
|
120 |
|
| 121 |
//----------------------------------------------------------------------------- |
121 |
//----------------------------------------------------------------------------- |
| 122 |
RoutingProtocol::RoutingProtocol () : |
122 |
RoutingProtocol::RoutingProtocol () : |
| 123 |
RreqRetries (2), |
123 |
m_rreqRetries (2), |
| 124 |
TtlStart (1), |
124 |
m_ttlStart (1), |
| 125 |
TtlIncrement (2), |
125 |
m_ttlIncrement (2), |
| 126 |
TtlThreshold (7), |
126 |
m_ttlThreshold (7), |
| 127 |
TimeoutBuffer (2), |
127 |
m_timeoutBuffer (2), |
| 128 |
RreqRateLimit (10), |
128 |
m_rreqRateLimit (10), |
| 129 |
RerrRateLimit (10), |
129 |
m_rerrRateLimit (10), |
| 130 |
ActiveRouteTimeout (Seconds (3)), |
130 |
m_activeRouteTimeout (Seconds (3)), |
| 131 |
NetDiameter (35), |
131 |
m_netDiameter (35), |
| 132 |
NodeTraversalTime (MilliSeconds (40)), |
132 |
m_nodeTraversalTime (MilliSeconds (40)), |
| 133 |
NetTraversalTime (Time ((2 * NetDiameter) * NodeTraversalTime)), |
133 |
m_netTraversalTime (Time ((2 * m_netDiameter) * m_nodeTraversalTime)), |
| 134 |
PathDiscoveryTime ( Time (2 * NetTraversalTime)), |
134 |
m_pathDiscoveryTime ( Time (2 * m_netTraversalTime)), |
| 135 |
MyRouteTimeout (Time (2 * std::max (PathDiscoveryTime, ActiveRouteTimeout))), |
135 |
m_myRouteTimeout (Time (2 * std::max (m_pathDiscoveryTime, m_activeRouteTimeout))), |
| 136 |
HelloInterval (Seconds (1)), |
136 |
m_helloInterval (Seconds (1)), |
| 137 |
AllowedHelloLoss (2), |
137 |
m_allowedHelloLoss (2), |
| 138 |
DeletePeriod (Time (5 * std::max (ActiveRouteTimeout, HelloInterval))), |
138 |
m_deletePeriod (Time (5 * std::max (m_activeRouteTimeout, m_helloInterval))), |
| 139 |
NextHopWait (NodeTraversalTime + MilliSeconds (10)), |
139 |
m_nextHopWait (m_nodeTraversalTime + MilliSeconds (10)), |
| 140 |
BlackListTimeout (Time (RreqRetries * NetTraversalTime)), |
140 |
m_blackListTimeout (Time (m_rreqRetries * m_netTraversalTime)), |
| 141 |
MaxQueueLen (64), |
141 |
m_maxQueueLen (64), |
| 142 |
MaxQueueTime (Seconds (30)), |
142 |
m_maxQueueTime (Seconds (30)), |
| 143 |
DestinationOnly (false), |
143 |
m_destinationOnly (false), |
| 144 |
GratuitousReply (true), |
144 |
m_gratuitousReply (true), |
| 145 |
EnableHello (false), |
145 |
m_enableHello (false), |
| 146 |
m_routingTable (DeletePeriod), |
146 |
m_routingTable (m_deletePeriod), |
| 147 |
m_queue (MaxQueueLen, MaxQueueTime), |
147 |
m_queue (m_maxQueueLen, m_maxQueueTime), |
| 148 |
m_requestId (0), |
148 |
m_requestId (0), |
| 149 |
m_seqNo (0), |
149 |
m_seqNo (0), |
| 150 |
m_rreqIdCache (PathDiscoveryTime), |
150 |
m_rreqIdCache (m_pathDiscoveryTime), |
| 151 |
m_dpd (PathDiscoveryTime), |
151 |
m_dpd (m_pathDiscoveryTime), |
| 152 |
m_nb (HelloInterval), |
152 |
m_nb (m_helloInterval), |
| 153 |
m_rreqCount (0), |
153 |
m_rreqCount (0), |
| 154 |
m_rerrCount (0), |
154 |
m_rerrCount (0), |
| 155 |
m_htimer (Timer::CANCEL_ON_DESTROY), |
155 |
m_htimer (Timer::CANCEL_ON_DESTROY), |
|
|
| 169 |
.AddConstructor<RoutingProtocol> () |
169 |
.AddConstructor<RoutingProtocol> () |
| 170 |
.AddAttribute ("HelloInterval", "HELLO messages emission interval.", |
170 |
.AddAttribute ("HelloInterval", "HELLO messages emission interval.", |
| 171 |
TimeValue (Seconds (1)), |
171 |
TimeValue (Seconds (1)), |
| 172 |
MakeTimeAccessor (&RoutingProtocol::HelloInterval), |
172 |
MakeTimeAccessor (&RoutingProtocol::m_helloInterval), |
| 173 |
MakeTimeChecker ()) |
173 |
MakeTimeChecker ()) |
| 174 |
.AddAttribute ("TtlStart", "Initial TTL value for RREQ.", |
174 |
.AddAttribute ("TtlStart", "Initial TTL value for RREQ.", |
| 175 |
UintegerValue (1), |
175 |
UintegerValue (1), |
| 176 |
MakeUintegerAccessor (&RoutingProtocol::TtlStart), |
176 |
MakeUintegerAccessor (&RoutingProtocol::m_ttlStart), |
| 177 |
MakeUintegerChecker<uint16_t> ()) |
177 |
MakeUintegerChecker<uint16_t> ()) |
| 178 |
.AddAttribute ("TtlIncrement", "TTL increment for each attempt using the expanding ring search for RREQ dissemination.", |
178 |
.AddAttribute ("TtlIncrement", "TTL increment for each attempt using the expanding ring search for RREQ dissemination.", |
| 179 |
UintegerValue (2), |
179 |
UintegerValue (2), |
| 180 |
MakeUintegerAccessor (&RoutingProtocol::TtlIncrement), |
180 |
MakeUintegerAccessor (&RoutingProtocol::m_ttlIncrement), |
| 181 |
MakeUintegerChecker<uint16_t> ()) |
181 |
MakeUintegerChecker<uint16_t> ()) |
| 182 |
.AddAttribute ("TtlThreshold", "Maximum TTL value for expanding ring search, TTL = NetDiameter is used beyond this value.", |
182 |
.AddAttribute ("TtlThreshold", "Maximum TTL value for expanding ring search, TTL = NetDiameter is used beyond this value.", |
| 183 |
UintegerValue (7), |
183 |
UintegerValue (7), |
| 184 |
MakeUintegerAccessor (&RoutingProtocol::TtlThreshold), |
184 |
MakeUintegerAccessor (&RoutingProtocol::m_ttlThreshold), |
| 185 |
MakeUintegerChecker<uint16_t> ()) |
185 |
MakeUintegerChecker<uint16_t> ()) |
| 186 |
.AddAttribute ("TimeoutBuffer", "Provide a buffer for the timeout.", |
186 |
.AddAttribute ("TimeoutBuffer", "Provide a buffer for the timeout.", |
| 187 |
UintegerValue (2), |
187 |
UintegerValue (2), |
| 188 |
MakeUintegerAccessor (&RoutingProtocol::TimeoutBuffer), |
188 |
MakeUintegerAccessor (&RoutingProtocol::m_timeoutBuffer), |
| 189 |
MakeUintegerChecker<uint16_t> ()) |
189 |
MakeUintegerChecker<uint16_t> ()) |
| 190 |
.AddAttribute ("RreqRetries", "Maximum number of retransmissions of RREQ to discover a route", |
190 |
.AddAttribute ("RreqRetries", "Maximum number of retransmissions of RREQ to discover a route", |
| 191 |
UintegerValue (2), |
191 |
UintegerValue (2), |
| 192 |
MakeUintegerAccessor (&RoutingProtocol::RreqRetries), |
192 |
MakeUintegerAccessor (&RoutingProtocol::m_rreqRetries), |
| 193 |
MakeUintegerChecker<uint32_t> ()) |
193 |
MakeUintegerChecker<uint32_t> ()) |
| 194 |
.AddAttribute ("RreqRateLimit", "Maximum number of RREQ per second.", |
194 |
.AddAttribute ("RreqRateLimit", "Maximum number of RREQ per second.", |
| 195 |
UintegerValue (10), |
195 |
UintegerValue (10), |
| 196 |
MakeUintegerAccessor (&RoutingProtocol::RreqRateLimit), |
196 |
MakeUintegerAccessor (&RoutingProtocol::m_rreqRateLimit), |
| 197 |
MakeUintegerChecker<uint32_t> ()) |
197 |
MakeUintegerChecker<uint32_t> ()) |
| 198 |
.AddAttribute ("RerrRateLimit", "Maximum number of RERR per second.", |
198 |
.AddAttribute ("RerrRateLimit", "Maximum number of RERR per second.", |
| 199 |
UintegerValue (10), |
199 |
UintegerValue (10), |
| 200 |
MakeUintegerAccessor (&RoutingProtocol::RerrRateLimit), |
200 |
MakeUintegerAccessor (&RoutingProtocol::m_rerrRateLimit), |
| 201 |
MakeUintegerChecker<uint32_t> ()) |
201 |
MakeUintegerChecker<uint32_t> ()) |
| 202 |
.AddAttribute ("NodeTraversalTime", "Conservative estimate of the average one hop traversal time for packets and should include " |
202 |
.AddAttribute ("NodeTraversalTime", "Conservative estimate of the average one hop traversal time for packets and should include " |
| 203 |
"queuing delays, interrupt processing times and transfer times.", |
203 |
"queuing delays, interrupt processing times and transfer times.", |
| 204 |
TimeValue (MilliSeconds (40)), |
204 |
TimeValue (MilliSeconds (40)), |
| 205 |
MakeTimeAccessor (&RoutingProtocol::NodeTraversalTime), |
205 |
MakeTimeAccessor (&RoutingProtocol::m_nodeTraversalTime), |
| 206 |
MakeTimeChecker ()) |
206 |
MakeTimeChecker ()) |
| 207 |
.AddAttribute ("NextHopWait", "Period of our waiting for the neighbour's RREP_ACK = 10 ms + NodeTraversalTime", |
207 |
.AddAttribute ("NextHopWait", "Period of our waiting for the neighbour's RREP_ACK = 10 ms + NodeTraversalTime", |
| 208 |
TimeValue (MilliSeconds (50)), |
208 |
TimeValue (MilliSeconds (50)), |
| 209 |
MakeTimeAccessor (&RoutingProtocol::NextHopWait), |
209 |
MakeTimeAccessor (&RoutingProtocol::m_nextHopWait), |
| 210 |
MakeTimeChecker ()) |
210 |
MakeTimeChecker ()) |
| 211 |
.AddAttribute ("ActiveRouteTimeout", "Period of time during which the route is considered to be valid", |
211 |
.AddAttribute ("ActiveRouteTimeout", "Period of time during which the route is considered to be valid", |
| 212 |
TimeValue (Seconds (3)), |
212 |
TimeValue (Seconds (3)), |
| 213 |
MakeTimeAccessor (&RoutingProtocol::ActiveRouteTimeout), |
213 |
MakeTimeAccessor (&RoutingProtocol::m_activeRouteTimeout), |
| 214 |
MakeTimeChecker ()) |
214 |
MakeTimeChecker ()) |
| 215 |
.AddAttribute ("MyRouteTimeout", "Value of lifetime field in RREP generating by this node = 2 * max(ActiveRouteTimeout, PathDiscoveryTime)", |
215 |
.AddAttribute ("MyRouteTimeout", "Value of lifetime field in RREP generating by this node = 2 * max(ActiveRouteTimeout, PathDiscoveryTime)", |
| 216 |
TimeValue (Seconds (11.2)), |
216 |
TimeValue (Seconds (11.2)), |
| 217 |
MakeTimeAccessor (&RoutingProtocol::MyRouteTimeout), |
217 |
MakeTimeAccessor (&RoutingProtocol::m_myRouteTimeout), |
| 218 |
MakeTimeChecker ()) |
218 |
MakeTimeChecker ()) |
| 219 |
.AddAttribute ("BlackListTimeout", "Time for which the node is put into the blacklist = RreqRetries * NetTraversalTime", |
219 |
.AddAttribute ("BlackListTimeout", "Time for which the node is put into the blacklist = RreqRetries * NetTraversalTime", |
| 220 |
TimeValue (Seconds (5.6)), |
220 |
TimeValue (Seconds (5.6)), |
| 221 |
MakeTimeAccessor (&RoutingProtocol::BlackListTimeout), |
221 |
MakeTimeAccessor (&RoutingProtocol::m_blackListTimeout), |
| 222 |
MakeTimeChecker ()) |
222 |
MakeTimeChecker ()) |
| 223 |
.AddAttribute ("DeletePeriod", "DeletePeriod is intended to provide an upper bound on the time for which an upstream node A " |
223 |
.AddAttribute ("DeletePeriod", "DeletePeriod is intended to provide an upper bound on the time for which an upstream node A " |
| 224 |
"can have a neighbor B as an active next hop for destination D, while B has invalidated the route to D." |
224 |
"can have a neighbor B as an active next hop for destination D, while B has invalidated the route to D." |
| 225 |
" = 5 * max (HelloInterval, ActiveRouteTimeout)", |
225 |
" = 5 * max (HelloInterval, ActiveRouteTimeout)", |
| 226 |
TimeValue (Seconds (15)), |
226 |
TimeValue (Seconds (15)), |
| 227 |
MakeTimeAccessor (&RoutingProtocol::DeletePeriod), |
227 |
MakeTimeAccessor (&RoutingProtocol::m_deletePeriod), |
| 228 |
MakeTimeChecker ()) |
228 |
MakeTimeChecker ()) |
| 229 |
.AddAttribute ("NetDiameter", "Net diameter measures the maximum possible number of hops between two nodes in the network", |
229 |
.AddAttribute ("NetDiameter", "Net diameter measures the maximum possible number of hops between two nodes in the network", |
| 230 |
UintegerValue (35), |
230 |
UintegerValue (35), |
| 231 |
MakeUintegerAccessor (&RoutingProtocol::NetDiameter), |
231 |
MakeUintegerAccessor (&RoutingProtocol::m_netDiameter), |
| 232 |
MakeUintegerChecker<uint32_t> ()) |
232 |
MakeUintegerChecker<uint32_t> ()) |
| 233 |
.AddAttribute ("NetTraversalTime", "Estimate of the average net traversal time = 2 * NodeTraversalTime * NetDiameter", |
233 |
.AddAttribute ("NetTraversalTime", "Estimate of the average net traversal time = 2 * NodeTraversalTime * NetDiameter", |
| 234 |
TimeValue (Seconds (2.8)), |
234 |
TimeValue (Seconds (2.8)), |
| 235 |
MakeTimeAccessor (&RoutingProtocol::NetTraversalTime), |
235 |
MakeTimeAccessor (&RoutingProtocol::m_netTraversalTime), |
| 236 |
MakeTimeChecker ()) |
236 |
MakeTimeChecker ()) |
| 237 |
.AddAttribute ("PathDiscoveryTime", "Estimate of maximum time needed to find route in network = 2 * NetTraversalTime", |
237 |
.AddAttribute ("PathDiscoveryTime", "Estimate of maximum time needed to find route in network = 2 * NetTraversalTime", |
| 238 |
TimeValue (Seconds (5.6)), |
238 |
TimeValue (Seconds (5.6)), |
| 239 |
MakeTimeAccessor (&RoutingProtocol::PathDiscoveryTime), |
239 |
MakeTimeAccessor (&RoutingProtocol::m_pathDiscoveryTime), |
| 240 |
MakeTimeChecker ()) |
240 |
MakeTimeChecker ()) |
| 241 |
.AddAttribute ("MaxQueueLen", "Maximum number of packets that we allow a routing protocol to buffer.", |
241 |
.AddAttribute ("MaxQueueLen", "Maximum number of packets that we allow a routing protocol to buffer.", |
| 242 |
UintegerValue (64), |
242 |
UintegerValue (64), |
|
|
| 250 |
MakeTimeChecker ()) |
250 |
MakeTimeChecker ()) |
| 251 |
.AddAttribute ("AllowedHelloLoss", "Number of hello messages which may be loss for valid link.", |
251 |
.AddAttribute ("AllowedHelloLoss", "Number of hello messages which may be loss for valid link.", |
| 252 |
UintegerValue (2), |
252 |
UintegerValue (2), |
| 253 |
MakeUintegerAccessor (&RoutingProtocol::AllowedHelloLoss), |
253 |
MakeUintegerAccessor (&RoutingProtocol::m_allowedHelloLoss), |
| 254 |
MakeUintegerChecker<uint16_t> ()) |
254 |
MakeUintegerChecker<uint16_t> ()) |
| 255 |
.AddAttribute ("GratuitousReply", "Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.", |
255 |
.AddAttribute ("GratuitousReply", "Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.", |
| 256 |
BooleanValue (true), |
256 |
BooleanValue (true), |
|
|
| 284 |
void |
284 |
void |
| 285 |
RoutingProtocol::SetMaxQueueLen (uint32_t len) |
285 |
RoutingProtocol::SetMaxQueueLen (uint32_t len) |
| 286 |
{ |
286 |
{ |
| 287 |
MaxQueueLen = len; |
287 |
m_maxQueueLen = len; |
| 288 |
m_queue.SetMaxQueueLen (len); |
288 |
m_queue.SetMaxQueueLen (len); |
| 289 |
} |
289 |
} |
| 290 |
void |
290 |
void |
| 291 |
RoutingProtocol::SetMaxQueueTime (Time t) |
291 |
RoutingProtocol::SetMaxQueueTime (Time t) |
| 292 |
{ |
292 |
{ |
| 293 |
MaxQueueTime = t; |
293 |
m_maxQueueTime = t; |
| 294 |
m_queue.SetQueueTimeout (t); |
294 |
m_queue.SetQueueTimeout (t); |
| 295 |
} |
295 |
} |
| 296 |
|
296 |
|
|
|
| 341 |
RoutingProtocol::Start () |
341 |
RoutingProtocol::Start () |
| 342 |
{ |
342 |
{ |
| 343 |
NS_LOG_FUNCTION (this); |
343 |
NS_LOG_FUNCTION (this); |
| 344 |
if (EnableHello) |
344 |
if (m_enableHello) |
| 345 |
{ |
345 |
{ |
| 346 |
m_nb.ScheduleTimer (); |
346 |
m_nb.ScheduleTimer (); |
| 347 |
} |
347 |
} |
|
|
| 387 |
sockerr = Socket::ERROR_NOROUTETOHOST; |
387 |
sockerr = Socket::ERROR_NOROUTETOHOST; |
| 388 |
return Ptr<Ipv4Route> (); |
388 |
return Ptr<Ipv4Route> (); |
| 389 |
} |
389 |
} |
| 390 |
UpdateRouteLifeTime (dst, ActiveRouteTimeout); |
390 |
UpdateRouteLifeTime (dst, m_activeRouteTimeout); |
| 391 |
UpdateRouteLifeTime (route->GetGateway (), ActiveRouteTimeout); |
391 |
UpdateRouteLifeTime (route->GetGateway (), m_activeRouteTimeout); |
| 392 |
return route; |
392 |
return route; |
| 393 |
} |
393 |
} |
| 394 |
|
394 |
|
|
|
| 481 |
NS_LOG_DEBUG ("Duplicated packet " << p->GetUid () << " from " << origin << ". Drop."); |
481 |
NS_LOG_DEBUG ("Duplicated packet " << p->GetUid () << " from " << origin << ". Drop."); |
| 482 |
return true; |
482 |
return true; |
| 483 |
} |
483 |
} |
| 484 |
UpdateRouteLifeTime (origin, ActiveRouteTimeout); |
484 |
UpdateRouteLifeTime (origin, m_activeRouteTimeout); |
| 485 |
Ptr<Packet> packet = p->Copy (); |
485 |
Ptr<Packet> packet = p->Copy (); |
| 486 |
if (lcb.IsNull () == false) |
486 |
if (lcb.IsNull () == false) |
| 487 |
{ |
487 |
{ |
|
|
| 494 |
NS_LOG_ERROR ("Unable to deliver packet locally due to null callback " << p->GetUid () << " from " << origin); |
494 |
NS_LOG_ERROR ("Unable to deliver packet locally due to null callback " << p->GetUid () << " from " << origin); |
| 495 |
ecb (p, header, Socket::ERROR_NOROUTETOHOST); |
495 |
ecb (p, header, Socket::ERROR_NOROUTETOHOST); |
| 496 |
} |
496 |
} |
| 497 |
if (!EnableBroadcast) |
497 |
if (!m_enableBroadcast) |
| 498 |
{ |
498 |
{ |
| 499 |
return true; |
499 |
return true; |
| 500 |
} |
500 |
} |
|
|
| 533 |
// Unicast local delivery |
533 |
// Unicast local delivery |
| 534 |
if (m_ipv4->IsDestinationAddress (dst, iif)) |
534 |
if (m_ipv4->IsDestinationAddress (dst, iif)) |
| 535 |
{ |
535 |
{ |
| 536 |
UpdateRouteLifeTime (origin, ActiveRouteTimeout); |
536 |
UpdateRouteLifeTime (origin, m_activeRouteTimeout); |
| 537 |
RoutingTableEntry toOrigin; |
537 |
RoutingTableEntry toOrigin; |
| 538 |
if (m_routingTable.LookupValidRoute (origin, toOrigin)) |
538 |
if (m_routingTable.LookupValidRoute (origin, toOrigin)) |
| 539 |
{ |
539 |
{ |
| 540 |
UpdateRouteLifeTime (toOrigin.GetNextHop (), ActiveRouteTimeout); |
540 |
UpdateRouteLifeTime (toOrigin.GetNextHop (), m_activeRouteTimeout); |
| 541 |
m_nb.Update (toOrigin.GetNextHop (), ActiveRouteTimeout); |
541 |
m_nb.Update (toOrigin.GetNextHop (), m_activeRouteTimeout); |
| 542 |
} |
542 |
} |
| 543 |
if (lcb.IsNull () == false) |
543 |
if (lcb.IsNull () == false) |
| 544 |
{ |
544 |
{ |
|
|
| 587 |
* path to the destination is updated to be no less than the current |
587 |
* path to the destination is updated to be no less than the current |
| 588 |
* time plus ActiveRouteTimeout. |
588 |
* time plus ActiveRouteTimeout. |
| 589 |
*/ |
589 |
*/ |
| 590 |
UpdateRouteLifeTime (origin, ActiveRouteTimeout); |
590 |
UpdateRouteLifeTime (origin, m_activeRouteTimeout); |
| 591 |
UpdateRouteLifeTime (dst, ActiveRouteTimeout); |
591 |
UpdateRouteLifeTime (dst, m_activeRouteTimeout); |
| 592 |
UpdateRouteLifeTime (route->GetGateway (), ActiveRouteTimeout); |
592 |
UpdateRouteLifeTime (route->GetGateway (), m_activeRouteTimeout); |
| 593 |
/* |
593 |
/* |
| 594 |
* Since the route between each originator and destination pair is expected to be symmetric, the |
594 |
* Since the route between each originator and destination pair is expected to be symmetric, the |
| 595 |
* Active Route Lifetime for the previous hop, along the reverse path back to the IP source, is also updated |
595 |
* Active Route Lifetime for the previous hop, along the reverse path back to the IP source, is also updated |
|
|
| 597 |
*/ |
597 |
*/ |
| 598 |
RoutingTableEntry toOrigin; |
598 |
RoutingTableEntry toOrigin; |
| 599 |
m_routingTable.LookupRoute (origin, toOrigin); |
599 |
m_routingTable.LookupRoute (origin, toOrigin); |
| 600 |
UpdateRouteLifeTime (toOrigin.GetNextHop (), ActiveRouteTimeout); |
600 |
UpdateRouteLifeTime (toOrigin.GetNextHop (), m_activeRouteTimeout); |
| 601 |
|
601 |
|
| 602 |
m_nb.Update (route->GetGateway (), ActiveRouteTimeout); |
602 |
m_nb.Update (route->GetGateway (), m_activeRouteTimeout); |
| 603 |
m_nb.Update (toOrigin.GetNextHop (), ActiveRouteTimeout); |
603 |
m_nb.Update (toOrigin.GetNextHop (), m_activeRouteTimeout); |
| 604 |
|
604 |
|
| 605 |
ucb (route, p, header); |
605 |
ucb (route, p, header); |
| 606 |
return true; |
606 |
return true; |
|
|
| 929 |
{ |
929 |
{ |
| 930 |
NS_LOG_FUNCTION ( this << dst); |
930 |
NS_LOG_FUNCTION ( this << dst); |
| 931 |
// A node SHOULD NOT originate more than RREQ_RATELIMIT RREQ messages per second. |
931 |
// A node SHOULD NOT originate more than RREQ_RATELIMIT RREQ messages per second. |
| 932 |
if (m_rreqCount == RreqRateLimit) |
932 |
if (m_rreqCount == m_rreqRateLimit) |
| 933 |
{ |
933 |
{ |
| 934 |
Simulator::Schedule (m_rreqRateLimitTimer.GetDelayLeft () + MicroSeconds (100), |
934 |
Simulator::Schedule (m_rreqRateLimitTimer.GetDelayLeft () + MicroSeconds (100), |
| 935 |
&RoutingProtocol::SendRequest, this, dst); |
935 |
&RoutingProtocol::SendRequest, this, dst); |
|
|
| 943 |
|
943 |
|
| 944 |
RoutingTableEntry rt; |
944 |
RoutingTableEntry rt; |
| 945 |
// Using the Hop field in Routing Table to manage the expanding ring search |
945 |
// Using the Hop field in Routing Table to manage the expanding ring search |
| 946 |
uint16_t ttl = TtlStart; |
946 |
uint16_t ttl = m_ttlStart; |
| 947 |
if (m_routingTable.LookupRoute (dst, rt)) |
947 |
if (m_routingTable.LookupRoute (dst, rt)) |
| 948 |
{ |
948 |
{ |
| 949 |
if (rt.GetFlag () != IN_SEARCH) |
949 |
if (rt.GetFlag () != IN_SEARCH) |
| 950 |
{ |
950 |
{ |
| 951 |
ttl = std::min<uint16_t> (rt.GetHop () + TtlIncrement, NetDiameter); |
951 |
ttl = std::min<uint16_t> (rt.GetHop () + m_ttlIncrement, m_netDiameter); |
| 952 |
} |
952 |
} |
| 953 |
else |
953 |
else |
| 954 |
{ |
954 |
{ |
| 955 |
ttl = rt.GetHop () + TtlIncrement; |
955 |
ttl = rt.GetHop () + m_ttlIncrement; |
| 956 |
if (ttl > TtlThreshold) |
956 |
if (ttl > m_ttlThreshold) |
| 957 |
ttl = NetDiameter; |
957 |
ttl = m_netDiameter; |
| 958 |
} |
958 |
} |
| 959 |
if (ttl == NetDiameter) |
959 |
if (ttl == m_netDiameter) |
| 960 |
rt.IncrementRreqCnt (); |
960 |
rt.IncrementRreqCnt (); |
| 961 |
if (rt.GetValidSeqNo ()) |
961 |
if (rt.GetValidSeqNo ()) |
| 962 |
rreqHeader.SetDstSeqno (rt.GetSeqNo ()); |
962 |
rreqHeader.SetDstSeqno (rt.GetSeqNo ()); |
|
|
| 964 |
rreqHeader.SetUnknownSeqno (true); |
964 |
rreqHeader.SetUnknownSeqno (true); |
| 965 |
rt.SetHop (ttl); |
965 |
rt.SetHop (ttl); |
| 966 |
rt.SetFlag (IN_SEARCH); |
966 |
rt.SetFlag (IN_SEARCH); |
| 967 |
rt.SetLifeTime (PathDiscoveryTime); |
967 |
rt.SetLifeTime (m_pathDiscoveryTime); |
| 968 |
m_routingTable.Update (rt); |
968 |
m_routingTable.Update (rt); |
| 969 |
} |
969 |
} |
| 970 |
else |
970 |
else |
|
|
| 973 |
Ptr<NetDevice> dev = 0; |
973 |
Ptr<NetDevice> dev = 0; |
| 974 |
RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ dst, /*validSeqNo=*/ false, /*seqno=*/ 0, |
974 |
RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ dst, /*validSeqNo=*/ false, /*seqno=*/ 0, |
| 975 |
/*iface=*/ Ipv4InterfaceAddress (),/*hop=*/ ttl, |
975 |
/*iface=*/ Ipv4InterfaceAddress (),/*hop=*/ ttl, |
| 976 |
/*nextHop=*/ Ipv4Address (), /*lifeTime=*/ PathDiscoveryTime); |
976 |
/*nextHop=*/ Ipv4Address (), /*lifeTime=*/ m_pathDiscoveryTime); |
| 977 |
// Check if TtlStart == NetDiameter |
977 |
// Check if TtlStart == NetDiameter |
| 978 |
if (ttl == NetDiameter) |
978 |
if (ttl == m_netDiameter) |
| 979 |
newEntry.IncrementRreqCnt (); |
979 |
newEntry.IncrementRreqCnt (); |
| 980 |
newEntry.SetFlag (IN_SEARCH); |
980 |
newEntry.SetFlag (IN_SEARCH); |
| 981 |
m_routingTable.AddRoute (newEntry); |
981 |
m_routingTable.AddRoute (newEntry); |
| 982 |
} |
982 |
} |
| 983 |
|
983 |
|
| 984 |
if (GratuitousReply) |
984 |
if (m_gratuitousReply) |
| 985 |
rreqHeader.SetGratiousRrep (true); |
985 |
rreqHeader.SetGratiousRrep (true); |
| 986 |
if (DestinationOnly) |
986 |
if (m_destinationOnly) |
| 987 |
rreqHeader.SetDestinationOnly (true); |
987 |
rreqHeader.SetDestinationOnly (true); |
| 988 |
|
988 |
|
| 989 |
m_seqNo++; |
989 |
m_seqNo++; |
|
|
| 1046 |
RoutingTableEntry rt; |
1046 |
RoutingTableEntry rt; |
| 1047 |
m_routingTable.LookupRoute (dst, rt); |
1047 |
m_routingTable.LookupRoute (dst, rt); |
| 1048 |
Time retry; |
1048 |
Time retry; |
| 1049 |
if (rt.GetHop () < NetDiameter) |
1049 |
if (rt.GetHop () < m_netDiameter) |
| 1050 |
{ |
1050 |
{ |
| 1051 |
retry = 2 * NodeTraversalTime * (rt.GetHop () + TimeoutBuffer); |
1051 |
retry = 2 * m_nodeTraversalTime * (rt.GetHop () + m_timeoutBuffer); |
| 1052 |
} |
1052 |
} |
| 1053 |
else |
1053 |
else |
| 1054 |
{ |
1054 |
{ |
| 1055 |
// Binary exponential backoff |
1055 |
// Binary exponential backoff |
| 1056 |
retry = std::pow<uint16_t> (2, rt.GetRreqCnt () - 1) * NetTraversalTime; |
1056 |
retry = std::pow<uint16_t> (2, rt.GetRreqCnt () - 1) * m_netTraversalTime; |
| 1057 |
} |
1057 |
} |
| 1058 |
m_addressReqTimer[dst].Schedule (retry); |
1058 |
m_addressReqTimer[dst].Schedule (retry); |
| 1059 |
NS_LOG_LOGIC ("Scheduled RREQ retry in " << retry.GetSeconds () << " seconds"); |
1059 |
NS_LOG_LOGIC ("Scheduled RREQ retry in " << retry.GetSeconds () << " seconds"); |
|
|
| 1145 |
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)); |
1145 |
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)); |
| 1146 |
RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ sender, /*know seqno=*/ false, /*seqno=*/ 0, |
1146 |
RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ sender, /*know seqno=*/ false, /*seqno=*/ 0, |
| 1147 |
/*iface=*/ m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), |
1147 |
/*iface=*/ m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), |
| 1148 |
/*hops=*/ 1, /*next hop=*/ sender, /*lifetime=*/ ActiveRouteTimeout); |
1148 |
/*hops=*/ 1, /*next hop=*/ sender, /*lifetime=*/ m_activeRouteTimeout); |
| 1149 |
m_routingTable.AddRoute (newEntry); |
1149 |
m_routingTable.AddRoute (newEntry); |
| 1150 |
} |
1150 |
} |
| 1151 |
else |
1151 |
else |
|
|
| 1153 |
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)); |
1153 |
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)); |
| 1154 |
if (toNeighbor.GetValidSeqNo () && (toNeighbor.GetHop () == 1) && (toNeighbor.GetOutputDevice () == dev)) |
1154 |
if (toNeighbor.GetValidSeqNo () && (toNeighbor.GetHop () == 1) && (toNeighbor.GetOutputDevice () == dev)) |
| 1155 |
{ |
1155 |
{ |
| 1156 |
toNeighbor.SetLifeTime (std::max (ActiveRouteTimeout, toNeighbor.GetLifeTime ())); |
1156 |
toNeighbor.SetLifeTime (std::max (m_activeRouteTimeout, toNeighbor.GetLifeTime ())); |
| 1157 |
} |
1157 |
} |
| 1158 |
else |
1158 |
else |
| 1159 |
{ |
1159 |
{ |
| 1160 |
RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ sender, /*know seqno=*/ false, /*seqno=*/ 0, |
1160 |
RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ sender, /*know seqno=*/ false, /*seqno=*/ 0, |
| 1161 |
/*iface=*/ m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), |
1161 |
/*iface=*/ m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), |
| 1162 |
/*hops=*/ 1, /*next hop=*/ sender, /*lifetime=*/ std::max (ActiveRouteTimeout, toNeighbor.GetLifeTime ())); |
1162 |
/*hops=*/ 1, /*next hop=*/ sender, /*lifetime=*/ std::max (m_activeRouteTimeout, toNeighbor.GetLifeTime ())); |
| 1163 |
m_routingTable.Update (newEntry); |
1163 |
m_routingTable.Update (newEntry); |
| 1164 |
} |
1164 |
} |
| 1165 |
} |
1165 |
} |
|
|
| 1217 |
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)); |
1217 |
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)); |
| 1218 |
RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ origin, /*validSeno=*/ true, /*seqNo=*/ rreqHeader.GetOriginSeqno (), |
1218 |
RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ origin, /*validSeno=*/ true, /*seqNo=*/ rreqHeader.GetOriginSeqno (), |
| 1219 |
/*iface=*/ m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), /*hops=*/ hop, |
1219 |
/*iface=*/ m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), /*hops=*/ hop, |
| 1220 |
/*nextHop*/ src, /*timeLife=*/ Time ((2 * NetTraversalTime - 2 * hop * NodeTraversalTime))); |
1220 |
/*nextHop*/ src, /*timeLife=*/ Time ((2 * m_netTraversalTime - 2 * hop * m_nodeTraversalTime))); |
| 1221 |
m_routingTable.AddRoute (newEntry); |
1221 |
m_routingTable.AddRoute (newEntry); |
| 1222 |
} |
1222 |
} |
| 1223 |
else |
1223 |
else |
|
|
| 1234 |
toOrigin.SetOutputDevice (m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver))); |
1234 |
toOrigin.SetOutputDevice (m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver))); |
| 1235 |
toOrigin.SetInterface (m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0)); |
1235 |
toOrigin.SetInterface (m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0)); |
| 1236 |
toOrigin.SetHop (hop); |
1236 |
toOrigin.SetHop (hop); |
| 1237 |
toOrigin.SetLifeTime (std::max (Time (2 * NetTraversalTime - 2 * hop * NodeTraversalTime), |
1237 |
toOrigin.SetLifeTime (std::max (Time (2 * m_netTraversalTime - 2 * hop * m_nodeTraversalTime), |
| 1238 |
toOrigin.GetLifeTime ())); |
1238 |
toOrigin.GetLifeTime ())); |
| 1239 |
m_routingTable.Update (toOrigin); |
1239 |
m_routingTable.Update (toOrigin); |
| 1240 |
//m_nb.Update (src, Time (AllowedHelloLoss * HelloInterval)); |
1240 |
//m_nb.Update (src, Time (AllowedHelloLoss * HelloInterval)); |
|
|
| 1248 |
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)); |
1248 |
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)); |
| 1249 |
RoutingTableEntry newEntry (dev, src, false, rreqHeader.GetOriginSeqno (), |
1249 |
RoutingTableEntry newEntry (dev, src, false, rreqHeader.GetOriginSeqno (), |
| 1250 |
m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), |
1250 |
m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), |
| 1251 |
1, src, ActiveRouteTimeout); |
1251 |
1, src, m_activeRouteTimeout); |
| 1252 |
m_routingTable.AddRoute (newEntry); |
1252 |
m_routingTable.AddRoute (newEntry); |
| 1253 |
} |
1253 |
} |
| 1254 |
else |
1254 |
else |
| 1255 |
{ |
1255 |
{ |
| 1256 |
toNeighbor.SetLifeTime (ActiveRouteTimeout); |
1256 |
toNeighbor.SetLifeTime (m_activeRouteTimeout); |
| 1257 |
toNeighbor.SetValidSeqNo (false); |
1257 |
toNeighbor.SetValidSeqNo (false); |
| 1258 |
toNeighbor.SetSeqNo (rreqHeader.GetOriginSeqno ()); |
1258 |
toNeighbor.SetSeqNo (rreqHeader.GetOriginSeqno ()); |
| 1259 |
toNeighbor.SetFlag (VALID); |
1259 |
toNeighbor.SetFlag (VALID); |
|
|
| 1263 |
toNeighbor.SetNextHop (src); |
1263 |
toNeighbor.SetNextHop (src); |
| 1264 |
m_routingTable.Update (toNeighbor); |
1264 |
m_routingTable.Update (toNeighbor); |
| 1265 |
} |
1265 |
} |
| 1266 |
m_nb.Update (src, Time (AllowedHelloLoss * HelloInterval)); |
1266 |
m_nb.Update (src, Time (m_allowedHelloLoss * m_helloInterval)); |
| 1267 |
|
1267 |
|
| 1268 |
NS_LOG_LOGIC (receiver << " receive RREQ with hop count " << static_cast<uint32_t>(rreqHeader.GetHopCount ()) |
1268 |
NS_LOG_LOGIC (receiver << " receive RREQ with hop count " << static_cast<uint32_t>(rreqHeader.GetHopCount ()) |
| 1269 |
<< " ID " << rreqHeader.GetId () |
1269 |
<< " ID " << rreqHeader.GetId () |
|
|
| 1361 |
if (!rreqHeader.GetUnknownSeqno () && (rreqHeader.GetDstSeqno () == m_seqNo + 1)) |
1361 |
if (!rreqHeader.GetUnknownSeqno () && (rreqHeader.GetDstSeqno () == m_seqNo + 1)) |
| 1362 |
m_seqNo++; |
1362 |
m_seqNo++; |
| 1363 |
RrepHeader rrepHeader ( /*prefixSize=*/ 0, /*hops=*/ 0, /*dst=*/ rreqHeader.GetDst (), |
1363 |
RrepHeader rrepHeader ( /*prefixSize=*/ 0, /*hops=*/ 0, /*dst=*/ rreqHeader.GetDst (), |
| 1364 |
/*dstSeqNo=*/ m_seqNo, /*origin=*/ toOrigin.GetDestination (), /*lifeTime=*/ MyRouteTimeout); |
1364 |
/*dstSeqNo=*/ m_seqNo, /*origin=*/ toOrigin.GetDestination (), /*lifeTime=*/ m_myRouteTimeout); |
| 1365 |
Ptr<Packet> packet = Create<Packet> (); |
1365 |
Ptr<Packet> packet = Create<Packet> (); |
| 1366 |
SocketIpTtlTag tag; |
1366 |
SocketIpTtlTag tag; |
| 1367 |
tag.SetTtl (toOrigin.GetHop ()); |
1367 |
tag.SetTtl (toOrigin.GetHop ()); |
|
|
| 1389 |
RoutingTableEntry toNextHop; |
1389 |
RoutingTableEntry toNextHop; |
| 1390 |
m_routingTable.LookupRoute (toOrigin.GetNextHop (), toNextHop); |
1390 |
m_routingTable.LookupRoute (toOrigin.GetNextHop (), toNextHop); |
| 1391 |
toNextHop.m_ackTimer.SetFunction (&RoutingProtocol::AckTimerExpire, this); |
1391 |
toNextHop.m_ackTimer.SetFunction (&RoutingProtocol::AckTimerExpire, this); |
| 1392 |
toNextHop.m_ackTimer.SetArguments (toNextHop.GetDestination (), BlackListTimeout); |
1392 |
toNextHop.m_ackTimer.SetArguments (toNextHop.GetDestination (), m_blackListTimeout); |
| 1393 |
toNextHop.m_ackTimer.SetDelay (NextHopWait); |
1393 |
toNextHop.m_ackTimer.SetDelay (m_nextHopWait); |
| 1394 |
} |
1394 |
} |
| 1395 |
toDst.InsertPrecursor (toOrigin.GetNextHop ()); |
1395 |
toDst.InsertPrecursor (toOrigin.GetNextHop ()); |
| 1396 |
toOrigin.InsertPrecursor (toDst.GetNextHop ()); |
1396 |
toOrigin.InsertPrecursor (toDst.GetNextHop ()); |
|
|
| 1541 |
{ |
1541 |
{ |
| 1542 |
return; // Impossible! drop. |
1542 |
return; // Impossible! drop. |
| 1543 |
} |
1543 |
} |
| 1544 |
toOrigin.SetLifeTime (std::max (ActiveRouteTimeout, toOrigin.GetLifeTime ())); |
1544 |
toOrigin.SetLifeTime (std::max (m_activeRouteTimeout, toOrigin.GetLifeTime ())); |
| 1545 |
m_routingTable.Update (toOrigin); |
1545 |
m_routingTable.Update (toOrigin); |
| 1546 |
|
1546 |
|
| 1547 |
// Update information about precursors |
1547 |
// Update information about precursors |
|
|
| 1616 |
} |
1616 |
} |
| 1617 |
else |
1617 |
else |
| 1618 |
{ |
1618 |
{ |
| 1619 |
toNeighbor.SetLifeTime (std::max (Time (AllowedHelloLoss * HelloInterval), toNeighbor.GetLifeTime ())); |
1619 |
toNeighbor.SetLifeTime (std::max (Time (m_allowedHelloLoss * m_helloInterval), toNeighbor.GetLifeTime ())); |
| 1620 |
toNeighbor.SetSeqNo (rrepHeader.GetDstSeqno ()); |
1620 |
toNeighbor.SetSeqNo (rrepHeader.GetDstSeqno ()); |
| 1621 |
toNeighbor.SetValidSeqNo (true); |
1621 |
toNeighbor.SetValidSeqNo (true); |
| 1622 |
toNeighbor.SetFlag (VALID); |
1622 |
toNeighbor.SetFlag (VALID); |
|
|
| 1626 |
toNeighbor.SetNextHop (rrepHeader.GetDst ()); |
1626 |
toNeighbor.SetNextHop (rrepHeader.GetDst ()); |
| 1627 |
m_routingTable.Update (toNeighbor); |
1627 |
m_routingTable.Update (toNeighbor); |
| 1628 |
} |
1628 |
} |
| 1629 |
if (EnableHello) |
1629 |
if (m_enableHello) |
| 1630 |
{ |
1630 |
{ |
| 1631 |
m_nb.Update (rrepHeader.GetDst (), Time (AllowedHelloLoss * HelloInterval)); |
1631 |
m_nb.Update (rrepHeader.GetDst (), Time (m_allowedHelloLoss * m_helloInterval)); |
| 1632 |
} |
1632 |
} |
| 1633 |
} |
1633 |
} |
| 1634 |
|
1634 |
|
|
|
| 1708 |
* receiving any RREP, all data packets destined for the corresponding destination SHOULD be |
1708 |
* receiving any RREP, all data packets destined for the corresponding destination SHOULD be |
| 1709 |
* dropped from the buffer and a Destination Unreachable message SHOULD be delivered to the application. |
1709 |
* dropped from the buffer and a Destination Unreachable message SHOULD be delivered to the application. |
| 1710 |
*/ |
1710 |
*/ |
| 1711 |
if (toDst.GetRreqCnt () == RreqRetries) |
1711 |
if (toDst.GetRreqCnt () == m_rreqRetries) |
| 1712 |
{ |
1712 |
{ |
| 1713 |
NS_LOG_LOGIC ("route discovery to " << dst << " has been attempted RreqRetries (" << RreqRetries << ") times with ttl " << NetDiameter); |
1713 |
NS_LOG_LOGIC ("route discovery to " << dst << " has been attempted RreqRetries (" << m_rreqRetries << ") times with ttl " << m_netDiameter); |
| 1714 |
m_addressReqTimer.erase (dst); |
1714 |
m_addressReqTimer.erase (dst); |
| 1715 |
m_routingTable.DeleteRoute (dst); |
1715 |
m_routingTable.DeleteRoute (dst); |
| 1716 |
NS_LOG_DEBUG ("Route not found. Drop all packets with dst " << dst); |
1716 |
NS_LOG_DEBUG ("Route not found. Drop all packets with dst " << dst); |
|
|
| 1747 |
SendHello (); |
1747 |
SendHello (); |
| 1748 |
} |
1748 |
} |
| 1749 |
m_htimer.Cancel (); |
1749 |
m_htimer.Cancel (); |
| 1750 |
Time diff = HelloInterval - offset; |
1750 |
Time diff = m_helloInterval - offset; |
| 1751 |
m_htimer.Schedule (std::max (Time (Seconds (0)), diff)); |
1751 |
m_htimer.Schedule (std::max (Time (Seconds (0)), diff)); |
| 1752 |
m_lastBcastTime = Time (Seconds (0)); |
1752 |
m_lastBcastTime = Time (Seconds (0)); |
| 1753 |
} |
1753 |
} |
|
|
| 1790 |
Ptr<Socket> socket = j->first; |
1790 |
Ptr<Socket> socket = j->first; |
| 1791 |
Ipv4InterfaceAddress iface = j->second; |
1791 |
Ipv4InterfaceAddress iface = j->second; |
| 1792 |
RrepHeader helloHeader (/*prefix size=*/ 0, /*hops=*/ 0, /*dst=*/ iface.GetLocal (), /*dst seqno=*/ m_seqNo, |
1792 |
RrepHeader helloHeader (/*prefix size=*/ 0, /*hops=*/ 0, /*dst=*/ iface.GetLocal (), /*dst seqno=*/ m_seqNo, |
| 1793 |
/*origin=*/ iface.GetLocal (),/*lifetime=*/ Time (AllowedHelloLoss * HelloInterval)); |
1793 |
/*origin=*/ iface.GetLocal (),/*lifetime=*/ Time (m_allowedHelloLoss * m_helloInterval)); |
| 1794 |
Ptr<Packet> packet = Create<Packet> (); |
1794 |
Ptr<Packet> packet = Create<Packet> (); |
| 1795 |
SocketIpTtlTag tag; |
1795 |
SocketIpTtlTag tag; |
| 1796 |
tag.SetTtl (1); |
1796 |
tag.SetTtl (1); |
|
|
| 1896 |
{ |
1896 |
{ |
| 1897 |
NS_LOG_FUNCTION (this); |
1897 |
NS_LOG_FUNCTION (this); |
| 1898 |
// A node SHOULD NOT originate more than RERR_RATELIMIT RERR messages per second. |
1898 |
// A node SHOULD NOT originate more than RERR_RATELIMIT RERR messages per second. |
| 1899 |
if (m_rerrCount == RerrRateLimit) |
1899 |
if (m_rerrCount == m_rerrRateLimit) |
| 1900 |
{ |
1900 |
{ |
| 1901 |
// Just make sure that the RerrRateLimit timer is running and will expire |
1901 |
// Just make sure that the RerrRateLimit timer is running and will expire |
| 1902 |
NS_ASSERT (m_rerrRateLimitTimer.IsRunning ()); |
1902 |
NS_ASSERT (m_rerrRateLimitTimer.IsRunning ()); |
|
|
| 1958 |
return; |
1958 |
return; |
| 1959 |
} |
1959 |
} |
| 1960 |
// A node SHOULD NOT originate more than RERR_RATELIMIT RERR messages per second. |
1960 |
// A node SHOULD NOT originate more than RERR_RATELIMIT RERR messages per second. |
| 1961 |
if (m_rerrCount == RerrRateLimit) |
1961 |
if (m_rerrCount == m_rerrRateLimit) |
| 1962 |
{ |
1962 |
{ |
| 1963 |
// Just make sure that the RerrRateLimit timer is running and will expire |
1963 |
// Just make sure that the RerrRateLimit timer is running and will expire |
| 1964 |
NS_ASSERT (m_rerrRateLimitTimer.IsRunning ()); |
1964 |
NS_ASSERT (m_rerrRateLimitTimer.IsRunning ()); |
|
|
| 2053 |
{ |
2053 |
{ |
| 2054 |
NS_LOG_FUNCTION (this); |
2054 |
NS_LOG_FUNCTION (this); |
| 2055 |
uint32_t startTime; |
2055 |
uint32_t startTime; |
| 2056 |
if (EnableHello) |
2056 |
if (m_enableHello) |
| 2057 |
{ |
2057 |
{ |
| 2058 |
m_htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this); |
2058 |
m_htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this); |
| 2059 |
startTime = m_uniformRandomVariable->GetInteger (0, 100); |
2059 |
startTime = m_uniformRandomVariable->GetInteger (0, 100); |