documentation
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