blob: a79efde19215c354827c1b64747352dc9b3da23d [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyevab1d5602011-08-17 19:17:18 -07002/*
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 */
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070020
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070021#include "ccnx-l3-protocol.h"
22
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070023#include "ns3/packet.h"
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070024#include "ns3/node.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070025#include "ns3/log.h"
26#include "ns3/callback.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070027#include "ns3/uinteger.h"
28#include "ns3/trace-source-accessor.h"
29#include "ns3/object-vector.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070030#include "ns3/boolean.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070031
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070032#include "ns3/ccnx-header-helper.h"
33
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070034#include "ccnx-face.h"
35#include "ccnx-route.h"
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070036#include "ccnx-forwarding-strategy.h"
37#include "ccnx-interest-header.h"
38#include "ccnx-content-object-header.h"
39
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070040#include <boost/foreach.hpp>
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070041
42NS_LOG_COMPONENT_DEFINE ("CcnxL3Protocol");
43
44namespace ns3 {
45
Alexander Afanasyev7112f482011-08-17 14:05:57 -070046const uint16_t CcnxL3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070047
48NS_OBJECT_ENSURE_REGISTERED (CcnxL3Protocol);
49
50TypeId
51CcnxL3Protocol::GetTypeId (void)
52{
53 static TypeId tid = TypeId ("ns3::CcnxL3Protocol")
54 .SetParent<Ccnx> ()
Alexander Afanasyev070aa482011-08-20 00:38:25 -070055 .SetGroupName ("Ccnx")
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070056 .AddConstructor<CcnxL3Protocol> ()
Alexander Afanasyev7112f482011-08-17 14:05:57 -070057 // .AddTraceSource ("Tx", "Send ccnx packet to outgoing interface.",
58 // MakeTraceSourceAccessor (&CcnxL3Protocol::m_txTrace))
59 // .AddTraceSource ("Rx", "Receive ccnx packet from incoming interface.",
60 // MakeTraceSourceAccessor (&CcnxL3Protocol::m_rxTrace))
61 // .AddTraceSource ("Drop", "Drop ccnx packet",
62 // MakeTraceSourceAccessor (&CcnxL3Protocol::m_dropTrace))
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070063 .AddAttribute ("InterfaceList", "The set of Ccnx interfaces associated to this Ccnx stack.",
64 ObjectVectorValue (),
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070065 MakeObjectVectorAccessor (&CcnxL3Protocol::m_faces),
66 MakeObjectVectorChecker<CcnxFace> ())
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070067
Alexander Afanasyev7112f482011-08-17 14:05:57 -070068 // .AddTraceSource ("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission",
69 // MakeTraceSourceAccessor (&CcnxL3Protocol::m_sendOutgoingTrace))
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070070
71 ;
72 return tid;
73}
74
75CcnxL3Protocol::CcnxL3Protocol()
Alexander Afanasyevab1d5602011-08-17 19:17:18 -070076: m_faceCounter (0)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070077{
78 NS_LOG_FUNCTION (this);
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070079
80 m_rit = CreateObject<CcnxRit> ();
81 m_pit = CreateObject<CcnxPit> ();
82 m_contentStore = CreateObject<CcnxContentStore> ();
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070083}
84
85CcnxL3Protocol::~CcnxL3Protocol ()
86{
87 NS_LOG_FUNCTION (this);
88}
89
90void
91CcnxL3Protocol::SetNode (Ptr<Node> node)
92{
93 m_node = node;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070094}
95
96/*
97 * This method is called by AddAgregate and completes the aggregation
98 * by setting the node in the ccnx stack
99 */
100void
101CcnxL3Protocol::NotifyNewAggregate ()
102{
103 if (m_node == 0)
104 {
105 Ptr<Node>node = this->GetObject<Node>();
106 // verify that it's a valid node and that
107 // the node has not been set before
108 if (node != 0)
109 {
110 this->SetNode (node);
111 }
112 }
113 Object::NotifyNewAggregate ();
114}
115
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700116void
117CcnxL3Protocol::DoDispose (void)
118{
119 NS_LOG_FUNCTION (this);
120
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700121 for (CcnxFaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700122 {
123 *i = 0;
124 }
Alexander Afanasyev98256102011-08-14 01:00:02 -0700125 m_faces.clear ();
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700126 m_node = 0;
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700127 // m_forwardingStrategy = 0;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700128 Object::DoDispose ();
129}
130
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700131void
132CcnxL3Protocol::SetForwardingStrategy (Ptr<CcnxForwardingStrategy> forwardingStrategy)
133{
134 NS_LOG_FUNCTION (this);
135 m_forwardingStrategy = forwardingStrategy;
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700136 // m_forwardingStrategy->SetCcnx (this);
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700137}
138
139Ptr<CcnxForwardingStrategy>
140CcnxL3Protocol::GetForwardingStrategy (void) const
141{
142 return m_forwardingStrategy;
143}
144
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700145uint32_t
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700146CcnxL3Protocol::AddFace (const Ptr<CcnxFace> &face)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700147{
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700148 NS_LOG_FUNCTION (this << &face);
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700149
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700150 face->SetNode (m_node);
Alexander Afanasyevab1d5602011-08-17 19:17:18 -0700151 face->SetId (m_faceCounter); // sets a unique ID of the face. This ID serves only informational purposes
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700152
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700153 // ask face to register in lower-layer stack
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700154 face->RegisterProtocolHandler (MakeCallback (&CcnxL3Protocol::Receive, this));
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700155
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700156 m_faces.push_back (face);
Alexander Afanasyevab1d5602011-08-17 19:17:18 -0700157 m_faceCounter ++;
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -0700158 return face->GetId ();
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700159}
160
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700161Ptr<CcnxFace>
Alexander Afanasyev98256102011-08-14 01:00:02 -0700162CcnxL3Protocol::GetFace (uint32_t index) const
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700163{
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700164 BOOST_FOREACH (const Ptr<CcnxFace> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700165 {
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700166 if (face->GetId () == index)
167 return face;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700168 }
169 return 0;
170}
171
172uint32_t
Alexander Afanasyev98256102011-08-14 01:00:02 -0700173CcnxL3Protocol::GetNFaces (void) const
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700174{
Alexander Afanasyev98256102011-08-14 01:00:02 -0700175 return m_faces.size ();
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700176}
177
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700178void
179CcnxL3Protocol::TransmittedDataTrace (Ptr<Packet> packet,
180 ContentObjectSource type,
181 Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
182{
183 // a "small" inefficiency for logging purposes
184 Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
185 static CcnxContentObjectTail tail;
186 packet->RemoveHeader (*header);
187 packet->RemoveTrailer (tail);
188
189 m_transmittedDataTrace (header, packet/*payload*/, type, ccnx, face);
190
191 packet->AddHeader (*header);
192 packet->AddTrailer (tail);
193}
194
195
Alexander Afanasyev98256102011-08-14 01:00:02 -0700196// Callback from lower layer
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700197void
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -0700198CcnxL3Protocol::Receive (const Ptr<CcnxFace> &face, const Ptr<const Packet> &p)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700199{
Alexander Afanasyev070aa482011-08-20 00:38:25 -0700200 if (face->IsUp ())
201 {
202 NS_LOG_LOGIC ("Dropping received packet -- interface is down");
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700203 // m_dropTrace (p, INTERFACE_DOWN, m_node->GetObject<Ccnx> ()/*this*/, face);
Alexander Afanasyev070aa482011-08-20 00:38:25 -0700204 return;
205 }
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700206 NS_LOG_LOGIC ("Packet from face " << &face << " received on node " << m_node->GetId ());
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700207
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700208 Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700209 try
210 {
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700211 CcnxHeaderHelper::Type type = CcnxHeaderHelper::CreateCorrectCcnxHeader (p);
212 switch (type)
213 {
214 case CcnxHeaderHelper::INTEREST:
215 {
216 Ptr<CcnxInterestHeader> header = Create<CcnxInterestHeader> ();
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700217
218 // Deserialization. Exception may be thrown
219 packet->RemoveHeader (*header);
220 NS_ASSERT_MSG (packet->GetSize () == 0, "Payload of Interests should be zero");
221
222 OnInterest (face, header, p/*original packet*/);
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700223 break;
224 }
225 case CcnxHeaderHelper::CONTENT_OBJECT:
226 {
227 Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700228
229 static CcnxContentObjectTail contentObjectTrailer; //there is no data in this object
230
231 // Deserialization. Exception may be thrown
232 packet->RemoveHeader (*header);
233 packet->RemoveTrailer (contentObjectTrailer);
234
235 OnData (face, header, packet/*payload*/, p/*original packet*/);
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700236 break;
237 }
238 }
239
240 // exception will be thrown if packet is not recognized
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700241 }
242 catch (CcnxUnknownHeaderException)
243 {
244 NS_ASSERT_MSG (false, "Unknown CCNx header. Should not happen");
245 }
Alexander Afanasyev98256102011-08-14 01:00:02 -0700246}
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700247
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700248// Processing Interests
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700249void CcnxL3Protocol::OnInterest (const Ptr<CcnxFace> &incomingFace,
250 Ptr<CcnxInterestHeader> &header,
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700251 const Ptr<const Packet> &packet)
Alexander Afanasyev98256102011-08-14 01:00:02 -0700252{
Alexander Afanasyev070aa482011-08-20 00:38:25 -0700253 NS_LOG_LOGIC ("Receiving interest from " << &incomingFace);
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700254 m_receivedInterestsTrace (header, m_node->GetObject<Ccnx> ()/*this*/, incomingFace);
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700255
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700256 if (m_rit->WasRecentlySatisfied (*header))
257 {
258 m_droppedInterestsTrace (header, NDN_DUPLICATE_INTEREST,
259 m_node->GetObject<Ccnx> ()/*this*/, incomingFace);
260 // loop?
261 return;
262 }
263 m_rit->SetRecentlySatisfied (*header);
264
265 Ptr<Packet> contentObject = m_contentStore->Lookup (header);
266 if (contentObject != 0)
267 {
268 TransmittedDataTrace (contentObject, CACHED,
269 m_node->GetObject<Ccnx> ()/*this*/, incomingFace);
270 incomingFace->Send (contentObject);
271 return;
272 }
Alexander Afanasyev070aa482011-08-20 00:38:25 -0700273
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700274 CcnxPitEntry pitEntry = m_pit->Lookup (*header);
275
276 CcnxPitEntryIncomingFaceContainer::type::iterator inFace = pitEntry.m_incoming.find (incomingFace);
277 CcnxPitEntryOutgoingFaceContainer::type::iterator outFace = pitEntry.m_outgoing.find (incomingFace);
278
279 // suppress interest if
280 if (pitEntry.m_incoming.size () == 0 || // new PIT entry
281 inFace ==pitEntry.m_incoming.end ()) // existing entry, but interest received via different face
282 {
283 m_droppedInterestsTrace (header, NDN_SUPPRESSED_INTEREST,
284 m_node->GetObject<Ccnx> ()/*this*/, incomingFace);
285 return;
286 }
287
288 NS_ASSERT_MSG (m_forwardingStrategy != 0, "Need a forwarding protocol object to process packets");
289
290 /*bool propagated = */m_forwardingStrategy->
291 PropagateInterest (incomingFace, header, packet,
292 MakeCallback (&CcnxL3Protocol::SendInterest, this)
293 );
294
295 // // If interest wasn't propagated further (probably, a limit is reached),
296 // // prune and delete PIT entry if there are no outstanding interests.
297 // // Stop processing otherwise.
298 // if( !propagated && pitEntry.numberOfPromisingInterests()==0 )
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700299 // {
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700300 // // printf( "Node %d. Pruning after unsuccessful try to forward an interest\n", _node->nodeId );
301
302 // BOOST_FOREACH (const CcnxPitEntryIncomingFace face, pitEntry.m_incoming)
303 // {
304 // // send prune
305 // }
306 // m_pit->erase (m_pit->iterator_to (pitEntry));
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700307 // }
308}
309
310// Processing ContentObjects
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700311void CcnxL3Protocol::OnData (const Ptr<CcnxFace> &incomingFace,
312 Ptr<CcnxContentObjectHeader> &header,
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700313 Ptr<Packet> &payload,
314 const Ptr<const Packet> &packet)
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700315{
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700316
Alexander Afanasyev070aa482011-08-20 00:38:25 -0700317 NS_LOG_LOGIC ("Receiving contentObject from " << &incomingFace);
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700318 m_receivedDataTrace (header, payload, m_node->GetObject<Ccnx> ()/*this*/, incomingFace);
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700319
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700320 // 1. Lookup PIT entry
321 try
322 {
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700323 const CcnxPitEntry &pitEntry = m_pit->Lookup (*header);
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700324
325 // Note that with MultiIndex we need to modify entries indirectly
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700326
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700327 // Update metric status for the incoming interface in the corresponding FIB entry
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700328 m_pit->modify (m_pit->iterator_to (pitEntry),
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700329 CcnxPitEntry::UpdateFibStatus (incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN));
330
331 // Add or update entry in the content store
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700332 m_contentStore->Add (header, payload);
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700333
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700334 CcnxPitEntryOutgoingFaceContainer::type::iterator
335 out = pitEntry.m_outgoing.find (incomingFace);
336
337 // If we have sent interest for this data via this face, then update stats.
338 if (out != pitEntry.m_outgoing.end ())
339 {
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700340 m_pit->modify (m_pit->iterator_to (pitEntry), CcnxPitEntry::EstimateRttAndRemoveFace(out));
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700341 // face will be removed in the above call
342 }
343 else
344 {
345 NS_LOG_WARN ("Node "<< m_node->GetId() <<
346 ". PIT entry for "<< header->GetName ()<<" is valid, "
347 "but outgoing entry for interface "<< incomingFace <<" doesn't exist\n");
348 }
349
350 //satisfy all pending incoming Interests
351 BOOST_FOREACH (const CcnxPitEntryIncomingFace &interest, pitEntry.m_incoming)
352 {
353 if (interest.m_face == incomingFace) continue;
354
355 // may not work either because of 'const' thing
356 interest.m_face->Send (packet->Copy ()); // unfortunately, we have to copy packet...
357 m_transmittedDataTrace (header, payload, FORWARDED, m_node->GetObject<Ccnx> (), interest.m_face);
358 }
359
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700360 m_pit->modify (m_pit->iterator_to (pitEntry), CcnxPitEntry::ClearIncoming()); // satisfy all incoming interests
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700361
362 if( pitEntry.m_outgoing.size()==0 ) // remove PIT when all outgoing interests are "satisfied"
363 {
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700364 m_pit->erase (m_pit->iterator_to (pitEntry));
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700365 }
366
367 }
368 catch (CcnxPitEntryNotFound)
369 {
370 // 2. Drop data packet if PIT entry is not found
371 // (unsolicited data packets should not "poison" content store)
372
373 //drop dulicated or not requested data packet
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700374 m_droppedDataTrace (header, payload, NDN_UNSOLICITED_DATA, m_node->GetObject<Ccnx> (), incomingFace);
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700375 return; // do not process unsoliced data packets
376 }
377}
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700378
379void
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700380CcnxL3Protocol::SendInterest (const Ptr<CcnxFace> &face,
381 const Ptr<CcnxInterestHeader> &header,
382 const Ptr<Packet> &packet)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700383{
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700384 NS_LOG_FUNCTION (this << "packet: " << &packet << ", face: "<< &face);
Alexander Afanasyev070aa482011-08-20 00:38:25 -0700385 NS_ASSERT_MSG (face != 0, "Face should never be NULL");
386
387 if (face->IsUp ())
388 {
389 NS_LOG_LOGIC ("Sending via face " << &face); //
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700390 m_transmittedInterestsTrace (header, m_node->GetObject<Ccnx> (), face);
391 face->Send (packet);
392 }
393 else
394 {
395 NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << &face);
396 m_droppedInterestsTrace (header, INTERFACE_DOWN, m_node->GetObject<Ccnx> (), face);
397 }
398}
399
400void
401CcnxL3Protocol::SendContentObject (const Ptr<CcnxFace> &face,
402 const Ptr<CcnxContentObjectHeader> &header,
403 const Ptr<Packet> &packet)
404{
405 NS_LOG_FUNCTION (this << "packet: " << &packet << ", face: "<< &face);
406 NS_ASSERT_MSG (face != 0, "Face should never be NULL");
407
408 NS_ASSERT_MSG (false, "Should not be called for now");
409
410 if (face->IsUp ())
411 {
412 NS_LOG_LOGIC ("Sending via face " << &face); //
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700413 // m_txTrace (packet, m_node->GetObject<Ccnx> (), face);
Alexander Afanasyev070aa482011-08-20 00:38:25 -0700414 face->Send (packet);
415 }
416 else
417 {
418 NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << &face);
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700419 // m_dropTrace (packet, INTERFACE_DOWN, m_node->GetObject<Ccnx> (), face);
Alexander Afanasyev070aa482011-08-20 00:38:25 -0700420 }
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700421}
422
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700423} //namespace ns3