23 #include "ns3/point-to-point-star.h"
24 #include "ns3/constant-position-mobility-model.h"
26 #include "ns3/node-list.h"
27 #include "ns3/point-to-point-net-device.h"
28 #include "ns3/vector.h"
29 #include "ns3/ipv6-address-generator.h"
39 m_spokes.
Create (numSpokes);
41 for (uint32_t i = 0; i < m_spokes.
GetN (); ++i)
44 m_hubDevices.
Add (nd.
Get (0));
45 m_spokeDevices.
Add (nd.
Get (1));
49 PointToPointStarHelper::~PointToPointStarHelper ()
62 return m_spokes.
Get (i);
92 return m_spokes.
GetN ();
105 for (uint32_t i = 0; i < m_spokes.
GetN (); ++i)
107 m_hubInterfaces.
Add (address.
Assign (m_hubDevices.
Get (i)));
108 m_spokeInterfaces.
Add (address.
Assign (m_spokeDevices.
Get (i)));
120 for (uint32_t i = 0; i < m_spokes.
GetN (); ++i)
123 addressHelper.
SetBase (v6network, prefix);
126 m_hubInterfaces6.
Add (ic);
127 ic = addressHelper.
Assign (m_spokeDevices.
Get (i));
128 m_spokeInterfaces6.
Add (ic);
136 double lrx,
double lry)
162 hubLoc = CreateObject<ConstantPositionMobilityModel> ();
165 Vector hubVec (ulx + xDist/2.0, uly + yDist/2.0, 0);
166 hubLoc->SetPosition (hubVec);
171 spokeDist = yDist/4.0;
175 spokeDist = xDist/4.0;
178 double theta = 2*M_PI/m_spokes.
GetN ();
179 for (uint32_t i = 0; i < m_spokes.
GetN (); ++i)
185 spokeLoc = CreateObject<ConstantPositionMobilityModel> ();
188 Vector spokeVec (hubVec.
x + std::cos (theta*i) * spokeDist,
189 hubVec.
y + std::sin (theta*i) * spokeDist,
191 spokeLoc->SetPosition (spokeVec);
void AssignIpv4Addresses(Ipv4AddressHelper address)
Keep track of a set of IPv6 interfaces.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix)
void Add(Ptr< Ipv6 > ipv6, uint32_t interface)
Add a couple IPv6/interface.
Mobility model for which the current position does not change once it has been set and until it is se...
#define NS_LOG_COMPONENT_DEFINE(name)
aggregate IP/TCP/UDP functionality to existing Nodes.
static Ipv6Address NextNetwork(const Ipv6Prefix prefix)
Get the next network acoording to the given Ipv6Prefix.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Build a set of PointToPointNetDevice objects.
PointToPointStarHelper(uint32_t numSpokes, PointToPointHelper p2pHelper)
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
Ipv6Address GetHubIpv6Address(uint32_t i) const
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
static void Init(const Ipv6Address net, const Ipv6Prefix prefix, const Ipv6Address interfaceId="::1")
Initialise the base network and interfaceId for the generator.
holds a vector of ns3::NetDevice pointers
Ptr< Node > GetSpokeNode(uint32_t i) const
void AggregateObject(Ptr< Object > other)
Ipv6Address GetSpokeIpv6Address(uint32_t i) const
void Install(std::string nodeName) const
Ptr< Node > GetHub() const
uint32_t SpokeCount() const
Helper class to auto-assign global IPv6 unicast addresses.
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4Address GetSpokeIpv4Address(uint32_t i) const
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
Ipv4Address NewNetwork(void)
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void BoundingBox(double ulx, double uly, double lrx, double lry)
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void Add(Ipv4InterfaceContainer other)
void InstallStack(InternetStackHelper stack)
Ptr< T > GetObject(void) const
Ipv4Address GetHubIpv4Address(uint32_t i) const
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
static Ipv6Address GetNetwork(const Ipv6Prefix prefix)
Get the current network of the given Ipv6Prefix.