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 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 21 | #include "ndn-pit-entry.h" |
Alexander Afanasyev | e3d126f | 2012-07-16 17:07:31 -0700 | [diff] [blame] | 22 | |
Alexander Afanasyev | cdeefb4 | 2013-05-01 16:04:53 -0700 | [diff] [blame] | 23 | #include "ns3/ndn-pit.h" |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 24 | #include "ns3/ndn-fib.h" |
Alexander Afanasyev | cfdc14f | 2013-03-15 14:38:44 -0700 | [diff] [blame] | 25 | #include "ns3/ndn-name.h" |
Alexander Afanasyev | bd9c18e | 2012-11-19 15:23:41 -0800 | [diff] [blame] | 26 | #include "ns3/ndn-interest.h" |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 27 | |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 28 | #include "ns3/simulator.h" |
Alexander Afanasyev | 5a59507 | 2011-11-25 14:49:07 -0800 | [diff] [blame] | 29 | #include "ns3/log.h" |
| 30 | |
| 31 | #include <boost/lambda/lambda.hpp> |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 32 | #include <boost/lambda/bind.hpp> |
Alexander Afanasyev | 78057c3 | 2012-07-06 15:18:46 -0700 | [diff] [blame] | 33 | #include <boost/foreach.hpp> |
Alexander Afanasyev | 5a59507 | 2011-11-25 14:49:07 -0800 | [diff] [blame] | 34 | namespace ll = boost::lambda; |
| 35 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 36 | NS_LOG_COMPONENT_DEFINE ("ndn.pit.Entry"); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 37 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 38 | namespace ns3 { |
| 39 | namespace ndn { |
| 40 | namespace pit { |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 41 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 42 | Entry::Entry (Pit &container, |
Alexander Afanasyev | eae83ee | 2013-03-15 15:01:10 -0700 | [diff] [blame] | 43 | Ptr<const Interest> header, |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 44 | Ptr<fib::Entry> fibEntry) |
Alexander Afanasyev | 36b4577 | 2012-07-10 16:57:42 -0700 | [diff] [blame] | 45 | : m_container (container) |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 46 | , m_interest (header) |
Alexander Afanasyev | 0560eec | 2012-07-16 15:44:31 -0700 | [diff] [blame] | 47 | , m_fibEntry (fibEntry) |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 48 | , m_maxRetxCount (0) |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 49 | { |
Alexander Afanasyev | cdeefb4 | 2013-05-01 16:04:53 -0700 | [diff] [blame] | 50 | NS_LOG_FUNCTION (this); |
| 51 | |
| 52 | // UpdateLifetime is (and should) be called from the forwarding strategy |
| 53 | |
Alexander Afanasyev | 2890e57 | 2013-05-02 12:33:38 -0700 | [diff] [blame] | 54 | UpdateLifetime ((!header->GetInterestLifetime ().IsZero ()? |
| 55 | header->GetInterestLifetime (): |
| 56 | Seconds (1.0))); |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 57 | } |
| 58 | |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 59 | Entry::~Entry () |
| 60 | { |
| 61 | NS_LOG_FUNCTION (GetPrefix ()); |
| 62 | } |
| 63 | |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 64 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 65 | Entry::UpdateLifetime (const Time &offsetTime) |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 66 | { |
Alexander Afanasyev | cdeefb4 | 2013-05-01 16:04:53 -0700 | [diff] [blame] | 67 | NS_LOG_FUNCTION (this); |
Alexander Afanasyev | eec6629 | 2013-02-06 16:23:21 -0800 | [diff] [blame] | 68 | |
Alexander Afanasyev | cdeefb4 | 2013-05-01 16:04:53 -0700 | [diff] [blame] | 69 | Time newExpireTime = Simulator::Now () + (m_container.GetMaxPitEntryLifetime ().IsZero () ? |
| 70 | offsetTime : |
| 71 | std::min (m_container.GetMaxPitEntryLifetime (), offsetTime)); |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 72 | if (newExpireTime > m_expireTime) |
| 73 | m_expireTime = newExpireTime; |
Alexander Afanasyev | eec6629 | 2013-02-06 16:23:21 -0800 | [diff] [blame] | 74 | |
| 75 | NS_LOG_INFO (this->GetPrefix () << ", Updated lifetime to " << m_expireTime.ToDouble (Time::S) << "s, " << (m_expireTime-Simulator::Now ()).ToDouble (Time::S) << "s left"); |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 76 | } |
| 77 | |
Alexander Afanasyev | 08b7d9e | 2012-08-23 10:53:46 -0700 | [diff] [blame] | 78 | void |
| 79 | Entry::OffsetLifetime (const Time &offsetTime) |
| 80 | { |
| 81 | m_expireTime += offsetTime; |
| 82 | if (m_expireTime < Simulator::Now ()) |
| 83 | { |
| 84 | m_expireTime = Simulator::Now (); |
| 85 | } |
Alexander Afanasyev | eec6629 | 2013-02-06 16:23:21 -0800 | [diff] [blame] | 86 | NS_LOG_INFO (this->GetPrefix () << ", Offsetting lifetime to " << m_expireTime.ToDouble (Time::S) << "s, " << (m_expireTime-Simulator::Now ()).ToDouble (Time::S) << "s left"); |
Alexander Afanasyev | 08b7d9e | 2012-08-23 10:53:46 -0700 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | |
Alexander Afanasyev | cfdc14f | 2013-03-15 14:38:44 -0700 | [diff] [blame] | 90 | const Name & |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 91 | Entry::GetPrefix () const |
| 92 | { |
| 93 | return m_interest->GetName (); |
| 94 | } |
| 95 | |
| 96 | const Time & |
| 97 | Entry::GetExpireTime () const |
| 98 | { |
| 99 | return m_expireTime; |
| 100 | } |
| 101 | |
| 102 | bool |
| 103 | Entry::IsNonceSeen (uint32_t nonce) const |
| 104 | { |
| 105 | return m_seenNonces.find (nonce) != m_seenNonces.end (); |
| 106 | } |
| 107 | |
| 108 | void |
| 109 | Entry::AddSeenNonce (uint32_t nonce) |
| 110 | { |
| 111 | m_seenNonces.insert (nonce); |
| 112 | } |
| 113 | |
| 114 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 115 | Entry::in_iterator |
| 116 | Entry::AddIncoming (Ptr<Face> face) |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 117 | { |
Alexander Afanasyev | eec6629 | 2013-02-06 16:23:21 -0800 | [diff] [blame] | 118 | std::pair<in_iterator,bool> ret = |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 119 | m_incoming.insert (IncomingFace (face)); |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame] | 120 | |
Alexander Afanasyev | e55d1e3 | 2012-07-19 15:33:05 -0700 | [diff] [blame] | 121 | // NS_ASSERT_MSG (ret.second, "Something is wrong"); |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame] | 122 | |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 123 | return ret.first; |
| 124 | } |
| 125 | |
Alexander Afanasyev | 9d313d4 | 2011-11-25 13:36:15 -0800 | [diff] [blame] | 126 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 127 | Entry::RemoveIncoming (Ptr<Face> face) |
Alexander Afanasyev | 9d313d4 | 2011-11-25 13:36:15 -0800 | [diff] [blame] | 128 | { |
| 129 | m_incoming.erase (face); |
| 130 | } |
| 131 | |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 132 | void |
| 133 | Entry::ClearIncoming () |
| 134 | { |
| 135 | m_incoming.clear (); |
| 136 | } |
Alexander Afanasyev | 9d313d4 | 2011-11-25 13:36:15 -0800 | [diff] [blame] | 137 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 138 | Entry::out_iterator |
| 139 | Entry::AddOutgoing (Ptr<Face> face) |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 140 | { |
Alexander Afanasyev | f034cbd | 2012-06-29 14:28:31 -0700 | [diff] [blame] | 141 | std::pair<out_iterator,bool> ret = |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 142 | m_outgoing.insert (OutgoingFace (face)); |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 143 | |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 144 | if (!ret.second) |
| 145 | { // outgoing face already exists |
Alexander Afanasyev | c202fd9 | 2012-09-03 21:46:00 -0700 | [diff] [blame] | 146 | const_cast<OutgoingFace&>(*ret.first).UpdateOnRetransmit (); |
| 147 | // m_outgoing.modify (ret.first, |
| 148 | // ll::bind (&OutgoingFace::UpdateOnRetransmit, ll::_1)); |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 149 | } |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 150 | |
| 151 | return ret.first; |
| 152 | } |
| 153 | |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 154 | void |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 155 | Entry::ClearOutgoing () |
| 156 | { |
| 157 | m_outgoing.clear (); |
| 158 | } |
| 159 | |
| 160 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 161 | Entry::RemoveAllReferencesToFace (Ptr<Face> face) |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 162 | { |
Alexander Afanasyev | f034cbd | 2012-06-29 14:28:31 -0700 | [diff] [blame] | 163 | in_iterator incoming = m_incoming.find (face); |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 164 | |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 165 | if (incoming != m_incoming.end ()) |
| 166 | m_incoming.erase (incoming); |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 167 | |
Alexander Afanasyev | f034cbd | 2012-06-29 14:28:31 -0700 | [diff] [blame] | 168 | out_iterator outgoing = |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 169 | m_outgoing.find (face); |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 170 | |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 171 | if (outgoing != m_outgoing.end ()) |
| 172 | m_outgoing.erase (outgoing); |
| 173 | } |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 174 | |
Alexander Afanasyev | 786936a | 2012-07-17 19:48:15 -0700 | [diff] [blame] | 175 | // void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 176 | // Entry::SetWaitingInVain (Entry::out_iterator face) |
Alexander Afanasyev | 786936a | 2012-07-17 19:48:15 -0700 | [diff] [blame] | 177 | // { |
| 178 | // NS_LOG_DEBUG (boost::cref (*face->m_face)); |
Alexander Afanasyev | 23d2b54 | 2011-12-07 18:54:46 -0800 | [diff] [blame] | 179 | |
Alexander Afanasyev | 786936a | 2012-07-17 19:48:15 -0700 | [diff] [blame] | 180 | // m_outgoing.modify (face, |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 181 | // (&ll::_1)->*&EntryOutgoingFace::m_waitingInVain = true); |
Alexander Afanasyev | 786936a | 2012-07-17 19:48:15 -0700 | [diff] [blame] | 182 | // } |
| 183 | |
| 184 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 185 | Entry::SetWaitingInVain (Ptr<Face> face) |
Alexander Afanasyev | 786936a | 2012-07-17 19:48:15 -0700 | [diff] [blame] | 186 | { |
| 187 | // NS_LOG_DEBUG (boost::cref (*face->m_face)); |
| 188 | |
| 189 | out_iterator item = m_outgoing.find (face); |
| 190 | if (item == m_outgoing.end ()) |
| 191 | return; |
Alexander Afanasyev | c202fd9 | 2012-09-03 21:46:00 -0700 | [diff] [blame] | 192 | |
| 193 | const_cast<OutgoingFace&>(*item).m_waitingInVain = true; |
| 194 | // m_outgoing.modify (item, |
| 195 | // (&ll::_1)->*&OutgoingFace::m_waitingInVain = true); |
Alexander Afanasyev | 5a59507 | 2011-11-25 14:49:07 -0800 | [diff] [blame] | 196 | } |
| 197 | |
Alexander Afanasyev | 786936a | 2012-07-17 19:48:15 -0700 | [diff] [blame] | 198 | |
Alexander Afanasyev | 5a59507 | 2011-11-25 14:49:07 -0800 | [diff] [blame] | 199 | bool |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 200 | Entry::AreAllOutgoingInVain () const |
Alexander Afanasyev | 5a59507 | 2011-11-25 14:49:07 -0800 | [diff] [blame] | 201 | { |
Alexander Afanasyev | 23d2b54 | 2011-12-07 18:54:46 -0800 | [diff] [blame] | 202 | NS_LOG_DEBUG (m_outgoing.size ()); |
| 203 | |
Alexander Afanasyev | 5a59507 | 2011-11-25 14:49:07 -0800 | [diff] [blame] | 204 | bool inVain = true; |
| 205 | std::for_each (m_outgoing.begin (), m_outgoing.end (), |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 206 | ll::var(inVain) &= (&ll::_1)->*&OutgoingFace::m_waitingInVain); |
Alexander Afanasyev | 5a59507 | 2011-11-25 14:49:07 -0800 | [diff] [blame] | 207 | |
| 208 | NS_LOG_DEBUG ("inVain " << inVain); |
| 209 | return inVain; |
| 210 | } |
| 211 | |
Alexander Afanasyev | a7a2b8b | 2011-11-28 18:19:09 -0800 | [diff] [blame] | 212 | bool |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 213 | Entry::AreTherePromisingOutgoingFacesExcept (Ptr<Face> face) const |
Alexander Afanasyev | a7a2b8b | 2011-11-28 18:19:09 -0800 | [diff] [blame] | 214 | { |
| 215 | bool inVain = true; |
| 216 | std::for_each (m_outgoing.begin (), m_outgoing.end (), |
| 217 | ll::var(inVain) &= |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 218 | ((&ll::_1)->*&OutgoingFace::m_face == face || |
| 219 | (&ll::_1)->*&OutgoingFace::m_waitingInVain)); |
Alexander Afanasyev | a7a2b8b | 2011-11-28 18:19:09 -0800 | [diff] [blame] | 220 | |
| 221 | return !inVain; |
| 222 | } |
Alexander Afanasyev | 5a59507 | 2011-11-25 14:49:07 -0800 | [diff] [blame] | 223 | |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 224 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 225 | Entry::IncreaseAllowedRetxCount () |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 226 | { |
Alexander Afanasyev | 9a517db | 2012-04-30 13:58:47 -0700 | [diff] [blame] | 227 | if (Simulator::Now () - m_lastRetransmission >= MilliSeconds (100)) |
Alexander Afanasyev | 7f3e49e | 2012-04-30 00:17:07 -0700 | [diff] [blame] | 228 | { |
| 229 | // cheat: |
Alexander Afanasyev | 9a517db | 2012-04-30 13:58:47 -0700 | [diff] [blame] | 230 | // don't allow retransmission faster than every 100ms |
Alexander Afanasyev | 7f3e49e | 2012-04-30 00:17:07 -0700 | [diff] [blame] | 231 | m_maxRetxCount++; |
Alexander Afanasyev | 9a517db | 2012-04-30 13:58:47 -0700 | [diff] [blame] | 232 | m_lastRetransmission = Simulator::Now (); |
Alexander Afanasyev | 7f3e49e | 2012-04-30 00:17:07 -0700 | [diff] [blame] | 233 | } |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 234 | } |
| 235 | |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 236 | Ptr<fib::Entry> |
| 237 | Entry::GetFibEntry () |
| 238 | { |
| 239 | return m_fibEntry; |
| 240 | }; |
| 241 | |
| 242 | const Entry::in_container & |
| 243 | Entry::GetIncoming () const |
| 244 | { |
| 245 | return m_incoming; |
| 246 | } |
| 247 | |
| 248 | const Entry::out_container & |
| 249 | Entry::GetOutgoing () const |
| 250 | { |
| 251 | return m_outgoing; |
| 252 | } |
| 253 | |
| 254 | uint32_t |
Alexander Afanasyev | ff03395 | 2012-08-23 15:45:52 -0700 | [diff] [blame] | 255 | Entry::GetOutgoingCount () const |
| 256 | { |
| 257 | return m_outgoing.size (); |
| 258 | } |
| 259 | |
| 260 | |
| 261 | uint32_t |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 262 | Entry::GetMaxRetxCount () const |
| 263 | { |
| 264 | return m_maxRetxCount; |
| 265 | } |
| 266 | |
Alexander Afanasyev | eae83ee | 2013-03-15 15:01:10 -0700 | [diff] [blame] | 267 | Ptr<const Interest> |
Alexander Afanasyev | 91e1128 | 2012-08-21 17:23:11 -0700 | [diff] [blame] | 268 | Entry::GetInterest () const |
| 269 | { |
| 270 | return m_interest; |
| 271 | } |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 272 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 273 | std::ostream& operator<< (std::ostream& os, const Entry &entry) |
Alexander Afanasyev | a95b739 | 2012-03-09 10:54:10 -0800 | [diff] [blame] | 274 | { |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 275 | os << "Prefix: " << entry.GetPrefix () << "\n"; |
Alexander Afanasyev | a95b739 | 2012-03-09 10:54:10 -0800 | [diff] [blame] | 276 | os << "In: "; |
| 277 | bool first = true; |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 278 | BOOST_FOREACH (const IncomingFace &face, entry.m_incoming) |
Alexander Afanasyev | a95b739 | 2012-03-09 10:54:10 -0800 | [diff] [blame] | 279 | { |
| 280 | if (!first) |
| 281 | os << ","; |
| 282 | else |
| 283 | first = false; |
Alexander Afanasyev | eec6629 | 2013-02-06 16:23:21 -0800 | [diff] [blame] | 284 | |
Alexander Afanasyev | a95b739 | 2012-03-09 10:54:10 -0800 | [diff] [blame] | 285 | os << *face.m_face; |
| 286 | } |
| 287 | |
| 288 | os << "\nOut: "; |
| 289 | first = true; |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 290 | BOOST_FOREACH (const OutgoingFace &face, entry.m_outgoing) |
Alexander Afanasyev | a95b739 | 2012-03-09 10:54:10 -0800 | [diff] [blame] | 291 | { |
| 292 | if (!first) |
| 293 | os << ","; |
| 294 | else |
| 295 | first = false; |
Alexander Afanasyev | eec6629 | 2013-02-06 16:23:21 -0800 | [diff] [blame] | 296 | |
Alexander Afanasyev | a95b739 | 2012-03-09 10:54:10 -0800 | [diff] [blame] | 297 | os << *face.m_face; |
| 298 | } |
Alexander Afanasyev | 7f3e49e | 2012-04-30 00:17:07 -0700 | [diff] [blame] | 299 | os << "\nNonces: "; |
| 300 | first = true; |
| 301 | BOOST_FOREACH (uint32_t nonce, entry.m_seenNonces) |
| 302 | { |
| 303 | if (!first) |
| 304 | os << ","; |
| 305 | else |
| 306 | first = false; |
Alexander Afanasyev | eec6629 | 2013-02-06 16:23:21 -0800 | [diff] [blame] | 307 | |
Alexander Afanasyev | 7f3e49e | 2012-04-30 00:17:07 -0700 | [diff] [blame] | 308 | os << nonce; |
| 309 | } |
Alexander Afanasyev | a95b739 | 2012-03-09 10:54:10 -0800 | [diff] [blame] | 310 | |
| 311 | return os; |
| 312 | } |
| 313 | |
| 314 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 315 | } // namespace pit |
| 316 | } // namespace ndn |
| 317 | } // namespace ns3 |