NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndn-global-router.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #include "ndn-global-router.hpp"
21 
23 #include "model/ndn-face.hpp"
24 
25 #include "ns3/channel.h"
26 
27 namespace ns3 {
28 namespace ndn {
29 
30 uint32_t GlobalRouter::m_idCounter = 0;
31 
32 NS_OBJECT_ENSURE_REGISTERED(GlobalRouter);
33 
34 TypeId
36 {
37  static TypeId tid = TypeId("ns3::ndn::GlobalRouter").SetGroupName("Ndn").SetParent<Object>();
38  return tid;
39 }
40 
42 {
43  m_id = m_idCounter;
44  m_idCounter++;
45 }
46 
47 void
49 {
50  if (m_ndn == 0) {
51  m_ndn = GetObject<L3Protocol>();
52  }
53  Object::NotifyNewAggregate();
54 }
55 
56 uint32_t
58 {
59  return m_id;
60 }
61 
62 Ptr<L3Protocol>
64 {
65  return m_ndn;
66 }
67 
68 void
69 GlobalRouter::AddLocalPrefix(shared_ptr<Name> prefix)
70 {
71  m_localPrefixes.push_back(prefix);
72 }
73 
74 void
75 GlobalRouter::AddIncidency(shared_ptr<Face> face, Ptr<GlobalRouter> gr)
76 {
77  m_incidencies.push_back(std::make_tuple(this, face, gr));
78 }
79 
82 {
83  return m_incidencies;
84 }
85 
88 {
89  return m_localPrefixes;
90 }
91 
92 // void
93 // GlobalRouter::AddIncidencyChannel (Ptr< NdnFace > face, Ptr< Channel > channel)
94 // {
95 // m_incidenciesChannel.push_back (make_tuple (face, channel));
96 // }
97 
98 } // namespace ndn
99 } // namespace ns3
void AddLocalPrefix(shared_ptr< Name > prefix)
Add new locally exported prefix.
GlobalRouter()
Default constructor.
std::list< shared_ptr< Name > > LocalPrefixList
List of locally exported prefixes.
NS_OBJECT_ENSURE_REGISTERED(ContentStore)
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.
IncidencyList & GetIncidencies()
Get list of edges that are connected to this node.
static TypeId GetTypeId()
Interface ID.
Ptr< L3Protocol > GetL3Protocol() const
Helper function to get smart pointer to ndn::L3Protocol object (basically, self)
const LocalPrefixList & GetLocalPrefixes() const
Get list of locally exported prefixes.