NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
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 
24 #include "ns3/channel.h"
25 
26 namespace ns3 {
27 namespace ndn {
28 
29 uint32_t GlobalRouter::m_idCounter = 0;
30 
31 NS_OBJECT_ENSURE_REGISTERED(GlobalRouter);
32 
33 TypeId
35 {
36  static TypeId tid = TypeId("ns3::ndn::GlobalRouter").SetGroupName("Ndn").SetParent<Object>();
37  return tid;
38 }
39 
41 {
42  m_id = m_idCounter;
43  m_idCounter++;
44 }
45 
46 void
48 {
49  if (m_ndn == 0) {
50  m_ndn = GetObject<L3Protocol>();
51  }
52  Object::NotifyNewAggregate();
53 }
54 
55 uint32_t
57 {
58  return m_id;
59 }
60 
61 Ptr<L3Protocol>
63 {
64  return m_ndn;
65 }
66 
67 void
68 GlobalRouter::AddLocalPrefix(shared_ptr<Name> prefix)
69 {
70  m_localPrefixes.push_back(prefix);
71 }
72 
73 void
74 GlobalRouter::AddIncidency(shared_ptr<Face> face, Ptr<GlobalRouter> gr)
75 {
76  m_incidencies.push_back(std::make_tuple(this, face, gr));
77 }
78 
81 {
82  return m_incidencies;
83 }
84 
87 {
88  return m_localPrefixes;
89 }
90 
91 void
93 {
94  m_idCounter = 0;
95 }
96 
97 } // namespace ndn
98 } // namespace ns3
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.
const LocalPrefixList & GetLocalPrefixes() const
Get list of locally exported prefixes.
NS_OBJECT_ENSURE_REGISTERED(GlobalRouter)
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)
std::list< Incidency > IncidencyList
List of graph edges.
uint32_t GetId() const
Get numeric ID of the node (internally assigned)
Copyright (c) 2011-2015 Regents of the University of California.
IncidencyList & GetIncidencies()
Get list of edges that are connected to this node.
static TypeId GetTypeId()
Interface ID.
static void clear()
Clear global state.
Ptr< L3Protocol > GetL3Protocol() const
Helper function to get smart pointer to ndn::L3Protocol object (basically, self)