|
1 // -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- |
|
2 // |
|
3 // Copyright (c) 2006 Georgia Tech Research Corporation |
|
4 // All rights reserved. |
|
5 // |
|
6 // This program is free software; you can redistribute it and/or modify |
|
7 // it under the terms of the GNU General Public License version 2 as |
|
8 // published by the Free Software Foundation; |
|
9 // |
|
10 // This program is distributed in the hope that it will be useful, |
|
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 // GNU General Public License for more details. |
|
14 // |
|
15 // You should have received a copy of the GNU General Public License |
|
16 // along with this program; if not, write to the Free Software |
|
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 // |
|
19 // Author: George F. Riley<riley@ece.gatech.edu> |
|
20 // |
|
21 // Implementation of the InternetNode class for ns3. |
|
22 // George F. Riley, Georgia Tech, Fall 2006 |
|
23 |
|
24 #include "net-device-list.h" |
|
25 #include "l3-demux.h" |
|
26 #include "ipv4-l4-demux.h" |
|
27 #include "internet-node.h" |
|
28 |
|
29 namespace ns3 { |
|
30 |
|
31 InternetNode::InternetNode() |
|
32 { |
|
33 // Instantiate the capabilities |
|
34 m_netDevices = new NetDeviceList(); |
|
35 m_l3Demux = new L3Demux(); |
|
36 m_ipv4L4Demux = new Ipv4L4Demux(); |
|
37 // Configure the capabilities |
|
38 // Insert an IPv4 protocol at layer 3 |
|
39 //m_l3Protocols->Insert(ns3::IPV4()); |
|
40 // L4 protocols (instances of TCP or UDP layer 4 objects) |
|
41 // are inserted as created by process socket creations |
|
42 // or bind calls. |
|
43 } |
|
44 |
|
45 InternetNode::InternetNode(const InternetNode& rhs) |
|
46 { // Copy constructor |
|
47 // Note we do not copy the contents of the process list or |
|
48 // the interfaces list, as these are added later. |
|
49 m_netDevices = new NetDeviceList(); |
|
50 // Make a copy of each capability |
|
51 m_l3Demux = rhs.GetL3Demux()->Copy(); |
|
52 m_ipv4L4Demux = rhs.GetIpv4L4Demux()->Copy(); |
|
53 } |
|
54 |
|
55 // Copy this node |
|
56 InternetNode* |
|
57 InternetNode::Copy() const |
|
58 { |
|
59 return new InternetNode(*this); |
|
60 } |
|
61 |
|
62 |
|
63 NetDeviceList* |
|
64 InternetNode::GetNetDevices() const |
|
65 { |
|
66 return m_netDevices; |
|
67 } |
|
68 |
|
69 L3Demux* |
|
70 InternetNode::GetL3Demux() const |
|
71 { |
|
72 return m_l3Demux; |
|
73 } |
|
74 |
|
75 Ipv4L4Demux* |
|
76 InternetNode::GetIpv4L4Demux() const |
|
77 { |
|
78 return m_ipv4L4Demux; |
|
79 } |
|
80 |
|
81 }//namespace ns3 |