29 #include "ns3/core-module.h"
30 #include "ns3/network-module.h"
31 #include "ns3/internet-module.h"
32 #include "ns3/point-to-point-module.h"
33 #include "ns3/applications-module.h"
34 #include "ns3/ipv4-static-routing-helper.h"
35 #include "ns3/ipv4-list-routing-helper.h"
36 #include "ns3/ipv4-nix-vector-helper.h"
38 #include "ns3/topology-read-module.h"
46 static std::list<unsigned int>
data;
52 std::cout <<
"TTL: " << (unsigned)ipv4.
GetTtl () << std::endl;
59 int main (
int argc,
char *argv[])
62 std::string format (
"Inet");
63 std::string input (
"src/topology-read/examples/Inet_small_toposample.txt");
67 cmd.
AddValue (
"format",
"Format to use for data input [Orbis|Inet|Rocketfuel].",
69 cmd.
AddValue (
"input",
"Name of the input file.",
71 cmd.
Parse (argc, argv);
88 nodes = inFile->
Read ();
93 NS_LOG_ERROR (
"Problems reading the topology file. Failing.");
108 listRH.
Add (staticRouting, 0);
109 listRH.
Add (nixRouting, 10);
116 address.
SetBase (
"10.0.0.0",
"255.255.255.252");
126 nc[i] =
NodeContainer (iter->GetFromNode (), iter->GetToNode ());
132 for (
int i = 0; i < totlinks; i++)
143 for (
int i = 0; i < totlinks; i++)
145 ipic[i] = address.
Assign (ndc[i]);
150 uint32_t totalNodes = nodes.
GetN ();
155 unsigned int randomServerNumber = unifRandom->
GetInteger (0, totalNodes - 1);
157 Ptr<Node> randomServerNode = nodes.
Get (randomServerNumber);
160 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
173 for (
unsigned int i = 0; i < nodes.
GetN (); i++ )
175 if (i != randomServerNumber )
178 clientNodes.
Add (clientNode);
183 apps.
Start (Seconds (1.0));
184 apps.
Stop (Seconds (2.0));
187 apps = sink.
Install (randomServerNode);
188 apps.
Start (Seconds (0.0));
189 apps.
Stop (Seconds (3.0));
holds a vector of ns3::Application pointers.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
holds a vector of std::pair of Ptr and interface index.
hold variables of type string
NetDeviceContainer Install(NodeContainer c)
ConstLinksIterator LinksBegin(void) const
Returns an iterator to the the first link in this block.
static void Run(void)
Run the simulation until one of:
Helper class that adds Nix-vector routing to nodes.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
void SetFileName(const std::string fileName)
Sets the input file name.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
a polymophic address class
Ptr< TopologyReader > GetTopologyReader()
Gets a Ptr to the actual TopologyReader.
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
Class for representing data rates.
int LinksSize(void) const
Returns the number of links in this block.
static void SinkRx(Ptr< const Packet > p, const Address &ad)
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
int main(int argc, char *argv[])
void SetFileType(const std::string fileType)
Sets the input file type.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
Access to the Ipv4 forwarding table, interfaces, and configuration.
std::list< Link >::const_iterator ConstLinksIterator
Constant iterator to the list of the links.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void SetDefault(std::string name, const AttributeValue &value)
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
keep track of a set of node pointers.
static std::list< unsigned int > data
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void Add(const Ipv4RoutingHelper &routing, int16_t priority)
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
Helper class which makes it easier to configure and use a generic TopologyReader. ...
Ipv4 addresses are stored in host order in this class.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
a class to store IPv4 address information on an interface
Helper class that adds ns3::Ipv4StaticRouting objects.
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
virtual Ipv4InterfaceAddress GetAddress(uint32_t interface, uint32_t addressIndex) const =0
Because addresses can be removed, the addressIndex is not guaranteed to be static across calls to thi...
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
virtual NodeContainer Read(void)=0
Main topology reading function.
Ipv4Address NewNetwork(void)
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
Helper class that adds ns3::Ipv4ListRouting objects.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
void Parse(int argc, char *argv[])
Parse the program arguments.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
#define NS_LOG_ERROR(msg)
Hold a floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
ConstLinksIterator LinksEnd(void) const
Returns an iterator to the the last link in this block.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.