1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * This program is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License version 2 as 5 * published by the Free Software Foundation; 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 * 16 * Author: George F. Riley<riley@ece.gatech.edu> 17 */ 18 19 // Define an object to create a dumbbell topology. 20 21 #ifndef POINT_TO_POINT_DUMBBELL_HELPER_H 22 #define POINT_TO_POINT_DUMBBELL_HELPER_H 23 24 #include <string> 25 26 #include "point-to-point-helper.h" 27 #include "ipv4-address-helper.h" 28 #include "ipv6-address-helper.h" 29 #include "internet-stack-helper.h" 30 #include "ipv4-interface-container.h" 31 #include "ipv6-interface-container.h" 32 33 namespace ns3 { 34 35 /** 36 * \ingroup point-to-point-layout 37 * 38 * \brief A helper to make it easier to create a dumbbell topology 39 * with p2p links 40 */ 41 class PointToPointDumbbellHelper 42 { 43 public: 44 /** 45 * Create a PointToPointDumbbellHelper in order to easily create 46 * dumbbell topologies using p2p links 47 * 48 * \param nLeftLeaf number of left side leaf nodes in the dumbbell 49 * 50 * \param leftHelper PointToPointHelper used to install the links 51 * between the left leaf nodes and the left-most 52 * router 53 * 54 * \param nRightLeaf number of right side leaf nodes in the dumbbell 55 * 56 * \param rightHelper PointToPointHelper used to install the links 57 * between the right leaf nodes and the right-most 58 * router 59 * 60 * \param bottleneckHelper PointToPointHelper used to install the link 61 * between the inner-routers, usually known as 62 * the bottleneck link 63 */ 64 PointToPointDumbbellHelper (uint32_t nLeftLeaf, 65 PointToPointHelper leftHelper, 66 uint32_t nRightLeaf, 67 PointToPointHelper rightHelper, 68 PointToPointHelper bottleneckHelper); 69 70 ~PointToPointDumbbellHelper (); 71 72 public: 73 /** 74 * \returns pointer to the node of the left side bottleneck 75 * router 76 */ 77 Ptr<Node> GetLeft () const; 78 79 /** 80 * \returns pointer to the i'th left side leaf node 81 * \param i node number 82 */ 83 Ptr<Node> GetLeft (uint32_t i) const; 84 85 /** 86 * \returns pointer to the node of the right side bottleneck 87 * router 88 */ 89 Ptr<Node> GetRight () const; 90 91 /** 92 * \returns pointer to the i'th right side leaf node 93 * \param i node number 94 */ 95 Ptr<Node> GetRight (uint32_t i) const; 96 97 /** 98 * \returns an Ipv4Address of the i'th left leaf 99 * \param i node number 100 */ 101 Ipv4Address GetLeftIpv4Address (uint32_t i ) const; // Get left leaf address 102 103 /** 104 * \returns an Ipv4Address of the i'th right leaf 105 * \param i node number 106 */ 107 Ipv4Address GetRightIpv4Address (uint32_t i) const; // Get right leaf address 108 109 /** 110 * \returns an Ipv6Address of the i'th left leaf 111 * \param i node number 112 */ 113 Ipv6Address GetLeftIpv6Address (uint32_t i ) const; // Get left leaf address 114 115 /** 116 * \returns an Ipv6Address of the i'th right leaf 117 * \param i node number 118 */ 119 Ipv6Address GetRightIpv6Address (uint32_t i) const; // Get right leaf address 120 121 /** 122 * \returns total number of left side leaf nodes 123 */ 124 uint32_t LeftCount () const; 125 126 /** 127 * \returns total number of right side leaf nodes 128 */ 129 uint32_t RightCount () const; 130 131 /** 132 * \param stack an InternetStackHelper which is used to install 133 * on every node in the dumbbell 134 */ 135 void InstallStack (InternetStackHelper stack); 136 137 /** 138 * \param leftIp Ipv4AddressHelper to assign Ipv4 addresses to the 139 * interfaces on the left side of the dumbbell 140 * 141 * \param rightIp Ipv4AddressHelper to assign Ipv4 addresses to the 142 * interfaces on the right side of the dumbbell 143 * 144 * \param routerIp Ipv4AddressHelper to assign Ipv4 addresses to the 145 * interfaces on the bottleneck link 146 */ 147 void AssignIpv4Addresses (Ipv4AddressHelper leftIp, 148 Ipv4AddressHelper rightIp, 149 Ipv4AddressHelper routerIp); 150 151 /** 152 * \param network an IPv6 address representing the network portion 153 * of the IPv6 Address 154 * \param prefix the prefix length 155 */ 156 void AssignIpv6Addresses (Ipv6Address network, Ipv6Prefix prefix); 157 158 /** 159 * Sets up the node canvas locations for every node in the dumbbell. 160 * This is needed for use with the animation interface 161 * 162 * \param ulx upper left x value 163 * \param uly upper left y value 164 * \param lrx lower right x value 165 * \param lry lower right y value 166 */ 167 void BoundingBox (double ulx, double uly, double lrx, double lry); 168 169 private: 170 NodeContainer m_leftLeaf; //!< Left Leaf nodes 171 NetDeviceContainer m_leftLeafDevices; //!< Left Leaf NetDevices 172 NodeContainer m_rightLeaf; //!< Right Leaf nodes 173 NetDeviceContainer m_rightLeafDevices; //!< Right Leaf NetDevices 174 NodeContainer m_routers; //!< Routers 175 NetDeviceContainer m_routerDevices; //!< Routers NetDevices 176 NetDeviceContainer m_leftRouterDevices; //!< Left router NetDevices 177 NetDeviceContainer m_rightRouterDevices; //!< Right router NetDevices 178 Ipv4InterfaceContainer m_leftLeafInterfaces; //!< Left Leaf interfaces (IPv4) 179 Ipv4InterfaceContainer m_leftRouterInterfaces; //!< Left router interfaces (IPv4) 180 Ipv4InterfaceContainer m_rightLeafInterfaces; //!< Right Leaf interfaces (IPv4) 181 Ipv4InterfaceContainer m_rightRouterInterfaces; //!< Right router interfaces (IPv4) 182 Ipv4InterfaceContainer m_routerInterfaces; //!< Router interfaces (IPv4) 183 Ipv6InterfaceContainer m_leftLeafInterfaces6; //!< Left Leaf interfaces (IPv6) 184 Ipv6InterfaceContainer m_leftRouterInterfaces6; //!< Left router interfaces (IPv6) 185 Ipv6InterfaceContainer m_rightLeafInterfaces6; //!< Right Leaf interfaces (IPv6) 186 Ipv6InterfaceContainer m_rightRouterInterfaces6; //!< Right router interfaces (IPv6) 187 Ipv6InterfaceContainer m_routerInterfaces6; //!< Router interfaces (IPv6) 188 }; 189 190 } // namespace ns3 191 192 #endif /* POINT_TO_POINT_DUMBBELL_HELPER_H */ 193