Index: src/dsr/model/dsr-routing.h |
=================================================================== |
--- a/src/dsr/model/dsr-routing.h |
+++ b/src/dsr/model/dsr-routing.h |
@@ -27,6 +27,8 @@ |
* under grant CNS-0626918 (Postmodern Internet Architecture), |
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI), |
* US Department of Defense (DoD), and ITTC at The University of Kansas. |
+ * |
+ * Author of LEAR modification: Tomasz Seweryn <tomasz.seweryn7@gmail.com> |
*/ |
#ifndef DSR_ROUTING_H |
@@ -88,6 +90,64 @@ |
namespace dsr { |
class DsrOptions; |
+ |
+/** |
+ * \class ReceivedDropEntry |
+ * \brief Class for dropped packets management used for LEAR option |
+ */ |
+class ReceivedDropEntry |
+{ |
+ |
+public: |
+ ReceivedDropEntry (uint16_t dropRouteRequestId, |
+ Ipv4Address destinationAddress) |
+ : dropRouteRequestId (dropRouteRequestId), |
+ destinationAddress (destinationAddress) |
+ { |
+ } |
+ |
+ ~ReceivedDropEntry () |
+ { |
+ |
+ } |
+ |
+ bool |
+ operator== (ReceivedDropEntry const & o) const |
+ { |
+ return ((this->destinationAddress == o.destinationAddress) |
+ && (this->dropRouteRequestId == o.dropRouteRequestId)); |
+ } |
+ |
+ |
+ void |
+ SetDropRouteRequestId (uint16_t dropRouteRequestId) |
+ { |
+ this->dropRouteRequestId = dropRouteRequestId; |
+ } |
+ |
+ uint16_t |
+ GetDropRouteRequestId () |
+ { |
+ return this->dropRouteRequestId; |
+ } |
+ |
+ Ipv4Address |
+ getDestinationAddress () const |
Tom Henderson
2014/11/17 22:51:44
we prefer to avoid implementation in header files,
|
+ { |
+ return destinationAddress; |
+ } |
+ |
+ void |
+ setDestinationAddress (Ipv4Address destinationAddress) |
+ { |
+ this->destinationAddress = destinationAddress; |
+ } |
+ |
+private: |
+ uint16_t dropRouteRequestId; |
+ Ipv4Address destinationAddress; |
+}; |
+ |
/** |
* \class DsrRouting |
* \brief Dsr Routing base |
@@ -152,6 +212,16 @@ |
* \return the passive buffer |
*/ |
Ptr<dsr::PassiveBuffer> GetPassiveBuffer () const; |
+ /** |
+ * \brief Adjust threshold parameter by d |
+ * \param d global parameter common for all nodes |
+ */ |
+ void AdjustThreshold (); |
+ /** |
+ * \brief Get threshold parameter. |
+ * \return threshold |
+ */ |
+ double GetThreshold (); |
/// functions used to direct to route cache |
//\{ |
@@ -166,6 +236,17 @@ |
//\} |
/** |
+ * \brief Method for remembering dropped entries for next RREQ processing decisions |
+ */ |
+ void AddDropSourceEntry (Ipv4Address src, Ipv4Address dst, uint16_t futureId); |
+ |
+ /** |
+ * \brief Method for deleting dropped entries for next RREQ processing decisions, which have been already |
+ * processed |
+ */ |
+ bool FindDropSourceEntry (Ipv4Address src, Ipv4Address dst, uint16_t futureId); |
+ |
+ /** |
* \brief Connect the callback for the tracing event. |
* \return void |
*/ |
@@ -405,6 +486,14 @@ |
void SendRequest (Ptr<Packet> packet, |
Ipv4Address source); |
/** |
+ * \brief Forward (unicast) packet |
+ */ |
+ void |
+ SendUnicastForward (Ptr<Packet> packet, |
+ Ipv4Address source, |
+ Ipv4Address nextHop, |
+ Ptr<Ipv4Route> route); |
+ /** |
* \brief Schedule the intermediate route request |
* \param packet the original packet |
*/ |
@@ -553,14 +642,14 @@ |
*/ |
void RouteRequestTimerExpire (Ptr<Packet> packet, std::vector<Ipv4Address> address, uint32_t requestId, uint8_t protocol); |
- /** |
- * Assign a fixed random variable stream number to the random variables |
- * used by this model. Return the number of streams (possibly zero) that |
- * have been assigned. |
- * |
- * \param stream first stream index to use |
- * \return the number of stream indices assigned by this model |
- */ |
+ /** |
+ * Assign a fixed random variable stream number to the random variables |
+ * used by this model. Return the number of streams (possibly zero) that |
+ * have been assigned. |
+ * |
+ * \param stream first stream index to use |
+ * \return the number of stream indices assigned by this model |
+ */ |
int64_t AssignStreams (int64_t stream); |
protected: |
@@ -577,7 +666,8 @@ |
* The trace for drop, receive and send data packets |
*/ |
TracedCallback<Ptr<const Packet> > m_dropTrace; |
- TracedCallback <const DsrOptionSRHeader &> m_txPacketTrace; |
+ TracedCallback <Ptr<const Packet> > m_txPacketTrace; |
+ TracedCallback <Ptr<const Packet> > m_rxPacketTrace; |
private: |
@@ -764,7 +854,17 @@ |
std::map <std::string, uint32_t> m_macToNodeIdMap; ///< The map of mac address to node id |
- Ptr<UniformRandomVariable> m_uniformRandomVariable; ///< Provides uniform random variables. |
+ Ptr<UniformRandomVariable> m_uniformRandomVariable; ///< Provides uniform random variables. |
+ |
+ uint32_t m_dropRequestTableIds; ///< The dropped request table identifiers |
+ |
+ std::map <Ipv4Address, std::list <ReceivedDropEntry> > m_DroppedEntriesMap; ///< A map for remembering dropped entries ids |
+ |
+ double m_threshold; ///< Threshold algorithm parameter |
+ |
+ double m_dParameter; ///< "d" adjust algorithm parameter used for adjusting threshold |
+ |
+ bool m_isLearActive; ///< define if LEAR version of DSR should be active |
}; |
} /* namespace dsr */ |
} /* namespace ns3 */ |