Index: src/dsr/model/dsr-routing.h |
=================================================================== |
--- a/src/dsr/model/dsr-routing.h |
+++ b/src/dsr/model/dsr-routing.h |
@@ -144,6 +144,11 @@ |
*/ |
uint32_t GetIDfromIP (Ipv4Address address); |
/** |
+ * \brief Get the ip address from id. |
+ * \return the ip address for the id |
+ */ |
+ Ipv4Address GetIPfromID (uint32_t id); |
+ /** |
* \brief Get the Ip address from mac address. |
* \return the ip address |
*/ |
@@ -158,6 +163,10 @@ |
*/ |
Ipv4Address SearchNextHop (Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec); |
/** |
+ * \brief Cut the route before our own ip address |
+ */ |
+ void CutRoute (Ipv4Address ourAdd, std::vector<Ipv4Address>& nodeList); |
+ /** |
* \brief Get the dsr protocol number. |
* \return protocol number |
*/ |
@@ -178,11 +187,6 @@ |
Ipv4Address destination, |
uint8_t protocol); |
/* |
- * \brief Find the similar packets in the maintenance buffer |
- */ |
- bool FindSamePackets (Ptr<Packet> packet, Ipv4Header const & ipv4Header, Ipv4Address ourAdd, Ipv4Address nextHop, Ipv4Address source, Ipv4Address destination, |
- uint16_t ackId, uint8_t segsLeft, uint16_t routeSize); |
- /* |
* \brief Set the route to use for data packets |
* \return the route |
* \used by the option headers when sending data/control packets |
@@ -197,7 +201,7 @@ |
*/ |
void ForwardErrPacket (DsrOptionRerrUnreachHeader &rerr, |
DsrOptionSRHeader &sourceRoute, |
- Ipv4Address destination, |
+ Ipv4Address nextHop, |
uint8_t protocol, |
Ptr<Ipv4Route> route); |
/* |
@@ -211,16 +215,24 @@ |
*/ |
void SendPacket (DsrOptionSRHeader const &sourceRoute, |
Ipv4Address nextHop, |
- uint8_t protocol, |
- Ptr<Ipv4Route> route); |
+ uint8_t protocol); |
+ /* |
+ * \brief Find the similar entries in the maintenance buffer |
+ */ |
+ bool FindSamePackets (Ptr<Packet> packet, Ipv4Header const& ipv4Header, Ipv4Address source, Ipv4Address destination, |
+ uint8_t segsLeft); |
/* |
* Call the cancel packet retransmission timer function |
*/ |
void CallCancelPacketTimer (uint16_t ackId, Ipv4Header const& ipv4Header, Ipv4Address realSrc, Ipv4Address realDst); |
/* |
- * Cancel the packet retransmission timer for a specific maintenance entry |
+ * Cancel the network packet retransmission timer for a specific maintenance entry |
*/ |
- void CancelPacketTimer (MaintainBuffEntry & mb); |
+ void CancelNetworkPacketTimer (MaintainBuffEntry & mb); |
+ /* |
+ * Cancel the passive packet retransmission timer for a specific maintenance entry |
+ */ |
+ void CancelPassivePacketTimer (MaintainBuffEntry & mb); |
/* |
* Cancel the packet retransmission timer for a all maintenance entries with nextHop address |
*/ |
@@ -228,7 +240,7 @@ |
/* |
* Salvage the packet which has been transmitted for 3 times |
*/ |
- void SalvagePacket (Ptr<const Packet> packet, Ipv4Address source, Ipv4Address dst, uint8_t salvage, uint8_t protocol); |
+ void SalvagePacket (Ptr<const Packet> packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol); |
/* |
* Add ack request header to the data packet when need to use network acknowledgment |
*/ |
@@ -238,8 +250,7 @@ |
*/ |
void SchedulePacketRetry (MaintainBuffEntry & mb, |
PacketKey const & packetKey, |
- uint8_t protocol, |
- Ptr<Ipv4Route> route); |
+ uint8_t protocol); |
/* |
* This function deals with packet retransmission timer expire |
*/ |
@@ -248,14 +259,6 @@ |
uint8_t protocol, |
bool isPassive); |
/* |
- * Schedule the network acknowledgment |
- */ |
- void ScheduleNetworkAck (MaintainBuffEntry & mb, |
- PacketKey const & pk, |
- uint8_t protocol, |
- Ptr<Ipv4Route> route, |
- bool isPassive); |
- /* |
* Forward the packet using the route saved in the source route option header |
*/ |
void ForwardPacket (Ptr<const Packet> packet, |
@@ -264,7 +267,6 @@ |
Ipv4Address source, |
Ipv4Address destination, |
Ipv4Address targetAddress, |
- uint8_t routeSize, |
uint8_t protocol, |
Ptr<Ipv4Route> route); |
/* |
@@ -273,8 +275,22 @@ |
void SendInitialRequest (Ipv4Address source, |
Ipv4Address destination, |
uint8_t protocol); |
+ /* |
+ * \brief Send the error request packet |
+ * \param the route error header |
+ * \param the protocol number |
+ */ |
void SendErrorRequest (DsrOptionRerrUnreachHeader &rerr, uint8_t protocol); |
/* |
+ * \brief Send the route request and increment the request count |
+ * \param the original packet |
+ * \param source address |
+ * \param destination address |
+ */ |
+ void SendRequestAndIncrement (Ptr<Packet> packet, |
+ Ipv4Address source, |
+ Ipv4Address destination); |
+ /* |
* \brief Forward the route request if the node is not the destination |
* \param the original packet |
* \param source address |
@@ -285,9 +301,9 @@ |
* \brief Schedule the intermediate route request |
* \param the original packet |
* \param source The source address |
+ * \param destination The destination address |
*/ |
- void ScheduleInterRequest (Ptr<Packet> packet, |
- Ipv4Address source); |
+ void ScheduleInterRequest (Ptr<Packet> packet); |
/* |
* \brief Send the gratuitous reply |
* \param replyTo The destination address to send the reply to |
@@ -302,7 +318,7 @@ |
*/ |
void SendReply (Ptr<Packet> packet, |
Ipv4Address source, |
- Ipv4Address destination, |
+ Ipv4Address nextHop, |
Ptr<Ipv4Route> route); |
/* |
* this is a generating the initial route reply from the destination address, a random delay time |
@@ -310,7 +326,7 @@ |
*/ |
void ScheduleInitialReply (Ptr<Packet> packet, |
Ipv4Address source, |
- Ipv4Address destination, |
+ Ipv4Address nextHop, |
Ptr<Ipv4Route> route); |
/* |
* Schedule the cached reply to a random start time to avoid possible route reply storm |
@@ -323,9 +339,7 @@ |
/* |
* Send network layer acknowledgment back to the earlier hop to notify the receipt of data packet |
*/ |
- void SendAck (Ptr<Packet> packet, |
- uint16_t ackId, |
- Ipv4Address source, |
+ void SendAck (uint16_t ackId, |
Ipv4Address destination, |
Ipv4Address realSrc, |
Ipv4Address realDst, |
@@ -436,6 +450,8 @@ |
Ipv4Address m_mainAddress; // / Our own Ip address |
+ uint8_t segsLeft; // / The segment left value from SR header |
+ |
Ipv4L4Protocol::DownTargetCallback m_downTarget; // The callback for down layer |
uint8_t m_discoveryHopLimit; // / Maximum hops to go for route request |
@@ -468,6 +484,8 @@ |
Time m_maxCacheTime; // / Max time for caching the route cache entry |
+ uint32_t m_maxEntriesEachDst; // / Max number of route entries to save for each destination |
+ |
MaintainBuffer m_maintainBuffer; // / The declaration of maintain buffer |
uint16_t m_requestId; // / The id assigned to each route request |
@@ -476,16 +494,20 @@ |
uint32_t m_requestTableSize; // / The max size of the request table size |
- uint16_t m_requestTableIds; // / The request table identifiers |
+ uint32_t m_requestTableIds; // / The request table identifiers |
+ |
+ uint32_t m_maxRreqId; // / The max number of request ids for a single destination |
Time m_blacklistTimeout; // / The black list time out |
- Ipv4Address Broadcast; // / The broadcast IP address |
+ Ipv4Address m_broadcast; // / The broadcast IP address |
uint16_t m_broadcastJitter; // / The max time to delay route request broadcast. |
Time m_passiveAckTimeout; // / The timeout value for passive acknowledge |
+ uint32_t m_tryPassiveAcks; // /< Maximum number of packet transmission using passive acknowledgment |
+ |
Timer m_sendBuffTimer; // / The send buffer timer |
Time m_sendBuffInterval; // / how often to check send buffer |