blob: 816dc88ef6440a525f2526e09e6695c837b5d386 [file] [log] [blame]
Alexander Afanasyev4aac5572012-08-09 10:49:55 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2011 UCLA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#include "ndn-global-router.h"
22
23#include "ns3/ndn.h"
24#include "ns3/ndn-face.h"
25#include "ns3/ndn-name-components.h"
26
27#include "ns3/channel.h"
28
29using namespace boost;
30
31namespace ns3 {
32
33uint32_t NdnGlobalRouter::m_idCounter = 0;
34
35NS_OBJECT_ENSURE_REGISTERED (NdnGlobalRouter);
36
37TypeId
38NdnGlobalRouter::GetTypeId ()
39{
40 static TypeId tid = TypeId ("ns3::NdnGlobalRouter")
41 .SetGroupName ("Ndn")
42 .SetParent<Object> ()
43 ;
44 return tid;
45}
46
47NdnGlobalRouter::NdnGlobalRouter ()
48{
49 m_id = m_idCounter;
50 m_idCounter ++;
51}
52
53void
54NdnGlobalRouter::NotifyNewAggregate ()
55{
56 if (m_ndn == 0)
57 {
58 m_ndn = GetObject<Ndn> ();
59 }
60 Object::NotifyNewAggregate ();
61}
62
63uint32_t
64NdnGlobalRouter::GetId () const
65{
66 return m_id;
67}
68
69Ptr<Ndn>
70NdnGlobalRouter::GetNdn () const
71{
72 return m_ndn;
73}
74
75void
76NdnGlobalRouter::AddLocalPrefix (Ptr< NdnNameComponents > prefix)
77{
78 m_localPrefixes.push_back (prefix);
79}
80
81void
82NdnGlobalRouter::AddIncidency (Ptr< NdnFace > face, Ptr< NdnGlobalRouter > gr)
83{
84 m_incidencies.push_back (make_tuple (this, face, gr));
85}
86
87NdnGlobalRouter::IncidencyList &
88NdnGlobalRouter::GetIncidencies ()
89{
90 return m_incidencies;
91}
92
93const NdnGlobalRouter::LocalPrefixList &
94NdnGlobalRouter::GetLocalPrefixes () const
95{
96 return m_localPrefixes;
97}
98
99// void
100// NdnGlobalRouter::AddIncidencyChannel (Ptr< NdnFace > face, Ptr< Channel > channel)
101// {
102// m_incidenciesChannel.push_back (make_tuple (face, channel));
103// }
104
105}
106