2007-02-12 19:28:19 +01:00
|
|
|
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2007 INRIA
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
|
* published by the Free Software Foundation;
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*
|
|
|
|
|
* Authors:
|
|
|
|
|
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
|
|
|
|
|
*/
|
2007-03-18 14:06:51 -07:00
|
|
|
#include "ns3/empty-trace-resolver.h"
|
2007-02-12 19:28:19 +01:00
|
|
|
#include "ipv4-loopback-interface.h"
|
|
|
|
|
#include "net-device.h"
|
|
|
|
|
#include "node.h"
|
|
|
|
|
#include "ipv4.h"
|
|
|
|
|
|
|
|
|
|
namespace ns3 {
|
|
|
|
|
|
|
|
|
|
Ipv4LoopbackInterface::Ipv4LoopbackInterface (Node *node)
|
2007-03-29 17:07:04 +02:00
|
|
|
: Ipv4Interface (0),
|
2007-02-12 19:58:10 +01:00
|
|
|
m_node (node)
|
2007-02-12 19:28:19 +01:00
|
|
|
{
|
2007-05-02 14:40:40 +02:00
|
|
|
m_node->Ref ();
|
2007-02-12 19:28:19 +01:00
|
|
|
}
|
|
|
|
|
Ipv4LoopbackInterface::~Ipv4LoopbackInterface ()
|
|
|
|
|
{
|
2007-05-02 14:40:40 +02:00
|
|
|
m_node->Unref ();
|
2007-02-12 19:28:19 +01:00
|
|
|
}
|
|
|
|
|
|
2007-03-18 14:06:51 -07:00
|
|
|
TraceResolver *
|
|
|
|
|
Ipv4LoopbackInterface::DoCreateTraceResolver (TraceContext const &context)
|
|
|
|
|
{
|
|
|
|
|
return new EmptyTraceResolver (context);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:28:19 +01:00
|
|
|
void
|
|
|
|
|
Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest)
|
|
|
|
|
{
|
2007-05-02 23:42:22 +02:00
|
|
|
Ipv4 *ipv4 = m_node->GetIpv4 ();
|
|
|
|
|
ipv4->Receive (packet, PeekDevice ());
|
|
|
|
|
ipv4->Unref ();
|
2007-02-12 19:28:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}//namespace ns3
|