--- a/src/internet/model/codel-queue.cc +++ a/src/internet/model/codel-queue.cc @@ -35,6 +35,13 @@ NS_LOG_COMPONENT_DEFINE ("CoDelQueue"); +/** + * Performs a reciprocal divide, similar to the + * Linux kernel reciprocal_divide function + * \param A numerator + * \param R reciprocal of the denominator B + * \return the value of A/B + */ /* borrowed from the linux kernel */ static inline uint32_t ReciprocalDivide (uint32_t A, uint32_t R) { @@ -43,6 +50,10 @@ /* end kernel borrowings */ +/** + * Returns the current time translated in CoDel time representation + * \return the current time + */ static uint32_t CoDelGetTime (void) { Time time = Simulator::Now (); @@ -51,10 +62,17 @@ return ns >> CODEL_SHIFT; } +/** + * CoDel time stamp, used to carry CoDel time informations. + */ class CoDelTimestampTag : public Tag { public: CoDelTimestampTag (); + /** + * \brief Get the type ID. + * \return the object TypeId + */ static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; @@ -63,9 +81,13 @@ virtual void Deserialize (TagBuffer i); virtual void Print (std::ostream &os) const; + /** + * Gets the Tag creation time + * @return the time object stored in the tag + */ Time GetTxTime (void) const; private: - uint64_t m_creationTime; + uint64_t m_creationTime; //!< Tag creation time }; CoDelTimestampTag::CoDelTimestampTag () @@ -292,7 +314,7 @@ NS_LOG_FUNCTION (this); CoDelTimestampTag tag; bool okToDrop; - p->FindFirstMatchingByteTag (tag); + bool found = p->RemovePacketTag (tag); NS_ASSERT_MSG (found, "found a packet without an input timestamp tag"); NS_UNUSED (found); //silence compiler warning --- a/src/internet/model/codel-queue.h +++ a/src/internet/model/codel-queue.h @@ -42,9 +42,13 @@ namespace ns3 { +/** + * Number of bits discarded from the time representation. + * The time is assumed to be in nanoseconds. + */ static const int CODEL_SHIFT = 10; -static const int DEFAULT_CODEL_LIMIT = 1000; +#define DEFAULT_CODEL_LIMIT 1000 #define REC_INV_SQRT_BITS (8 * sizeof(uint16_t)) #define REC_INV_SQRT_SHIFT (32 - REC_INV_SQRT_BITS) @@ -59,6 +63,11 @@ class CoDelQueue : public Queue { public: + /** + * Get the type ID. + * \brief Get the type ID. + * \return the object TypeId + */ static TypeId GetTypeId (void); /** @@ -179,9 +188,33 @@ */ bool OkToDrop (Ptr p, uint32_t now); + /** + * Check if CoDel time a is successive to b + * @param a left operand + * @param b right operand + * @return true if a is greater than b + */ bool CoDelTimeAfter (uint32_t a, uint32_t b); + /** + * Check if CoDel time a is successive or equal to b + * @param a left operand + * @param b right operand + * @return true if a is greater than or equal to b + */ bool CoDelTimeAfterEq (uint32_t a, uint32_t b); + /** + * Check if CoDel time a is preceding b + * @param a left operand + * @param b right operand + * @return true if a is less than to b + */ bool CoDelTimeBefore (uint32_t a, uint32_t b); + /** + * Check if CoDel time a is preceding or equal to b + * @param a left operand + * @param b right operand + * @return true if a is less than or equal to b + */ bool CoDelTimeBeforeEq (uint32_t a, uint32_t b); /** @@ -199,7 +232,7 @@ Time m_target; //!< 5 ms target queue delay TracedValue m_count; //!< Number of packets dropped since entering drop state TracedValue m_dropCount; //!< Number of dropped packets according CoDel algorithm - TracedValue m_lastCount; // m_lastCount; //!< Last number of packets dropped since entering drop state TracedValue m_dropping; //!< True if in dropping state uint16_t m_recInvSqrt; //!< Reciprocal inverse square root uint32_t m_firstAboveTime; //!< Time to declare sojourn time above target --- a/src/internet/model/tcp-header.h +++ a/src/internet/model/tcp-header.h @@ -169,6 +169,7 @@ /** * \brief Append an option to the TCP header * \param option The option to append + * \return true if optionhas been appended, false otherwise */ bool AppendOption (Ptr option); @@ -259,6 +260,12 @@ */ bool IsChecksumOk (void) const; + /** + * Comparison operator + * \param lhs left operand + * \param rhs right operand + * \return true if the operands are equal + */ friend bool operator== (const TcpHeader &lhs, const TcpHeader &rhs); private: --- a/src/internet/model/tcp-socket-base.h +++ a/src/internet/model/tcp-socket-base.h @@ -585,7 +585,7 @@ * * Calculate our factor from the rxBuffer max size * - * \param header TcpHeader where the method should add the window scale option + * \returns the Window Scale factor */ uint8_t CalculateWScale () const; @@ -661,13 +661,13 @@ TracedValue m_rWnd; //!< Flow control window at remote side // Options - bool m_winScalingEnabled; - uint8_t m_sndScaleFactor; - uint8_t m_rcvScaleFactor; + bool m_winScalingEnabled; //!< Window Scale option enabled + uint8_t m_sndScaleFactor; //!< Sent Window Scale (i.e., the one of the node) + uint8_t m_rcvScaleFactor; //!< Received Window Scale (i.e., the one of the peer) - bool m_timestampEnabled; - uint32_t m_timestampToEcho; - uint32_t m_lastEchoedTime; + bool m_timestampEnabled; //!< Timestamp option enabled + uint32_t m_timestampToEcho; //!< Timestamp to echo + uint32_t m_lastEchoedTime; //!< Last echoed timestamp }; } // namespace ns3