Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -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 "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 | |
| 29 | using namespace boost; |
| 30 | |
| 31 | namespace ns3 { |
| 32 | |
| 33 | uint32_t NdnGlobalRouter::m_idCounter = 0; |
| 34 | |
| 35 | NS_OBJECT_ENSURE_REGISTERED (NdnGlobalRouter); |
| 36 | |
| 37 | TypeId |
| 38 | NdnGlobalRouter::GetTypeId () |
| 39 | { |
| 40 | static TypeId tid = TypeId ("ns3::NdnGlobalRouter") |
| 41 | .SetGroupName ("Ndn") |
| 42 | .SetParent<Object> () |
| 43 | ; |
| 44 | return tid; |
| 45 | } |
| 46 | |
| 47 | NdnGlobalRouter::NdnGlobalRouter () |
| 48 | { |
| 49 | m_id = m_idCounter; |
| 50 | m_idCounter ++; |
| 51 | } |
| 52 | |
| 53 | void |
| 54 | NdnGlobalRouter::NotifyNewAggregate () |
| 55 | { |
| 56 | if (m_ndn == 0) |
| 57 | { |
| 58 | m_ndn = GetObject<Ndn> (); |
| 59 | } |
| 60 | Object::NotifyNewAggregate (); |
| 61 | } |
| 62 | |
| 63 | uint32_t |
| 64 | NdnGlobalRouter::GetId () const |
| 65 | { |
| 66 | return m_id; |
| 67 | } |
| 68 | |
| 69 | Ptr<Ndn> |
| 70 | NdnGlobalRouter::GetNdn () const |
| 71 | { |
| 72 | return m_ndn; |
| 73 | } |
| 74 | |
| 75 | void |
| 76 | NdnGlobalRouter::AddLocalPrefix (Ptr< NdnNameComponents > prefix) |
| 77 | { |
| 78 | m_localPrefixes.push_back (prefix); |
| 79 | } |
| 80 | |
| 81 | void |
| 82 | NdnGlobalRouter::AddIncidency (Ptr< NdnFace > face, Ptr< NdnGlobalRouter > gr) |
| 83 | { |
| 84 | m_incidencies.push_back (make_tuple (this, face, gr)); |
| 85 | } |
| 86 | |
| 87 | NdnGlobalRouter::IncidencyList & |
| 88 | NdnGlobalRouter::GetIncidencies () |
| 89 | { |
| 90 | return m_incidencies; |
| 91 | } |
| 92 | |
| 93 | const NdnGlobalRouter::LocalPrefixList & |
| 94 | NdnGlobalRouter::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 | |