documentation
diff --git a/helper/ccnx-consumer-helper.cc b/helper/ccnx-consumer-helper.cc
index f6fcb7c..d41de22 100644
--- a/helper/ccnx-consumer-helper.cc
+++ b/helper/ccnx-consumer-helper.cc
@@ -31,51 +31,50 @@
CcnxConsumerHelper::CcnxConsumerHelper (const std::string &prefix)
{
- m_factory.SetTypeId ("ns3::CcnxConsumer");
+ m_factory.SetTypeId ("ns3::CcnxConsumer");
- CcnxNameComponentsValue prefixValue;
- prefixValue.DeserializeFromString (prefix, MakeCcnxNameComponentsChecker ());
- m_factory.Set ("InterestName", prefixValue);
+ CcnxNameComponentsValue prefixValue;
+ prefixValue.DeserializeFromString (prefix, MakeCcnxNameComponentsChecker ());
+ m_factory.Set ("InterestName", prefixValue);
}
void
CcnxConsumerHelper::SetAttribute (std::string name, const AttributeValue &value)
{
- m_factory.Set (name, value);
+ m_factory.Set (name, value);
}
ApplicationContainer
CcnxConsumerHelper::Install (Ptr<Node> node)
{
- return ApplicationContainer (InstallPriv (node));
+ return ApplicationContainer (InstallPriv (node));
}
ApplicationContainer
CcnxConsumerHelper::Install (std::string nodeName)
{
- Ptr<Node> node = Names::Find<Node> (nodeName);
- return ApplicationContainer (InstallPriv (node));
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
}
ApplicationContainer
CcnxConsumerHelper::Install (NodeContainer c)
{
- ApplicationContainer apps;
- for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+ ApplicationContainer apps;
+ for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
- apps.Add (InstallPriv (*i));
+ apps.Add (InstallPriv (*i));
}
- return apps;
+ return apps;
}
Ptr<Application>
CcnxConsumerHelper::InstallPriv (Ptr<Node> node)
{
- Ptr<CcnxConsumer> app = m_factory.Create<CcnxConsumer> ();
- node->AddApplication (app);
+ Ptr<CcnxConsumer> app = m_factory.Create<CcnxConsumer> ();
+ node->AddApplication (app);
- return app;
+ return app;
}
-
}
diff --git a/helper/ccnx-decoding-helper.cc b/helper/ccnx-decoding-helper.cc
index 4d4695c..ee3f084 100644
--- a/helper/ccnx-decoding-helper.cc
+++ b/helper/ccnx-decoding-helper.cc
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author:
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "ccnx-decoding-helper.h"
diff --git a/helper/ccnx-decoding-helper.h b/helper/ccnx-decoding-helper.h
index 8ebfcc5..015b7ff 100644
--- a/helper/ccnx-decoding-helper.h
+++ b/helper/ccnx-decoding-helper.h
@@ -35,15 +35,24 @@
class CcnxDecodingHelper
{
public:
+ /**
+ * \brief Deserialize Buffer::Iterator to CcnxInterestHeader
+ * @param start Buffer containing serialized CCNx message
+ * @param interest Pointer to the CcnxInterestHeader to hold deserialized value
+ * @return Number of bytes used for deserialization
+ */
static size_t
Deserialize (Buffer::Iterator start, CcnxInterestHeader &interest);
+ /**
+ * \brief Deserialize Buffer::Iterator to CcnxContentObjectHeader
+ * @param start Buffer containing serialized CCNx message
+ * @param contentObject Pointer to the CcnxContentObjectHeader to hold deserialized value
+ * @return Number of bytes used for deserialization
+ */
static size_t
Deserialize (Buffer::Iterator start, CcnxContentObjectHeader &contentObject);
-
-private:
};
-
} // namespace ns3
#endif // _CCNX_DECODING_HELPER_H_
diff --git a/helper/ccnx-encoding-helper.cc b/helper/ccnx-encoding-helper.cc
index 15757fc..e63c67c 100644
--- a/helper/ccnx-encoding-helper.cc
+++ b/helper/ccnx-encoding-helper.cc
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author:
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "ccnx-encoding-helper.h"
diff --git a/helper/ccnx-encoding-helper.h b/helper/ccnx-encoding-helper.h
index acce922..e4fe45d 100644
--- a/helper/ccnx-encoding-helper.h
+++ b/helper/ccnx-encoding-helper.h
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author:
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef _CCNX_ENCODING_HELPER_H_
@@ -36,15 +36,26 @@
class CcnxContentObjectHeader;
/**
- * Helper to encode/decode ccnb formatted CCNx message
+ * \brief Helper to encode/decode ccnb formatted CCNx message
*
*/
class CcnxEncodingHelper
{
public:
+ /**
+ * \brief Serialize CcnxInterestHeader to Buffer::Iterator
+ * @param start Buffer to store serialized CcnxInterestHeader
+ * @param interest Pointer to CcnxInterestHeader to be serialized
+ * @return length of serialized CcnxInterestHeader
+ */
static size_t
Serialize (Buffer::Iterator start, const CcnxInterestHeader &interest);
+ /**
+ * \brief Compute the size of serialized CcnxInterestHeader
+ * @param interest Pointer to CcnxInterestHeader
+ * @return length
+ */
static size_t
GetSerializedSize (const CcnxInterestHeader &interest);
diff --git a/helper/ccnx-producer-helper.cc b/helper/ccnx-producer-helper.cc
index 2bf369b..ec44aca 100644
--- a/helper/ccnx-producer-helper.cc
+++ b/helper/ccnx-producer-helper.cc
@@ -32,89 +32,54 @@
CcnxProducerHelper::CcnxProducerHelper (const std::string &prefix, uint32_t virtualPayloadSize)
{
- m_factory.SetTypeId ("ns3::CcnxProducer");
+ m_factory.SetTypeId ("ns3::CcnxProducer");
- CcnxNameComponentsValue prefixValue;
- prefixValue.DeserializeFromString (prefix, MakeCcnxNameComponentsChecker ());
- m_factory.Set ("Prefix", prefixValue);
+ CcnxNameComponentsValue prefixValue;
+ prefixValue.DeserializeFromString (prefix, MakeCcnxNameComponentsChecker ());
+ m_factory.Set ("Prefix", prefixValue);
- m_factory.Set ("PayloadSize", UintegerValue (virtualPayloadSize));
+ m_factory.Set ("PayloadSize", UintegerValue (virtualPayloadSize));
}
void
CcnxProducerHelper::SetAttribute (std::string name, const AttributeValue &value)
{
- m_factory.Set (name, value);
+ m_factory.Set (name, value);
}
ApplicationContainer
CcnxProducerHelper::Install (Ptr<Node> node)
{
- NS_LOG_FUNCTION(this);
- return ApplicationContainer (InstallPriv (node));
+ NS_LOG_FUNCTION(this);
+ return ApplicationContainer (InstallPriv (node));
}
ApplicationContainer
CcnxProducerHelper::Install (std::string nodeName)
{
- Ptr<Node> node = Names::Find<Node> (nodeName);
- return ApplicationContainer (InstallPriv (node));
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
}
ApplicationContainer
CcnxProducerHelper::Install (NodeContainer c)
{
- ApplicationContainer apps;
- for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+ ApplicationContainer apps;
+ for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
- apps.Add (InstallPriv (*i));
+ apps.Add (InstallPriv (*i));
}
- return apps;
+ return apps;
}
-
- /*CcnxStackHelper::CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId)
- {
- ObjectFactory factory;
- factory.SetTypeId (typeId);
- Ptr<Object> protocol = factory.Create <Object> ();
- node->AggregateObject (protocol);
- }*/
+
Ptr<Application>
CcnxProducerHelper::InstallPriv (Ptr<Node> node)
{
- NS_LOG_INFO ("InstallPriv started");
- Ptr<CcnxProducer> app = m_factory.Create<CcnxProducer> ();
- node->AddApplication (app);
-
- /*Ptr<CcnxLocalFace> localFace = Create<CcnxLocalFace> ();
- localFace->SetNode(node);
+ NS_LOG_INFO ("InstallPriv started");
+ Ptr<CcnxProducer> app = m_factory.Create<CcnxProducer> ();
+ node->AddApplication (app);
- //CreateAndAggregateObjectFromTypeId (node, "ns3::CcnxL3Protocol");
- ObjectFactory factory;
- factory.SetTypeId("ns3::CcnxL3Protocol");
- Ptr<Object> protocol = factory.Create<Object> ();
- node->AggregateObject(protocol);
-
- Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
-
- if (ccnx == NULL)
- {
- NS_FATAL_ERROR ("CcnxProducerHelper::InstallPriv (): Getting Ccnx "
- "a CcnxStack must be installed on the node");
- return 0;
- }
-
- // m_factory.Set ("Face", PointerValue (localFace));
- m_factory.Set ("Ccnx", PointerValue (ccnx));
- Ptr<CcnxProducer> app = m_factory.Create<CcnxProducer> ();
-
- //app->m_ccnx->m_contentStore->SetMaxSize(app->GetStoreCapacity());
- localFace->RegisterProtocolHandler (MakeCallback (&CcnxProducer::HandlePacket, app));
- localFace->SetUp();
-
- node->AddApplication (app);*/
-
- return app;
+ return app;
}
}
diff --git a/helper/ccnx-producer-helper.h b/helper/ccnx-producer-helper.h
index 31f76da..eaa3665 100644
--- a/helper/ccnx-producer-helper.h
+++ b/helper/ccnx-producer-helper.h
@@ -39,60 +39,59 @@
class CcnxProducerHelper
{
public:
-/**
-* Create an CcnxProducerHelper to make it easier to work with CcnxProducer applications
-*
-*/
-CcnxProducerHelper (const std::string &prefix, uint32_t virtualPayloadSize);
+ /**
+ * Create an CcnxProducerHelper to make it easier to work with CcnxProducer applications
+ *
+ */
+ CcnxProducerHelper (const std::string &prefix, uint32_t virtualPayloadSize);
-/**
-* Helper function used to set the underlying application attributes.
-*
-* \param name the name of the application attribute to set
-* \param value the value of the application attribute to set
-*/
-void SetAttribute (std::string name, const AttributeValue &value);
+ /**
+ * Helper function used to set the underlying application attributes.
+ *
+ * \param name the name of the application attribute to set
+ * \param value the value of the application attribute to set
+ */
+ void SetAttribute (std::string name, const AttributeValue &value);
-/**
-* Install an ns3::CcnxProducer on each node of the input container
-* configured with all the attributes set with SetAttribute.
-*
-* \param c NodeContainer of the set of nodes on which an CcnxProducer
-* will be installed.
-* \returns Container of Ptr to the applications installed.
-*/
-ApplicationContainer Install (NodeContainer c);
+ /**
+ * Install an ns3::CcnxProducer on each node of the input container
+ * configured with all the attributes set with SetAttribute.
+ *
+ * \param c NodeContainer of the set of nodes on which an CcnxProducer
+ * will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (NodeContainer c);
-/**
-* Install an ns3::CcnxProducer on the node configured with all the
-* attributes set with SetAttribute.
-*
-* \param node The node on which an CcnxProducer will be installed.
-* \returns Container of Ptr to the applications installed.
-*/
-ApplicationContainer Install (Ptr<Node> node);
+ /**
+ * Install an ns3::CcnxProducer on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param node The node on which an CcnxProducer will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (Ptr<Node> node);
-/**
-* Install an ns3::CcnxProducer on the node configured with all the
-* attributes set with SetAttribute.
-*
-* \param nodeName The node on which an CcnxProducer will be installed.
-* \returns Container of Ptr to the applications installed.
-*/
-ApplicationContainer Install (std::string nodeName);
+ /**
+ * Install an ns3::CcnxProducer on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param nodeName The node on which an CcnxProducer will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (std::string nodeName);
private:
-/**
-* \internal
-* Install an ns3::CcnxProducer on the node configured with all the
-* attributes set with SetAttribute.
-*
-* \param node The node on which an CcnxProducer will be installed.
-* \returns Ptr to the application installed.
-*/
-Ptr<Application> InstallPriv (Ptr<Node> node);
-ObjectFactory m_factory;
-
+ /**
+ * \internal
+ * Install an ns3::CcnxProducer on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param node The node on which an CcnxProducer will be installed.
+ * \returns Ptr to the application installed.
+ */
+ Ptr<Application> InstallPriv (Ptr<Node> node);
+ ObjectFactory m_factory;
};
}
diff --git a/model/ccnx-forwarding-strategy.h b/model/ccnx-forwarding-strategy.h
index bb11ec6..9fae7b1 100644
--- a/model/ccnx-forwarding-strategy.h
+++ b/model/ccnx-forwarding-strategy.h
@@ -51,7 +51,7 @@
virtual ~CcnxForwardingStrategy ();
/**
- * @brief Base method to propagate the insterest according to the forwarding strategy
+ * @brief Base method to propagate the interest according to the forwarding strategy
*
* @param pitEntry Reference to PIT entry (reference to corresponding FIB entry inside)
* @param incomingFace Incoming face
@@ -77,7 +77,7 @@
protected:
/**
- * @brief Propage interest vie a green interface. Fail, if no green interfaces available
+ * @brief Propagate interest via a green interface. Fail, if no green interfaces available
*
* @param pitEntry Reference to PIT entry (reference to corresponding FIB entry inside)
* @param incomingFace Incoming face
diff --git a/model/ccnx-interest-header.h b/model/ccnx-interest-header.h
index 979dfdd..dcfd983 100644
--- a/model/ccnx-interest-header.h
+++ b/model/ccnx-interest-header.h
@@ -114,7 +114,7 @@
**/
/**
- NDN InterestHeader and routines to serialize/deserialize
+ * NDN InterestHeader and routines to serialize/deserialize
Simplifications:
- Name: binary name components are not supported
@@ -129,7 +129,7 @@
{
public:
/**
- * Constructor
+ * \brief Constructor
*
* Creates a null header
**/
@@ -139,22 +139,60 @@
* \brief Set interest name
*
* Sets name of the interest. For example, SetName( CcnxNameComponents("prefix")("postfix") );
+ * @param[in] name const pointer to CcnxNameComponents object that contains an interest name
**/
void
SetName (const Ptr<CcnxNameComponents> &name);
+
+ /**
+ * \brief Get interest name
+ *
+ * Gets name of the interest.
+ **/
const CcnxNameComponents&
GetName () const;
+ /**
+ * \brief Set interest MinSuffixComponents
+ *
+ * MinSuffixComponents refer to the number of name components beyond those in the prefix,
+ * and counting the implicit digest, that may occur in the matching ContentObject.
+ * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information.
+ * @param[in] value minimum length of suffix components
+ **/
void
SetMinSuffixComponents (int32_t value);
+ /**
+ * \brief Get interest MinSuffixComponents
+ *
+ * MinSuffixComponents refer to the number of name components beyond those in the prefix,
+ * and counting the implicit digest, that may occur in the matching ContentObject.
+ * For more information, see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html
+ **/
int32_t
GetMinSuffixComponents () const;
+
+ /**
+ * \brief Set interest MaxSuffixComponents
+ *
+ * MaxSuffixComponents refer to the number of name components beyond those in the prefix,
+ * and counting the implicit digest, that may occur in the matching ContentObject.
+ * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information.
+ * @param[in] value maximum length of suffix components
+ **/
void
SetMaxSuffixComponents (int32_t value);
+ /**
+ * \brief Get interest MaxSuffixComponents
+ *
+ * MaxSuffixComponents refer to the number of name components beyond those in the prefix,
+ * and counting the implicit digest, that may occur in the matching ContentObject.
+ * For more information, see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html
+ **/
int32_t
GetMaxSuffixComponents () const;
@@ -162,46 +200,122 @@
* \brief Set exclude filer
*
* For example, SetExclude (CcnxNameComponents("exclude1")("exclude2")("exclude3"))
+ * @param[in] exclude const pointer to CcnxNameComponents to be excluded
**/
void
SetExclude (const Ptr<CcnxNameComponents> &exclude);
+ /**
+ * \brief Check if interest conatins exclude filter
+ *
+ */
bool
IsEnabledExclude () const;
+ /**
+ * \brief Get exclude filter
+ */
const CcnxNameComponents&
GetExclude () const;
+ /**
+ * \brief Set ChildSelector
+ * Often a given interest will match more than one ContentObject within a given content store.
+ * The ChildSelector provides a way of expressing a preference for which of these should be returned.
+ * If the value is false, the leftmost child is preferred. If true, the rightmost child is preferred.
+ * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information.
+ * @param[in] value boolean ChildSelector value
+ */
void
SetChildSelector (bool value);
+ /**
+ * \brief Return ChildSelector value
+ * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information.
+ *
+ */
bool
IsEnabledChildSelector () const;
+ /**
+ * \brief Set AnswerOriginKind
+ * Default value for AnswerOriginKind is false.
+ * @param[in] value boolean AnswerOriginKind value
+ */
void
SetAnswerOriginKind (bool value);
+ /**
+ * \brief Check the value of AnswerOriginKind
+ *
+ */
bool
IsEnabledAnswerOriginKind () const;
+ /**
+ * \brief Set Scope
+ * Scope limits where the Interest may propagate.
+ * Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host).
+ * Scope 1 limits propagation to the applications on the originating host.
+ * Scope 2 limits propagation to no further than the next host.
+ * Other values are not defined, and will cause the Interest message to be dropped.
+ * Note that this is not a hop count - the value is not decremented as the interest is forwarded.
+ * @param[in] scope interest scope
+ */
void
SetScope (int8_t scope);
+ /**
+ * \brief Get Scope value
+ * Scope limits where the Interest may propagate.
+ * Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host).
+ * Scope 1 limits propagation to the applications on the originating host.
+ * Scope 2 limits propagation to no further than the next host.
+ * Other values are not defined, and will cause the Interest message to be dropped.
+ * Note that this is not a hop count - the value is not decremented as the interest is forwarded.
+ */
int8_t
GetScope () const;
+ /**
+ * \brief Set InterestLifetime
+ * InterestLifetime indicates the (approximate) time remaining before the interest times out.
+ * The timeout is relative to the arrival time of the interest at the current node.
+ * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information.
+ * @param[in] time interest lifetime
+ */
void
SetInterestLifetime (Time time);
+ /**
+ * \brief Get InterestLifetime value
+ * InterestLifetime indicates the (approximate) time remaining before the interest times out.
+ * The timeout is relative to the arrival time of the interest at the current node.
+ * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information.
+ */
Time
GetInterestLifetime () const;
+ /**
+ * \brief Set Nonce
+ * Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages.
+ * @param[in] nonce Unique packet identification number
+ */
void
SetNonce (uint32_t nonce);
+ /**
+ * \brief Get Nonce value
+ * Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages.
+ *
+ */
uint32_t
GetNonce () const;
-
+
+ /**
+ * \enum NACK Type
+ * \brief Specifies the type of Interest packet
+ */
enum
{
NORMAL_INTEREST = 0,
@@ -210,9 +324,22 @@
NACK_GIVEUP_PIT = 12,
};
+ /**
+ * \brief Mark the Interest as a Negative Acknowledgement
+ * Three types of NACKs are supported
+ * 1. NACK_LOOP
+ * 2. NACK_CONGESTION
+ * 3. NACK_GIVEUP_PIT
+ * @param[in] nackType NACK_LOOP or NACK_CONGESTION or NACK_GIVEUP_PIT or NORMAL_INTEREST
+ */
void
SetNack (uint32_t nackType);
+ /**
+ * \brief Get NACK type
+ * Returns NACK_LOOP, NACK_CONGESTION or NACK_GIVEUP_PIT.
+ * Otherwise, in case of normal interest packet, returns NORMAL_INTEREST (equals 0).
+ */
uint32_t
GetNack () const;
@@ -220,24 +347,48 @@
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
+
+ /**
+ * \brief Print Interest packet
+ */
virtual void Print (std::ostream &os) const;
+
+ /**
+ * \brief Get the size of Interest packet
+ * Returns the Interest packet size after serialization
+ */
virtual uint32_t GetSerializedSize (void) const;
+
+ /**
+ * \brief Serialize Interest packet
+ * Serializes Interest packet into Buffer::Iterator
+ * @param[in] start buffer to contain serialized Interest packet
+ */
virtual void Serialize (Buffer::Iterator start) const;
+
+ /**
+ * \brief Deserialize Interest packet
+ * Deserializes Buffer::Iterator into Interest packet
+ * @param[in] start buffer that contains serialized Interest packet
+ */
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
- Ptr<CcnxNameComponents> m_name;
- int32_t m_minSuffixComponents; ///< minimum suffix components. not used if negative
- int32_t m_maxSuffixComponents; ///< maximum suffix components. not used if negative
- Ptr<CcnxNameComponents> m_exclude; ///< exclude filter
- bool m_childSelector;
- bool m_answerOriginKind;
- int8_t m_scope; ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood
- Time m_interestLifetime;
- uint32_t m_nonce; ///< Nonce. not used if zero
- uint32_t m_nackType;
+ Ptr<CcnxNameComponents> m_name; ///< Interest name
+ int32_t m_minSuffixComponents; ///< Minimum suffix components. not used if negative
+ int32_t m_maxSuffixComponents; ///< Maximum suffix components. not used if negative
+ Ptr<CcnxNameComponents> m_exclude; ///< Exclude filter
+ bool m_childSelector; ///< Default value for ChildSelector is false
+ bool m_answerOriginKind; ///< Default value for AnswerOriginKind is false
+ int8_t m_scope; ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood
+ Time m_interestLifetime; ///< InterestLifetime
+ uint32_t m_nonce; ///< Nonce. not used if zero
+ uint32_t m_nackType; ///< Negative Acknowledgement type
};
+/**
+ * \brief Exception class for CcnxInterestHeader
+ */
class CcnxInterestHeaderException {};
} // namespace ns3
diff --git a/model/ccnx-name-components.cc b/model/ccnx-name-components.cc
index 323a3f8..d785423 100644
--- a/model/ccnx-name-components.cc
+++ b/model/ccnx-name-components.cc
@@ -36,11 +36,6 @@
{
}
-// CcnxNameComponents::CcnxNameComponents (const string &s)
-// {
-// m_prefix.push_back (s);
-// }
-
CcnxNameComponents::CcnxNameComponents (const std::list<boost::reference_wrapper<const std::string> > &components)
{
BOOST_FOREACH (const boost::reference_wrapper<const std::string> &component, components)
diff --git a/model/ccnx-name-components.h b/model/ccnx-name-components.h
index fdffe91..892ac4b 100644
--- a/model/ccnx-name-components.h
+++ b/model/ccnx-name-components.h
@@ -34,58 +34,90 @@
namespace ns3 {
+/**
+ * \ingroup ccnx
+ * \brief Hierarchical CCNX name
+ * A Name element represents a hierarchical name for CCNx content.
+ * It simply contains a sequence of Component elements.
+ * Each Component element contains a sequence of zero or more bytes.
+ * There are no restrictions on what byte sequences may be used.
+ * The Name element in an Interest is often referred to with the term name prefix or simply prefix.
+ */
class CcnxNameComponents : public SimpleRefCount<CcnxNameComponents>
{
public:
/**
- * \brief Creates a prefix with zero components (can be looked as root "/")
+ * \brief Constructor
+ * Creates a prefix with zero components (can be looked as root "/")
*/
CcnxNameComponents ();
- // CcnxNameComponents (const std::string &s);
+
+ /**
+ * \brief Constructor
+ * Creates a prefix from a list of strings where every string represents a prefix component
+ * @param[in] components A list of strings
+ */
CcnxNameComponents (const std::list<boost::reference_wrapper<const std::string> > &components);
+ /**
+ * \brief Generic Add method
+ * Appends object of type T to the list of components
+ * @param[in] value The object to be appended
+ */
template<class T>
inline void
Add (const T &value);
+ /**
+ * \brief Generic constructor operator
+ * The object of type T will be appended to the list of components
+ */
template<class T>
inline CcnxNameComponents&
operator () (const T &value);
+ /**
+ * \brief Get a name
+ * Returns a list of components (strings)
+ */
const std::list<std::string> &
GetComponents () const;
/**
* \brief Get subcomponents of the name, starting with first component
- * \param num Number of components to return. Valid value is in range [1, GetComponents ().size ()]
+ * @param[in] num Number of components to return. Valid value is in range [1, GetComponents ().size ()]
*/
std::list<boost::reference_wrapper<const std::string> >
GetSubComponents (size_t num) const;
- // virtual uint32_t
- // GetSerializedSize (void) const;
-
- // virtual void
- // Serialize (Buffer::Iterator start) const;
-
- // virtual uint32_t
- // Deserialize (Buffer::Iterator start);
-
+ /**
+ * \brief Print name
+ * @param[in] os Stream to print
+ */
void Print (std::ostream &os) const;
+ /**
+ * \brief Returns the size of CcnxNameComponents
+ */
inline size_t
size () const;
+ /**
+ * \brief Equality operator for CcnxNameComponents
+ */
inline bool
operator== (const CcnxNameComponents &prefix) const;
+ /**
+ * \brief Less than operator for CcnxNameComponents
+ */
inline bool
operator< (const CcnxNameComponents &prefix) const;
private:
- std::list<std::string> m_prefix;
+ std::list<std::string> m_prefix; ///< \brief a list of strings (components)
- typedef std::list<std::string>::iterator iterator;
+ typedef std::list<std::string>::iterator iterator;
typedef std::list<std::string>::const_iterator const_iterator;
};
@@ -97,20 +129,24 @@
/**
* \brief Read components from input and add them to components. Will read input stream till eof
- *
- * \todo Check that NS-3 doesn't give unlimited input streams... Otherwise it would be disaster
- *
* Substrings separated by slashes will become separate components
*/
std::istream &
operator >> (std::istream &is, CcnxNameComponents &components);
-
+
+/**
+ * \brief Returns the size of CcnxNameComponents object
+ */
size_t
CcnxNameComponents::size () const
{
return m_prefix.size ();
}
+/**
+ * \brief Generic constructor operator
+ * The object of type T will be appended to the list of components
+ */
template<class T>
CcnxNameComponents&
CcnxNameComponents::operator () (const T &value)
@@ -119,13 +155,11 @@
return *this;
}
-// template<>
-// void
-// CcnxNameComponents::Add (const std::string &string)
-// {
-// m_prefix.push_back (string);
-// }
-
+/**
+ * \brief Generic Add method
+ * Appends object of type T to the list of components
+ * @param[in] value The object to be appended
+ */
template<class T>
void
CcnxNameComponents::Add (const T &value)
@@ -135,6 +169,9 @@
m_prefix.push_back (os.str ());
}
+/**
+ * \brief Equality operator for CcnxNameComponents
+ */
bool
CcnxNameComponents::operator== (const CcnxNameComponents &prefix) const
{
@@ -144,6 +181,9 @@
return std::equal (m_prefix.begin (), m_prefix.end (), prefix.m_prefix.begin ());
}
+/**
+ * \brief Less than operator for CcnxNameComponents
+ */
bool
CcnxNameComponents::operator< (const CcnxNameComponents &prefix) const
{
diff --git a/model/hash-helper.h b/model/hash-helper.h
index c14b567..779f7f1 100644
--- a/model/hash-helper.h
+++ b/model/hash-helper.h
@@ -55,13 +55,6 @@
return hash;
}
};
-
-// // A collision-chaining hash table mapping strings to ints.
-// template<typename Value>
-// class string_key_hash_t : public boost::unordered_map<std::string,Value, string_hash, std::equal_to<std::string>,std::allocator<std::string> >
-// {
-// };
-
} // namespace ns3
#endif // CCNX_HASH_HELPER_H