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