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