author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 13 Mar 2008 11:10:38 -0700 | |
changeset 2600 | 6c389d0c717d |
parent 2592 | 3ebf97150166 |
child 2720 | 3c7d9f8c9034 |
permissions | -rw-r--r-- |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
2 |
// |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
3 |
// Copyright (c) 2006 Georgia Tech Research Corporation |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
4 |
// |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
5 |
// This program is free software; you can redistribute it and/or modify |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
6 |
// it under the terms of the GNU General Public License version 2 as |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
7 |
// published by the Free Software Foundation; |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
8 |
// |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
9 |
// This program is distributed in the hope that it will be useful, |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
12 |
// GNU General Public License for more details. |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
13 |
// |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
14 |
// You should have received a copy of the GNU General Public License |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
15 |
// along with this program; if not, write to the Free Software |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
16 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
17 |
// |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
18 |
// Author: George F. Riley<riley@ece.gatech.edu> |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
19 |
// |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
20 |
|
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
21 |
// |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
22 |
// Topology helper for ns3. |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
23 |
// George F. Riley, Georgia Tech, Spring 2007 |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
24 |
|
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
25 |
#include <algorithm> |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
26 |
#include "ns3/assert.h" |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
973
diff
changeset
|
27 |
#include "ns3/log.h" |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
28 |
#include "ns3/fatal-error.h" |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
29 |
#include "ns3/nstime.h" |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
30 |
#include "ns3/internet-node.h" |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
31 |
#include "ns3/ipv4-address.h" |
752
a4febfb8416f
IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
732
diff
changeset
|
32 |
#include "ns3/ipv4.h" |
584
d843d0d5314d
make Queue::CreateDefault use the ComponentManager.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
581
diff
changeset
|
33 |
#include "ns3/queue.h" |
2533
80cdc3eec057
do not use Queue::CreateDefault
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2502
diff
changeset
|
34 |
#include "ns3/drop-tail-queue.h" |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
35 |
|
973
2aea9e9f698c
src/devices/point-to-point/p2p-* -> src/devices/point-to-point/point-to-point-*
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
972
diff
changeset
|
36 |
#include "point-to-point-channel.h" |
2aea9e9f698c
src/devices/point-to-point/p2p-* -> src/devices/point-to-point/point-to-point-*
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
972
diff
changeset
|
37 |
#include "point-to-point-net-device.h" |
2aea9e9f698c
src/devices/point-to-point/p2p-* -> src/devices/point-to-point/point-to-point-*
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
972
diff
changeset
|
38 |
#include "point-to-point-topology.h" |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
39 |
|
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
40 |
namespace ns3 { |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
41 |
|
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
567
diff
changeset
|
42 |
Ptr<PointToPointChannel> |
369
29ea5d1a83c8
Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents:
368
diff
changeset
|
43 |
PointToPointTopology::AddPointToPointLink( |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
44 |
Ptr<Node> n1, |
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
45 |
Ptr<Node> n2, |
373
960c8e8721de
Move simple-p2p.cc to DataRate; fix small bug in DataRate and add include guards
Tom Henderson <tomh@tomh.org>
parents:
369
diff
changeset
|
46 |
const DataRate& bps, |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
47 |
const Time& delay) |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
48 |
{ |
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2533
diff
changeset
|
49 |
Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> ("BitRate", bps, "Delay", delay); |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
50 |
|
2600
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
51 |
Ptr<PointToPointNetDevice> net1 = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ()); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
52 |
n1->AddDevice (net1); |
567
6fb98941c36f
remove leaks and rework the Ptr class to work with a new refcount mechanism
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
561
diff
changeset
|
53 |
|
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2533
diff
changeset
|
54 |
Ptr<Queue> q = CreateObject<DropTailQueue> (); |
581
15240a33f517
make Queue derive from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
571
diff
changeset
|
55 |
net1->AddQueue(q); |
376
5801e09f82bf
Add net devices to net-device-list in topology
Tom Henderson <tomh@tomh.org>
parents:
375
diff
changeset
|
56 |
net1->Attach (channel); |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
57 |
|
2600
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
58 |
Ptr<PointToPointNetDevice> net2 = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ()); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
59 |
n2->AddDevice (net2); |
567
6fb98941c36f
remove leaks and rework the Ptr class to work with a new refcount mechanism
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
561
diff
changeset
|
60 |
|
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2533
diff
changeset
|
61 |
q = CreateObject<DropTailQueue> (); |
581
15240a33f517
make Queue derive from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
571
diff
changeset
|
62 |
net2->AddQueue(q); |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
63 |
net2->Attach (channel); |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
64 |
|
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
65 |
return channel; |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
66 |
} |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
67 |
|
1821
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
68 |
Ptr<PointToPointNetDevice> |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
69 |
PointToPointTopology::GetNetDevice (Ptr<Node> n, Ptr<PointToPointChannel> chan) |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
70 |
{ |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
71 |
Ptr<PointToPointNetDevice> found = 0; |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
72 |
|
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
73 |
// The PointToPoint channel is used to find the relevant NetDevice |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
74 |
NS_ASSERT (chan->GetNDevices () == 2); |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
75 |
Ptr<PointToPointNetDevice> nd1 = chan->GetDevice (0); |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
76 |
Ptr<PointToPointNetDevice> nd2 = chan->GetDevice (1); |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
77 |
if ( nd1->GetNode ()->GetId () == n->GetId () ) |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
78 |
{ |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
79 |
found = nd1; |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
80 |
} |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
81 |
else if ( nd2->GetNode ()->GetId () == n->GetId () ) |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
82 |
{ |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
83 |
found = nd2; |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
84 |
} |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
85 |
else |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
86 |
{ |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
87 |
NS_ASSERT (found); |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
88 |
} |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
89 |
return found; |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
90 |
} |
c6d74a0bce7f
GetNetDevice method in PointToPointTopology class
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
91 |
|
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
92 |
void |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
93 |
PointToPointTopology::AddIpv4Addresses( |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
567
diff
changeset
|
94 |
Ptr<const PointToPointChannel> chan, |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
95 |
Ptr<Node> n1, const Ipv4Address& addr1, |
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
96 |
Ptr<Node> n2, const Ipv4Address& addr2) |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
97 |
{ |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
98 |
|
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
99 |
// Duplex link is assumed to be subnetted as a /30 |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
100 |
// May run this unnumbered in the future? |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
101 |
Ipv4Mask netmask("255.255.255.252"); |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
102 |
NS_ASSERT (netmask.IsMatch(addr1,addr2)); |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
103 |
|
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
104 |
// The PointToPoint channel is used to find the relevant NetDevices |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
105 |
NS_ASSERT (chan->GetNDevices () == 2); |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
567
diff
changeset
|
106 |
Ptr<NetDevice> nd1 = chan->GetDevice (0); |
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
567
diff
changeset
|
107 |
Ptr<NetDevice> nd2 = chan->GetDevice (1); |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
108 |
// Make sure that nd1 belongs to n1 and nd2 to n2 |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
109 |
if ( (nd1->GetNode ()->GetId () == n2->GetId () ) && |
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
110 |
(nd2->GetNode ()->GetId () == n1->GetId () ) ) |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
111 |
{ |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
112 |
std::swap(nd1, nd2); |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
113 |
} |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
114 |
NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ()); |
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
115 |
NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ()); |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
116 |
|
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
117 |
Ptr<Ipv4> ip1 = n1->GetObject<Ipv4> (); |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
118 |
uint32_t index1 = ip1->AddInterface (nd1); |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
119 |
|
444
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
390
diff
changeset
|
120 |
ip1->SetAddress (index1, addr1); |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
390
diff
changeset
|
121 |
ip1->SetNetworkMask (index1, netmask); |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
390
diff
changeset
|
122 |
ip1->SetUp (index1); |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
123 |
|
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
124 |
Ptr<Ipv4> ip2 = n2->GetObject<Ipv4> (); |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
125 |
uint32_t index2 = ip2->AddInterface (nd2); |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
126 |
|
444
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
390
diff
changeset
|
127 |
ip2->SetAddress (index2, addr2); |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
390
diff
changeset
|
128 |
ip2->SetNetworkMask (index2, netmask); |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
390
diff
changeset
|
129 |
ip2->SetUp (index2); |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
522
diff
changeset
|
130 |
|
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
131 |
} |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
132 |
|
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
133 |
void |
1776
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
134 |
PointToPointTopology::SetIpv4Metric( |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
135 |
Ptr<const PointToPointChannel> chan, |
2204
4d23c1277c9c
remove const qualifier from uint16_t
Tom Henderson <tomh@tomh.org>
parents:
1821
diff
changeset
|
136 |
Ptr<Node> n1, Ptr<Node> n2, uint16_t metric) |
1776
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
137 |
{ |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
138 |
|
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
139 |
// The PointToPoint channel is used to find the relevant NetDevices |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
140 |
NS_ASSERT (chan->GetNDevices () == 2); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
141 |
Ptr<NetDevice> nd1 = chan->GetDevice (0); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
142 |
Ptr<NetDevice> nd2 = chan->GetDevice (1); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
143 |
// Make sure that nd1 belongs to n1 and nd2 to n2 |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
144 |
if ( (nd1->GetNode ()->GetId () == n2->GetId () ) && |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
145 |
(nd2->GetNode ()->GetId () == n1->GetId () ) ) |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
146 |
{ |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
147 |
std::swap(nd1, nd2); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
148 |
} |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
149 |
NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ()); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
150 |
NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ()); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
151 |
|
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
152 |
// The NetDevice ifIndex does not correspond to the |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
153 |
// ifIndex used by Ipv4. Therefore, we have to iterate |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
154 |
// through the NetDevices until we find the Ipv4 ifIndex |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
155 |
// that corresponds to NetDevice nd1 |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
156 |
// Get interface indexes for both nodes corresponding to the right channel |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
157 |
uint32_t index = 0; |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
158 |
bool found = false; |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
159 |
Ptr<Ipv4> ip1 = n1->GetObject<Ipv4> (); |
1776
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
160 |
for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++) |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
161 |
{ |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
162 |
if (ip1 ->GetNetDevice (i) == nd1) |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
163 |
{ |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
164 |
index = i; |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
165 |
found = true; |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
166 |
} |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
167 |
} |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
168 |
NS_ASSERT(found); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
169 |
ip1->SetMetric (index, metric); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
170 |
|
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
171 |
index = 0; |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
172 |
found = false; |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
173 |
Ptr<Ipv4> ip2 = n2->GetObject<Ipv4> (); |
1776
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
174 |
for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++) |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
175 |
{ |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
176 |
if (ip2 ->GetNetDevice (i) == nd2) |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
177 |
{ |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
178 |
index = i; |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
179 |
found = true; |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
180 |
} |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
181 |
} |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
182 |
NS_ASSERT(found); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
183 |
ip2->SetMetric (index, metric); |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
184 |
} |
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
185 |
|
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
186 |
void |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
187 |
PointToPointTopology::AddIpv4Routes ( |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
188 |
Ptr<Node> n1, Ptr<Node> n2, Ptr<const PointToPointChannel> chan) |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
189 |
{ |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
190 |
// The PointToPoint channel is used to find the relevant NetDevices |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
191 |
NS_ASSERT (chan->GetNDevices () == 2); |
593 | 192 |
Ptr<NetDevice> nd1 = chan->GetDevice (0); |
193 |
Ptr<NetDevice> nd2 = chan->GetDevice (1); |
|
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
194 |
|
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
195 |
// Assert that n1 is the Node owning one of the two NetDevices |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
196 |
// and make sure that nd1 corresponds to it |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
197 |
if (nd1->GetNode ()->GetId () == n1->GetId ()) |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
198 |
{ |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
199 |
; // Do nothing |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
200 |
} |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
201 |
else if (nd2->GetNode ()->GetId () == n1->GetId ()) |
593 | 202 |
{ |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
203 |
std::swap(nd1, nd2); |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
204 |
} |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
205 |
else |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
206 |
{ |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
207 |
NS_FATAL_ERROR("P2PTopo: Node does not contain an interface on Channel"); |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
208 |
} |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
209 |
|
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
210 |
// Assert that n2 is the Node owning one of the two NetDevices |
593 | 211 |
// and make sure that nd2 corresponds to it |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
212 |
if (nd2->GetNode ()->GetId () != n2->GetId ()) |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
213 |
{ |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
214 |
NS_FATAL_ERROR("P2PTopo: Node does not contain an interface on Channel"); |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
215 |
} |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
216 |
|
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
217 |
// Assert that both are Ipv4 nodes |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
218 |
Ptr<Ipv4> ip1 = nd1->GetNode ()->GetObject<Ipv4> (); |
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2231
diff
changeset
|
219 |
Ptr<Ipv4> ip2 = nd2->GetNode ()->GetObject<Ipv4> (); |
593 | 220 |
NS_ASSERT(ip1 != 0 && ip2 != 0); |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
221 |
|
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
222 |
// Get interface indexes for both nodes corresponding to the right channel |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
223 |
uint32_t index1 = 0; |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
224 |
bool found = false; |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
225 |
for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++) |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
226 |
{ |
593 | 227 |
if (ip1 ->GetNetDevice (i) == nd1) |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
228 |
{ |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
229 |
index1 = i; |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
230 |
found = true; |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
231 |
} |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
232 |
} |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
233 |
NS_ASSERT(found); |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
234 |
|
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
235 |
uint32_t index2 = 0; |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
236 |
found = false; |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
237 |
for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++) |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
238 |
{ |
593 | 239 |
if (ip2 ->GetNetDevice (i) == nd2) |
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
240 |
{ |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
241 |
index2 = i; |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
242 |
found = true; |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
243 |
} |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
244 |
} |
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
245 |
NS_ASSERT(found); |
593 | 246 |
|
540
507eababb124
Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents:
535
diff
changeset
|
247 |
ip1->AddHostRouteTo (ip2-> GetAddress (index2), index1); |
593 | 248 |
ip2->AddHostRouteTo (ip1-> GetAddress (index1), index2); |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
249 |
} |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
250 |
|
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
251 |
} // namespace ns3 |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
252 |