NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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 
25 #include "ns3/object.h"
26 #include "ns3/ptr.h"
27 
28 #include <list>
29 #include <tuple>
30 
31 namespace ns3 {
32 
33 class Channel;
34 
35 namespace ndn {
36 
37 class L3Protocol;
38 
43 class GlobalRouter : public Object {
44 public:
48  typedef std::tuple<Ptr<GlobalRouter>, shared_ptr<Face>, Ptr<GlobalRouter>> Incidency;
52  typedef std::list<Incidency> IncidencyList;
56  typedef std::list<shared_ptr<Name>> LocalPrefixList;
57 
63  static TypeId
64  GetTypeId();
65 
69  GlobalRouter();
70 
74  uint32_t
75  GetId() const;
76 
80  Ptr<L3Protocol>
81  GetL3Protocol() const;
82 
87  void
88  AddLocalPrefix(shared_ptr<Name> prefix);
89 
95  void
96  AddIncidency(shared_ptr<Face> face, Ptr<GlobalRouter> ndn);
97 
102  GetIncidencies();
103 
107  const LocalPrefixList&
108  GetLocalPrefixes() const;
109 
113  static void
114  clear();
115 
116 protected:
117  virtual void
119 
121 private:
122  uint32_t m_id;
123 
124  Ptr<L3Protocol> m_ndn;
125  LocalPrefixList m_localPrefixes;
126  IncidencyList m_incidencies;
127 
128  static uint32_t m_idCounter;
129 };
130 
131 inline bool
133 {
134  return std::get<0>(a) == std::get<0>(b) && std::get<1>(a) == std::get<1>(b)
135  && std::get<2>(a) == std::get<2>(b);
136 }
137 
138 inline bool
140 {
141  return !(a == b);
142 }
143 
144 } // namespace ndn
145 } // namespace ns3
146 
147 #endif // NDN_GLOBAL_ROUTER_H
ns3::ndn::GlobalRouter::GetId
uint32_t GetId() const
Get numeric ID of the node (internally assigned)
Definition: ndn-global-router.cpp:56
ns3::ndn::GlobalRouter::AddLocalPrefix
void AddLocalPrefix(shared_ptr< Name > prefix)
Add new locally exported prefix.
Definition: ndn-global-router.cpp:68
ns3::ndn::GlobalRouter::GetLocalPrefixes
const LocalPrefixList & GetLocalPrefixes() const
Get list of locally exported prefixes.
Definition: ndn-global-router.cpp:86
ns3::ndn::GlobalRouter::IncidencyList
std::list< Incidency > IncidencyList
List of graph edges.
Definition: ndn-global-router.hpp:52
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::ndn::GlobalRouter::LocalPrefixList
std::list< shared_ptr< Name > > LocalPrefixList
List of locally exported prefixes.
Definition: ndn-global-router.hpp:56
ns3::ndn::GlobalRouter::AddIncidency
void AddIncidency(shared_ptr< Face > face, Ptr< GlobalRouter > ndn)
Add edge to the node.
Definition: ndn-global-router.cpp:74
ns3::ndn::operator==
bool operator==(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
Definition: ndn-global-router.hpp:132
ns3::ndn::GlobalRouter::GetIncidencies
IncidencyList & GetIncidencies()
Get list of edges that are connected to this node.
Definition: ndn-global-router.cpp:80
ns3::ndn::operator!=
bool operator!=(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
Definition: ndn-global-router.hpp:139
ns3::ndn::GlobalRouter
Class representing global router interface for ndnSIM.
Definition: ndn-global-router.hpp:43
ns3::ndn::GlobalRouter::GetL3Protocol
Ptr< L3Protocol > GetL3Protocol() const
Helper function to get smart pointer to ndn::L3Protocol object (basically, self)
Definition: ndn-global-router.cpp:62
ns3::ndn::GlobalRouter::GetTypeId
static TypeId GetTypeId()
Interface ID.
Definition: ndn-global-router.cpp:34
ns3::ndn::GlobalRouter::GlobalRouter
GlobalRouter()
Default constructor.
Definition: ndn-global-router.cpp:40
ns3::ndn::GlobalRouter::clear
static void clear()
Clear global state.
Definition: ndn-global-router.cpp:92
ns3::ndn::GlobalRouter::NotifyNewAggregate
virtual void NotifyNewAggregate()
Notify when the object is aggregated to another object (e.g., Node)
Definition: ndn-global-router.cpp:47
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ns3::ndn::GlobalRouter::Incidency
std::tuple< Ptr< GlobalRouter >, shared_ptr< Face >, Ptr< GlobalRouter > > Incidency
Graph edge.
Definition: ndn-global-router.hpp:48
L3Protocol
ndn L3Protocol
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-l3-protocol.cpp:60