diff --git a/src/dsr/model/dsr-errorbuff.h b/src/dsr/model/dsr-errorbuff.h index 31d81ac2f..a3ee87688 100644 --- a/src/dsr/model/dsr-errorbuff.h +++ b/src/dsr/model/dsr-errorbuff.h @@ -209,13 +209,29 @@ public: * \return true if entry added */ bool Enqueue (DsrErrorBuffEntry & entry); - /// Return first found (the earliest) entry for given destination + /** + * Return first found (the earliest) entry for given destination + * \param [in] dst The destination to look for + * \param [out] entry The entry + * \return true if an entry is found + */ bool Dequeue (Ipv4Address dst, DsrErrorBuffEntry & entry); - /// Remove all packets with the error link + /** + * Remove all packets with the error link + * \param source The source + * \param nextHop The next hop + */ void DropPacketForErrLink (Ipv4Address source, Ipv4Address nextHop); - /// Finds whether a packet with destination dst exists in the queue + /** + * Finds whether a packet with destination dst exists in the queue + * \param dst The destination + * \return true if a packet is found. + */ bool Find (Ipv4Address dst); - /// Number of entries + /** + * Returns the number of entries in the queue. + * \return the number of entries in the queue. + */ uint32_t GetSize (); // Fields @@ -265,15 +281,30 @@ private: std::vector m_errorBuffer; /// Remove all expired entries void Purge (); - /// Notify that packet is dropped from queue by timeout + /** + * Notify that packet is dropped from queue by timeout + * \param en Error Buffer Entry + * \param reason Drop reason. + */ + /// void Drop (DsrErrorBuffEntry en, std::string reason); - /// Notify that packet is dropped from queue by timeout + /** + * Notify that packet is dropped from queue by link error + * \param en Error Buffer Entry + * \param reason Drop reason. + */ void DropLink (DsrErrorBuffEntry en, std::string reason); /// The maximum number of packets that we allow a routing protocol to buffer. uint32_t m_maxLen; /// The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds. Time m_errorBufferTimeout; - /// Check if the send buffer entry is the same or not + /** + * Check if the send buffer entry is the same or not + * \param en Buffer Entry + * \param link Link description. + * \return true if the entry is compatible with the link description (source and next hop) + */ + /// static bool LinkEqual (DsrErrorBuffEntry en, const std::vector link) { return ((en.GetSource () == link[0]) && (en.GetNextHop () == link[1])); diff --git a/src/dsr/model/dsr-gratuitous-reply-table.h b/src/dsr/model/dsr-gratuitous-reply-table.h index bd36e8914..30a972129 100644 --- a/src/dsr/model/dsr-gratuitous-reply-table.h +++ b/src/dsr/model/dsr-gratuitous-reply-table.h @@ -56,7 +56,7 @@ struct GraReplyEntry * * \param t IPv4 address to reply to * \param f IPv4 address to hear from - * \param h gratitious hold off time + * \param h gratuitous hold off time */ GraReplyEntry (Ipv4Address t, Ipv4Address f, Time h) : m_replyTo (t), @@ -82,18 +82,26 @@ public: virtual ~DsrGraReply (); /// Set the gratuitous reply table size + /// \param g The gratuitous reply table size void SetGraTableSize (uint32_t g) { GraReplyTableSize = g; } /// Get the gratuitous reply table size + /// \returns The gratuitous reply table size uint32_t GetGraTableSize () const { return GraReplyTableSize; } /// Add a new gratuitous reply entry + /// \param graTableEntry The gratuitous reply entry + /// \return true on success bool AddEntry (GraReplyEntry & graTableEntry); - /// Update the route entry if found, create a new one if not + /// Update the route entry if found + /// \param replyTo Entry directed to + /// \param replyFrom Entry heard from + /// \param gratReplyHoldoff New gratuitous reply holdoff time + /// \return true on success bool FindAndUpdate (Ipv4Address replyTo, Ipv4Address replyFrom, Time gratReplyHoldoff); /// Remove all expired entries void Purge (); diff --git a/src/dsr/model/dsr-maintain-buff.h b/src/dsr/model/dsr-maintain-buff.h index a68e5f277..4319bbf71 100644 --- a/src/dsr/model/dsr-maintain-buff.h +++ b/src/dsr/model/dsr-maintain-buff.h @@ -401,14 +401,23 @@ public: { } /// Push entry in queue, if there is no entry with the same packet and destination address in queue. + /// \param entry Maintain Buffer Entry + /// \return true on success adding the Entry. bool Enqueue (DsrMaintainBuffEntry & entry); /// Return first found (the earliest) entry for given destination + /// \param [in] dst Entry destination + /// \param [out] entry The Entry found (if any). + /// \return true on success bool Dequeue (Ipv4Address dst, DsrMaintainBuffEntry & entry); - /// Remove all packets with destination IP address dst + /// Remove all packets with next hop IP address dst + /// \param nextHop Next hop in the route. void DropPacketWithNextHop (Ipv4Address nextHop); - /// Finds whether a packet with destination dst exists in the queue + /// Finds whether a packet with next hop dst exists in the queue + /// \param nextHop Next hop in the route. + /// \return true if there is a packet directed to the next hop. bool Find (Ipv4Address nextHop); /// Number of entries + /// \return The number of entries. uint32_t GetSize (); // Fields @@ -444,13 +453,23 @@ public: { m_maintainBufferTimeout = t; } - /// Verify if all the elements in the maintainence buffer entry is the same + /// Verify if all the elements in the maintenance buffer entry is the same + /// \note For real this function checks if at most one entry is equal. If it is, + /// that entry is removed. Further entries are NOT checked. This could be a bug. + /// \param entry The Entry to check + /// \return true if an Entry was found and removed. bool AllEqual (DsrMaintainBuffEntry & entry); /// Verify if the maintain buffer entry is the same in every field for link ack + /// \param entry The Entry to check + /// \return true if an Entry was found and removed. bool LinkEqual (DsrMaintainBuffEntry & entry); /// Verify if the maintain buffer entry is the same in every field for network ack + /// \param entry The Entry to check + /// \return true if an Entry was found and removed. bool NetworkEqual (DsrMaintainBuffEntry & entry); /// Verify if the maintain buffer entry is the same in every field for promiscuous ack + /// \param entry The Entry to check + /// \return true if an Entry was found and removed. bool PromiscEqual (DsrMaintainBuffEntry & entry); private: @@ -465,6 +484,9 @@ private: /// The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds. Time m_maintainBufferTimeout; /// Verify if the maintain buffer is equal or not + /// \param en The Entry to check + /// \param nextHop The next hop to check + /// \return true if an Entry next hop is equal to the function second parameter static bool IsEqual (DsrMaintainBuffEntry en, const Ipv4Address nextHop) { return (en.GetNextHop () == nextHop); diff --git a/src/dsr/model/dsr-option-header.h b/src/dsr/model/dsr-option-header.h index 1f616089e..ea7fc8cc6 100644 --- a/src/dsr/model/dsr-option-header.h +++ b/src/dsr/model/dsr-option-header.h @@ -774,6 +774,7 @@ public: virtual Ipv4Address GetErrorSrc () const; /** * \brief Set the salvage value of the packet + * \param salvage The salvage value of the packet */ virtual void SetSalvage (uint8_t salvage); /** @@ -909,6 +910,7 @@ public: virtual Ipv4Address GetErrorSrc () const; /** * \brief Set the salvage value of the packet + * \param salvage The salvage value of the packet */ virtual void SetSalvage (uint8_t salvage); /** diff --git a/src/dsr/model/dsr-options.h b/src/dsr/model/dsr-options.h index 917e17f9f..33f2f401b 100644 --- a/src/dsr/model/dsr-options.h +++ b/src/dsr/model/dsr-options.h @@ -161,6 +161,7 @@ public: Ipv4Address ReverseSearchNextTwoHop (Ipv4Address ipv4Address, std::vector& vec); /** * \brief Print out the elements in the route vector + * \param vec The route vector to print. */ void PrintVector (std::vector& vec); /** diff --git a/src/dsr/model/dsr-passive-buff.h b/src/dsr/model/dsr-passive-buff.h index 3e509099d..4dc3f1987 100644 --- a/src/dsr/model/dsr-passive-buff.h +++ b/src/dsr/model/dsr-passive-buff.h @@ -268,14 +268,26 @@ public: virtual ~DsrPassiveBuffer (); /// Push entry in queue, if there is no entry with the same packet and destination address in queue. + /// \param entry Buffer Entry + /// \return true on success adding the Entry. bool Enqueue (DsrPassiveBuffEntry & entry); /// Return first found (the earliest) entry for given destination + /// \param [in] dst Entry destination + /// \param [out] entry The Entry found (if any). + /// \return true on success bool Dequeue (Ipv4Address dst, DsrPassiveBuffEntry & entry); /// Finds whether a packet with destination dst exists in the queue - bool Find (Ipv4Address dst); + /// \param dst Destination. + /// \return true if there is a packet. + bool Find (Ipv4Address dst); /// Check if all the entries in passive buffer entry is all equal or not + /// \note For real this function checks if at most one entry is equal. If it is, + /// that entry is removed. Further entries are NOT checked. This could be a bug. + /// \param entry The Entry to check + /// \return true if an Entry was found and removed. bool AllEqual (DsrPassiveBuffEntry & entry); /// Number of entries + /// \return The number of entries. uint32_t GetSize (); // Fields @@ -318,14 +330,21 @@ private: /// Remove all expired entries void Purge (); /// Notify that packet is dropped from queue by timeout + /// \param en BuffEntry Buffer entry + /// \param reason Drop reason void Drop (DsrPassiveBuffEntry en, std::string reason); /// Notify that packet is dropped from queue by timeout + /// \param en BuffEntry Buffer entry + /// \param reason Drop reason void DropLink (DsrPassiveBuffEntry en, std::string reason); /// The maximum number of packets that we allow a routing protocol to buffer. uint32_t m_maxLen; /// The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds. Time m_passiveBufferTimeout; /// Check if the send buffer entry is the same or not + /// \param en The Entry to check + /// \param link The link to check + /// \return true if an Entry source and Next hop are equal to the Link parameters static bool LinkEqual (DsrPassiveBuffEntry en, const std::vector link) { return ((en.GetSource () == link[0]) && (en.GetNextHop () == link[1])); diff --git a/src/dsr/model/dsr-rcache.h b/src/dsr/model/dsr-rcache.h index 2349f78fe..d85148dc8 100644 --- a/src/dsr/model/dsr-rcache.h +++ b/src/dsr/model/dsr-rcache.h @@ -140,6 +140,7 @@ class DsrLinkStab public: /** * \brief Constructor + * \param linkStab duration of the link stability */ DsrLinkStab (Time linkStab = Simulator::Now ()); /** @@ -231,6 +232,7 @@ public: virtual ~DsrRouteCacheEntry (); /// Mark entry as "down" (i.e. disable it) + /// \param badLinkLifetime Time before purging the link for real. void Invalidate (Time badLinkLifetime); // Fields @@ -317,6 +319,7 @@ public: /** * \brief Print necessary fields + * \param os the output stream */ void Print (std::ostream & os) const; /** @@ -386,6 +389,7 @@ public: /** * \brief Remove the aged route cache entries when the route cache is full + * \param rtVector the route cache to scan. */ void RemoveLastEntry (std::list & rtVector); /** @@ -614,6 +618,7 @@ public: /// Delete all outdated entries and invalidate valid entry if Lifetime is expired void Purge (); /// Print route cache + /// \param os the output stream void Print (std::ostream &os); //------------------------------------------------------------------------------------------ @@ -715,6 +720,7 @@ public: } /// Handle link failure callback + /// \param cb the callback to be set void SetCallback (Callback cb) { m_handleLinkFailure = cb; @@ -727,14 +733,15 @@ public: private: /** - * \brief assignment operator + * \brief assignment operator - defined but not implemented to avoid misuse. + * \return */ DsrRouteCache & operator= (DsrRouteCache const &); DsrRouteCacheEntry::IP_VECTOR m_vector; ///< The route vector to save the ip addresses for intermediate nodes. uint32_t m_maxCacheLen; ///< The maximum number of packets that we allow a routing protocol to buffer. Time RouteCacheTimeout; ///< The maximum period of time that dsr is allowed to for an unused route. Time m_badLinkLifetime; ///< The time for which the neighboring node is put into the blacklist. - /** + /* * Define the parameters for link cache type */ uint32_t m_stabilityDecrFactor; ///< stability decrease factor @@ -777,7 +784,7 @@ private: * \brief used by LookupRoute when LinkCache * \param id the ip address we are looking for * \param rt the route cache entry to store the found one - * \return true if route rute found + * \return true if route route found */ bool LookupRoute_Link (Ipv4Address id, DsrRouteCacheEntry & rt); /** @@ -851,9 +858,14 @@ public: Time m_delay; ///< This timeout deals with the passive ack - Mac48Address LookupMacAddress (Ipv4Address); ///< Find MAC address by IP using list of ARP caches + /// Find MAC address by IP using list of ARP caches + /// \param addr the IPv4 address to look for + /// \return The MAC address + Mac48Address LookupMacAddress (Ipv4Address addr); - void ProcessTxError (WifiMacHeader const &); ///< Process layer 2 TX error notification + /// Process layer 2 TX error notification + /// \param hdr Wi-Fi Mac Header + void ProcessTxError (WifiMacHeader const &hdr); }; } // namespace dsr } // namespace ns3 diff --git a/src/dsr/model/dsr-routing.h b/src/dsr/model/dsr-routing.h index f6f9ce9d7..e1b8f1234 100644 --- a/src/dsr/model/dsr-routing.h +++ b/src/dsr/model/dsr-routing.h @@ -203,6 +203,7 @@ public: Ptr GetNodeWithAddress (Ipv4Address ipv4Address); /** * \brief Print the route vector. + * \param vec the vector to print. */ void PrintVector (std::vector& vec); /** @@ -394,21 +395,21 @@ public: void SalvagePacket (Ptr packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol); /** * \brief Schedule the packet retransmission based on link-layer acknowledgment - * \param mb maintainenace buffer entry + * \param mb maintenance buffer entry * \param protocol the protocol number */ void ScheduleLinkPacketRetry (DsrMaintainBuffEntry & mb, uint8_t protocol); /** * \brief Schedule the packet retransmission based on passive acknowledgment - * \param mb maintainenace buffer entry + * \param mb maintenance buffer entry * \param protocol the protocol number */ void SchedulePassivePacketRetry (DsrMaintainBuffEntry & mb, uint8_t protocol); /** * \brief Schedule the packet retransmission based on network layer acknowledgment - * \param mb maintainenace buffer entry + * \param mb maintenance buffer entry * \param isFirst see if this is the first packet retry or not * \param protocol the protocol number */ @@ -417,21 +418,35 @@ public: uint8_t protocol); /** * \brief This function deals with packet retransmission timer expire using link acknowledgment + * \param mb maintenance buffer entry + * \param protocol the protocol number */ void LinkScheduleTimerExpire (DsrMaintainBuffEntry & mb, uint8_t protocol); /** * \brief This function deals with packet retransmission timer expire using network acknowledgment + * \param mb maintenance buffer entry + * \param protocol the protocol number */ void NetworkScheduleTimerExpire (DsrMaintainBuffEntry & mb, uint8_t protocol); /** * \brief This function deals with packet retransmission timer expire using passive acknowledgment + * \param mb maintenance buffer entry + * \param protocol the protocol number */ void PassiveScheduleTimerExpire (DsrMaintainBuffEntry & mb, uint8_t protocol); /** * \brief Forward the packet using the route saved in the source route option header + * \param packet The packet + * \param sourceRoute Source route saved in option header + * \param ipv4Header IPv4 Header + * \param source source address + * \param destination destination address + * \param targetAddress target address + * \param protocol protocol number + * \param route route */ void ForwardPacket (Ptr packet, DsrOptionSRHeader &sourceRoute, @@ -443,6 +458,9 @@ public: Ptr route); /** * \brief Broadcast the route request packet in subnet + * \param source source address + * \param destination destination address + * \param protocol protocol number */ void SendInitialRequest (Ipv4Address source, Ipv4Address destination, @@ -640,6 +658,8 @@ private: void Start (); /** * \brief Send the route error message when the link breaks to the next hop. + * \param nextHop next hop address + * \param protocol protocol number */ void SendRerrWhenBreaksLinkToNextHop (Ipv4Address nextHop, uint8_t protocol); /** diff --git a/src/dsr/model/dsr-rreq-table.cc b/src/dsr/model/dsr-rreq-table.cc index ef033fe25..6514eb235 100644 --- a/src/dsr/model/dsr-rreq-table.cc +++ b/src/dsr/model/dsr-rreq-table.cc @@ -63,13 +63,13 @@ DsrRreqTable::~DsrRreqTable () } void -DsrRreqTable::RemoveLeastExpire (std::map & rreqDstMap) +DsrRreqTable::RemoveLeastExpire () { NS_LOG_FUNCTION (this); Ipv4Address firstExpire; Time max = Seconds (0.0); for (std::map::const_iterator i = - rreqDstMap.begin (); i != rreqDstMap.end (); ++i) + m_rreqDstMap.begin (); i != m_rreqDstMap.end (); ++i) { Ipv4Address dst = i->first; RreqTableEntry rreqTableEntry = i->second; @@ -79,7 +79,7 @@ DsrRreqTable::RemoveLeastExpire (std::map & rreqDs firstExpire = dst; } } - rreqDstMap.erase (firstExpire); + m_rreqDstMap.erase (firstExpire); } void @@ -96,7 +96,7 @@ DsrRreqTable::FindAndUpdate (Ipv4Address dst) */ if (m_rreqDstMap.size () >= m_requestTableSize) { - RemoveLeastExpire (m_rreqDstMap); + RemoveLeastExpire (); NS_LOG_INFO ("The request table size after erase " << (uint32_t)m_rreqDstMap.size ()); } RreqTableEntry rreqTableEntry; diff --git a/src/dsr/model/dsr-rreq-table.h b/src/dsr/model/dsr-rreq-table.h index 100159343..41bca4531 100644 --- a/src/dsr/model/dsr-rreq-table.h +++ b/src/dsr/model/dsr-rreq-table.h @@ -288,12 +288,16 @@ public: } /// Remove the least used entry - void RemoveLeastExpire (std::map & rreqDstMap); + void RemoveLeastExpire (); /// Find the entry in the route request queue to see if already exists + /// \param dst Destination IP void FindAndUpdate (Ipv4Address dst); /// Remove route request entry for dst + /// \param dst Destination IP void RemoveRreqEntry (Ipv4Address dst); /// Get the request count number for one destination address + /// \param dst Destination IP + /// \return the route request counter uint32_t GetRreqCnt (Ipv4Address dst); /** diff --git a/src/dsr/model/dsr-rsendbuff.h b/src/dsr/model/dsr-rsendbuff.h index 70fdf02b2..5a195a33f 100644 --- a/src/dsr/model/dsr-rsendbuff.h +++ b/src/dsr/model/dsr-rsendbuff.h @@ -251,7 +251,12 @@ public: private: std::vector m_sendBuffer; ///< The send buffer to cache unsent packet void Purge (); ///< Remove all expired entries - void Drop (DsrSendBuffEntry en, std::string reason); ///< Notify that packet is dropped from queue by timeout + + /// Notify that packet is dropped from queue by timeout + /// \param en BuffEntry Buffer entry + /// \param reason Drop reason + void Drop (DsrSendBuffEntry en, std::string reason); + uint32_t m_maxLen; ///< The maximum number of packets that we allow a routing protocol to buffer. Time m_sendBufferTimeout; ///< The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds. /** diff --git a/src/dsr/test/dsr-test-suite.cc b/src/dsr/test/dsr-test-suite.cc index 55b810178..005ee9717 100644 --- a/src/dsr/test/dsr-test-suite.cc +++ b/src/dsr/test/dsr-test-suite.cc @@ -54,7 +54,7 @@ using namespace dsr; // ----------------------------------------------------------------------------- /** - * \ingroup dsr-test + * \ingroup dsr * \defgroup dsr-test DSR routing module tests */