Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Alexander Afanasyev | ab1d560 | 2011-08-17 19:17:18 -0700 | [diff] [blame] | 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> |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 19 | * Ilya Moiseenko <iliamo@cs.ucla.edu> |
Alexander Afanasyev | ab1d560 | 2011-08-17 19:17:18 -0700 | [diff] [blame] | 20 | */ |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 21 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 22 | #include "ccnx-l3-protocol.h" |
| 23 | |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 24 | #include "ns3/packet.h" |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 25 | #include "ns3/node.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 26 | #include "ns3/log.h" |
| 27 | #include "ns3/callback.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 28 | #include "ns3/uinteger.h" |
| 29 | #include "ns3/trace-source-accessor.h" |
| 30 | #include "ns3/object-vector.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 31 | #include "ns3/boolean.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 32 | |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 33 | #include "ns3/ccnx-header-helper.h" |
| 34 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 35 | #include "ccnx-face.h" |
| 36 | #include "ccnx-route.h" |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 37 | #include "ccnx-forwarding-strategy.h" |
| 38 | #include "ccnx-interest-header.h" |
| 39 | #include "ccnx-content-object-header.h" |
| 40 | |
Alexander Afanasyev | 52e9aa9 | 2011-11-15 20:23:20 -0800 | [diff] [blame] | 41 | #include "ccnx-net-device-face.h" |
| 42 | |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 43 | #include <boost/foreach.hpp> |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 44 | #include <boost/lambda/lambda.hpp> |
| 45 | |
| 46 | using namespace boost::tuples; |
| 47 | using namespace boost::lambda; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 48 | |
| 49 | NS_LOG_COMPONENT_DEFINE ("CcnxL3Protocol"); |
| 50 | |
| 51 | namespace ns3 { |
| 52 | |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 53 | const uint16_t CcnxL3Protocol::ETHERNET_FRAME_TYPE = 0x7777; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 54 | |
| 55 | NS_OBJECT_ENSURE_REGISTERED (CcnxL3Protocol); |
| 56 | |
| 57 | TypeId |
| 58 | CcnxL3Protocol::GetTypeId (void) |
| 59 | { |
| 60 | static TypeId tid = TypeId ("ns3::CcnxL3Protocol") |
| 61 | .SetParent<Ccnx> () |
Alexander Afanasyev | 070aa48 | 2011-08-20 00:38:25 -0700 | [diff] [blame] | 62 | .SetGroupName ("Ccnx") |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 63 | .AddConstructor<CcnxL3Protocol> () |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 64 | // .AddTraceSource ("Tx", "Send ccnx packet to outgoing interface.", |
| 65 | // MakeTraceSourceAccessor (&CcnxL3Protocol::m_txTrace)) |
| 66 | // .AddTraceSource ("Rx", "Receive ccnx packet from incoming interface.", |
| 67 | // MakeTraceSourceAccessor (&CcnxL3Protocol::m_rxTrace)) |
| 68 | // .AddTraceSource ("Drop", "Drop ccnx packet", |
| 69 | // MakeTraceSourceAccessor (&CcnxL3Protocol::m_dropTrace)) |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 70 | // .AddAttribute ("InterfaceList", "The set of Ccnx interfaces associated to this Ccnx stack.", |
| 71 | // ObjectVectorValue (), |
| 72 | // MakeObjectVectorAccessor (&CcnxL3Protocol::m_faces), |
| 73 | // MakeObjectVectorChecker<CcnxFace> ()) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 74 | |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 75 | // .AddTraceSource ("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission", |
| 76 | // MakeTraceSourceAccessor (&CcnxL3Protocol::m_sendOutgoingTrace)) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 77 | |
| 78 | ; |
| 79 | return tid; |
| 80 | } |
| 81 | |
| 82 | CcnxL3Protocol::CcnxL3Protocol() |
Alexander Afanasyev | ab1d560 | 2011-08-17 19:17:18 -0700 | [diff] [blame] | 83 | : m_faceCounter (0) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 84 | { |
| 85 | NS_LOG_FUNCTION (this); |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 86 | |
| 87 | m_rit = CreateObject<CcnxRit> (); |
| 88 | m_pit = CreateObject<CcnxPit> (); |
| 89 | m_contentStore = CreateObject<CcnxContentStore> (); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | CcnxL3Protocol::~CcnxL3Protocol () |
| 93 | { |
| 94 | NS_LOG_FUNCTION (this); |
| 95 | } |
| 96 | |
| 97 | void |
| 98 | CcnxL3Protocol::SetNode (Ptr<Node> node) |
| 99 | { |
| 100 | m_node = node; |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 101 | m_fib = m_node->GetObject<CcnxFib> (); |
| 102 | NS_ASSERT_MSG (m_fib != 0, "FIB should be created and aggregated to a node before calling Ccnx::SetNode"); |
| 103 | |
| 104 | m_pit->SetFib (m_fib); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | /* |
| 108 | * This method is called by AddAgregate and completes the aggregation |
| 109 | * by setting the node in the ccnx stack |
| 110 | */ |
| 111 | void |
| 112 | CcnxL3Protocol::NotifyNewAggregate () |
| 113 | { |
| 114 | if (m_node == 0) |
| 115 | { |
| 116 | Ptr<Node>node = this->GetObject<Node>(); |
| 117 | // verify that it's a valid node and that |
| 118 | // the node has not been set before |
| 119 | if (node != 0) |
| 120 | { |
| 121 | this->SetNode (node); |
| 122 | } |
| 123 | } |
| 124 | Object::NotifyNewAggregate (); |
| 125 | } |
| 126 | |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 127 | void |
| 128 | CcnxL3Protocol::DoDispose (void) |
| 129 | { |
| 130 | NS_LOG_FUNCTION (this); |
| 131 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 132 | for (CcnxFaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 133 | { |
| 134 | *i = 0; |
| 135 | } |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 136 | m_faces.clear (); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 137 | m_node = 0; |
Alexander Afanasyev | d02a5d6 | 2011-11-21 11:01:51 -0800 | [diff] [blame] | 138 | |
| 139 | // Force delete on objects |
Alexander Afanasyev | 1825285 | 2011-11-21 13:35:31 -0800 | [diff] [blame] | 140 | m_forwardingStrategy = 0; // there is a reference to PIT stored in here |
Alexander Afanasyev | d02a5d6 | 2011-11-21 11:01:51 -0800 | [diff] [blame] | 141 | m_rit = 0; |
| 142 | m_pit = 0; |
| 143 | m_contentStore = 0; |
Alexander Afanasyev | 1825285 | 2011-11-21 13:35:31 -0800 | [diff] [blame] | 144 | m_fib = 0; |
| 145 | |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 146 | // m_forwardingStrategy = 0; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 147 | Object::DoDispose (); |
| 148 | } |
| 149 | |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 150 | void |
| 151 | CcnxL3Protocol::SetForwardingStrategy (Ptr<CcnxForwardingStrategy> forwardingStrategy) |
| 152 | { |
| 153 | NS_LOG_FUNCTION (this); |
| 154 | m_forwardingStrategy = forwardingStrategy; |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 155 | // m_forwardingStrategy->SetCcnx (this); |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | Ptr<CcnxForwardingStrategy> |
| 159 | CcnxL3Protocol::GetForwardingStrategy (void) const |
| 160 | { |
| 161 | return m_forwardingStrategy; |
| 162 | } |
| 163 | |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 164 | uint32_t |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 165 | CcnxL3Protocol::AddFace (const Ptr<CcnxFace> &face) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 166 | { |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 167 | NS_LOG_FUNCTION (this << &face); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 168 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 169 | face->SetNode (m_node); |
Alexander Afanasyev | ab1d560 | 2011-08-17 19:17:18 -0700 | [diff] [blame] | 170 | face->SetId (m_faceCounter); // sets a unique ID of the face. This ID serves only informational purposes |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 171 | |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 172 | // ask face to register in lower-layer stack |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 173 | face->RegisterProtocolHandler (MakeCallback (&CcnxL3Protocol::Receive, this)); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 174 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 175 | m_faces.push_back (face); |
Alexander Afanasyev | ab1d560 | 2011-08-17 19:17:18 -0700 | [diff] [blame] | 176 | m_faceCounter ++; |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 177 | return face->GetId (); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 180 | void |
| 181 | CcnxL3Protocol::RemoveFace (Ptr<CcnxFace> face) |
| 182 | { |
| 183 | // ask face to register in lower-layer stack |
| 184 | face->RegisterProtocolHandler (MakeNullCallback<void,const Ptr<CcnxFace>&,const Ptr<const Packet>&> ()); |
| 185 | CcnxFaceList::iterator face_it = find (m_faces.begin(), m_faces.end(), face); |
| 186 | NS_ASSERT_MSG (face_it != m_faces.end (), "Attempt to remove face that doesn't exist"); |
| 187 | m_faces.erase (face_it); |
| 188 | } |
| 189 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 190 | Ptr<CcnxFace> |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 191 | CcnxL3Protocol::GetFace (uint32_t index) const |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 192 | { |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 193 | BOOST_FOREACH (const Ptr<CcnxFace> &face, m_faces) // this function is not supposed to be called often, so linear search is fine |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 194 | { |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 195 | if (face->GetId () == index) |
| 196 | return face; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 197 | } |
| 198 | return 0; |
| 199 | } |
| 200 | |
Alexander Afanasyev | 52e9aa9 | 2011-11-15 20:23:20 -0800 | [diff] [blame] | 201 | Ptr<CcnxFace> |
| 202 | CcnxL3Protocol::GetFaceByNetDevice (Ptr<NetDevice> netDevice) const |
| 203 | { |
| 204 | BOOST_FOREACH (const Ptr<CcnxFace> &face, m_faces) // this function is not supposed to be called often, so linear search is fine |
| 205 | { |
| 206 | Ptr<CcnxNetDeviceFace> netDeviceFace = DynamicCast<CcnxNetDeviceFace> (face); |
| 207 | if (netDeviceFace == 0) continue; |
| 208 | |
| 209 | if (netDeviceFace->GetNetDevice () == netDevice) |
| 210 | return face; |
| 211 | } |
| 212 | return 0; |
| 213 | } |
| 214 | |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 215 | uint32_t |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 216 | CcnxL3Protocol::GetNFaces (void) const |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 217 | { |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 218 | return m_faces.size (); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 219 | } |
| 220 | |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 221 | void |
| 222 | CcnxL3Protocol::TransmittedDataTrace (Ptr<Packet> packet, |
| 223 | ContentObjectSource type, |
| 224 | Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face) |
| 225 | { |
| 226 | // a "small" inefficiency for logging purposes |
| 227 | Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> (); |
| 228 | static CcnxContentObjectTail tail; |
| 229 | packet->RemoveHeader (*header); |
| 230 | packet->RemoveTrailer (tail); |
| 231 | |
| 232 | m_transmittedDataTrace (header, packet/*payload*/, type, ccnx, face); |
| 233 | |
| 234 | packet->AddHeader (*header); |
| 235 | packet->AddTrailer (tail); |
| 236 | } |
| 237 | |
| 238 | |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 239 | // Callback from lower layer |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 240 | void |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 241 | CcnxL3Protocol::Receive (const Ptr<CcnxFace> &face, const Ptr<const Packet> &p) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 242 | { |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 243 | if (!face->IsUp ()) |
Alexander Afanasyev | 070aa48 | 2011-08-20 00:38:25 -0700 | [diff] [blame] | 244 | { |
| 245 | NS_LOG_LOGIC ("Dropping received packet -- interface is down"); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 246 | // m_dropTrace (p, INTERFACE_DOWN, m_node->GetObject<Ccnx> ()/*this*/, face); |
Alexander Afanasyev | 070aa48 | 2011-08-20 00:38:25 -0700 | [diff] [blame] | 247 | return; |
| 248 | } |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 249 | NS_LOG_LOGIC ("Packet from face " << *face << " received on node " << m_node->GetId ()); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 250 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 251 | Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 252 | try |
| 253 | { |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 254 | CcnxHeaderHelper::Type type = CcnxHeaderHelper::GetCcnxHeaderType (p); |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 255 | switch (type) |
| 256 | { |
| 257 | case CcnxHeaderHelper::INTEREST: |
| 258 | { |
| 259 | Ptr<CcnxInterestHeader> header = Create<CcnxInterestHeader> (); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 260 | |
| 261 | // Deserialization. Exception may be thrown |
| 262 | packet->RemoveHeader (*header); |
| 263 | NS_ASSERT_MSG (packet->GetSize () == 0, "Payload of Interests should be zero"); |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 264 | |
| 265 | if (header->GetNack () > 0) |
| 266 | OnNack (face, header, p/*original packet*/); |
| 267 | else |
| 268 | OnInterest (face, header, p/*original packet*/); |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 269 | break; |
| 270 | } |
| 271 | case CcnxHeaderHelper::CONTENT_OBJECT: |
| 272 | { |
| 273 | Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> (); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 274 | |
| 275 | static CcnxContentObjectTail contentObjectTrailer; //there is no data in this object |
| 276 | |
| 277 | // Deserialization. Exception may be thrown |
| 278 | packet->RemoveHeader (*header); |
| 279 | packet->RemoveTrailer (contentObjectTrailer); |
| 280 | |
| 281 | OnData (face, header, packet/*payload*/, p/*original packet*/); |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 282 | break; |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | // exception will be thrown if packet is not recognized |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 287 | } |
| 288 | catch (CcnxUnknownHeaderException) |
| 289 | { |
| 290 | NS_ASSERT_MSG (false, "Unknown CCNx header. Should not happen"); |
| 291 | } |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 292 | } |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 293 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 294 | void |
| 295 | CcnxL3Protocol::OnNack (const Ptr<CcnxFace> &face, |
| 296 | Ptr<CcnxInterestHeader> &header, |
| 297 | const Ptr<const Packet> &p) |
| 298 | { |
| 299 | NS_LOG_FUNCTION (face << header << p); |
| 300 | |
| 301 | // Huh... Ignore all this for now |
| 302 | |
| 303 | /*if( header->IsCongested () == false ) |
| 304 | m_pit->LeakBucket(incomingFace,1); |
| 305 | |
| 306 | |
| 307 | m_droppedInterestsTrace (header, DROP_CONGESTION, |
| 308 | m_node->GetObject<Ccnx> (), incomingFace); |
| 309 | |
| 310 | m_pit->modify(pitEntry, CcnxPitEntry::DeleteOutgoing(incomingFace));*/ |
| 311 | |
| 312 | // No matter is it duplicate or not, if it is a NACK message, remove all possible incoming |
| 313 | // entries for this interface (NACK means that neighbor gave up trying and there is no |
| 314 | // point of sending data in this direction) |
| 315 | |
| 316 | // NS_LOG_INFO("Before (header->IsNack()) && (pitEntry != m_pit->end ())"); |
| 317 | // if ((header->IsNack()) && (pitEntry != m_pit->end ())) |
| 318 | // { |
| 319 | // //m_pit->erase (pitEntry); |
| 320 | // NS_LOG_INFO("TRUE"); |
| 321 | // m_pit->modify(pitEntry, CcnxPitEntry::DeleteIncoming(incomingFace)); |
| 322 | // } |
| 323 | |
| 324 | // m_fib->modify (m_fib->iterator_to (pitEntry->m_fibEntry), |
| 325 | // CcnxFibEntry::UpdateStatus(incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW)); |
| 326 | |
| 327 | // if (!pitEntry.AreThereMoreFacesToTry ()) |
| 328 | // { |
| 329 | // BOOST_FOREACH (const CcnxPitEntryIncomingFace face, pitEntry.m_incoming) |
| 330 | // { |
| 331 | // // check all entries if the name of RIT entry matches the name of interest |
| 332 | // for (CcnxRitByNonce::type::iterator it = m_rit->begin(); it != m_rit->end(); it++) |
| 333 | // { |
| 334 | // if (it->m_prefix == iter->GetPrefix() ) |
| 335 | // { |
| 336 | // header->SetNonce(it->m_nonce); |
| 337 | // header->SetNack(true); |
| 338 | // SendInterest(face.m_face, header, packet->Copy()); |
| 339 | // } |
| 340 | // } |
| 341 | // } |
| 342 | |
| 343 | // m_pit->erase(pitEntry); |
| 344 | |
| 345 | // return; |
| 346 | // } |
| 347 | } |
| 348 | |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 349 | // Processing Interests |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 350 | // |
| 351 | // !!! Key point. |
| 352 | // !!! All interests should be answerred!!! Either later with data, immediately with data, or immediately with NACK |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 353 | void CcnxL3Protocol::OnInterest (const Ptr<CcnxFace> &incomingFace, |
| 354 | Ptr<CcnxInterestHeader> &header, |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 355 | const Ptr<const Packet> &packet) |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 356 | { |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 357 | NS_LOG_FUNCTION (incomingFace << header << packet); |
| 358 | // m_receivedInterestsTrace (header, m_node->GetObject<Ccnx> (), incomingFace); |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 359 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 360 | // Lookup of Pit (and associated Fib) entry for this Interest |
| 361 | const CcnxPitEntry &pitEntry; |
| 362 | bool isNew; |
| 363 | bool isDuplicated; |
| 364 | tie (pitEntry, isNew, isDuplicated) = m_pit->Lookup (*header); |
Ilya Moiseenko | d83eb0d | 2011-11-16 15:23:46 -0800 | [diff] [blame] | 365 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 366 | if (isDuplicated) |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 367 | { |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 368 | /** |
| 369 | * This condition will handle "routing" loops and also recently satisfied interests. |
| 370 | * Every time interest is satisfied, PIT entry (with empty incoming and outgoing faces) |
| 371 | * is kept for another small chunk of time. |
| 372 | */ |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 373 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 374 | // //Trace duplicate interest |
| 375 | // m_droppedInterestsTrace (header, NDN_DUPLICATE_INTEREST, m_node->GetObject<Ccnx> (), incomingFace); |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 376 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 377 | header->SetNack (CcnxInterestHeader::NACK_LOOP); |
| 378 | Ptr<Packet> packet = Create<Packet> (); |
| 379 | packet->AddHeader (*header); |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 380 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 381 | SendInterest (m_incomingFace, header, packet); |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 382 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 383 | // //Trace duplicate interest |
| 384 | // m_droppedInterestsTrace (header, NDN_DUPLICATE_INTEREST, m_node->GetObject<Ccnx> (), incomingFace); |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 385 | return; |
| 386 | } |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 387 | |
| 388 | Ptr<Packet> contentObject; |
| 389 | Ptr<CcnxContentObjectHeader> contentObjectHeader; |
| 390 | tie (contentObject, contentObjectHeader) = m_contentStore->Lookup (header); |
| 391 | if (contentObject != 0) |
| 392 | { |
| 393 | NS_ASSERT_MSG (pitEntry.m_incoming.size () == 0, |
| 394 | "Something strange. Data is cached, but size of incoming interests is not zero..."); |
| 395 | NS_ASSERT (contentObjectHeader != 0); |
| 396 | |
| 397 | NS_LOG_LOGIC("Found in cache"); |
| 398 | |
| 399 | // TransmittedDataTrace (contentObject, CACHED, |
| 400 | // m_node->GetObject<Ccnx> (), incomingFace); |
| 401 | SendContentObject (incomingFace, contentObjectHeader, contentObject); |
| 402 | |
| 403 | // Set pruning timout on PIT entry (instead of deleting the record) |
| 404 | m_pit->modify (m_pit->iterator_to (pitEntry), |
| 405 | boost::bind (&CcnxPitEntry::SetExpireTime, _1, |
| 406 | Simulator::Now () + m_pit->GetPitEntryPruningTimeout ())); |
| 407 | return; |
| 408 | } |
| 409 | |
| 410 | // \todo Detect retransmissions. Not yet sure how... |
Alexander Afanasyev | 070aa48 | 2011-08-20 00:38:25 -0700 | [diff] [blame] | 411 | |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 412 | // Data is not in cache |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 413 | CcnxPitEntryIncomingFaceContainer::type::iterator inFace = pitEntry.m_incoming.find (incomingFace); |
| 414 | CcnxPitEntryOutgoingFaceContainer::type::iterator outFace = pitEntry.m_outgoing.find (incomingFace); |
| 415 | |
| 416 | if (inFace != pitEntry.m_incoming.end ()) |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 417 | { |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 418 | // CcnxPitEntryIncomingFace.m_arrivalTime keeps track arrival time of the first packet... why? |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 419 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 420 | // this is almost definitely a retransmission. But should we trust the user on that? |
| 421 | } |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 422 | else |
| 423 | { |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 424 | m_pit->modify (m_pit->iterator_to (m_pitpitEntry), |
| 425 | iface = _1->m_incoming.insert (CcnxPitEntryIncoming (incomingFace, Simulator::Now ()))); |
| 426 | } |
| 427 | |
| 428 | if (outFace != pitEntry.m_outgoing.end ()) |
| 429 | { |
| 430 | // got a non-duplicate interest from the face we have sent interest to |
| 431 | // Probably, there is no point in waiting data from that face... Not sure yet |
| 432 | |
| 433 | // If we're expecting data from the interface we got the interest from ("producer" asks us for "his own" data) |
| 434 | // Mark interface YELLOW, but keep a small hope that data will come eventually. |
| 435 | |
| 436 | // ?? not sure if we need to do that ?? ... |
| 437 | |
| 438 | m_fib->modify(m_fib->iterator_to (pitEntry.m_fibEntry), |
| 439 | boost::bind (&CcnxFibEntry::UpdateStatus, |
| 440 | _1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW)); |
| 441 | |
| 442 | // suppress? |
| 443 | } |
| 444 | else if (pitEntry->m_outgoing.size() > 0) // Suppress this interest if we're still expecting data from some other face |
| 445 | |
| 446 | { |
| 447 | // We are already expecting data later in future. Suppress the interest |
| 448 | // m_droppedInterestsTrace (header, NDN_SUPPRESSED_INTEREST, m_node->GetObject<Ccnx> (), incomingFace); |
| 449 | return; |
| 450 | } |
| 451 | |
| 452 | ///////////////////////////////////////////////////////////////////// |
| 453 | // Propagate |
| 454 | ///////////////////////////////////////////////////////////////////// |
| 455 | |
| 456 | NS_ASSERT_MSG (m_forwardingStrategy != 0, "Need a forwarding protocol object to process packets"); |
| 457 | |
| 458 | bool propagated = m_forwardingStrategy-> |
| 459 | PropagateInterest (pitEntry, fibEntry,incomingFace, header, packet, |
| 460 | MakeCallback (&CcnxL3Protocol::SendInterest, this) |
| 461 | ); |
| 462 | |
| 463 | // ForwardingStrategy will try its best to forward packet to at least one interface. |
| 464 | // If no interests was propagated, then there is not other option for forwarding or |
| 465 | // ForwardingStrategy failed to find it. |
| 466 | if (!propagated) |
| 467 | { |
| 468 | Ptr<Packet> packet = Create<Packet> (); |
| 469 | header->SetNack (CcnxInterestHeader::NACK_CONGESTION); |
| 470 | packet.AddHeader (*header); |
| 471 | |
| 472 | while (pitEntry.m_incoming.size () > 0) |
| 473 | { |
| 474 | SendInterest (pitEntry.m_incoming.front ().m_face, header, packet->Copy ()); |
| 475 | |
| 476 | pitEntry.m_incoming.pop_front (); |
| 477 | |
| 478 | // m_droppedInterestsTrace (header, DROP_CONGESTION, |
| 479 | // m_node->GetObject<Ccnx> (), incomingFace); |
| 480 | } |
| 481 | |
| 482 | // Set pruning timout on PIT entry (instead of deleting the record) |
| 483 | m_pit->modify (m_pit->iterator_to (pitEntry), |
| 484 | boost::bind (&CcnxPitEntry::SetExpireTime, _1, |
| 485 | Simulator::Now () + m_pit->GetPitEntryPruningTimeout ())); |
| 486 | } |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 487 | } |
| 488 | |
| 489 | // Processing ContentObjects |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 490 | void CcnxL3Protocol::OnData (const Ptr<CcnxFace> &incomingFace, |
| 491 | Ptr<CcnxContentObjectHeader> &header, |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 492 | Ptr<Packet> &payload, |
| 493 | const Ptr<const Packet> &packet) |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 494 | { |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 495 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 496 | NS_LOG_FUNCTION (incomingFace << header, payload, packet); |
| 497 | // m_receivedDataTrace (header, payload, m_node->GetObject<Ccnx> ()/*this*/, incomingFace); |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 498 | |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 499 | // 1. Lookup PIT entry |
| 500 | try |
| 501 | { |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 502 | const CcnxPitEntry &pitEntry = m_pit->Lookup (*header); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 503 | |
| 504 | // Note that with MultiIndex we need to modify entries indirectly |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 505 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 506 | // Update metric status for the incoming interface in the corresponding FIB entry |
| 507 | m_fib->modify (m_fib->iterator_to (pitEntry.m_fibEntry), |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 508 | boost::bind (CcnxFibEntry::UpdateStatus, _1, incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN)); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 509 | |
| 510 | // Add or update entry in the content store |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 511 | m_contentStore->Add (header, payload); |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 512 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 513 | CcnxPitEntryOutgoingFaceContainer::type::iterator out = pitEntry.m_outgoing.find (incomingFace); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 514 | |
| 515 | // If we have sent interest for this data via this face, then update stats. |
| 516 | if (out != pitEntry.m_outgoing.end ()) |
| 517 | { |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 518 | m_fib->modify (m_fib->iterator_to (pitEntry.m_fibEntry), |
| 519 | boost::bind (&CcnxFibEntry::UpdateRtt, |
| 520 | _1, |
| 521 | Simulator::Now () - out->m_sendTime)); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 522 | } |
| 523 | else |
| 524 | { |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 525 | // Unsolicited data, but we're interested in it... should we get it? |
| 526 | // Potential hole for attacks |
| 527 | |
| 528 | NS_LOG_ERROR ("Node "<< m_node->GetId() << |
| 529 | ". PIT entry for "<< header->GetName ()<<" is valid, " |
| 530 | "but outgoing entry for interface "<< incomingFace <<" doesn't exist\n"); |
| 531 | |
| 532 | NS_ASSERT (false); // temporary put false here |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 533 | } |
| 534 | |
| 535 | //satisfy all pending incoming Interests |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 536 | while (pitEntry.m_incoming.size () > 0) |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 537 | { |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 538 | if (pitEntry.m_incoming.front ().m_face != incomingFace) |
| 539 | SendInterest (pitEntry.m_incoming.front ().m_face, header, packet->Copy ()); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 540 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 541 | pitEntry.m_incoming.pop_front (); |
| 542 | |
| 543 | // m_transmittedDataTrace (header, payload, FORWARDED, m_node->GetObject<Ccnx> (), interest.m_face); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 544 | } |
| 545 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 546 | // Set pruning timout on PIT entry (instead of deleting the record) |
| 547 | m_pit->modify (m_pit->iterator_to (pitEntry), |
| 548 | boost::bind (&CcnxPitEntry::SetExpireTime, _1, |
| 549 | Simulator::Now () + m_pit->GetPitEntryPruningTimeout ())); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 550 | } |
| 551 | catch (CcnxPitEntryNotFound) |
| 552 | { |
| 553 | // 2. Drop data packet if PIT entry is not found |
| 554 | // (unsolicited data packets should not "poison" content store) |
| 555 | |
| 556 | //drop dulicated or not requested data packet |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 557 | // m_droppedDataTrace (header, payload, NDN_UNSOLICITED_DATA, m_node->GetObject<Ccnx> (), incomingFace); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 558 | return; // do not process unsoliced data packets |
| 559 | } |
| 560 | } |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 561 | |
| 562 | void |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 563 | CcnxL3Protocol::SendInterest (const Ptr<CcnxFace> &face, |
| 564 | const Ptr<CcnxInterestHeader> &header, |
| 565 | const Ptr<Packet> &packet) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 566 | { |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 567 | NS_LOG_FUNCTION (this << "packet: " << &packet << ", face: "<< &face); |
Alexander Afanasyev | 070aa48 | 2011-08-20 00:38:25 -0700 | [diff] [blame] | 568 | NS_ASSERT_MSG (face != 0, "Face should never be NULL"); |
| 569 | |
| 570 | if (face->IsUp ()) |
| 571 | { |
| 572 | NS_LOG_LOGIC ("Sending via face " << &face); // |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 573 | // m_transmittedInterestsTrace (header, m_node->GetObject<Ccnx> (), face); |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 574 | face->Send (packet); |
| 575 | } |
| 576 | else |
| 577 | { |
| 578 | NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << &face); |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 579 | // m_droppedInterestsTrace (header, INTERFACE_DOWN, m_node->GetObject<Ccnx> (), face); |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 580 | } |
| 581 | } |
| 582 | |
| 583 | void |
| 584 | CcnxL3Protocol::SendContentObject (const Ptr<CcnxFace> &face, |
| 585 | const Ptr<CcnxContentObjectHeader> &header, |
| 586 | const Ptr<Packet> &packet) |
| 587 | { |
| 588 | NS_LOG_FUNCTION (this << "packet: " << &packet << ", face: "<< &face); |
| 589 | NS_ASSERT_MSG (face != 0, "Face should never be NULL"); |
| 590 | |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 591 | if (face->IsUp ()) |
| 592 | { |
| 593 | NS_LOG_LOGIC ("Sending via face " << &face); // |
Alexander Afanasyev | a67e28c | 2011-08-31 21:16:25 -0700 | [diff] [blame] | 594 | // m_txTrace (packet, m_node->GetObject<Ccnx> (), face); |
Alexander Afanasyev | 070aa48 | 2011-08-20 00:38:25 -0700 | [diff] [blame] | 595 | face->Send (packet); |
| 596 | } |
| 597 | else |
| 598 | { |
| 599 | NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << &face); |
Alexander Afanasyev | 78cf0c9 | 2011-09-01 19:57:14 -0700 | [diff] [blame] | 600 | // m_dropTrace (packet, INTERFACE_DOWN, m_node->GetObject<Ccnx> (), face); |
Alexander Afanasyev | 070aa48 | 2011-08-20 00:38:25 -0700 | [diff] [blame] | 601 | } |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 602 | } |
| 603 | |
Ilya Moiseenko | 172763c | 2011-10-28 13:21:53 -0700 | [diff] [blame] | 604 | Ptr<CcnxPit> |
| 605 | CcnxL3Protocol::GetPit() |
| 606 | { |
| 607 | return m_pit; |
| 608 | } |
Ilya Moiseenko | d83eb0d | 2011-11-16 15:23:46 -0800 | [diff] [blame] | 609 | |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame^] | 610 | // void |
| 611 | // CcnxL3Protocol::ScheduleLeakage() |
| 612 | // { |
| 613 | // m_pit->LeakBuckets(); |
| 614 | // Time interval = MilliSeconds (NDN_INTEREST_RESET_PERIOD); |
| 615 | |
| 616 | // Simulator::Schedule (interval, &CcnxL3Protocol::ScheduleLeakage, this); |
| 617 | // } |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 618 | } //namespace ns3 |