NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-l3-protocol.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef NDN_L3_PROTOCOL_H
21 #define NDN_L3_PROTOCOL_H
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 
25 #include <list>
26 #include <vector>
27 
28 #include "ns3/ptr.h"
29 #include "ns3/net-device.h"
30 #include "ns3/nstime.h"
31 #include "ns3/traced-callback.h"
32 
33 #include <boost/property_tree/ptree_fwd.hpp>
34 
35 namespace nfd {
36 class Forwarder;
37 class FibManager;
39 typedef boost::property_tree::ptree ConfigSection;
40 namespace pit {
41 class Entry;
42 } // namespace pit
43 namespace cs {
44 class Policy;
45 } // namespace cs
46 } // namespace nfd
47 
48 namespace ns3 {
49 
50 class Packet;
51 class Node;
52 class Header;
53 
54 namespace ndn {
55 
77 class L3Protocol : boost::noncopyable, public Object {
78 public:
84  static TypeId
85  GetTypeId();
86 
87  static const uint16_t ETHERNET_FRAME_TYPE;
88  static const uint16_t IP_STACK_PORT;
89  // static const uint16_t IP_PROTOCOL_TYPE; ///< \brief IP protocol type of NDN
90 
94  L3Protocol();
95 
96  virtual ~L3Protocol();
97 
101  shared_ptr<nfd::Forwarder>
102  getForwarder();
103 
107  shared_ptr<nfd::FibManager>
108  getFibManager();
109 
113  shared_ptr<nfd::StrategyChoiceManager>
114  getStrategyChoiceManager();
115 
125  addFace(shared_ptr<Face> face);
126 
132  shared_ptr<Face>
133  getFaceById(nfd::FaceId face) const;
134 
135  // /**
136  // * \brief Remove face from ndn stack (remove callbacks)
137  // */
138  // virtual void
139  // removeFace(shared_ptr<Face> face);
140 
144  shared_ptr<Face>
145  getFaceByNetDevice(Ptr<NetDevice> netDevice) const;
146 
151  getConfig();
152 
156  void
157  injectInterest(const Interest& interest);
158 
159  typedef std::function<std::unique_ptr<nfd::cs::Policy>()> PolicyCreationCallback;
160 
164  void
165  setCsReplacementPolicy(const PolicyCreationCallback& policy);
166 
167 public: // Workaround for python bindings
168  static Ptr<L3Protocol>
169  getL3Protocol(Ptr<Object> node);
170 
171 public:
172  typedef void (*InterestTraceCallback)(const Interest&, const Face&);
173  typedef void (*DataTraceCallback)(const Data&, const Face&);
174 
175  typedef void (*SatisfiedInterestsCallback)(const nfd::pit::Entry& pitEntry, const Face& inFace, const Data& data);
176  typedef void (*TimedOutInterestsCallback)(const nfd::pit::Entry& pitEntry);
177 
178 protected:
179  virtual void
180  DoDispose(void);
181 
188  virtual void
189  NotifyNewAggregate();
190 
191 private:
192  void
193  initialize();
194 
195  void
196  initializeManagement();
197 
198  void
199  initializeRibManager();
200 
201 private:
202  class Impl;
203  std::unique_ptr<Impl> m_impl;
204 
205  // These objects are aggregated, but for optimization, get them here
206  Ptr<Node> m_node;
207 
208  TracedCallback<const Interest&, const Face&>
209  m_inInterests;
210  TracedCallback<const Interest&, const Face&>
211  m_outInterests;
212 
213  TracedCallback<const Data&, const Face&> m_outData;
214  TracedCallback<const Data&, const Face&> m_inData;
215 
216  TracedCallback<const nfd::pit::Entry&, const Face&/*in face*/, const Data&> m_satisfiedInterests;
217  TracedCallback<const nfd::pit::Entry&> m_timedOutInterests;
218 };
219 
220 } // namespace ndn
221 } // namespace ns3
222 
223 #endif /* NDN_L3_PROTOCOL_H */
static const uint16_t IP_STACK_PORT
TCP/UDP port for NDN stack.
Copyright (c) 2011-2015 Regents of the University of California.
static const uint16_t ETHERNET_FRAME_TYPE
Ethernet Frame Type of Ndn.
implement the Strategy Choice Management of NFD Management Protocol.
std::function< std::unique_ptr< nfd::cs::Policy >)> PolicyCreationCallback
FibManager
Definition: fib-manager.cpp:31
represents a CS replacement policy
Definition: cs-policy.hpp:39
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
represents a PIT entry
Definition: pit-entry.hpp:69
Copyright (c) 2011-2015 Regents of the University of California.
boost::property_tree::ptree ConfigSection
ndn L3Protocol
Copyright (c) 2011-2015 Regents of the University of California.
Forwarder
Definition: forwarder.cpp:38
Implementation network-layer of NDN stack.
uint64_t FaceId
identifies a face
Definition: face.hpp:39