blob: bf1230cd22e2e0a81fa630809341092527830436 [file] [log] [blame]
Alexander Afanasyev08d984e2011-08-13 19:20:22 -07001// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
2//
3// Copyright (c) 2006 Georgia Tech Research Corporation
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: George F. Riley<riley@ece.gatech.edu>
19//
20
21#include "ns3/packet.h"
22#include "ns3/log.h"
23#include "ns3/callback.h"
24#include "ns3/ccnx-address.h"
25#include "ns3/ccnx-route.h"
26#include "ns3/node.h"
27#include "ns3/socket.h"
28#include "ns3/net-device.h"
29#include "ns3/uinteger.h"
30#include "ns3/trace-source-accessor.h"
31#include "ns3/object-vector.h"
32#include "ns3/ccnx-header.h"
33#include "ns3/boolean.h"
34//#include "ns3/ccnx-routing-table-entry.h"
35
36#include "arp-l3-protocol.h"
37#include "ccnx-l3-protocol.h"
38#include "ccnx-interface.h"
39
40NS_LOG_COMPONENT_DEFINE ("CcnxL3Protocol");
41
42namespace ns3 {
43
44const uint16_t CcnxL3Protocol::PROT_NUMBER = 0x7777;
45
46NS_OBJECT_ENSURE_REGISTERED (CcnxL3Protocol);
47
48TypeId
49CcnxL3Protocol::GetTypeId (void)
50{
51 static TypeId tid = TypeId ("ns3::CcnxL3Protocol")
52 .SetParent<Ccnx> ()
53 .AddConstructor<CcnxL3Protocol> ()
54 .AddTraceSource ("Tx", "Send ccnx packet to outgoing interface.",
55 MakeTraceSourceAccessor (&CcnxL3Protocol::m_txTrace))
56 .AddTraceSource ("Rx", "Receive ccnx packet from incoming interface.",
57 MakeTraceSourceAccessor (&CcnxL3Protocol::m_rxTrace))
58 .AddTraceSource ("Drop", "Drop ccnx packet",
59 MakeTraceSourceAccessor (&CcnxL3Protocol::m_dropTrace))
60 .AddAttribute ("InterfaceList", "The set of Ccnx interfaces associated to this Ccnx stack.",
61 ObjectVectorValue (),
62 MakeObjectVectorAccessor (&CcnxL3Protocol::m_interfaces),
63 MakeObjectVectorChecker<CcnxInterface> ())
64
65 .AddTraceSource ("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission",
66 MakeTraceSourceAccessor (&CcnxL3Protocol::m_sendOutgoingTrace))
67
68 ;
69 return tid;
70}
71
72CcnxL3Protocol::CcnxL3Protocol()
73 : m_identification (0)
74{
75 NS_LOG_FUNCTION (this);
76}
77
78CcnxL3Protocol::~CcnxL3Protocol ()
79{
80 NS_LOG_FUNCTION (this);
81}
82
83void
84CcnxL3Protocol::SetNode (Ptr<Node> node)
85{
86 m_node = node;
87 // Add a LoopbackNetDevice if needed, and an CcnxInterface on top of it
88 SetupLoopback ();
89}
90
91/*
92 * This method is called by AddAgregate and completes the aggregation
93 * by setting the node in the ccnx stack
94 */
95void
96CcnxL3Protocol::NotifyNewAggregate ()
97{
98 if (m_node == 0)
99 {
100 Ptr<Node>node = this->GetObject<Node>();
101 // verify that it's a valid node and that
102 // the node has not been set before
103 if (node != 0)
104 {
105 this->SetNode (node);
106 }
107 }
108 Object::NotifyNewAggregate ();
109}
110
111// void
112// CcnxL3Protocol::SetRoutingProtocol (Ptr<CcnxRoutingProtocol> routingProtocol)
113// {
114// NS_LOG_FUNCTION (this);
115// m_routingProtocol = routingProtocol;
116// m_routingProtocol->SetCcnx (this);
117// }
118
119
120// Ptr<CcnxRoutingProtocol>
121// CcnxL3Protocol::GetRoutingProtocol (void) const
122// {
123// return m_routingProtocol;
124// }
125
126void
127CcnxL3Protocol::DoDispose (void)
128{
129 NS_LOG_FUNCTION (this);
130
131 for (CcnxInterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i)
132 {
133 *i = 0;
134 }
135 m_interfaces.clear ();
136 m_node = 0;
137 // m_routingProtocol = 0;
138 Object::DoDispose ();
139}
140
141uint32_t
142CcnxL3Protocol::AddInterface (Ptr<NetDevice> device)
143{
144 NS_LOG_FUNCTION (this << &device);
145
146 Ptr<Node> node = GetObject<Node> ();
147 node->RegisterProtocolHandler (MakeCallback (&CcnxL3Protocol::Receive, this),
148 CcnxL3Protocol::PROT_NUMBER, device, true);
149
150 // ccnx doesn't need arp protocol to run. Everything is broadcast!
151 // node->RegisterProtocolHandler (MakeCallback (&ArpL3Protocol::Receive, PeekPointer (GetObject<ArpL3Protocol> ())),
152 // ArpL3Protocol::PROT_NUMBER, device, true);
153
154 Ptr<CcnxInterface> interface = CreateObject<CcnxInterface> ();
155 interface->SetNode (m_node);
156 interface->SetDevice (device);
157 // interface->SetForwarding (m_ipForward);
158 return AddCcnxInterface (interface);
159}
160
161uint32_t
162CcnxL3Protocol::AddCcnxInterface (Ptr<CcnxInterface>interface)
163{
164 NS_LOG_FUNCTION (this << interface);
165 uint32_t index = m_interfaces.size ();
166 m_interfaces.push_back (interface);
167 return index;
168}
169
170Ptr<CcnxInterface>
171CcnxL3Protocol::GetInterface (uint32_t index) const
172{
173 if (index < m_interfaces.size ())
174 {
175 return m_interfaces[index];
176 }
177 return 0;
178}
179
180uint32_t
181CcnxL3Protocol::GetNInterfaces (void) const
182{
183 return m_interfaces.size ();
184}
185
186int32_t
187CcnxL3Protocol::GetInterfaceForDevice (
188 Ptr<const NetDevice> device) const
189{
190 int32_t interface = 0;
191 for (CcnxInterfaceList::const_iterator i = m_interfaces.begin ();
192 i != m_interfaces.end ();
193 i++, interface++)
194 {
195 if ((*i)->GetDevice () == device)
196 {
197 return interface;
198 }
199 }
200
201 return -1;
202}
203
204void
205CcnxL3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
206 const Address &to, NetDevice::PacketType packetType)
207{
208 NS_LOG_FUNCTION (this << &device << p << protocol << from);
209
210 NS_LOG_LOGIC ("Packet from " << from << " received on node " <<
211 m_node->GetId ());
212
213 uint32_t interface = 0;
214 Ptr<Packet> packet = p->Copy ();
215
216 Ptr<CcnxInterface> ccnxInterface;
217 for (CcnxInterfaceList::const_iterator i = m_interfaces.begin ();
218 i != m_interfaces.end ();
219 i++, interface++)
220 {
221 ccnxInterface = *i;
222 if (ccnxInterface->GetDevice () == device)
223 {
224 if (ccnxInterface->IsUp ())
225 {
226 m_rxTrace (packet, m_node->GetObject<Ccnx> (), interface);
227 break;
228 }
229 else
230 {
231 NS_LOG_LOGIC ("Dropping received packet -- interface is down");
232 CcnxHeader ipHeader;
233 packet->RemoveHeader (ipHeader);
234 m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), interface);
235 return;
236 }
237 }
238 }
239
240 CcnxHeader ipHeader;
241 if (Node::ChecksumEnabled ())
242 {
243 ipHeader.EnableChecksum ();
244 }
245 packet->RemoveHeader (ipHeader);
246
247 // Trim any residual frame padding from underlying devices
248 if (ipHeader.GetPayloadSize () < packet->GetSize ())
249 {
250 packet->RemoveAtEnd (packet->GetSize () - ipHeader.GetPayloadSize ());
251 }
252
253 if (!ipHeader.IsChecksumOk ())
254 {
255 NS_LOG_LOGIC ("Dropping received packet -- checksum not ok");
256 m_dropTrace (ipHeader, packet, DROP_BAD_CHECKSUM, m_node->GetObject<Ccnx> (), interface);
257 return;
258 }
259
260 for (SocketList::iterator i = m_sockets.begin (); i != m_sockets.end (); ++i)
261 {
262 NS_LOG_LOGIC ("Forwarding to raw socket");
263 Ptr<CcnxRawSocketImpl> socket = *i;
264 socket->ForwardUp (packet, ipHeader, ccnxInterface);
265 }
266
267 NS_ASSERT_MSG (m_routingProtocol != 0, "Need a routing protocol object to process packets");
268 if (!m_routingProtocol->RouteInput (packet, ipHeader, device,
269 MakeCallback (&CcnxL3Protocol::IpForward, this),
270 MakeCallback (&CcnxL3Protocol::IpMulticastForward, this),
271 MakeCallback (&CcnxL3Protocol::LocalDeliver, this),
272 MakeCallback (&CcnxL3Protocol::RouteInputError, this)
273 ))
274 {
275 NS_LOG_WARN ("No route found for forwarding packet. Drop.");
276 m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), interface);
277 }
278
279
280}
281
282// void
283// CcnxL3Protocol::SendWithHeader (Ptr<Packet> packet,
284// CcnxHeader ipHeader,
285// Ptr<CcnxRoute> route)
286// {
287// NS_LOG_FUNCTION (this << packet << ipHeader << route);
288// SendRealOut (route, packet, ipHeader);
289// }
290
291void
292CcnxL3Protocol::Send (Ptr<Packet> packet,
293 Ptr<CcnxRoute> route)
294{
295 NS_LOG_FUNCTION (this << packet << route);
296
297 // CcnxHeader ipHeader;
298 // bool mayFragment = true;
299 // uint8_t ttl = m_defaultTtl;
300 // SocketIpTtlTag tag;
301 // bool found = packet->RemovePacketTag (tag);
302 // if (found)
303 // {
304 // ttl = tag.GetTtl ();
305 // }
306
307 // // Handle a few cases:
308 // // 1) packet is destined to limited broadcast address
309 // // 2) packet is destined to a subnet-directed broadcast address
310 // // 3) packet is not broadcast, and is passed in with a route entry
311 // // 4) packet is not broadcast, and is passed in with a route entry but route->GetGateway is not set (e.g., on-demand)
312 // // 5) packet is not broadcast, and route is NULL (e.g., a raw socket call, or ICMP)
313
314 // // 1) packet is destined to limited broadcast address or link-local multicast address
315 // if (destination.IsBroadcast () || destination.IsLocalMulticast ())
316 // {
317 // NS_LOG_LOGIC ("CcnxL3Protocol::Send case 1: limited broadcast");
318 // ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
319 // uint32_t ifaceIndex = 0;
320 // for (CcnxInterfaceList::iterator ifaceIter = m_interfaces.begin ();
321 // ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++)
322 // {
323 // Ptr<CcnxInterface> outInterface = *ifaceIter;
324 // Ptr<Packet> packetCopy = packet->Copy ();
325
326 // NS_ASSERT (packetCopy->GetSize () <= outInterface->GetDevice ()->GetMtu ());
327
328 // m_sendOutgoingTrace (ipHeader, packetCopy, ifaceIndex);
329 // packetCopy->AddHeader (ipHeader);
330 // m_txTrace (packetCopy, m_node->GetObject<Ccnx> (), ifaceIndex);
331 // outInterface->Send (packetCopy, destination);
332 // }
333 // return;
334 // }
335
336 // // 2) check: packet is destined to a subnet-directed broadcast address
337 // uint32_t ifaceIndex = 0;
338 // for (CcnxInterfaceList::iterator ifaceIter = m_interfaces.begin ();
339 // ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++)
340 // {
341 // Ptr<CcnxInterface> outInterface = *ifaceIter;
342 // for (uint32_t j = 0; j < GetNAddresses (ifaceIndex); j++)
343 // {
344 // CcnxInterfaceAddress ifAddr = GetAddress (ifaceIndex, j);
345 // NS_LOG_LOGIC ("Testing address " << ifAddr.GetLocal () << " with mask " << ifAddr.GetMask ());
346 // if (destination.IsSubnetDirectedBroadcast (ifAddr.GetMask ()) &&
347 // destination.CombineMask (ifAddr.GetMask ()) == ifAddr.GetLocal ().CombineMask (ifAddr.GetMask ()) )
348 // {
349 // NS_LOG_LOGIC ("CcnxL3Protocol::Send case 2: subnet directed bcast to " << ifAddr.GetLocal ());
350 // ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
351 // Ptr<Packet> packetCopy = packet->Copy ();
352 // m_sendOutgoingTrace (ipHeader, packetCopy, ifaceIndex);
353 // packetCopy->AddHeader (ipHeader);
354 // m_txTrace (packetCopy, m_node->GetObject<Ccnx> (), ifaceIndex);
355 // outInterface->Send (packetCopy, destination);
356 // return;
357 // }
358 // }
359 // }
360
361 // // 3) packet is not broadcast, and is passed in with a route entry
362 // // with a valid CcnxAddress as the gateway
363 // if (route && route->GetGateway () != CcnxAddress ())
364 // {
365 // NS_LOG_LOGIC ("CcnxL3Protocol::Send case 3: passed in with route");
366 // ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
367 // int32_t interface = GetInterfaceForDevice (route->GetOutputDevice ());
368 // m_sendOutgoingTrace (ipHeader, packet, interface);
369 // SendRealOut (route, packet->Copy (), ipHeader);
370 // return;
371 // }
372 // // 4) packet is not broadcast, and is passed in with a route entry but route->GetGateway is not set (e.g., on-demand)
373 // if (route && route->GetGateway () == CcnxAddress ())
374 // {
375 // // This could arise because the synchronous RouteOutput() call
376 // // returned to the transport protocol with a source address but
377 // // there was no next hop available yet (since a route may need
378 // // to be queried).
379 // NS_FATAL_ERROR ("CcnxL3Protocol::Send case 4: This case not yet implemented");
380 // }
381 // // 5) packet is not broadcast, and route is NULL (e.g., a raw socket call)
382 // NS_LOG_LOGIC ("CcnxL3Protocol::Send case 5: passed in with no route " << destination);
383 // Socket::SocketErrno errno_;
384 // Ptr<NetDevice> oif (0); // unused for now
385 // ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
386 // Ptr<CcnxRoute> newRoute;
387 // if (m_routingProtocol != 0)
388 // {
389 // newRoute = m_routingProtocol->RouteOutput (packet, ipHeader, oif, errno_);
390 // }
391 // else
392 // {
393 // NS_LOG_ERROR ("CcnxL3Protocol::Send: m_routingProtocol == 0");
394 // }
395 // if (newRoute)
396 // {
397 // int32_t interface = GetInterfaceForDevice (newRoute->GetOutputDevice ());
398 // m_sendOutgoingTrace (ipHeader, packet, interface);
399 // SendRealOut (newRoute, packet->Copy (), ipHeader);
400 // }
401 // else
402 // {
403 // NS_LOG_WARN ("No route to host. Drop.");
404 // m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), 0);
405 // }
406}
407
408
409void
410CcnxL3Protocol::SendRealOut (Ptr<CcnxRoute> route,
411 Ptr<Packet> packet,
412 CcnxHeader const &ipHeader)
413{
414 NS_LOG_FUNCTION (this << packet << &ipHeader);
415
416 // if (route == 0)
417 // {
418 // NS_LOG_WARN ("No route to host. Drop.");
419 // m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), 0);
420 // return;
421 // }
422 // packet->AddHeader (ipHeader);
423 // Ptr<NetDevice> outDev = route->GetOutputDevice ();
424 // int32_t interface = GetInterfaceForDevice (outDev);
425 // NS_ASSERT (interface >= 0);
426 // Ptr<CcnxInterface> outInterface = GetInterface (interface);
427 // NS_LOG_LOGIC ("Send via NetDevice ifIndex " << outDev->GetIfIndex () << " ccnxInterfaceIndex " << interface);
428
429 // NS_ASSERT_MSG (packet->GetSize () <= outInterface->GetDevice ()->GetMtu (),
430 // "Packet size " << packet->GetSize () << " exceeds device MTU "
431 // << outInterface->GetDevice ()->GetMtu ()
432 // << " for Ccnx; fragmentation not supported");
433 // if (!route->GetGateway ().IsEqual (CcnxAddress ("0.0.0.0")))
434 // {
435 // if (outInterface->IsUp ())
436 // {
437 // NS_LOG_LOGIC ("Send to gateway " << route->GetGateway ());
438 // m_txTrace (packet, m_node->GetObject<Ccnx> (), interface);
439 // outInterface->Send (packet, route->GetGateway ());
440 // }
441 // else
442 // {
443 // NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << route->GetGateway ());
444 // CcnxHeader ipHeader;
445 // packet->RemoveHeader (ipHeader);
446 // m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), interface);
447 // }
448 // }
449 // else
450 // {
451 // if (outInterface->IsUp ())
452 // {
453 // NS_LOG_LOGIC ("Send to destination " << ipHeader.GetDestination ());
454 // m_txTrace (packet, m_node->GetObject<Ccnx> (), interface);
455 // outInterface->Send (packet, ipHeader.GetDestination ());
456 // }
457 // else
458 // {
459 // NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << ipHeader.GetDestination ());
460 // CcnxHeader ipHeader;
461 // packet->RemoveHeader (ipHeader);
462 // m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), interface);
463 // }
464 // }
465}
466
467
468// This function analogous to Linux ip_forward()
469// void
470// CcnxL3Protocol::IpForward (Ptr<CcnxRoute> rtentry, Ptr<const Packet> p, const CcnxHeader &header)
471// {
472// NS_LOG_FUNCTION (this << rtentry << p << header);
473// NS_LOG_LOGIC ("Forwarding logic for node: " << m_node->GetId ());
474// // Forwarding
475// CcnxHeader ipHeader = header;
476// Ptr<Packet> packet = p->Copy ();
477// int32_t interface = GetInterfaceForDevice (rtentry->GetOutputDevice ());
478// ipHeader.SetTtl (ipHeader.GetTtl () - 1);
479// if (ipHeader.GetTtl () == 0)
480// {
481// // Do not reply to ICMP or to multicast/broadcast IP address
482// if (ipHeader.GetProtocol () != Icmpv4L4Protocol::PROT_NUMBER &&
483// ipHeader.GetDestination ().IsBroadcast () == false &&
484// ipHeader.GetDestination ().IsMulticast () == false)
485// {
486// Ptr<Icmpv4L4Protocol> icmp = GetIcmp ();
487// icmp->SendTimeExceededTtl (ipHeader, packet);
488// }
489// NS_LOG_WARN ("TTL exceeded. Drop.");
490// m_dropTrace (header, packet, DROP_TTL_EXPIRED, m_node->GetObject<Ccnx> (), interface);
491// return;
492// }
493// m_unicastForwardTrace (ipHeader, packet, interface);
494// SendRealOut (rtentry, packet, ipHeader);
495// }
496
497// Will be called from CcnxRoutingProtocol if prefix is locally registered
498// Local interest will be satisfied inside CcnxInterface::Send call
499
500void
501CcnxL3Protocol::LocalDeliver (Ptr<const Packet> packet, CcnxHeader const&ip, uint32_t iif)
502{
503 NS_LOG_FUNCTION (this << packet << &ip);
504 Ptr<Packet> p = packet->Copy (); // need to pass a non-const packet up
505
506// m_localDeliverTrace (ip, packet, iif);
507
508// Ptr<CcnxL4Protocol> protocol = GetProtocol (ip.GetProtocol ());
509// if (protocol != 0)
510// {
511// // we need to make a copy in the unlikely event we hit the
512// // RX_ENDPOINT_UNREACH codepath
513// Ptr<Packet> copy = p->Copy ();
514// enum CcnxL4Protocol::RxStatus status =
515// protocol->Receive (p, ip, GetInterface (iif));
516// switch (status) {
517// case CcnxL4Protocol::RX_OK:
518// // fall through
519// case CcnxL4Protocol::RX_ENDPOINT_CLOSED:
520// // fall through
521// case CcnxL4Protocol::RX_CSUM_FAILED:
522// break;
523// case CcnxL4Protocol::RX_ENDPOINT_UNREACH:
524// if (ip.GetDestination ().IsBroadcast () == true ||
525// ip.GetDestination ().IsMulticast () == true)
526// {
527// break; // Do not reply to broadcast or multicast
528// }
529// // Another case to suppress ICMP is a subnet-directed broadcast
530// bool subnetDirected = false;
531// for (uint32_t i = 0; i < GetNAddresses (iif); i++)
532// {
533// CcnxInterfaceAddress addr = GetAddress (iif, i);
534// if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination ().CombineMask (addr.GetMask ()) &&
535// ip.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ()))
536// {
537// subnetDirected = true;
538// }
539s// }
540// if (subnetDirected == false)
541// {
542// GetIcmp ()->SendDestUnreachPort (ip, copy);
543// }
544// }
545// }
546}
547
548void
549CcnxL3Protocol::SetMetric (uint32_t i, uint16_t metric)
550{
551 NS_LOG_FUNCTION (this << i << metric);
552 Ptr<CcnxInterface> interface = GetInterface (i);
553 interface->SetMetric (metric);
554}
555
556uint16_t
557CcnxL3Protocol::GetMetric (uint32_t i) const
558{
559 Ptr<CcnxInterface> interface = GetInterface (i);
560 return interface->GetMetric ();
561}
562
563uint16_t
564CcnxL3Protocol::GetMtu (uint32_t i) const
565{
566 Ptr<CcnxInterface> interface = GetInterface (i);
567 return interface->GetDevice ()->GetMtu ();
568}
569
570bool
571CcnxL3Protocol::IsUp (uint32_t i) const
572{
573 Ptr<CcnxInterface> interface = GetInterface (i);
574 return interface->IsUp ();
575}
576
577void
578CcnxL3Protocol::SetUp (uint32_t i)
579{
580 NS_LOG_FUNCTION (this << i);
581 Ptr<CcnxInterface> interface = GetInterface (i);
582 interface->SetUp ();
583
584 if (m_routingProtocol != 0)
585 {
586 m_routingProtocol->NotifyInterfaceUp (i);
587 }
588}
589
590void
591CcnxL3Protocol::SetDown (uint32_t ifaceIndex)
592{
593 NS_LOG_FUNCTION (this << ifaceIndex);
594 Ptr<CcnxInterface> interface = GetInterface (ifaceIndex);
595 interface->SetDown ();
596
597 if (m_routingProtocol != 0)
598 {
599 m_routingProtocol->NotifyInterfaceDown (ifaceIndex);
600 }
601}
602
603Ptr<NetDevice>
604CcnxL3Protocol::GetNetDevice (uint32_t i)
605{
606 return GetInterface (i)->GetDevice ();
607}
608
609void
610CcnxL3Protocol::RouteInputError (Ptr<const Packet> p, const CcnxHeader & ipHeader, Socket::SocketErrno sockErrno)
611{
612 NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
613 NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno);
614 m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, m_node->GetObject<Ccnx> (), 0);
615}
616
617} //namespace ns3