|
1 /* -*- 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 // Topology helper for ns3. |
|
21 // George F. Riley, Georgia Tech, Spring 2007 |
|
22 #ifndef __POINT_TO_POINT_TOPOLOGY_H__ |
|
23 #define __POINT_TO_POINT_TOPOLOGY_H__ |
|
24 |
|
25 #include "ns3/ptr.h" |
|
26 |
|
27 // The topology class consists of only static methods thar are used to |
|
28 // create the topology and data flows for an ns3 simulation |
|
29 |
|
30 namespace ns3 { |
|
31 |
|
32 class PointToPointChannel; |
|
33 class Node; |
|
34 class IPAddr; |
|
35 class DataRate; |
|
36 class Queue; |
|
37 |
|
38 /** |
|
39 * \brief A helper class to create Topologies based on the |
|
40 * ns3::PointToPointNetDevice and ns3::PointToPointChannel objects. |
|
41 */ |
|
42 class PointToPointTopology { |
|
43 public: |
|
44 /** |
|
45 * \param n1 Node |
|
46 * \param n2 Node |
|
47 * \param dataRate Maximum transmission link rate |
|
48 * \param delay one-way propagation delay |
|
49 * \return Pointer to the underlying PointToPointChannel |
|
50 * |
|
51 * Add a full-duplex point-to-point link between two nodes |
|
52 * and attach PointToPointNetDevices to the resulting |
|
53 * PointToPointChannel. |
|
54 */ |
|
55 static Ptr<PointToPointChannel> AddPointToPointLink( |
|
56 Ptr<Node> n1, Ptr<Node> n2, const DataRate& dataRate, const Time& delay); |
|
57 |
|
58 /** |
|
59 * \param chan PointToPointChannel to use |
|
60 * \param n1 Node |
|
61 * \param addr1 Ipv4 Address for n1 |
|
62 * \param n2 Node |
|
63 * \param addr2 Ipv4 Address for n2 |
|
64 * |
|
65 * Add Ipv4Addresses to the Ipv4 interfaces associated with the |
|
66 * two PointToPointNetDevices on the provided PointToPointChannel |
|
67 */ |
|
68 static void AddIpv4Addresses( |
|
69 Ptr<const PointToPointChannel> chan, |
|
70 Ptr<Node> n1, const Ipv4Address& addr1, |
|
71 Ptr<Node> n2, const Ipv4Address& addr2); |
|
72 |
|
73 /** |
|
74 * \param channel PointToPointChannel to use |
|
75 * \param n1 Node |
|
76 * \param n2 Node |
|
77 * |
|
78 * For the given PointToPointChannel, for each Node, add an |
|
79 * IPv4 host route to the IPv4 address of the peer node. |
|
80 */ |
|
81 static void AddIpv4Routes (Ptr<Node> n1, Ptr<Node> n2, Ptr<const PointToPointChannel> channel); |
|
82 }; |
|
83 |
|
84 } // namespace ns3 |
|
85 |
|
86 #endif |
|
87 |