Merge remote-tracking branch 'git.irl/ilya'
diff --git a/apps/ccnx-app.h b/apps/ccnx-app.h
index 457172e..ae52048 100644
--- a/apps/ccnx-app.h
+++ b/apps/ccnx-app.h
@@ -43,6 +43,9 @@
class CcnxApp: public Application
{
public:
+ /**
+ * \typedef A callback to pass packets to underlying CCNx protocol
+ */
typedef Callback<bool, const Ptr<const Packet>&> ProtocolHandler;
static TypeId GetTypeId ();
@@ -94,9 +97,9 @@
StopApplication (); // Called at time specified by Stop
protected:
- ProtocolHandler m_protocolHandler;
+ ProtocolHandler m_protocolHandler; ///< \brief A callback to pass packets to underlying CCNx protocol
bool m_active;
- Ptr<CcnxFace> m_face; // local face that is created
+ Ptr<CcnxFace> m_face; // local face that is created
TracedCallback<Ptr<const CcnxInterestHeader>,
Ptr<CcnxApp>, Ptr<CcnxFace> > m_receivedInterests;
diff --git a/apps/ccnx-consumer.cc b/apps/ccnx-consumer.cc
index 0010be2..9fc5d12 100644
--- a/apps/ccnx-consumer.cc
+++ b/apps/ccnx-consumer.cc
@@ -79,7 +79,7 @@
StringValue ("/"),
MakeCcnxNameComponentsAccessor (&CcnxConsumer::m_interestName),
MakeCcnxNameComponentsChecker ())
- .AddAttribute ("LifeTime", "LifeTime fo interest packet",
+ .AddAttribute ("LifeTime", "LifeTime for interest packet",
StringValue ("2s"),
MakeTimeAccessor (&CcnxConsumer::m_interestLifeTime),
MakeTimeChecker ())
diff --git a/apps/ccnx-consumer.h b/apps/ccnx-consumer.h
index 6138416..9b28a2c 100644
--- a/apps/ccnx-consumer.h
+++ b/apps/ccnx-consumer.h
@@ -40,11 +40,19 @@
namespace ns3
{
+/**
+ * @ingroup ccnx
+ * \brief CCNx application for sending out Interest packets
+ */
class CcnxConsumer: public CcnxApp
{
public:
static TypeId GetTypeId ();
+ /**
+ * \brief Default constructor
+ * Sets up randomizer function and packet sequence number
+ */
CcnxConsumer ();
// From CcnxApp
@@ -67,7 +75,9 @@
StopApplication ();
private:
- //helpers
+ /**
+ * \brief Constructs the Interest packet and sends it using a callback to the underlying CCNx protocol
+ */
void
ScheduleNextPacket ();
@@ -89,15 +99,26 @@
void
SendPacket ();
+ /**
+ * \brief Checks if the packet need to be retransmitted becuase of retransmission timer expiration
+ */
void
CheckRetxTimeout ();
+ /**
+ * \brief Modifies the frequency of checking the retransmission timeouts
+ * \param retxTimer Timeout defining how frequent retransmission timeouts should be checked
+ */
void
SetRetxTimer (Time retxTimer);
+ /**
+ * \brief Returns the frequency of checking the retransmission timeouts
+ * \return Timeout defining how frequent retransmission timeouts should be checked
+ */
Time
GetRetxTimer () const;
-
+
double
GetMaxSize () const;
@@ -116,24 +137,30 @@
EventId m_sendEvent; // Eventid of pending "send packet" event
Time m_retxTimer;
EventId m_retxEvent; // Event to check whether or not retransmission should be performed
-
- Time m_rto; // Retransmission timeout
- Time m_rttVar; // RTT variance
- Time m_sRtt; // smoothed RTT
-
- Time m_offTime;
- CcnxNameComponents m_interestName;
- Time m_interestLifeTime;
- int32_t m_minSuffixComponents;
- int32_t m_maxSuffixComponents;
- bool m_childSelector;
- CcnxNameComponents m_exclude;
+ Time m_rto; ///< \brief Retransmission timeout
+ Time m_rttVar; ///< \brief RTT variance
+ Time m_sRtt; ///< \brief smoothed RTT
+
+ Time m_offTime; ///< \brief Time interval between packets
+ CcnxNameComponents m_interestName; ///< \brief CcnxName of the Interest (use CcnxNameComponents)
+ Time m_interestLifeTime; ///< \brief LifeTime for interest packet
+ int32_t m_minSuffixComponents; ///< \brief MinSuffixComponents. See CcnxInterestHeader for more information
+ int32_t m_maxSuffixComponents; ///< \brief MaxSuffixComponents. See CcnxInterestHeader for more information
+ bool m_childSelector; ///< \brief ChildSelector. See CcnxInterestHeader for more information
+ CcnxNameComponents m_exclude; ///< \brief Exclude. See CcnxInterestHeader for more information
+
+ /**
+ * \struct This struct contains sequence numbers of packets to be retransmitted
+ */
struct RetxSeqsContainer :
public std::set<uint32_t> { };
- RetxSeqsContainer m_retxSeqs; // ordered set of sequence numbers to be retransmitted
+ RetxSeqsContainer m_retxSeqs; ///< \brief ordered set of sequence numbers to be retransmitted
+ /**
+ * \struct This struct contains a pair of packet sequence number and its timeout
+ */
struct SeqTimeout
{
SeqTimeout (uint32_t _seq, Time _time) : seq (_seq), time (_time) { }
@@ -145,6 +172,9 @@
class i_seq { };
class i_timestamp { };
+ /**
+ * \struct This struct contains a multi-index for the set of SeqTimeout structs
+ */
struct SeqTimeoutsContainer :
public boost::multi_index::multi_index_container<
SeqTimeout,
@@ -160,9 +190,12 @@
>
> { } ;
- SeqTimeoutsContainer m_seqTimeouts;
- boost::mutex m_seqTimeoutsGuard;
+ SeqTimeoutsContainer m_seqTimeouts; ///< \brief multi-index for the set of SeqTimeout structs
+ boost::mutex m_seqTimeoutsGuard; ///< \brief mutex for safe work with the m_seqTimeouts
+ /**
+ * \brief A trace that is called after each transmitted Interest packet
+ */
TracedCallback<Ptr<const CcnxInterestHeader>,
Ptr<CcnxApp>, Ptr<CcnxFace> > m_transmittedInterests;
};
diff --git a/apps/ccnx-interest-sender.cc b/apps/ccnx-interest-sender.cc
deleted file mode 100644
index d110978..0000000
--- a/apps/ccnx-interest-sender.cc
+++ /dev/null
@@ -1,160 +0,0 @@
-// /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-// /*
-// * Copyright (c) 2011 University of California, Los Angeles
-// *
-// * This program is free software; you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License version 2 as
-// * published by the Free Software Foundation;
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program; if not, write to the Free Software
-// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-// *
-// * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
-// */
-
-// #include "ccnx-interest-sender.h"
-
-// NS_LOG_COMPONENT_DEFINE ("CcnxInterestSender");
-
-// namespace ns3
-// {
-
-// NS_OBJECT_ENSURE_REGISTERED (CcnxInterestSender);
-
-// TypeId
-// CcnxInterestSender::GetTypeId (void)
-// {
-// static TypeId tid = TypeId ("ns3::CcnxInterestSender")
-// .SetParent<Application> ()
-// .AddConstructor<CcnxInterestSender> ()
-// .AddAttribute ("OffTime", "Time interval between packets",
-// TimeValue (Seconds (0.1)),
-// MakeTimeAccessor (&CcnxInterestSender::m_offTime),
-// MakeTimeChecker ())
-// // Alex: this is incorrect. SetNode call is not called if face is created using this accessor
-// // .AddAttribute ("Face","Local face to be used",
-// // PointerValue (CreateObject<CcnxLocalFace> ()),
-// // MakePointerAccessor (&CcnxInterestSender::m_face),
-// // MakePointerChecker<CcnxLocalFace> ())
-// .AddAttribute ("NameComponents","CcnxName of the Interest (use CcnxNameComponents)",
-// CcnxNameComponentsValue (CcnxNameComponents (/* root */)),
-// MakeCcnxNameComponentsAccessor (&CcnxInterestSender::m_interestName),
-// MakeCcnxNameComponentsChecker ())
-// .AddAttribute ("LifeTime", "LifeTime fo interest packet",
-// TimeValue (Seconds (4.0)),
-// MakeTimeAccessor (&CcnxInterestSender::m_interestLifeTime),
-// MakeTimeChecker ())
-// .AddAttribute ("MinSuffixComponents", "MinSuffixComponents",
-// IntegerValue(-1),
-// MakeIntegerAccessor(&CcnxInterestSender::m_minSuffixComponents),
-// MakeIntegerChecker<int32_t>())
-// .AddAttribute ("MaxSuffixComponents", "MaxSuffixComponents",
-// IntegerValue(-1),
-// MakeIntegerAccessor(&CcnxInterestSender::m_maxSuffixComponents),
-// MakeIntegerChecker<int32_t>())
-// .AddAttribute ("ChildSelector", "ChildSelector",
-// BooleanValue(false),
-// MakeBooleanAccessor(&CcnxInterestSender::m_childSelector),
-// MakeBooleanChecker())
-// .AddAttribute ("Exclude","only simple name matching is supported (use CcnxNameComponents)",
-// CcnxNameComponentsValue (CcnxNameComponents(/* root */)),
-// MakeCcnxNameComponentsAccessor (&CcnxInterestSender::m_exclude),
-// MakeCcnxNameComponentsChecker ())
-// .AddAttribute ("Initial Nonce", "If 0 then nonce is not used",
-// UintegerValue(1),
-// MakeUintegerAccessor(&CcnxInterestSender::m_initialNonce),
-// MakeUintegerChecker<uint32_t>())
-// ;
-// /*
-// .AddAttribute ("NoiseModel",
-// "A pointer to the model of the channel ambient noise.",
-// PointerValue (CreateObject<UanNoiseModelDefault> ()),
-// MakePointerAccessor (&UanChannel::m_noise),
-// MakePointerChecker<UanNoiseModel> ())*/
-// return tid;
-// }
-
-// CcnxInterestSender::CcnxInterestSender ()
-// {
-// NS_LOG_FUNCTION_NOARGS ();
-// }
-
-// CcnxInterestSender::~CcnxInterestSender()
-// {
-// NS_LOG_FUNCTION_NOARGS ();
-// }
-
-// void
-// CcnxInterestSender::DoDispose (void)
-// {
-// NS_LOG_FUNCTION_NOARGS ();
-
-// Application::DoDispose ();
-// }
-
-// // Application Methods
-// void
-// CcnxInterestSender::StartApplication () // Called at time specified by Start
-// {
-// NS_LOG_FUNCTION_NOARGS ();
-// ScheduleNextTx();
-// }
-
-// void
-// CcnxInterestSender::StopApplication () // Called at time specified by Stop
-// {
-// NS_LOG_FUNCTION_NOARGS ();
-
-// CancelEvents ();
-// }
-
-// void
-// CcnxInterestSender::CancelEvents ()
-// {
-// NS_LOG_FUNCTION_NOARGS ();
-
-// Simulator::Cancel (m_sendEvent);
-// }
-
-// void
-// CcnxInterestSender::ScheduleNextTx ()
-// {
-// NS_LOG_FUNCTION_NOARGS ();
-
-// Time nextTime = Seconds(m_offTime);
-// m_sendEvent = Simulator::Schedule (nextTime, &CcnxInterestSender::SendPacket, this);
-// }
-
-// void
-// CcnxInterestSender::SendPacket ()
-// {
-// NS_LOG_FUNCTION_NOARGS ();
-// // NS_LOG_INFO ("Sending Interest at " << Simulator::Now ());
-
-// uint32_t randomNonce = UniformVariable().GetInteger(1, std::numeric_limits<uint32_t>::max ());
-// CcnxInterestHeader interestHeader;
-// interestHeader.SetNonce(randomNonce);
-// //const Ptr<CcnxNameComponents> name = Create<CcnxNameComponents>(m_interestName);
-// interestHeader.SetName(Create<CcnxNameComponents> (m_interestName)); //making a copy of name
-// interestHeader.SetInterestLifetime(m_interestLifeTime);
-// interestHeader.SetChildSelector(m_childSelector);
-// //const Ptr<CcnxNameComponents> exclude = Create<CcnxNameComponents>(m_exclude);
-// interestHeader.SetExclude(Create<CcnxNameComponents> (m_exclude));
-// interestHeader.SetMaxSuffixComponents(m_maxSuffixComponents);
-// interestHeader.SetMinSuffixComponents(m_minSuffixComponents);
-
-// Ptr<Packet> packet = Create<Packet> ();
-// packet->AddHeader (interestHeader);
-
-// m_face->Send(packet);
-
-// ScheduleNextTx();
-// }
-
-// }
diff --git a/apps/ccnx-interest-sender.h b/apps/ccnx-interest-sender.h
deleted file mode 100644
index cbb54ad..0000000
--- a/apps/ccnx-interest-sender.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-// /*
-// * Copyright (c) 2011 University of California, Los Angeles
-// *
-// * This program is free software; you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License version 2 as
-// * published by the Free Software Foundation;
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program; if not, write to the Free Software
-// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-// *
-// * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
-// */
-
-// #include "ns3/application.h"
-// #include "ns3/log.h"
-// #include "ns3/random-variable.h"
-// #include "ns3/nstime.h"
-// #include "ns3/event-id.h"
-// #include "ns3/ptr.h"
-// #include "ns3/simulator.h"
-// #include "ns3/ccnx-interest-header.h"
-// #include "ns3/ccnx-local-face.h"
-// #include "ns3/ccnx-name-components.h"
-// #include "ns3/packet.h"
-// #include "ns3/boolean.h"
-// #include "ns3/integer.h"
-// #include "ns3/uinteger.h"
-// #include "ns3/random-variable.h"
-// #include <limits>
-// #include "ns3/pointer.h"
-
-// namespace ns3
-// {
-
-// class Socket;
-
-// class CcnxInterestSender: public Application
-// {
-// public:
-// static TypeId GetTypeId (void);
-
-// CcnxInterestSender ();
-
-// virtual ~CcnxInterestSender ();
-
-// protected:
-// virtual void DoDispose (void);
-// private:
-// // inherited from Application base class.
-// virtual void StartApplication (void); // Called at time specified by Start
-// virtual void StopApplication (void); // Called at time specified by Stop
-
-// //Time m_onTime;
-// Time m_offTime;
-// CcnxNameComponents m_interestName;
-
-// Time m_interestLifeTime;
-// int32_t m_minSuffixComponents;
-// int32_t m_maxSuffixComponents;
-// bool m_childSelector;
-// CcnxNameComponents m_exclude;
-// uint32_t m_initialNonce;
-
-// //EventId m_startStopEvent; // Event id for next start or stop event
-// EventId m_sendEvent; // Eventid of pending "send packet" event
-// TypeId m_tid;
-// Ptr<CcnxLocalFace> m_face;
-
-// //helpers
-// void CancelEvents ();
-
-// void Construct (Ptr<Node> n,
-// std::string tid,
-// const Time& offtime,
-// Ptr<CcnxLocalFace> face,
-// Ptr<CcnxNameComponents> nameComponents,
-// const Time& lifetime,
-// const int32_t& minSuffixComponents,
-// const int32_t& maxSuffixComponents,
-// const bool childSelector,
-// Ptr<CcnxNameComponents> exclude,
-// const uint32_t& initialNonce
-// );
-
-// // Event handlers
-// void StartSending ();
-// void StopSending ();
-// void SendPacket ();
-
-// private:
-// void ScheduleNextTx ();
-// //void ScheduleStartEvent ();
-// //void ScheduleStopEvent ();
-// void ConnectionSucceeded (Ptr<Socket>);
-// void ConnectionFailed (Ptr<Socket>);
-// void Ignore (Ptr<Socket>);
-
-// };
-// }
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-stack-helper.h b/helper/ccnx-stack-helper.h
index 16e4e25..b4cdbc6 100644
--- a/helper/ccnx-stack-helper.h
+++ b/helper/ccnx-stack-helper.h
@@ -74,7 +74,7 @@
*
* Set the forwarding helper to use during Install. The forwarding helper is
* really an object factory which is used to create an object of type
- * ns3::CcnxFrProtocol per node. This forwarding object is then associated to
+ * ns3::CcnxL3Protocol per node. This forwarding object is then associated to
* a single ns3::Ccnx object through its ns3::Ccnx::SetforwardingProtocol.
*/
void
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index 95c0b7f..77122e0 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2005,2006,2007 INRIA
+ * Copyright (c) 2011 University of California, Los Angeles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/model/ccnx-face.h b/model/ccnx-face.h
index 98969e2..df488dc 100644
--- a/model/ccnx-face.h
+++ b/model/ccnx-face.h
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2005,2006,2007 INRIA
+ * Copyright (c) 2011 University of California, Los Angeles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/model/ccnx-forwarding-strategy.h b/model/ccnx-forwarding-strategy.h
index 73f1165..23c15a5 100644
--- a/model/ccnx-forwarding-strategy.h
+++ b/model/ccnx-forwarding-strategy.h
@@ -49,7 +49,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
@@ -75,7 +75,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-local-face.cc b/model/ccnx-local-face.cc
index a3267bd..7b4413c 100644
--- a/model/ccnx-local-face.cc
+++ b/model/ccnx-local-face.cc
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2005,2006,2007 INRIA
+ * Copyright (c) 2011 University of California, Los Angeles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/model/ccnx-local-face.h b/model/ccnx-local-face.h
index 8855b75..63458f2 100644
--- a/model/ccnx-local-face.h
+++ b/model/ccnx-local-face.h
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2005,2006,2007 INRIA
+ * Copyright (c) 2011 University of California, Los Angeles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/model/ccnx-name-components.cc b/model/ccnx-name-components.cc
index 77ac75c..893f7bb 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 58ca927..7f629dc 100644
--- a/model/ccnx-name-components.h
+++ b/model/ccnx-name-components.h
@@ -34,24 +34,52 @@
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;
@@ -60,35 +88,39 @@
/**
* \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;
};
@@ -100,20 +132,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)
@@ -122,13 +158,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)
@@ -138,6 +172,9 @@
m_prefix.push_back (os.str ());
}
+/**
+ * \brief Equality operator for CcnxNameComponents
+ */
bool
CcnxNameComponents::operator== (const CcnxNameComponents &prefix) const
{
@@ -147,6 +184,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/ccnx-net-device-face.cc b/model/ccnx-net-device-face.cc
index d4af70f..3d3275e 100644
--- a/model/ccnx-net-device-face.cc
+++ b/model/ccnx-net-device-face.cc
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2005,2006,2007 INRIA
+ * Copyright (c) 2011 University of California, Los Angeles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/model/ccnx-net-device-face.h b/model/ccnx-net-device-face.h
index 148da39..a83ed70 100644
--- a/model/ccnx-net-device-face.h
+++ b/model/ccnx-net-device-face.h
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2005,2006,2007 INRIA
+ * Copyright (c) 2011 University of California, Los Angeles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
diff --git a/model/ccnx.cc b/model/ccnx.cc
index 30b290e..2e30e7f 100644
--- a/model/ccnx.cc
+++ b/model/ccnx.cc
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2007 INRIA
+ * Copyright (c) 2011 University of California, Los Angeles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
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