Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 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-pit-entry.h" |
| 22 | #include "ccnx-name-components.h" |
| 23 | #include "ccnx-fib.h" |
| 24 | |
| 25 | namespace ns3 |
| 26 | { |
| 27 | |
| 28 | // struct SearchByFace |
| 29 | // { |
| 30 | // /** |
| 31 | // * \brief To perform effective searches by CcnxFace |
| 32 | // */ |
| 33 | // bool |
| 34 | // operator() (const CcnxPitIncomingInterest &m, const Ptr<CcnxFace> &face) const |
| 35 | // { |
| 36 | // return *(m.m_face) < *face; |
| 37 | // } |
| 38 | |
| 39 | // /** |
| 40 | // * \brief To perform effective searches by CcnxFace |
| 41 | // */ |
| 42 | // bool |
| 43 | // operator() (const Ptr<CcnxFace> &face, const CcnxPitIncomingInterest &m) const |
| 44 | // { |
| 45 | // return *face < *(m.m_face); |
| 46 | // } |
| 47 | |
| 48 | // /** |
| 49 | // * \brief To perform effective searches by CcnxFace |
| 50 | // */ |
| 51 | // bool |
| 52 | // operator() (const CcnxPitOutgoingInterest &m, const Ptr<CcnxFace> &face) const |
| 53 | // { |
| 54 | // return *(m.m_face) < *face; |
| 55 | // } |
| 56 | |
| 57 | // /** |
| 58 | // * \brief To perform effective searches by CcnxFace |
| 59 | // */ |
| 60 | // bool |
| 61 | // operator() (const Ptr<CcnxFace> &face, const CcnxPitOutgoingInterest &m) const |
| 62 | // { |
| 63 | // return *face < *(m.m_face); |
| 64 | // } |
| 65 | // }; |
| 66 | |
| 67 | |
| 68 | CcnxPitEntry::CcnxPitEntry (Ptr<CcnxNameComponents> prefix) |
| 69 | : m_prefix (prefix) |
| 70 | , m_fib (0) |
| 71 | // , m_expireTime (?) |
| 72 | , m_timerExpired (false) |
| 73 | , m_counterExpirations (0) |
| 74 | { |
| 75 | } |
| 76 | |
| 77 | const CcnxNameComponents & |
| 78 | CcnxPitEntry::GetPrefix () const |
| 79 | { |
| 80 | return *m_prefix; |
| 81 | } |
| 82 | |
| 83 | CcnxPitEntry::SetFibEntry::SetFibEntry (Ptr<CcnxFibEntry> fib) |
| 84 | : m_fib (fib) |
| 85 | { |
| 86 | } |
| 87 | |
| 88 | void |
| 89 | CcnxPitEntry::SetFibEntry::operator() (CcnxPitEntry &entry) |
| 90 | { |
| 91 | entry.m_fib = m_fib; |
| 92 | } |
| 93 | |
| 94 | void |
| 95 | CcnxPitEntry::AddIncoming::operator() (CcnxPitEntry &entry) |
| 96 | { |
| 97 | entry.m_incoming.insert (CcnxPitEntryIncomingFace (m_face)); |
| 98 | } |
| 99 | |
| 100 | void |
| 101 | CcnxPitEntry::AddOutgoing::operator() (CcnxPitEntry &entry) |
| 102 | { |
| 103 | entry.m_outgoing.insert (CcnxPitEntryOutgoingFace (m_face)); |
| 104 | } |
| 105 | |
| 106 | void |
| 107 | CcnxPitEntry::DeleteIncoming::operator() (CcnxPitEntry &entry) |
| 108 | { |
| 109 | entry.m_incoming.erase (m_face); |
| 110 | } |
| 111 | |
| 112 | void |
| 113 | CcnxPitEntry::ClearIncoming::operator() (CcnxPitEntry &entry) |
| 114 | { |
| 115 | entry.m_incoming.clear (); |
| 116 | } |
| 117 | |
| 118 | |
| 119 | } |