8751
|
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_ROUTING_H
|
|
33 |
#define DSR_ROUTING_H
|
|
34 |
|
|
35 |
#include <map>
|
|
36 |
#include <list>
|
|
37 |
#include <vector>
|
|
38 |
#include <stdint.h>
|
|
39 |
#include <cassert>
|
|
40 |
#include <sys/types.h>
|
|
41 |
|
|
42 |
#include "ns3/callback.h"
|
|
43 |
#include "ns3/object.h"
|
|
44 |
#include "ns3/node.h"
|
|
45 |
#include "ns3/ptr.h"
|
|
46 |
#include "ns3/buffer.h"
|
|
47 |
#include "ns3/packet.h"
|
|
48 |
#include "ns3/ipv4.h"
|
|
49 |
#include "ns3/ipv4-l4-protocol.h"
|
|
50 |
#include "ns3/ipv4-l3-protocol.h"
|
|
51 |
#include "ns3/icmpv4-l4-protocol.h"
|
|
52 |
#include "ns3/ipv4-interface.h"
|
|
53 |
#include "ns3/ipv4-header.h"
|
|
54 |
#include "ns3/ipv4-address.h"
|
|
55 |
#include "ns3/traced-callback.h"
|
|
56 |
#include "ns3/ipv4-route.h"
|
|
57 |
#include "ns3/timer.h"
|
|
58 |
#include "ns3/net-device.h"
|
|
59 |
#include "ns3/output-stream-wrapper.h"
|
|
60 |
#include "ns3/wifi-mac.h"
|
|
61 |
#include "ns3/socket.h"
|
|
62 |
#include "ns3/event-garbage-collector.h"
|
|
63 |
#include "ns3/test.h"
|
|
64 |
|
8752
|
65 |
#include "dsr-network-queue.h"
|
8751
|
66 |
#include "dsr-rcache.h"
|
|
67 |
#include "dsr-rreq-table.h"
|
|
68 |
#include "dsr-maintain-buff.h"
|
|
69 |
#include "dsr-option-header.h"
|
|
70 |
#include "dsr-fs-header.h"
|
|
71 |
#include "dsr-rsendbuff.h"
|
8752
|
72 |
#include "dsr-errorbuff.h"
|
8751
|
73 |
#include "dsr-gratuitous-reply-table.h"
|
|
74 |
|
|
75 |
namespace ns3 {
|
|
76 |
|
|
77 |
class Packet;
|
|
78 |
class Node;
|
|
79 |
class Ipv4;
|
|
80 |
class Ipv4Address;
|
|
81 |
class Ipv4Header;
|
|
82 |
class Ipv4Interface;
|
|
83 |
class Ipv4L3Protocol;
|
|
84 |
class Time;
|
|
85 |
|
|
86 |
namespace dsr {
|
|
87 |
|
|
88 |
class DsrOptions;
|
|
89 |
/**
|
|
90 |
* \class DsrRouting
|
|
91 |
* \brief Dsr Routing base
|
|
92 |
*/
|
|
93 |
class DsrRouting : public Ipv4L4Protocol
|
|
94 |
{
|
|
95 |
public:
|
|
96 |
/**
|
|
97 |
* \brief Get the type identificator.
|
|
98 |
* \return type identificator
|
|
99 |
*/
|
|
100 |
static TypeId GetTypeId ();
|
|
101 |
/**
|
|
102 |
* \brief Define the dsr protocol number.
|
|
103 |
*/
|
|
104 |
static const uint8_t PROT_NUMBER;
|
|
105 |
/**
|
|
106 |
* \brief Constructor.
|
|
107 |
*/
|
|
108 |
DsrRouting ();
|
|
109 |
/**
|
|
110 |
* \brief Destructor.
|
|
111 |
*/
|
|
112 |
virtual ~DsrRouting ();
|
|
113 |
/**
|
|
114 |
* \brief Get the node.
|
|
115 |
* \return the node
|
|
116 |
*/
|
|
117 |
Ptr<Node> GetNode () const;
|
|
118 |
/**
|
|
119 |
* \brief Set the node.
|
|
120 |
* \param node the node to set
|
|
121 |
*/
|
|
122 |
void SetNode (Ptr<Node> node);
|
|
123 |
/**
|
|
124 |
* \brief Set the route cache.
|
|
125 |
* \param the route cache to set
|
|
126 |
*/
|
|
127 |
void SetRouteCache (Ptr<dsr::RouteCache> r);
|
|
128 |
/**
|
|
129 |
* \brief Get the route cache.
|
|
130 |
* \return the route cache
|
|
131 |
*/
|
|
132 |
Ptr<dsr::RouteCache> GetRouteCache () const;
|
|
133 |
/**
|
|
134 |
* \brief Set the node.
|
|
135 |
* \param the request table to set
|
|
136 |
*/
|
|
137 |
void SetRequestTable (Ptr<dsr::RreqTable> r);
|
|
138 |
/**
|
|
139 |
* \brief Get the request table.
|
|
140 |
* \return the request table
|
|
141 |
*/
|
|
142 |
Ptr<dsr::RreqTable> GetRequestTable () const;
|
8752
|
143 |
|
|
144 |
///\functions used to direct to route cache
|
|
145 |
//\{
|
|
146 |
bool IsLinkCache ();
|
|
147 |
void UseExtends (RouteCacheEntry::IP_VECTOR rt);
|
|
148 |
bool LookupRoute (Ipv4Address id, RouteCacheEntry & rt);
|
|
149 |
bool AddRoute_Link (RouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source);
|
|
150 |
bool AddRoute (RouteCacheEntry & rt);
|
|
151 |
void DeleteAllRoutesIncludeLink (Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node);
|
|
152 |
bool UpdateRouteEntry (Ipv4Address dst);
|
|
153 |
//\}
|
|
154 |
|
8751
|
155 |
/**
|
|
156 |
* \brief Get the node id from ip address.
|
|
157 |
* \return the node id
|
|
158 |
*/
|
8752
|
159 |
uint16_t GetIDfromIP (Ipv4Address address);
|
8751
|
160 |
/**
|
|
161 |
* \brief Get the ip address from id.
|
|
162 |
* \return the ip address for the id
|
|
163 |
*/
|
8752
|
164 |
Ipv4Address GetIPfromID (uint16_t id);
|
8751
|
165 |
/**
|
|
166 |
* \brief Get the Ip address from mac address.
|
|
167 |
* \return the ip address
|
|
168 |
*/
|
|
169 |
Ipv4Address GetIPfromMAC (Mac48Address address);
|
|
170 |
/**
|
|
171 |
* \brief Print the route vector.
|
|
172 |
*/
|
|
173 |
void PrintVector (std::vector<Ipv4Address>& vec);
|
|
174 |
/**
|
|
175 |
* \brief Get the next hop of the route.
|
|
176 |
* \return the next hop address of the route
|
|
177 |
*/
|
|
178 |
Ipv4Address SearchNextHop (Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec);
|
|
179 |
/**
|
|
180 |
* \brief Get the dsr protocol number.
|
|
181 |
* \return protocol number
|
|
182 |
*/
|
|
183 |
int GetProtocolNumber (void) const;
|
|
184 |
/**
|
|
185 |
* \brief The send buffer timer expire.
|
|
186 |
*/
|
|
187 |
void SendBuffTimerExpire ();
|
|
188 |
/**
|
|
189 |
* \brief Check the send buffer of packets with route when send buffer timer expire.
|
|
190 |
*/
|
|
191 |
void CheckSendBuffer ();
|
|
192 |
/**
|
|
193 |
* \brief When route vector corrupted, originate a new packet, normally not happening.
|
|
194 |
*/
|
|
195 |
void PacketNewRoute (Ptr<Packet> packet,
|
|
196 |
Ipv4Address source,
|
|
197 |
Ipv4Address destination,
|
|
198 |
uint8_t protocol);
|
|
199 |
/*
|
|
200 |
* \brief Set the route to use for data packets
|
|
201 |
* \return the route
|
|
202 |
* \used by the option headers when sending data/control packets
|
|
203 |
*/
|
|
204 |
Ptr<Ipv4Route> SetRoute (Ipv4Address nextHop, Ipv4Address srcAddress);
|
|
205 |
/*
|
8752
|
206 |
* \brief Set the priority of the packet in network queue
|
|
207 |
* \return the priority value
|
|
208 |
*/
|
|
209 |
uint32_t GetPriority (DsrMessageType messageType);
|
|
210 |
/*
|
8751
|
211 |
* \brief This function is responsible for sending error packets in case of break link to next hop
|
|
212 |
*/
|
8752
|
213 |
void SendUnreachError (Ipv4Address errorHop, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol);
|
8751
|
214 |
/*
|
|
215 |
* \brief This function is responsible for forwarding error packets along the route
|
|
216 |
*/
|
|
217 |
void ForwardErrPacket (DsrOptionRerrUnreachHeader &rerr,
|
|
218 |
DsrOptionSRHeader &sourceRoute,
|
|
219 |
Ipv4Address nextHop,
|
|
220 |
uint8_t protocol,
|
|
221 |
Ptr<Ipv4Route> route);
|
|
222 |
/*
|
|
223 |
* \brief This function is called by higher layer protocol when sending packets
|
|
224 |
*/
|
|
225 |
void Send (Ptr<Packet> packet, Ipv4Address source,
|
|
226 |
Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route);
|
|
227 |
/*
|
8752
|
228 |
* \brief This function is called to add ack request header for network acknowledgement
|
|
229 |
*/
|
|
230 |
uint16_t AddAckReqHeader (Ptr<Packet> &packet, Ipv4Address nextHop);
|
|
231 |
/*
|
|
232 |
* \brief This function is called by when really sending out the packet
|
|
233 |
*/
|
|
234 |
void SendPacket (Ptr<Packet> packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol);
|
|
235 |
/*
|
|
236 |
* \brief This function is called to schedule sending packets from the network queue
|
|
237 |
*/
|
|
238 |
void Scheduler (uint32_t priority);
|
|
239 |
/*
|
|
240 |
* \brief This function is called to schedule sending packets from the network queue by priority
|
|
241 |
*/
|
|
242 |
void PriorityScheduler (uint32_t priority, bool continueWithFirst);
|
|
243 |
/*
|
|
244 |
* \brief This function is called to increase the retransmission timer for data packet in the network queue
|
|
245 |
*/
|
|
246 |
void IncreaseRetransTimer ();
|
|
247 |
/*
|
|
248 |
* \brief This function is called to send packets down stack
|
|
249 |
*/
|
|
250 |
bool SendRealDown (DsrNetworkQueueEntry & newEntry);
|
|
251 |
/*
|
8751
|
252 |
* This function is responsible for sending out data packets when have route, if no route found, it will
|
|
253 |
* cache the packet and send out route requests
|
|
254 |
*/
|
8752
|
255 |
void SendPacketFromBuffer (DsrOptionSRHeader const &sourceRoute,
|
|
256 |
Ipv4Address nextHop,
|
|
257 |
uint8_t protocol);
|
8751
|
258 |
/*
|
|
259 |
* \brief Find the similar entries in the maintenance buffer
|
|
260 |
*/
|
8752
|
261 |
bool FindSamePackets (Ptr<Packet> packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft);
|
8751
|
262 |
/*
|
|
263 |
* Call the cancel packet retransmission timer function
|
|
264 |
*/
|
|
265 |
void CallCancelPacketTimer (uint16_t ackId, Ipv4Header const& ipv4Header, Ipv4Address realSrc, Ipv4Address realDst);
|
|
266 |
/*
|
|
267 |
* Cancel the network packet retransmission timer for a specific maintenance entry
|
|
268 |
*/
|
|
269 |
void CancelNetworkPacketTimer (MaintainBuffEntry & mb);
|
|
270 |
/*
|
|
271 |
* Cancel the passive packet retransmission timer for a specific maintenance entry
|
|
272 |
*/
|
|
273 |
void CancelPassivePacketTimer (MaintainBuffEntry & mb);
|
|
274 |
/*
|
|
275 |
* Cancel the packet retransmission timer for a all maintenance entries with nextHop address
|
|
276 |
*/
|
|
277 |
void CancelPacketTimerNextHop (Ipv4Address nextHop, uint8_t protocol);
|
|
278 |
/*
|
|
279 |
* Salvage the packet which has been transmitted for 3 times
|
|
280 |
*/
|
|
281 |
void SalvagePacket (Ptr<const Packet> packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol);
|
|
282 |
/*
|
8752
|
283 |
* Schedule the packet retransmission when the packet has not reached to the next hop address
|
8751
|
284 |
*/
|
8752
|
285 |
void SchedulePassivePacketRetry (MaintainBuffEntry & mb,
|
|
286 |
bool onlyPassive,
|
|
287 |
uint8_t protocol);
|
8751
|
288 |
/*
|
|
289 |
* Schedule the packet retransmission when the packet has not reached to the next hop address
|
|
290 |
*/
|
8752
|
291 |
void ScheduleNetworkPacketRetry (MaintainBuffEntry & mb,
|
|
292 |
bool isFirst,
|
|
293 |
uint8_t protocol);
|
8751
|
294 |
/*
|
|
295 |
* This function deals with packet retransmission timer expire
|
|
296 |
*/
|
8752
|
297 |
void NetworkScheduleTimerExpire (MaintainBuffEntry & mb,
|
|
298 |
uint8_t protocol);
|
|
299 |
/*
|
|
300 |
* This function deals with packet retransmission timer expire
|
|
301 |
*/
|
|
302 |
void PassiveScheduleTimerExpire (MaintainBuffEntry & mb,
|
|
303 |
bool onlyPassive,
|
|
304 |
uint8_t protocol);
|
8751
|
305 |
/*
|
|
306 |
* Forward the packet using the route saved in the source route option header
|
|
307 |
*/
|
|
308 |
void ForwardPacket (Ptr<const Packet> packet,
|
|
309 |
DsrOptionSRHeader &sourceRoute,
|
|
310 |
Ipv4Header const& ipv4Header,
|
|
311 |
Ipv4Address source,
|
|
312 |
Ipv4Address destination,
|
|
313 |
Ipv4Address targetAddress,
|
|
314 |
uint8_t protocol,
|
|
315 |
Ptr<Ipv4Route> route);
|
|
316 |
/*
|
|
317 |
* Broadcast the route request packet in subnet
|
|
318 |
*/
|
|
319 |
void SendInitialRequest (Ipv4Address source,
|
|
320 |
Ipv4Address destination,
|
|
321 |
uint8_t protocol);
|
|
322 |
/*
|
|
323 |
* \brief Send the error request packet
|
|
324 |
* \param the route error header
|
|
325 |
* \param the protocol number
|
|
326 |
*/
|
|
327 |
void SendErrorRequest (DsrOptionRerrUnreachHeader &rerr, uint8_t protocol);
|
|
328 |
/*
|
|
329 |
* \brief Send the route request and increment the request count
|
|
330 |
* \param the original packet
|
|
331 |
* \param source address
|
|
332 |
* \param destination address
|
|
333 |
*/
|
|
334 |
void SendRequestAndIncrement (Ptr<Packet> packet,
|
|
335 |
Ipv4Address source,
|
|
336 |
Ipv4Address destination);
|
|
337 |
/*
|
|
338 |
* \brief Forward the route request if the node is not the destination
|
|
339 |
* \param the original packet
|
|
340 |
* \param source address
|
|
341 |
*/
|
|
342 |
void SendRequest (Ptr<Packet> packet,
|
|
343 |
Ipv4Address source);
|
|
344 |
/*
|
|
345 |
* \brief Schedule the intermediate route request
|
|
346 |
* \param the original packet
|
|
347 |
* \param source The source address
|
|
348 |
* \param destination The destination address
|
|
349 |
*/
|
|
350 |
void ScheduleInterRequest (Ptr<Packet> packet);
|
|
351 |
/*
|
|
352 |
* \brief Send the gratuitous reply
|
|
353 |
* \param replyTo The destination address to send the reply to
|
|
354 |
* \param replyFrom The source address sending the reply
|
|
355 |
*/
|
|
356 |
void SendGratuitousReply (Ipv4Address replyTo,
|
|
357 |
Ipv4Address replyFrom,
|
|
358 |
std::vector<Ipv4Address> &nodeList,
|
|
359 |
uint8_t protocol);
|
|
360 |
/*
|
|
361 |
* Send the route reply back to the request originator with the cumulated route
|
|
362 |
*/
|
|
363 |
void SendReply (Ptr<Packet> packet,
|
|
364 |
Ipv4Address source,
|
|
365 |
Ipv4Address nextHop,
|
|
366 |
Ptr<Ipv4Route> route);
|
|
367 |
/*
|
|
368 |
* this is a generating the initial route reply from the destination address, a random delay time
|
|
369 |
* [0, m_broadcastJitter] is used before unicasting back the route reply packet
|
|
370 |
*/
|
|
371 |
void ScheduleInitialReply (Ptr<Packet> packet,
|
|
372 |
Ipv4Address source,
|
|
373 |
Ipv4Address nextHop,
|
|
374 |
Ptr<Ipv4Route> route);
|
|
375 |
/*
|
|
376 |
* Schedule the cached reply to a random start time to avoid possible route reply storm
|
|
377 |
*/
|
|
378 |
void ScheduleCachedReply (Ptr<Packet> packet,
|
|
379 |
Ipv4Address source,
|
|
380 |
Ipv4Address destination,
|
|
381 |
Ptr<Ipv4Route> route,
|
8752
|
382 |
double hops);
|
8751
|
383 |
/*
|
|
384 |
* Send network layer acknowledgment back to the earlier hop to notify the receipt of data packet
|
|
385 |
*/
|
|
386 |
void SendAck (uint16_t ackId,
|
|
387 |
Ipv4Address destination,
|
|
388 |
Ipv4Address realSrc,
|
|
389 |
Ipv4Address realDst,
|
|
390 |
uint8_t protocol,
|
|
391 |
Ptr<Ipv4Route> route);
|
|
392 |
/*
|
|
393 |
* Get the node using the ip address
|
|
394 |
*/
|
|
395 |
Ptr<Node> GetNodeWithAddress (Ipv4Address ipv4Address);
|
|
396 |
/**
|
|
397 |
* \param p packet to forward up
|
|
398 |
* \param header IPv4 Header information
|
|
399 |
* \param incomingInterface the Ipv4Interface on which the packet arrived
|
|
400 |
*
|
|
401 |
* Called from lower-level layers to send the packet up
|
|
402 |
* in the stack.
|
|
403 |
*/
|
|
404 |
virtual enum Ipv4L4Protocol::RxStatus Receive (Ptr<Packet> p,
|
|
405 |
Ipv4Header const &header,
|
|
406 |
Ptr<Ipv4Interface> incomingInterface);
|
|
407 |
|
|
408 |
void SetDownTarget (Ipv4L4Protocol::DownTargetCallback callback);
|
|
409 |
Ipv4L4Protocol::DownTargetCallback GetDownTarget (void) const;
|
|
410 |
/**
|
|
411 |
* \brief Get the extension number.
|
|
412 |
* \return extension number
|
|
413 |
*/
|
|
414 |
uint8_t GetExtensionNumber () const;
|
|
415 |
/**
|
|
416 |
* \brief Process method
|
|
417 |
* Called from Ipv4L3Protocol::Receive.
|
|
418 |
*
|
|
419 |
* \param packet the packet
|
|
420 |
* \param offset the offset of the extension to process
|
|
421 |
* \param dst destination address of the packet received (i.e. us)
|
|
422 |
* \param nextHeader the next header
|
|
423 |
* \param isDropped if the packet must be dropped
|
|
424 |
* \return the size processed
|
|
425 |
*/
|
|
426 |
uint8_t Process (Ptr<Packet>& packet, Ipv4Header const& ipv4Header, Ipv4Address dst, uint8_t *nextHeader, uint8_t protocol, bool& isDropped);
|
|
427 |
/**
|
|
428 |
* \brief Insert a new Dsr Option.
|
|
429 |
* \param option the option to insert
|
|
430 |
*/
|
|
431 |
void Insert (Ptr<dsr::DsrOptions> option);
|
|
432 |
/**
|
|
433 |
* \brief Get the option corresponding to optionNumber.
|
|
434 |
* \param optionNumber the option number of the option to retrieve
|
|
435 |
* \return a matching Dsr option
|
|
436 |
*/
|
|
437 |
Ptr<dsr::DsrOptions> GetOption (int optionNumber);
|
|
438 |
/**
|
|
439 |
* \brief Cancel the route request timer.
|
|
440 |
* \param dst The dst address of the route request timer
|
8752
|
441 |
* \param isRemove whether to remove the route request entry or not
|
8751
|
442 |
*/
|
8752
|
443 |
void CancelRreqTimer (Ipv4Address dst, bool isRemove);
|
8751
|
444 |
/**
|
|
445 |
* \brief Schedule the route request retry.
|
|
446 |
* \param dst The dst address of the route request
|
|
447 |
*/
|
8752
|
448 |
void ScheduleRreqRetry (Ptr<Packet> packet, std::vector<Ipv4Address> address, bool nonProp, uint32_t requestId, uint8_t protocol);
|
8751
|
449 |
// / Handle route discovery timer
|
8752
|
450 |
void RouteRequestTimerExpire (Ptr<Packet> packet, std::vector<Ipv4Address> address, uint32_t requestId, uint8_t protocol);
|
8751
|
451 |
|
|
452 |
protected:
|
|
453 |
/*
|
|
454 |
* * This function will notify other components connected to the node that a new stack member is now connected
|
|
455 |
* * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
|
|
456 |
* */
|
|
457 |
virtual void NotifyNewAggregate ();
|
|
458 |
/**
|
|
459 |
* \brief Drop trace callback.
|
|
460 |
*/
|
|
461 |
virtual void DoDispose (void);
|
|
462 |
/*
|
|
463 |
* The trace for drop, receive and send data packets
|
|
464 |
*/
|
|
465 |
TracedCallback<Ptr<const Packet> > m_dropTrace;
|
|
466 |
TracedCallback <const DsrOptionSRHeader &> m_txPacketTrace;
|
|
467 |
|
|
468 |
private:
|
|
469 |
void Start ();
|
|
470 |
/**
|
|
471 |
* \brief Send the route error message when the link breaks to the next hop.
|
|
472 |
*/
|
|
473 |
void SendRerrWhenBreaksLinkToNextHop (Ipv4Address nextHop, uint8_t protocol);
|
|
474 |
/**
|
|
475 |
* \brief Promiscuous receive data packets destined to some other node.
|
|
476 |
*/
|
|
477 |
bool PromiscReceive (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &from,
|
|
478 |
const Address &to, NetDevice::PacketType packetType);
|
|
479 |
/**
|
|
480 |
* \brief Define the list to hold DSR options.
|
|
481 |
*/
|
|
482 |
typedef std::list<Ptr<DsrOptions> > DsrOptionList_t;
|
|
483 |
/**
|
|
484 |
* \brief List of DSR Options supported.
|
|
485 |
*/
|
|
486 |
DsrOptionList_t m_options;
|
|
487 |
|
|
488 |
Ptr<Ipv4L3Protocol> m_ipv4; // / Ipv4l3Protocol
|
|
489 |
|
|
490 |
Ptr<Ipv4Route> m_ipv4Route; // / Ipv4 Route
|
|
491 |
|
|
492 |
Ptr<Ipv4> m_ip; // / The ip ptr
|
|
493 |
|
|
494 |
Ptr<Node> m_node; // / The node ptr
|
|
495 |
|
|
496 |
Ipv4Address m_mainAddress; // / Our own Ip address
|
|
497 |
|
|
498 |
uint8_t segsLeft; // / The segment left value from SR header
|
|
499 |
|
|
500 |
Ipv4L4Protocol::DownTargetCallback m_downTarget; // The callback for down layer
|
|
501 |
|
8752
|
502 |
uint32_t m_maxNetworkSize; // / Maximum network queue size
|
|
503 |
|
|
504 |
Time m_maxNetworkDelay; // / Maximum network delay
|
|
505 |
|
|
506 |
uint32_t m_discoveryHopLimit; // / Maximum hops to go for route request
|
8751
|
507 |
|
|
508 |
uint8_t m_maxSalvageCount; // / Maximum # times to salvage a packet
|
|
509 |
|
|
510 |
Time m_requestPeriod; // / The base time interval between route requests
|
|
511 |
|
|
512 |
Time m_nonpropRequestTimeout; // / The non-propagation request timeout
|
|
513 |
|
8752
|
514 |
uint32_t m_sendRetries; // / # of retries have been sent for network acknowledgment
|
|
515 |
|
|
516 |
uint32_t m_passiveRetries; // / # of retries have been sent for passive acknowledgment
|
8751
|
517 |
|
|
518 |
uint32_t m_rreqRetries; // /< Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route
|
|
519 |
|
|
520 |
uint32_t m_maxMaintRexmt; // /< Maximum number of retransmissions of data packets
|
|
521 |
|
|
522 |
Time m_nodeTraversalTime; // / Time estimated for packet to travel between two nodes
|
|
523 |
|
|
524 |
uint32_t m_maxSendBuffLen; // /< The maximum number of packets that we allow a routing protocol to buffer.
|
|
525 |
|
|
526 |
Time m_sendBufferTimeout; // /< The maximum period of time that a routing protocol is allowed to buffer a packet for.
|
|
527 |
|
|
528 |
SendBuffer m_sendBuffer; // / The send buffer
|
|
529 |
|
8752
|
530 |
ErrorBuffer m_errorBuffer; // / The error buffer to save the error messages
|
|
531 |
|
8751
|
532 |
uint32_t m_maxMaintainLen; // / Max # of entries for maintainance buffer
|
|
533 |
|
|
534 |
Time m_maxMaintainTime; // / Time out for maintainance buffer
|
|
535 |
|
|
536 |
uint32_t m_maxCacheLen; // / Max # of cache entries for route cache
|
|
537 |
|
|
538 |
Time m_maxCacheTime; // / Max time for caching the route cache entry
|
|
539 |
|
|
540 |
Time m_maxRreqTime; // / Max time for caching the route request entry
|
|
541 |
|
|
542 |
uint32_t m_maxEntriesEachDst; // / Max number of route entries to save for each destination
|
|
543 |
|
|
544 |
MaintainBuffer m_maintainBuffer; // / The declaration of maintain buffer
|
|
545 |
|
8752
|
546 |
uint32_t m_requestId; // / The id assigned to each route request
|
8751
|
547 |
|
|
548 |
uint16_t m_ackId; // / The ack id assigned to each acknowledge
|
|
549 |
|
|
550 |
uint32_t m_requestTableSize; // / The max size of the request table size
|
|
551 |
|
|
552 |
uint32_t m_requestTableIds; // / The request table identifiers
|
|
553 |
|
|
554 |
uint32_t m_maxRreqId; // / The max number of request ids for a single destination
|
|
555 |
|
|
556 |
Time m_blacklistTimeout; // / The black list time out
|
|
557 |
|
|
558 |
Ipv4Address m_broadcast; // / The broadcast IP address
|
|
559 |
|
8752
|
560 |
uint32_t m_broadcastJitter; // / The max time to delay route request broadcast.
|
8751
|
561 |
|
|
562 |
Time m_passiveAckTimeout; // / The timeout value for passive acknowledge
|
|
563 |
|
|
564 |
uint32_t m_tryPassiveAcks; // /< Maximum number of packet transmission using passive acknowledgment
|
|
565 |
|
|
566 |
Timer m_sendBuffTimer; // / The send buffer timer
|
|
567 |
|
|
568 |
Time m_sendBuffInterval; // / how often to check send buffer
|
|
569 |
|
|
570 |
Time m_gratReplyHoldoff; // / The max gratuitous reply hold off time
|
|
571 |
|
|
572 |
Time m_maxRequestPeriod; // / The max request period
|
|
573 |
|
|
574 |
uint32_t m_graReplyTableSize; // / Set the gratuitous reply table size
|
|
575 |
|
|
576 |
std::string m_cacheType; // / The type of route cache
|
|
577 |
|
8752
|
578 |
std::string m_routeSortType; // / The type of route sort methods
|
8751
|
579 |
|
8752
|
580 |
uint64_t m_stabilityDecrFactor; // / The initial decrease factor for link cache
|
|
581 |
|
|
582 |
uint64_t m_stabilityIncrFactor; // / The initial increase factor for link cache
|
8751
|
583 |
|
8752
|
584 |
Time m_initStability; // / The initial stability value for link cache
|
8751
|
585 |
|
8752
|
586 |
Time m_minLifeTime; // / The min life time
|
8751
|
587 |
|
8752
|
588 |
Time m_useExtends; // / The use extension of the life time for link cache
|
8751
|
589 |
|
|
590 |
bool m_subRoute; // / Whether to save sub route or not
|
|
591 |
|
8752
|
592 |
Time m_retransIncr; // / the increase time for retransmission timer when face network congestion
|
|
593 |
|
|
594 |
std::vector<Ipv4Address> m_finalRoute; // / The route cache
|
8751
|
595 |
|
|
596 |
std::map<Ipv4Address, Timer> m_addressReqTimer; // / Map IP address + RREQ timer.
|
|
597 |
|
|
598 |
std::map<Ipv4Address, Timer> m_nonPropReqTimer; // / Map IP address + RREQ timer.
|
|
599 |
|
8752
|
600 |
std::map<NetworkKey, Timer> m_addressForwardTimer; // / Map network key + forward timer.
|
|
601 |
|
|
602 |
std::map<NetworkKey, uint32_t> m_addressForwardCnt; // / Map network key + forward counts.
|
8751
|
603 |
|
8752
|
604 |
std::map<PassiveKey, uint32_t> m_passiveCnt; // / Map packet key + passive forward counts.
|
8751
|
605 |
|
8752
|
606 |
std::map<PassiveKey, Timer> m_passiveAckTimer; // / The timer for passive acknowledgment
|
8751
|
607 |
|
|
608 |
Ptr<dsr::RouteCache> m_routeCache; // / A "drop-front" queue used by the routing layer to cache routes found.
|
|
609 |
|
|
610 |
Ptr<dsr::RreqTable> m_rreqTable; // / A "drop-front" queue used by the routing layer to cache route request sent.
|
|
611 |
|
8752
|
612 |
uint32_t m_numPriorityQueues;
|
|
613 |
|
|
614 |
std::map<uint32_t, Ptr<dsr::DsrNetworkQueue> > m_priorityQueue; // / priority queueus
|
|
615 |
|
8751
|
616 |
GraReply m_graReply; // / The gratuitous route reply.
|
|
617 |
|
|
618 |
std::vector<Ipv4Address> m_clearList; // / The node that is clear to send packet to
|
|
619 |
|
|
620 |
std::vector<Ipv4Address> m_addresses; // / The bind ipv4 addresses with next hop, src, destination address in sequence
|
|
621 |
};
|
|
622 |
} /* namespace dsr */
|
|
623 |
} /* namespace ns3 */
|
8752
|
624 |
|
8751
|
625 |
#endif /* DSR_ROUTING_H */
|