blob: 8a4f76727dc9659c63f7b4f1c196f4ece4c6f15e [file] [log] [blame]
Alexander Afanasyevad3757f2012-04-17 10:27:59 -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 "ccnx-global-router.h"
22
23#include "ns3/ccnx.h"
24#include "ns3/ccnx-face.h"
25#include "ns3/ccnx-name-components.h"
26
27#include "ns3/channel.h"
28
29using namespace boost;
30
31namespace ns3 {
32
33uint32_t CcnxGlobalRouter::m_idCounter = 0;
34
35NS_OBJECT_ENSURE_REGISTERED (CcnxGlobalRouter);
36
37TypeId
38CcnxGlobalRouter::GetTypeId ()
39{
40 static TypeId tid = TypeId ("ns3::CcnxGlobalRouter")
41 .SetGroupName ("Ccnx")
42 .SetParent<Object> ()
43 ;
44 return tid;
45}
46
47CcnxGlobalRouter::CcnxGlobalRouter ()
48{
49 m_id = m_idCounter;
50 m_idCounter ++;
51}
52
53void
54CcnxGlobalRouter::NotifyNewAggregate ()
55{
56 if (m_ccnx == 0)
57 {
58 m_ccnx = GetObject<Ccnx> ();
59 }
60 Object::NotifyNewAggregate ();
61}
62
63uint32_t
64CcnxGlobalRouter::GetId () const
65{
66 return m_id;
67}
68
69Ptr<Ccnx>
70CcnxGlobalRouter::GetCcnx () const
71{
72 return m_ccnx;
73}
74
75void
76CcnxGlobalRouter::AddLocalPrefix (Ptr< CcnxNameComponents > prefix)
77{
78 m_localPrefixes.push_back (prefix);
79}
80
81void
82CcnxGlobalRouter::AddIncidency (Ptr< CcnxFace > face, Ptr< CcnxGlobalRouter > gr)
83{
84 m_incidencies.push_back (make_tuple (this, face, gr));
85}
86
87CcnxGlobalRouter::IncidencyList &
88CcnxGlobalRouter::GetIncidencies ()
89{
90 return m_incidencies;
91}
92
Alexander Afanasyev8e2f1122012-04-17 15:01:11 -070093const CcnxGlobalRouter::LocalPrefixList &
94CcnxGlobalRouter::GetLocalPrefixes () const
95{
96 return m_localPrefixes;
97}
98
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070099// void
100// CcnxGlobalRouter::AddIncidencyChannel (Ptr< CcnxFace > face, Ptr< Channel > channel)
101// {
102// m_incidenciesChannel.push_back (make_tuple (face, channel));
103// }
104
105}
106