diff --git a/src/network/model/address.cc b/src/network/model/address.cc index 5223ef54c..32c97ae3c 100644 --- a/src/network/model/address.cc +++ b/src/network/model/address.cc @@ -169,7 +169,7 @@ Address::Deserialize (TagBuffer buffer) buffer.Read (m_data, m_len); } -ATTRIBUTE_HELPER_CPP (Address); +ATTRIBUTE_HELPER_CPP (Address); /// Macro to make help make class an ns-3 attribute bool operator == (const Address &a, const Address &b) diff --git a/src/network/model/address.h b/src/network/model/address.h index 7834638b9..00029be0d 100644 --- a/src/network/model/address.h +++ b/src/network/model/address.h @@ -224,7 +224,7 @@ private: * \brief hold objects of type ns3::Address */ -ATTRIBUTE_HELPER_HEADER (Address); +ATTRIBUTE_HELPER_HEADER (Address); /// Macro to make help make class an ns-3 attribute bool operator == (const Address &a, const Address &b); bool operator != (const Address &a, const Address &b); diff --git a/src/network/model/application.h b/src/network/model/application.h index a8b9782ba..73cea709f 100644 --- a/src/network/model/application.h +++ b/src/network/model/application.h @@ -123,11 +123,11 @@ protected: virtual void DoDispose (void); virtual void DoInitialize (void); - Ptr m_node; - Time m_startTime; - Time m_stopTime; - EventId m_startEvent; - EventId m_stopEvent; + Ptr m_node; /// The node that this application is installed on + Time m_startTime; /// The simulation time that the appliacation will start + Time m_stopTime; /// The simulation time that the appliacation will end + EventId m_startEvent; /// The event that will fire at m_startTime to start the application + EventId m_stopEvent; /// The event that will fire at m_stopTime to end the application }; } // namespace ns3 diff --git a/src/network/model/byte-tag-list.h b/src/network/model/byte-tag-list.h index 96d28228f..848b8f062 100644 --- a/src/network/model/byte-tag-list.h +++ b/src/network/model/byte-tag-list.h @@ -68,24 +68,53 @@ struct ByteTagListData; class ByteTagList { public: - + /* + * \brief An iterator for iterating through a byte tag list + * + * An iterator for iterating through a byte tag list + * + */ class Iterator { public: + /* + * \brief An item specifies an individual tag within a byte buffer + * + * An item specifies an individual tag within a byte buffer + * + */ struct Item { - TypeId tid; - uint32_t size; - int32_t start; - int32_t end; - TagBuffer buf; - Item (TagBuffer buf); + TypeId tid; /// type of the tag + uint32_t size; /// size of tag data + int32_t start; /// offset to the start of the tag from the virtual byte buffer + int32_t end; /// offset to the end of the tag from the virtual byte buffer + TagBuffer buf; /// the data for the tag as generated by Tag::Serialize + Item (TagBuffer buf); /// constructs an item with the given TagBuffer private: friend class ByteTagList; friend class ByteTagList::Iterator; }; + + /* + * \brief Used to determine if the iterator is at the end of the byteTagList + * + * \returns true if there are more Items in the list + */ bool HasNext (void) const; + + /* + * \brief Returns the next Item from the ByteTagList + * + * \returns the next Item in the ByteTagList + */ struct ByteTagList::Iterator::Item Next (void); + + /* + * \brief Returns the offset from the start of the virtual byte buffer to the ByteTagList + * + * \returns offset to the start of this ByteTagList + */ uint32_t GetOffsetStart (void) const; private: friend class ByteTagList; @@ -102,7 +131,26 @@ private: }; ByteTagList (); + + /** + * + * Copy constructor, copies the data and increases reference count + * + * \param The ByteTagList to copy + * \returns The newly created ByteTagList + * + */ ByteTagList (const ByteTagList &o); + + /** + * + * Assignment operator, deallocates current data and assigns + * value of passed in ByteTagList. Also increases reference count + * + * \param o reference to the ByteTagList to copy + * \returns reference to the assignee + * + */ ByteTagList &operator = (const ByteTagList &o); ~ByteTagList (); @@ -125,6 +173,10 @@ private: */ void Add (const ByteTagList &o); + /** + * + * Removes all of the tags from the ByteTagList + */ void RemoveAll (void); /** @@ -144,12 +196,20 @@ private: * Adjust the offsets stored internally by the adjustment delta and * make sure that all offsets are smaller than appendOffset which represents * the location where new bytes have been added to the byte buffer. + * + * \param adjustment value to change stored offsets by + * \param appendOffset maximum offset value + * */ void AddAtEnd (int32_t adjustment, int32_t appendOffset); /** * Adjust the offsets stored internally by the adjustment delta and * make sure that all offsets are bigger than prependOffset which represents * the location where new bytes have been added to the byte buffer. + * + * \param adjustment value to change stored offsets byte + * \param prependOffset minimum offset value + * */ void AddAtStart (int32_t adjustment, int32_t prependOffset); diff --git a/src/network/model/nix-vector.cc b/src/network/model/nix-vector.cc index 546a8642e..725ab6ac3 100644 --- a/src/network/model/nix-vector.cc +++ b/src/network/model/nix-vector.cc @@ -27,7 +27,7 @@ NS_LOG_COMPONENT_DEFINE ("NixVector"); namespace ns3 { -typedef std::vector NixBits_t; +typedef std::vector NixBits_t; ///typedef for the nixVector NixVector::NixVector () : m_nixVector (0), @@ -77,6 +77,7 @@ NixVector::Copy (void) const return Ptr (new NixVector (*this), false); } +/* For printing the nix vector */ std::ostream & operator << (std::ostream &os, const NixVector &nix) { nix.DumpNixVector (os); diff --git a/src/network/model/nix-vector.h b/src/network/model/nix-vector.h index 871030e60..3a7620b64 100644 --- a/src/network/model/nix-vector.h +++ b/src/network/model/nix-vector.h @@ -75,6 +75,8 @@ public: */ NixVector (const NixVector &o); /** + * \return a reference to the assignee + * * \param o the NixVector to copy to a new NixVector using the * equals operator */ diff --git a/src/network/utils/ascii-file.h b/src/network/utils/ascii-file.h index 3d7a4d8fb..3e296404f 100644 --- a/src/network/utils/ascii-file.h +++ b/src/network/utils/ascii-file.h @@ -30,10 +30,11 @@ namespace ns3 { -/* - * A class representing an ascii file. +/** + * \brief A class representing an ascii file. + * + * This class represents an ascii file */ - class AsciiFile { public: diff --git a/src/network/utils/data-rate.cc b/src/network/utils/data-rate.cc index badfffe72..13be1efbc 100644 --- a/src/network/utils/data-rate.cc +++ b/src/network/utils/data-rate.cc @@ -182,7 +182,7 @@ DoParse (const std::string s, uint64_t *v) namespace ns3 { -ATTRIBUTE_HELPER_CPP (DataRate); +ATTRIBUTE_HELPER_CPP (DataRate); /// Macro to make help make data-rate an ns-3 attribute DataRate::DataRate () : m_bps (0) @@ -248,11 +248,13 @@ DataRate::DataRate (std::string rate) } } +/* For printing of data rate */ std::ostream &operator << (std::ostream &os, const DataRate &rate) { os << rate.GetBitRate () << "bps"; return os; } +/* Initialize a data rate from an input stream */ std::istream &operator >> (std::istream &is, DataRate &rate) { std::string value; @@ -267,13 +269,26 @@ std::istream &operator >> (std::istream &is, DataRate &rate) return is; } - - +/** + * \brief Multiply datarate by a time value + * + * Calculates the number of bits that have been transmitted over a period of time + * \param lhs rate + * \param rhs time + * \return the number of bits over the period of time + */ double operator* (const DataRate& lhs, const Time& rhs) { return rhs.GetSeconds ()*lhs.GetBitRate (); } - +/** + * \brief Multiply time value by a data rate + * + * Calculates the number of bits that have been transmitted over a period of time + * \param lhs time + * \param rhs rate + * \return the number of bits over the period of time + */ double operator* (const Time& lhs, const DataRate& rhs) { return lhs.GetSeconds ()*rhs.GetBitRate (); diff --git a/src/network/utils/data-rate.h b/src/network/utils/data-rate.h index cc131c651..dc1c7cb05 100644 --- a/src/network/utils/data-rate.h +++ b/src/network/utils/data-rate.h @@ -81,13 +81,66 @@ public: * \param bps bit/s value */ DataRate (uint64_t bps); + /** + * \brief String constructor + * + * Construct a data rate from a string. Many different unit strings are supported + * Supported unit strings: + * bps, b/s, Bps, B/s \n + * kbps, kb/s, Kbps, Kb/s, kBps, kB/s, KBps, KB/s, Kib/s, KiB/s \n + * Mbps, Mb/s, MBps, MB/s, Mib/s, MiB/s \n + * Gbps, Gb/s, GBps, GB/s, Gib/s, GiB/s \n + * + * Examples: + * "56kbps" = 56,000 bits/s \n + * "128 kb/s" = 128,000 bits/s \n + * "8Kib/s" = 1 KiB/s = 8192 bits/s \n + * "1kB/s" = 8000 bits/s + * + * \param rate string representing the desired rate + */ DataRate (std::string rate); + /** + * \return true if this rate is less than rhs + * + * \param rhs the datarate to compare to this datarate + */ bool operator < (const DataRate& rhs) const; + + /** + * \return true if this rate is less than or equal to rhs + * + * \param rhs the datarate to compare to this datarate + */ bool operator <= (const DataRate& rhs) const; + + /** + * \return true if this rate is greater than rhs + * + * \param rhs the datarate to compare to this datarate + */ bool operator > (const DataRate& rhs) const; + + /** + * \return true if this rate is greather than or equal to rhs + * + * \param rhs the datarate to compare to this datarate + */ bool operator >= (const DataRate& rhs) const; + + /** + * \return true if this rate is equal to rhs + * + * \param rhs the datarate to compare to this datarate + */ bool operator == (const DataRate& rhs) const; + + /** + * \return true if this rate is not equal to rhs + * + * \param rhs the datarate to compare to this datarate + */ bool operator != (const DataRate& rhs) const; /** @@ -118,7 +171,8 @@ std::istream &operator >> (std::istream &is, DataRate &rate); * \brief hold objects of type ns3::DataRate */ -ATTRIBUTE_HELPER_HEADER (DataRate); + +ATTRIBUTE_HELPER_HEADER (DataRate); /// Macro to make help make data-rate an ns-3 attribute /** * \param lhs diff --git a/src/network/utils/error-model.h b/src/network/utils/error-model.h index cad004699..474902014 100644 --- a/src/network/utils/error-model.h +++ b/src/network/utils/error-model.h @@ -277,19 +277,19 @@ public: */ double GetBurstRate (void) const; /** - * \param burstRate the error rate to be used by the model + * \param rate the error rate to be used by the model */ void SetBurstRate (double rate); /** - * \param ranVariable A random variable distribution to generate random variates + * \param ranVar A random variable distribution to generate random variates */ - void SetRandomVariable (Ptr); + void SetRandomVariable (Ptr ranvar); /** - * \param burstSize A random variable distribution to generate random burst size + * \param burstSz A random variable distribution to generate random burst size */ - void SetRandomBurstSize (Ptr); + void SetRandomBurstSize (Ptr burstSz); /** * Assign a fixed random variable stream number to the random variables diff --git a/src/network/utils/flow-id-tag.h b/src/network/utils/flow-id-tag.h index 6fd5ab5c3..24999d39d 100644 --- a/src/network/utils/flow-id-tag.h +++ b/src/network/utils/flow-id-tag.h @@ -34,9 +34,27 @@ public: virtual void Deserialize (TagBuffer buf); virtual void Print (std::ostream &os) const; FlowIdTag (); + + /** + * Constructs a FlowIdTag with the given flow id + * + * \param flowId Id to use for the tag + */ FlowIdTag (uint32_t flowId); + /** + * Sets the flow id for the tag + * \param flowId Id to assign to the tag + */ void SetFlowId (uint32_t flowId); + /** + * Gets the flow id for the tag + * \returns current flow id for this tag + */ uint32_t GetFlowId (void) const; + /** + * Uses a static variable to generate sequential flow id + * \returns flow id allocated + */ static uint32_t AllocateFlowId (void); private: uint32_t m_flowId; diff --git a/src/network/utils/ipv4-address.cc b/src/network/utils/ipv4-address.cc index 0b2986d88..7f910baec 100644 --- a/src/network/utils/ipv4-address.cc +++ b/src/network/utils/ipv4-address.cc @@ -417,7 +417,7 @@ bool operator != (Ipv4Mask const &a, Ipv4Mask const &b) return !a.IsEqual (b); } -ATTRIBUTE_HELPER_CPP (Ipv4Address); -ATTRIBUTE_HELPER_CPP (Ipv4Mask); +ATTRIBUTE_HELPER_CPP (Ipv4Address); /// Macro to make help make class an ns-3 attribute +ATTRIBUTE_HELPER_CPP (Ipv4Mask); /// Macro to make help make class an ns-3 attribute } // namespace ns3 diff --git a/src/network/utils/ipv4-address.h b/src/network/utils/ipv4-address.h index fac4f181d..4436b5f8e 100644 --- a/src/network/utils/ipv4-address.h +++ b/src/network/utils/ipv4-address.h @@ -286,8 +286,8 @@ private: * \brief hold objects of type ns3::Ipv4Mask */ -ATTRIBUTE_HELPER_HEADER (Ipv4Address); -ATTRIBUTE_HELPER_HEADER (Ipv4Mask); +ATTRIBUTE_HELPER_HEADER (Ipv4Address); /// Macro to make help make class an ns-3 attribute +ATTRIBUTE_HELPER_HEADER (Ipv4Mask); /// Macro to make help make class an ns-3 attribute std::ostream& operator<< (std::ostream& os, Ipv4Address const& address); std::ostream& operator<< (std::ostream& os, Ipv4Mask const& mask); diff --git a/src/network/utils/ipv6-address.cc b/src/network/utils/ipv6-address.cc index 82c69d7c7..64392a7c1 100644 --- a/src/network/utils/ipv6-address.cc +++ b/src/network/utils/ipv6-address.cc @@ -929,8 +929,8 @@ size_t Ipv6AddressHash::operator () (Ipv6Address const &x) const return lookuphash (buf, sizeof (buf), 0); } -ATTRIBUTE_HELPER_CPP (Ipv6Address); -ATTRIBUTE_HELPER_CPP (Ipv6Prefix); +ATTRIBUTE_HELPER_CPP (Ipv6Address); /// Macro to make help make class an ns-3 attribute +ATTRIBUTE_HELPER_CPP (Ipv6Prefix); /// Macro to make help make class an ns-3 attribute } /* namespace ns3 */ diff --git a/src/network/utils/ipv6-address.h b/src/network/utils/ipv6-address.h index 9503049c3..44b914ae4 100644 --- a/src/network/utils/ipv6-address.h +++ b/src/network/utils/ipv6-address.h @@ -510,13 +510,13 @@ private: * \class ns3::Ipv6AddressValue * \brief Hold objects of type ns3::Ipv6Address */ -ATTRIBUTE_HELPER_HEADER (Ipv6Address); +ATTRIBUTE_HELPER_HEADER (Ipv6Address); /// Macro to make help make class an ns-3 attribute /** * \class ns3::Ipv6PrefixValue * \brief Hold objects of type ns3::Ipv6Prefix */ -ATTRIBUTE_HELPER_HEADER (Ipv6Prefix); +ATTRIBUTE_HELPER_HEADER (Ipv6Prefix); /// Macro to make help make class an ns-3 attribute /** * \brief Stream insertion operator. diff --git a/src/network/utils/mac16-address.cc b/src/network/utils/mac16-address.cc index dfd5d5e20..4a6551e94 100644 --- a/src/network/utils/mac16-address.cc +++ b/src/network/utils/mac16-address.cc @@ -30,7 +30,7 @@ NS_LOG_COMPONENT_DEFINE ("Mac16Address"); namespace ns3 { -ATTRIBUTE_HELPER_CPP (Mac16Address); +ATTRIBUTE_HELPER_CPP (Mac16Address); /// Macro to make help make class an ns-3 attribute #define ASCII_a (0x41) #define ASCII_z (0x5a) diff --git a/src/network/utils/mac16-address.h b/src/network/utils/mac16-address.h index 8ada1fe77..7b7e919fe 100644 --- a/src/network/utils/mac16-address.h +++ b/src/network/utils/mac16-address.h @@ -80,6 +80,7 @@ public: static bool IsMatchingType (const Address &address); /** * Allocate a new Mac16Address. + * \returns newly allocated mac16Address */ static Mac16Address Allocate (void); @@ -104,7 +105,7 @@ private: * \brief hold objects of type ns3::Mac16Address */ -ATTRIBUTE_HELPER_HEADER (Mac16Address); +ATTRIBUTE_HELPER_HEADER (Mac16Address); /// Macro to make help make class an ns-3 attribute inline bool operator == (const Mac16Address &a, const Mac16Address &b) { diff --git a/src/network/utils/mac48-address.cc b/src/network/utils/mac48-address.cc index d67074e5a..617977682 100644 --- a/src/network/utils/mac48-address.cc +++ b/src/network/utils/mac48-address.cc @@ -29,7 +29,7 @@ NS_LOG_COMPONENT_DEFINE ("Mac48Address"); namespace ns3 { -ATTRIBUTE_HELPER_CPP (Mac48Address); +ATTRIBUTE_HELPER_CPP (Mac48Address); /// Macro to make help make class an ns-3 attribute #define ASCII_a (0x41) #define ASCII_z (0x5a) diff --git a/src/network/utils/mac48-address.h b/src/network/utils/mac48-address.h index 8a714a0df..e96da7eb8 100644 --- a/src/network/utils/mac48-address.h +++ b/src/network/utils/mac48-address.h @@ -84,6 +84,7 @@ public: static bool IsMatchingType (const Address &address); /** * Allocate a new Mac48Address. + * \returns newly allocated mac48Address */ static Mac48Address Allocate (void); @@ -146,7 +147,7 @@ private: * \brief hold objects of type ns3::Mac48Address */ -ATTRIBUTE_HELPER_HEADER (Mac48Address); +ATTRIBUTE_HELPER_HEADER (Mac48Address); /// Macro to make help make class an ns-3 attribute inline bool operator == (const Mac48Address &a, const Mac48Address &b) { diff --git a/src/network/utils/mac64-address.cc b/src/network/utils/mac64-address.cc index bcdfda5ff..691b54232 100644 --- a/src/network/utils/mac64-address.cc +++ b/src/network/utils/mac64-address.cc @@ -29,7 +29,7 @@ NS_LOG_COMPONENT_DEFINE ("Mac64Address"); namespace ns3 { -ATTRIBUTE_HELPER_CPP (Mac64Address); +ATTRIBUTE_HELPER_CPP (Mac64Address); /// Macro to make help make class an ns-3 attribute #define ASCII_a (0x41) #define ASCII_z (0x5a) diff --git a/src/network/utils/mac64-address.h b/src/network/utils/mac64-address.h index 9ebaf4dca..78b4c7e90 100644 --- a/src/network/utils/mac64-address.h +++ b/src/network/utils/mac64-address.h @@ -83,6 +83,7 @@ public: static bool IsMatchingType (const Address &address); /** * Allocate a new Mac64Address. + * \returns newly allocated mac64Address */ static Mac64Address Allocate (void); private: @@ -106,7 +107,7 @@ private: * \brief hold objects of type ns3::Mac64Address */ -ATTRIBUTE_HELPER_HEADER (Mac64Address); +ATTRIBUTE_HELPER_HEADER (Mac64Address); /// Macro to make help make class an ns-3 attribute inline bool operator == (const Mac64Address &a, const Mac64Address &b) { diff --git a/src/network/utils/packet-data-calculators.h b/src/network/utils/packet-data-calculators.h index 51251f46e..ecd29a92d 100644 --- a/src/network/utils/packet-data-calculators.h +++ b/src/network/utils/packet-data-calculators.h @@ -31,13 +31,30 @@ namespace ns3 { /** * \ingroup stats * + * A stat for counting packets + * */ class PacketCounterCalculator : public CounterCalculator { public: PacketCounterCalculator(); virtual ~PacketCounterCalculator(); + /** + * Increments the packet counter by one + * + * \param path not used in this method + * \param packet not used in this method + */ void PacketUpdate (std::string path, Ptr packet); + + /** + * Increments the packet counter by one + * + * \param path not used in this method + * \param packet not used in this method + * \param realto not used in this method + */ + void FrameUpdate (std::string path, Ptr packet, Mac48Address realto); @@ -51,14 +68,30 @@ protected: /** * \ingroup stats * + * A stat for collecting packet size statistics: min, max and average + * */ class PacketSizeMinMaxAvgTotalCalculator : public MinMaxAvgTotalCalculator { public: PacketSizeMinMaxAvgTotalCalculator(); virtual ~PacketSizeMinMaxAvgTotalCalculator(); - + + /** + * Increments the packet stats by the size of the packet + * + * \param path not used in this method + * \param packet packet size used to update stats + */ void PacketUpdate (std::string path, Ptr packet); + + /** + * Increments the packet stats by the size of the packet + * + * \param path not used in this method + * \param packet packet size used to update stats + * \param realto not used in this method + */ void FrameUpdate (std::string path, Ptr packet, Mac48Address realto); diff --git a/src/network/utils/packetbb.h b/src/network/utils/packetbb.h index dc244b989..6dbb26c03 100644 --- a/src/network/utils/packetbb.h +++ b/src/network/utils/packetbb.h @@ -55,8 +55,8 @@ enum PbbAddressLength { class PbbTlvBlock { public: - typedef std::list< Ptr >::iterator Iterator; - typedef std::list< Ptr >::const_iterator ConstIterator; + typedef std::list< Ptr >::iterator Iterator; /// this is an iterator + typedef std::list< Ptr >::const_iterator ConstIterator; /// this is a const iterator PbbTlvBlock (void); ~PbbTlvBlock (void); @@ -192,7 +192,17 @@ public: */ void Print (std::ostream &os, int level) const; + /** + * \brief Equality operator for PbbTlvBlock + * \param other PbbTlvBlock to compare this one to + * \returns true if the blocks are equal + */ bool operator== (const PbbTlvBlock &other) const; + /** + * \brief Inequality operator for PbbTlvBlock + * \param other PbbTlvBlock to compare this one to + * \returns true if the blocks are not equal + */ bool operator!= (const PbbTlvBlock &other) const; private: @@ -207,8 +217,8 @@ private: class PbbAddressTlvBlock { public: - typedef std::list< Ptr >::iterator Iterator; - typedef std::list< Ptr >::const_iterator ConstIterator; + typedef std::list< Ptr >::iterator Iterator; /// This is a PbbAddressTlv iterator for PbbAddressTlvBlock + typedef std::list< Ptr >::const_iterator ConstIterator; /// This is a const PbbAddressTlv iterator for PbbAddressTlvBlock PbbAddressTlvBlock (void); ~PbbAddressTlvBlock (void); @@ -346,7 +356,18 @@ public: */ void Print (std::ostream &os, int level) const; + /** + * \brief Equality operator for PbbAddressTlvBlock + * \param other PbbAddressTlvBlock to compare to this one + * \returns true if PbbAddressTlvBlock are equal + */ bool operator== (const PbbAddressTlvBlock &other) const; + + /** + * \brief Inequality operator for PbbAddressTlvBlock + * \param other PbbAddressTlvBlock to compare to this one + * \returns true if PbbAddressTlvBlock are not equal + */ bool operator!= (const PbbAddressTlvBlock &other) const; private: @@ -364,10 +385,10 @@ private: class PbbPacket : public SimpleRefCount { public: - typedef std::list< Ptr >::iterator TlvIterator; - typedef std::list< Ptr >::const_iterator ConstTlvIterator; - typedef std::list< Ptr >::iterator MessageIterator; - typedef std::list< Ptr >::const_iterator ConstMessageIterator; + typedef std::list< Ptr >::iterator TlvIterator; /// This is a PbbTlv iterator for PbbPacket + typedef std::list< Ptr >::const_iterator ConstTlvIterator; /// This is a const PbbTlv iterator for PbbPacket + typedef std::list< Ptr >::iterator MessageIterator; /// This is a PbbMessageIterator for PbbPacket + typedef std::list< Ptr >::const_iterator ConstMessageIterator; /// This is a const PbbMessageIterator for PbbPacket PbbPacket (void); ~PbbPacket (void); @@ -627,7 +648,18 @@ public: */ virtual void Print (std::ostream &os) const; + /** + * \brief Equality operator for PbbPacket + * \param other PbbPacket to compare to this one + * \returns true if PbbPacket are equal + */ bool operator== (const PbbPacket &other) const; + + /** + * \brief Inequality operator for PbbPacket + * \param other PbbPacket to compare to this one + * \returns true if PbbPacket are not equal + */ bool operator!= (const PbbPacket &other) const; protected: @@ -652,10 +684,10 @@ private: class PbbMessage : public SimpleRefCount { public: - typedef std::list< Ptr >::iterator TlvIterator; - typedef std::list< Ptr >::const_iterator ConstTlvIterator; - typedef std::list< Ptr >::iterator AddressBlockIterator; - typedef std::list< Ptr >::const_iterator ConstAddressBlockIterator; + typedef std::list< Ptr >::iterator TlvIterator; /// This is a PbbTlv iterator for PbbMessage + typedef std::list< Ptr >::const_iterator ConstTlvIterator; /// This is a const PbbTlv iterator for PbbMessage + typedef std::list< Ptr >::iterator AddressBlockIterator; /// This is a PbbAddressBlock iterator for PbbMessage + typedef std::list< Ptr >::const_iterator ConstAddressBlockIterator; /// This is a const PbbAddressBlock iterator for PbbMessage PbbMessage (); virtual ~PbbMessage (); @@ -1004,13 +1036,27 @@ public: */ void Print (std::ostream &os, int level) const; + /** + * \brief Equality operator for PbbMessage + * \param other PbbMessage to compare to this one + * \returns true if PbbMessages are equal + */ bool operator== (const PbbMessage &other) const; + /** + * \brief Inequality operator for PbbMessage + * \param other PbbMessage to compare to this one + * \returns true if PbbMessages are not equal + */ bool operator!= (const PbbMessage &other) const; -protected: - /* PbbMessage size in bytes - 1. +protected: + /** + * \brief Returns address length (IPV4 3 or IPV6 15) * - * IPv4 = 4 - 1 = 3, IPv6 = 16 - 1 = 15 + * Returns message size in bytes - 1 + * IPv4 = 4 - 1 = 3, IPv6 = 16 - 1 = 15 + * + * \returns Address length (IPV4 3 or IPV6 15) */ virtual PbbAddressLength GetAddressLength (void) const = 0; @@ -1051,6 +1097,14 @@ public: virtual ~PbbMessageIpv4 (); protected: + /** + * \brief Returns address length (IPV4 3 or IPV6 15) + * + * Returns message size in bytes - 1 + * IPv4 = 4 - 1 = 3, IPv6 = 16 - 1 = 15 + * + * \returns Address length (IPV4 3 or IPV6 15) + */ virtual PbbAddressLength GetAddressLength (void) const; virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const; @@ -1071,6 +1125,14 @@ public: virtual ~PbbMessageIpv6 (); protected: + /** + * \brief Returns address length (IPV4 3 or IPV6 15) + * + * Returns message size in bytes - 1 + * IPv4 = 4 - 1 = 3, IPv6 = 16 - 1 = 15 + * + * \returns Address length (IPV4 3 or IPV6 15) + */ virtual PbbAddressLength GetAddressLength (void) const; virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const; @@ -1089,14 +1151,14 @@ protected: class PbbAddressBlock : public SimpleRefCount { public: - typedef std::list< Address >::iterator AddressIterator; - typedef std::list< Address >::const_iterator ConstAddressIterator; + typedef std::list< Address >::iterator AddressIterator; /// this is an address iterator for PbbAddressBlock + typedef std::list< Address >::const_iterator ConstAddressIterator; /// this is an const address iterator for PbbAddressBlock - typedef std::list::iterator PrefixIterator; - typedef std::list::const_iterator ConstPrefixIterator; + typedef std::list::iterator PrefixIterator; /// this is a prefix iterator for PbbAddressBlock + typedef std::list::const_iterator ConstPrefixIterator; /// this is a const prefix iterator for PbbAddressBlock - typedef PbbAddressTlvBlock::Iterator TlvIterator; - typedef PbbAddressTlvBlock::ConstIterator ConstTlvIterator; + typedef PbbAddressTlvBlock::Iterator TlvIterator; /// this is a tlvblock iterator for PbbAddressBlock + typedef PbbAddressTlvBlock::ConstIterator ConstTlvIterator; /// this is a const tlvblock iterator for PbbAddressBlock PbbAddressBlock (); virtual ~PbbAddressBlock (); @@ -1440,12 +1502,26 @@ public: */ void Print (std::ostream &os, int level) const; + /** + * \brief Equality operator for PbbAddressBlock + * \param other PbbAddressBlock to compare to this one + * \returns true if PbbMessages are equal + */ bool operator== (const PbbAddressBlock &other) const; + + /** + * \brief Inequality operator for PbbAddressBlock + * \param other PbbAddressBlock to compare to this one + * \returns true if PbbAddressBlock are not equal + */ bool operator!= (const PbbAddressBlock &other) const; protected: + /** + * \brief Returns address length + * \returns Address length + */ virtual uint8_t GetAddressLength (void) const = 0; - virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const = 0; virtual Address DeserializeAddress (uint8_t *buffer) const = 0; virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const = 0; @@ -1473,8 +1549,11 @@ public: virtual ~PbbAddressBlockIpv4 (); protected: + /** + * \brief Returns address length + * \returns Address length + */ virtual uint8_t GetAddressLength (void) const; - virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const; virtual Address DeserializeAddress (uint8_t *buffer) const; virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const; @@ -1492,8 +1571,11 @@ public: virtual ~PbbAddressBlockIpv6 (); protected: + /** + * \brief Returns address length + * \returns Address length + */ virtual uint8_t GetAddressLength (void) const; - virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const; virtual Address DeserializeAddress (uint8_t *buffer) const; virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const; @@ -1620,7 +1702,18 @@ public: */ void Print (std::ostream &os, int level) const; + /** + * \brief Equality operator for PbbTlv + * \param other PbbTlv to compare to this one + * \returns true if PbbTlv are equal + */ bool operator== (const PbbTlv &other) const; + + /** + * \brief Inequality operator for PbbTlv + * \param other PbbTlv to compare to this one + * \returns true if PbbTlv are not equal + */ bool operator!= (const PbbTlv &other) const; protected: diff --git a/src/network/utils/pcap-file.h b/src/network/utils/pcap-file.h index 7993af04f..52d32ba1d 100644 --- a/src/network/utils/pcap-file.h +++ b/src/network/utils/pcap-file.h @@ -31,12 +31,14 @@ namespace ns3 { class Packet; class Header; -/* + +/** + * \brief A class representing a pcap file + * * A class representing a pcap file. This allows easy creation, writing and * reading of files composed of stored packets; which may be viewed using * standard tools. */ - class PcapFile { public: diff --git a/src/network/utils/queue.h b/src/network/utils/queue.h index 89b527012..efc5d3854 100644 --- a/src/network/utils/queue.h +++ b/src/network/utils/queue.h @@ -156,7 +156,11 @@ private: virtual Ptr DoPeek (void) const = 0; protected: - // called by subclasses to notify parent of packet drops. + /** + * \brief Drop a packet + * \param packet packet that was dropped + * This method is called by subclasses to notify parent (this class) of packet drops. + */ void Drop (Ptr packet); private: diff --git a/src/network/utils/red-queue.h b/src/network/utils/red-queue.h index ed6423533..a3e832f5d 100644 --- a/src/network/utils/red-queue.h +++ b/src/network/utils/red-queue.h @@ -83,46 +83,43 @@ class RedQueue : public Queue { public: static TypeId GetTypeId (void); - /* + /** * \brief RedQueue Constructor * * Create a RED queue */ RedQueue (); - /* + /** * \brief Destructor * * Destructor */ virtual ~RedQueue (); - /* + /** * \brief Stats * */ typedef struct - { - // Early probability drops - uint32_t unforcedDrop; - // Forced drops, qavg > max threshold - uint32_t forcedDrop; - // Drops due to queue limits - uint32_t qLimDrop; + { + uint32_t unforcedDrop; /// Early probability drops + uint32_t forcedDrop; /// Forced drops, qavg > max threshold + uint32_t qLimDrop; /// Drops due to queue limits } Stats; - /* + /** * \brief Drop types * */ enum { - DTYPE_NONE, // Ok, no drop - DTYPE_FORCED, // A "forced" drop - DTYPE_UNFORCED, // An "unforced" (random) drop + DTYPE_NONE, /// Ok, no drop + DTYPE_FORCED, /// A "forced" drop + DTYPE_UNFORCED, /// An "unforced" (random) drop }; - /* + /** * \brief Set the operating mode of this queue. * Set operating mode * @@ -130,7 +127,7 @@ public: */ void SetMode (RedQueue::QueueMode mode); - /* + /** * \brief Get the encapsulation mode of this queue. * Get the encapsulation mode of this queue * @@ -138,21 +135,21 @@ public: */ RedQueue::QueueMode GetMode (void); - /* + /** * \brief Get the current value of the queue in bytes or packets. * * \returns The queue size in bytes or packets. */ uint32_t GetQueueSize (void); - /* + /** * \brief Set the limit of the queue. * * \param lim The limit in bytes or packets. */ void SetQueueLimit (uint32_t lim); - /* + /** * \brief Set the thresh limits of RED. * * \param min Minimum thresh in bytes or packets. @@ -160,7 +157,7 @@ public: */ void SetTh (double minTh, double maxTh); - /* + /** * \brief Get the RED statistics after running. * * \returns The drop statistics. diff --git a/src/network/utils/sequence-number.h b/src/network/utils/sequence-number.h index b06a591d0..17a578a05 100644 --- a/src/network/utils/sequence-number.h +++ b/src/network/utils/sequence-number.h @@ -64,19 +64,30 @@ public: : m_value (value) {} - // copy contructor + /** + * \brief Constructs a SequenceNumber from a copy + * \param value sequence number to copy + */ SequenceNumber (SequenceNumber const &value) : m_value (value.m_value) {} - // assignment from a plain number + /** + * \brief Constructs a SequenceNumber from an assignment of given value + * \param value sequence number to copy + * \returns reference to the assignee + */ SequenceNumber& operator= (NUMERIC_TYPE value) { m_value = value; return *this; } - // assignment from a sequence number + /** + * \brief Constructs a SequenceNumber from an assignment of another sequence number + * \param value sequence number to copy + * \returns reference to the assignee + */ SequenceNumber& operator= (SequenceNumber const &value) { m_value = value.m_value; @@ -100,14 +111,20 @@ public: return m_value; } - // prefix ++ + /** + * \brief Prefix increment operator + * \returns incremented sequence number + */ SequenceNumber operator++ () { m_value++; return *this; } - // postfix ++ + /** + * \brief Postfix increment operator + * \returns incremented sequence number + */ SequenceNumber operator++ (int) { SequenceNumber retval (m_value); @@ -115,14 +132,20 @@ public: return retval; } - // prefix -- + /** + * \brief Prefix decrement operator + * \returns decremented sequence number + */ SequenceNumber operator-- () { m_value--; return *this; } - // postfix -- + /** + * \brief Postfix decrement operator + * \returns incremented sequence number + */ SequenceNumber operator-- (int) { SequenceNumber retval (m_value); @@ -130,33 +153,63 @@ public: return retval; } + /** + * \brief Plus equals operator + * \param value value to add to sequence number + * \returns incremented sequence number + */ SequenceNumber& operator+= (SIGNED_TYPE value) { m_value += value; return *this; } - + + /** + * \brief Minus equals operator + * \param value value to subtract from sequence number + * \returns decremented sequence number + */ SequenceNumber& operator-= (SIGNED_TYPE value) { m_value -= value; return *this; } + /** + * \brief Operator defining addition of two sequence numbers + * \param other sequence number added to this + * \returns sequence number representing sum + */ SequenceNumber operator + (const SequenceNumber &other) const { return SequenceNumber (m_value + other.m_value); } + /** + * \brief Addition operator for adding numeric value to sequence number + * \param delta value to add to sequence number + * \returns sequence number representing sum + */ SequenceNumber operator + (SIGNED_TYPE delta) const { return SequenceNumber (m_value + delta); } + /** + * \brief Subtraction operator for subtracting numeric value from sequence number + * \param delta value to subtract from sequence number + * \returns sequence number representing difference + */ SequenceNumber operator - (SIGNED_TYPE delta) const { return SequenceNumber (m_value - delta); } + /** + * \brief Subtraction operator for subtracting sequence number from sequence number + * \param other sequence number to subtract from this sequence number + * \returns numeric value representing the difference + */ SIGNED_TYPE operator - (const SequenceNumber &other) const { static const NUMERIC_TYPE maxValue = std::numeric_limits::max (); @@ -199,16 +252,18 @@ public: } } - - // Here is the critical part, how the comparison is made taking into - // account wrap-around. From RFC 3626: - // - // The sequence number S1 is said to be "greater than" the sequence - // number S2 if: - // - // S1 > S2 AND S1 - S2 <= MAXVALUE/2 OR - // - // S2 > S1 AND S2 - S1 > MAXVALUE/2 + /** + * Here is the critical part, how the comparison is made taking into + * account wrap-around. From RFC 3626: + * + * The sequence number S1 is said to be "greater than" the sequence + * number S2 if: + * S1 > S2 AND S1 - S2 <= MAXVALUE/2 OR + * S2 > S1 AND S2 - S1 > MAXVALUE/2 + * + * \param other sequence number to compare to this one + * \returns true if this sequence number is greater than other + */ bool operator > (const SequenceNumber &other) const { static const NUMERIC_TYPE halfMaxValue = std::numeric_limits::max () / 2; @@ -217,35 +272,71 @@ public: || ((other.m_value > m_value) && (other.m_value - m_value) > halfMaxValue)); } + /** + * \brief Equality operator for comparing sequence number + * \param other sequence number to compare to this sequence number + * \returns true if the sequence numbers are equal + */ bool operator == (const SequenceNumber &other) const { return (m_value == other.m_value); } + /** + * \brief Inequality operator for comparing sequence numbers + * \param other sequence number to compare to this sequence number + * \returns true if the sequence numbers are not equal + */ bool operator != (const SequenceNumber &other) const { return (m_value != other.m_value); } + /** + * \brief Less than or equal operator for comparing sequence numbers + * \param other sequence number to compare to this sequence number + * \returns true if this sequence number is less than or equal to other + */ bool operator <= (const SequenceNumber &other) const { return (!this->operator> (other)); } + /** + * \brief Greater than or equal operator for comparing sequence numbers + * \param other sequence number to compare to this sequence number + * \returns true if this sequence number is greater than or equal to other + */ bool operator >= (const SequenceNumber &other) const { return (this->operator> (other) || this->operator== (other)); } + /** + * \brief Less than operator for comparing sequence numbers + * \param other sequence number to compare to this sequence number + * \returns true if this sequence number is less than other + */ bool operator < (const SequenceNumber &other) const { return !this->operator> (other) && m_value != other.m_value; } - + /** + * \brief For printing sequence number + * \param os output stream + * \param val sequence number to display + * \returns output stream os + */ template friend std::ostream & operator<< (std::ostream& os, const SequenceNumber &val); + /** + * \brief For loading sequence number from input streams + * \param is input stream + * \param val sequence number to load + * \returns input stream is + */ template friend std::istream & operator >> (std::istream &is, const SequenceNumber &val); @@ -271,7 +362,6 @@ private: NUMERIC_TYPE m_value; }; - template std::ostream & operator<< (std::ostream& os, const SequenceNumber &val) diff --git a/src/network/utils/simple-channel.h b/src/network/utils/simple-channel.h index 912b6591a..29bc9f639 100644 --- a/src/network/utils/simple-channel.h +++ b/src/network/utils/simple-channel.h @@ -39,9 +39,26 @@ public: static TypeId GetTypeId (void); SimpleChannel (); + /** + * A packet is sent by a net device. A receive event will be + * scheduled for all net device connected to the channel other + * than the net device who sent the packet + * + * \param p packet to be sent + * \param protocol protocol number + * \param to address to send packet to + * \param from address the packet is coming from + * \param sender netdevice who sent the packet + * + */ void Send (Ptr p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr sender); + /** + * Attached a net device to the channel. + * + * \param device the device to attach to the channel + */ void Add (Ptr device); // inherited from ns3::Channel diff --git a/src/network/utils/simple-net-device.h b/src/network/utils/simple-net-device.h index 60d193ba1..82f603893 100644 --- a/src/network/utils/simple-net-device.h +++ b/src/network/utils/simple-net-device.h @@ -48,7 +48,26 @@ public: static TypeId GetTypeId (void); SimpleNetDevice (); + /** + * Receive a packet from a connected SimpleChannel. The + * SimpleNetDevice receives packets from its connected channel + * and then forwards them by calling its rx callback method + * + * \param packet Packet received on the channel + * \param protocol protocol number + * \param to address packet should be sent to + * \param from address packet was sent from + */ void Receive (Ptr packet, uint16_t protocol, Mac48Address to, Mac48Address from); + + /** + * + * Attach a channel to this net device. This will be the + * channel the net device sends on + * + * \param channel channel to assign to this net device + * + */ void SetChannel (Ptr channel); /**