NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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;
38 class FaceTable;
40 typedef boost::property_tree::ptree ConfigSection;
41 namespace pit {
42 class Entry;
43 } // namespace pit
44 namespace cs {
45 class Policy;
46 } // namespace cs
47 namespace rib {
48 class Service;
49 }
50 } // namespace nfd
51 
52 namespace ns3 {
53 
54 class Packet;
55 class Node;
56 class Header;
57 
58 namespace ndn {
59 
81 class L3Protocol : boost::noncopyable, public Object {
82 public:
88  static TypeId
89  GetTypeId();
90 
91  static const uint16_t ETHERNET_FRAME_TYPE;
92  static const uint16_t IP_STACK_PORT;
93  // static const uint16_t IP_PROTOCOL_TYPE; ///< \brief IP protocol type of NDN
94 
98  L3Protocol();
99 
100  virtual ~L3Protocol();
101 
105  shared_ptr<nfd::Forwarder>
106  getForwarder();
107 
109  getFaceTable();
110 
114  shared_ptr<nfd::FibManager>
115  getFibManager();
116 
121  getStrategyChoiceManager();
122 
124  getRibService();
125 
135  addFace(shared_ptr<Face> face);
136 
142  shared_ptr<Face>
143  getFaceById(nfd::FaceId face) const;
144 
145  // /**
146  // * \brief Remove face from ndn stack (remove callbacks)
147  // */
148  // virtual void
149  // removeFace(shared_ptr<Face> face);
150 
154  shared_ptr<Face>
155  getFaceByNetDevice(Ptr<NetDevice> netDevice) const;
156 
161  getConfig();
162 
166  void
167  injectInterest(const Interest& interest);
168 
169  typedef std::function<std::unique_ptr<nfd::cs::Policy>()> PolicyCreationCallback;
170 
174  void
175  setCsReplacementPolicy(const PolicyCreationCallback& policy);
176 
177 public: // Workaround for python bindings
178  static Ptr<L3Protocol>
179  getL3Protocol(Ptr<Object> node);
180 
181 public:
182  typedef void (*InterestTraceCallback)(const Interest&, const Face&);
183  typedef void (*DataTraceCallback)(const Data&, const Face&);
184 
185  typedef void (*SatisfiedInterestsCallback)(const nfd::pit::Entry& pitEntry, const Face& inFace, const Data& data);
186  typedef void (*TimedOutInterestsCallback)(const nfd::pit::Entry& pitEntry);
187 
188 protected:
189  virtual void
190  DoDispose(void);
191 
198  virtual void
199  NotifyNewAggregate();
200 
201 private:
202  void
203  initialize();
204 
205  void
206  initializeManagement();
207 
208  void
209  initializeRibManager();
210 
211 private:
212  class Impl;
213  std::unique_ptr<Impl> m_impl;
214 
215  // These objects are aggregated, but for optimization, get them here
216  Ptr<Node> m_node;
217 
218  TracedCallback<const Interest&, const Face&>
219  m_inInterests;
220  TracedCallback<const Interest&, const Face&>
221  m_outInterests;
222 
223  TracedCallback<const Data&, const Face&> m_outData;
224  TracedCallback<const Data&, const Face&> m_inData;
225 
226  TracedCallback<const lp::Nack&, const Face&> m_outNack;
227  TracedCallback<const lp::Nack&, const Face&> m_inNack;
228 
229  TracedCallback<const nfd::pit::Entry&, const Face&/*in face*/, const Data&> m_satisfiedInterests;
230  TracedCallback<const nfd::pit::Entry&> m_timedOutInterests;
231 };
232 
233 } // namespace ndn
234 } // namespace ns3
235 
236 #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.
initializes and executes NFD-RIB service thread
Definition: service.hpp:52
Implements the Strategy Choice Management of NFD Management Protocol.
std::function< std::unique_ptr< nfd::cs::Policy >)> PolicyCreationCallback
FibManager
Definition: fib-manager.cpp:39
represents a CS replacement policy
Definition: cs-policy.hpp:38
ndn Face
Definition: face-impl.hpp:42
container of all faces
Definition: face-table.hpp:38
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:39
An Interest table entry.
Definition: pit-entry.hpp:58
Copyright (c) 2011-2015 Regents of the University of California.
boost::property_tree::ptree ConfigSection
a config file section
FaceTable
Definition: face-table.cpp:37
ndn L3Protocol
Copyright (c) 2011-2015 Regents of the University of California.
Forwarder
Definition: forwarder.cpp:43
Implementation network-layer of NDN stack.
uint64_t FaceId
Identifies a face.
Definition: face-common.hpp:44