NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-global-router.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef NDN_GLOBAL_ROUTER_H
21 #define NDN_GLOBAL_ROUTER_H
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 #include "ns3/ndnSIM/model/ndn-face.hpp"
25 
26 #include "ns3/object.h"
27 #include "ns3/ptr.h"
28 
29 #include <list>
30 #include <tuple>
31 
32 namespace ns3 {
33 
34 class Channel;
35 
36 namespace ndn {
37 
38 class L3Protocol;
39 
44 class GlobalRouter : public Object {
45 public:
49  typedef std::tuple<Ptr<GlobalRouter>, shared_ptr<Face>, Ptr<GlobalRouter>> Incidency;
53  typedef std::list<Incidency> IncidencyList;
57  typedef std::list<shared_ptr<Name>> LocalPrefixList;
58 
64  static TypeId
65  GetTypeId();
66 
70  GlobalRouter();
71 
75  uint32_t
76  GetId() const;
77 
81  Ptr<L3Protocol>
82  GetL3Protocol() const;
83 
88  void
89  AddLocalPrefix(shared_ptr<Name> prefix);
90 
96  void
97  AddIncidency(shared_ptr<Face> face, Ptr<GlobalRouter> ndn);
98 
102  IncidencyList&
103  GetIncidencies();
104 
108  const LocalPrefixList&
109  GetLocalPrefixes() const;
110 
114  static void
115  clear();
116 
117 protected:
118  virtual void
120 
122 private:
123  uint32_t m_id;
124 
125  Ptr<L3Protocol> m_ndn;
126  LocalPrefixList m_localPrefixes;
127  IncidencyList m_incidencies;
128 
129  static uint32_t m_idCounter;
130 };
131 
132 inline bool
134 {
135  return std::get<0>(a) == std::get<0>(b) && std::get<1>(a) == std::get<1>(b)
136  && std::get<2>(a) == std::get<2>(b);
137 }
138 
139 inline bool
141 {
142  return !(a == b);
143 }
144 
145 } // namespace ndn
146 } // namespace ns3
147 
148 #endif // NDN_GLOBAL_ROUTER_H
void AddLocalPrefix(shared_ptr< Name > prefix)
Add new locally exported prefix.
Copyright (c) 2011-2015 Regents of the University of California.
GlobalRouter()
Default constructor.
std::list< shared_ptr< Name > > LocalPrefixList
List of locally exported prefixes.
Class representing global router interface for ndnSIM.
std::tuple< Ptr< GlobalRouter >, shared_ptr< Face >, Ptr< GlobalRouter > > Incidency
Graph edge.
void AddIncidency(shared_ptr< Face > face, Ptr< GlobalRouter > ndn)
Add edge to the node.
virtual void NotifyNewAggregate()
Notify when the object is aggregated to another object (e.g., Node)
uint32_t GetId() const
Get numeric ID of the node (internally assigned)
std::list< Incidency > IncidencyList
List of graph edges.
Copyright (c) 2011-2015 Regents of the University of California.
IncidencyList & GetIncidencies()
Get list of edges that are connected to this node.
ndn L3Protocol
Copyright (c) 2011-2015 Regents of the University of California.
static TypeId GetTypeId()
Interface ID.
bool operator!=(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
Ptr< L3Protocol > GetL3Protocol() const
Helper function to get smart pointer to ndn::L3Protocol object (basically, self)
static void clear()
Clear global state.
const LocalPrefixList & GetLocalPrefixes() const
Get list of locally exported prefixes.
bool operator==(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)