Files
unison/src/internet-node/internet-node.cc

93 lines
2.6 KiB
C++
Raw Normal View History

2007-02-08 15:37:48 +01:00
// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
//
// Copyright (c) 2006 Georgia Tech Research Corporation
// 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
//
// Author: George F. Riley<riley@ece.gatech.edu>
//
2007-06-04 16:28:18 +02:00
// Implementation of the InternetNode class for ns3.
2007-02-08 15:37:48 +01:00
// George F. Riley, Georgia Tech, Fall 2006
#include "ns3/composite-trace-resolver.h"
2007-05-04 15:04:07 +02:00
#include "ns3/net-device.h"
#include "ns3/callback.h"
2007-02-08 15:37:48 +01:00
#include "ipv4-l4-demux.h"
2007-06-04 16:28:18 +02:00
#include "internet-node.h"
2007-06-04 17:18:02 +02:00
#include "udp-l4-protocol.h"
2007-06-04 16:42:10 +02:00
#include "ipv4-l3-protocol.h"
2007-06-04 16:54:36 +02:00
#include "arp-l3-protocol.h"
2007-06-04 17:13:21 +02:00
#include "udp-impl.h"
2007-06-04 16:59:51 +02:00
#include "ipv4-impl.h"
2007-02-08 15:37:48 +01:00
namespace ns3 {
2007-06-04 16:28:18 +02:00
InternetNode::InternetNode()
{
Construct ();
}
2007-06-04 16:28:18 +02:00
InternetNode::InternetNode(uint32_t systemId)
{
Construct ();
}
2007-06-04 16:28:18 +02:00
InternetNode::~InternetNode ()
{}
void
2007-06-04 16:28:18 +02:00
InternetNode::Construct (void)
2007-02-08 15:37:48 +01:00
{
2007-06-04 16:51:59 +02:00
Ptr<Ipv4L3Protocol> ipv4 = Create<Ipv4L3Protocol> (this);
2007-06-04 16:57:24 +02:00
Ptr<ArpL3Protocol> arp = Create<ArpL3Protocol> (this);
// XXX remove the PeekPointer below.
RegisterProtocolHandler (MakeCallback (&Ipv4L3Protocol::Receive, PeekPointer (ipv4)),
Ipv4L3Protocol::PROT_NUMBER, 0);
RegisterProtocolHandler (MakeCallback (&ArpL3Protocol::Receive, PeekPointer (arp)),
ArpL3Protocol::PROT_NUMBER, 0);
2007-05-03 14:20:04 +02:00
Ptr<Ipv4L4Demux> ipv4L4Demux = Create<Ipv4L4Demux> (this);
Ptr<UdpL4Protocol> udp = Create<UdpL4Protocol> (this);
2007-05-03 14:20:04 +02:00
ipv4L4Demux->Insert (udp);
2007-06-04 17:24:18 +02:00
Ptr<UdpImpl> udpImpl = Create<UdpImpl> (udp);
2007-06-04 17:40:09 +02:00
Ptr<Ipv4Impl> ipv4Impl = Create<Ipv4Impl> (ipv4);
Object::AddInterface (ipv4);
2007-07-31 09:17:05 +02:00
Object::AddInterface (arp);
2007-05-25 10:56:03 +02:00
Object::AddInterface (ipv4Impl);
Object::AddInterface (udpImpl);
Object::AddInterface (ipv4L4Demux);
2007-02-12 15:55:49 +01:00
}
void
InternetNode::DoFillTraceResolver (CompositeTraceResolver &resolver)
{
Node::DoFillTraceResolver (resolver);
Ptr<Ipv4L3Protocol> ipv4 = QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
resolver.Add ("ipv4",
MakeCallback (&Ipv4L3Protocol::CreateTraceResolver, PeekPointer (ipv4)));
}
2007-05-03 12:33:08 +02:00
void
2007-06-04 16:28:18 +02:00
InternetNode::DoDispose()
2007-05-02 09:10:19 +02:00
{
2007-06-04 16:17:01 +02:00
Node::DoDispose ();
2007-05-02 09:10:19 +02:00
}
2007-02-08 15:37:48 +01:00
}//namespace ns3