[ndnSIM] Reply: question for PIT
Alex Afanasyev
alexander.afanasyev at ucla.edu
Thu Feb 7 16:50:48 PST 2013
So the problem is definitely with includes. In ca.h you include ca-entry.h and in ca-entry.h you are including ca.h, which creates an error you're observing.
In PIT implementation, pit-entry.h does not include pit.h at all, it merely has a forward declaration of the class (https://github.com/NDN-Routing/ndnSIM/blob/master/model/pit/ndn-pit-entry.h#L45). You can do a similar trick.
---
Alex
PS
If you don't mind, can you also CC ndnsim mailing list in your replies. Thanks.
On Feb 7, 2013, at 4:45 PM, "独善其身 " <aaronishere at qq.com> wrote:
> Hi, Alex
> The CA header is below
>
> #ifndef _NDN_CA_H_
> #define _NDN_CA_H_
>
> #include "ns3/object.h"
> #include "ns3/nstime.h"
> #include "ns3/event-id.h"
>
> #include "ndn-ca-entry.h"
>
> namespace ns3 {
> namespace ndn {
>
> class L3Protocol;
> class Face;
> class ContentObjectHeader;
> //class InterestHeader;
> class CAHeader;
>
>
> /**
> * \ingroup ndn
> * \brief Class implementing Pending Interests Table
> */
> class Ca : public Object
> {
> public:
> /**
> * \brief Interface ID
> *
> * \return interface ID
> */
> static TypeId GetTypeId ();
>
> /**
> * \brief PIT constructor
> */
> Ca ();
>
> /**
> * \brief Destructor
> */
> virtual ~Ca ();
>
> /**
> * \brief Find corresponding PIT entry for the given content name
> *
> * Not that this call should be repeated enough times until it return 0.
> * This way all records with shorter or equal prefix as in content object will be found
> * and satisfied.
> *
> * \param prefix Prefix for which to lookup the entry
> * \returns smart pointer to PIT entry. If record not found,
> * returns 0
> */
> virtual Ptr<ca::Entry>
> Lookup (const ContentObjectHeader &header) = 0;
>
> /**
> * \brief Find a PIT entry for the given content interest
> * \param header parsed interest header
> * \returns iterator to Pit entry. If record not found,
> * return end() iterator
> */
> virtual Ptr<ca::Entry>
> Lookup (const CAHeader &header) = 0;
>
> /**
> * @brief Creates a PIT entry for the given interest
> * @param header parsed interest header
> * @returns iterator to Pit entry. If record could not be created (e.g., limit reached),
> * return end() iterator
> *
> * Note. This call assumes that the entry does not exist (i.e., there was a Lookup call before)
> */
> virtual Ptr<ca::Entry>
> Create (Ptr<const CAHeader> header) = 0;
>
> /**
> * @brief Mark PIT entry deleted
> * @param entry PIT entry
> *
> * Effectively, this method removes all incoming/outgoing faces and set
> * lifetime +m_PitEntryDefaultLifetime from Now ()
> */
> virtual void
> MarkErased (Ptr<ca::Entry> entry) = 0;
>
> /**
> * @brief Print out PIT contents for debugging purposes
> *
> * Note that there is no definite order in which entries are printed out
> */
> virtual void
> Print (std::ostream &os) const = 0;
>
> /**
> * @brief Get number of entries in PIT
> */
> virtual uint32_t
> GetSize () const = 0;
>
> /**
> * @brief Return first element of FIB (no order guaranteed)
> */
> virtual Ptr<ca::Entry>
> Begin () = 0;
>
> /**
> * @brief Return item next after last (no order guaranteed)
> */
> virtual Ptr<ca::Entry>
> End () = 0;
>
> /**
> * @brief Advance the iterator
> */
> virtual Ptr<ca::Entry>
> Next (Ptr<ca::Entry>) = 0;
>
> /**
> * @brief Static call to cheat python bindings
> */
> static inline Ptr<Ca>
> GetCa (Ptr<Object> node);
>
> protected:
> // configuration variables. Check implementation of GetTypeId for more details
> Time m_CaEntryPruningTimout;
> };
>
> inline std::ostream&
> operator<< (std::ostream& os, const Ca &ca)
> {
> ca.Print (os);
> return os;
> }
>
> inline Ptr<Ca>
> Ca::GetCa (Ptr<Object> node)
> {
> return node->GetObject<Ca> ();
> }
>
> } // namespace ndn
> } // namespace ns3
>
> #endif /* NDN_PIT_H */
>
>
> ------------------ Original ------------------
> Sender: "alexander.afanasyev"<alexander.afanasyev at ucla.edu>;
> Send time: Friday, Feb 8, 2013 0:51 AM
> To: "独善其身"<aaronishere at qq.com>;
> Cc: "ndnsim"<ndnsim at lists.cs.ucla.edu>;
> Subject: Re: question for PIT
>
> Hi
>
> It would help if you can send also header for your ndn-ca. I suspect there some missing forward declarations of your Entry class (as you're including ndn-ca inside ndn-ca-entry).
>
> ---
> Alex
>
> On Feb 7, 2013, at 1:14 AM, "独善其身 " <aaronishere at qq.com> wrote:
>
> > Hi, Alex
> > I want to imitate the PIT to establish a new table called ca. I just copy the PIT and rename as the ca. And under the file ca, I replaced the keyword Pit/pit as Ca/ca , Interest/interest as Cah/cah. I also add the ndn-cah.cc and ndn-cah.h under the model and corresponding header files in the wscript. However when I compiled, it errors like bellow.
> >
> > In file included from ./ns3/ndn-ca-entry.h:28:0,
> > from ./ns3/ndnSIM-module.h:16,
> > from ../src/ndnSIM/examples/ndn-tree-app-delay-tracer.cc:25:
> > ./ns3/ndn-ca.h:77:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:77:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:77:24: error: template argument 1 is invalid
> > ./ns3/ndn-ca.h:86:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:86:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:86:24: error: template argument 1 is invalid
> > ./ns3/ndn-ca.h:97:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:97:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:97:24: error: template argument 1 is invalid
> > ./ns3/ndn-ca.h:108:19: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:108:19: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:108:28: error: template argument 1 is invalid
> > ./ns3/ndn-ca.h:127:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:127:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:127:24: error: template argument 1 is invalid
> > ./ns3/ndn-ca.h:133:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:133:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:133:24: error: template argument 1 is invalid
> > ./ns3/ndn-ca.h:139:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:139:15: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:139:24: error: template argument 1 is invalid
> > ./ns3/ndn-ca.h:140:13: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:140:13: error: ‘Entry’ is not a member of ‘ns3::ndn::ca’
> > ./ns3/ndn-ca.h:140:22: error: template argument 1 is invalid
> >
> > here is the ndn-ca-entry.h, the Entry is included in ns3::ndn::ca. I'm not sure why?
> > #ifndef _NDN_CA_ENTRY_H_
> > #define _NDN_CA_ENTRY_H_
> > #include "ns3/ptr.h"
> > #include "ns3/simple-ref-count.h"
> > #include "ns3/ndn-fib.h"
> > #include "ns3/ndn-ca.h"//////////////////
> > #include "ns3/ndn-name-components.h"//////////////////
> > #include "ns3/ndn-ca-entry-incoming-face.h"
> > #include "ns3/ndn-ca-entry-outgoing-face.h"
> > ........
> > namespace ns3 {
> > namespace ndn {
> > class Ca;
> > namespace fw { class Tag; }
> > namespace ca {
> > class i_face {};
> > class i_retx {};
> > class Entry : public SimpleRefCount<Entry>
> > {
> > public:
> > typedef std::set< IncomingFace > in_container; ///< @brief incoming faces container type
> > typedef in_container::iterator in_iterator; ///< @brief iterator to incoming faces
> > typedef std::set< OutgoingFace > out_container; ///< @brief outgoing faces container type
> > typedef out_container::iterator out_iterator; ///< @brief iterator to outgoing faces
> > typedef std::set< uint32_t > nonce_container; ///< @brief nonce container type
> > ............................
> > }
> > Thanks for help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130207/55036e50/attachment.html>
More information about the ndnSIM
mailing list