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-nix-vector-helper.h" 36 #include "ns3/topology-read-module.h" 43 static std::list<unsigned int>
data;
49 std::cout <<
"TTL: " << (unsigned)ipv4.
GetTtl () << std::endl;
56 int main (
int argc,
char *argv[])
59 std::string format (
"Inet");
60 std::string input (
"src/topology-read/examples/Inet_small_toposample.txt");
64 cmd.AddValue (
"format",
"Format to use for data input [Orbis|Inet|Rocketfuel].",
66 cmd.AddValue (
"input",
"Name of the input file.",
68 cmd.Parse (argc, argv);
90 NS_LOG_ERROR (
"Problems reading the topology file. Failing.");
102 stack.SetRoutingHelper (nixRouting);
107 address.SetBase (
"10.0.0.0",
"255.255.255.252");
117 nc[i] =
NodeContainer (iter->GetFromNode (), iter->GetToNode ());
123 for (
int i = 0; i < totlinks; i++)
134 for (
int i = 0; i < totlinks; i++)
136 ipic[i] =
address.Assign (ndc[i]);
141 uint32_t totalNodes =
nodes.GetN ();
146 unsigned int randomServerNumber = unifRandom->
GetInteger (0, totalNodes - 1);
151 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
164 for (
unsigned int i = 0; i <
nodes.GetN (); i++ )
166 if (i != randomServerNumber )
169 clientNodes.
Add (clientNode);
178 apps =
sink.Install (randomServerNode);
holds a vector of ns3::Application pointers.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Hold variables of type string.
NetDeviceContainer Install(NodeContainer c)
static void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Helper class that adds Nix-vector routing to nodes.
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
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<TopologyReader> to the actual TopologyReader.
Class for representing data rates.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
virtual uint32_t GetInteger(void)=0
Get the next random value as an integer drawn from the distribution.
static void SinkRx(Ptr< const Packet > p, const Address &ad)
Hold an unsigned integer type.
ConstLinksIterator LinksEnd(void) const
Returns an iterator to the the last link in this block.
holds a vector of ns3::NetDevice pointers
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
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)
Execute the events scheduled with ScheduleDestroy().
Access to the IPv4 forwarding table, interfaces, and configuration.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
int LinksSize(void) const
Returns the number of links in this block.
std::list< Link >::const_iterator ConstLinksIterator
Constant iterator to the list of the links.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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 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...
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
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...
virtual NodeContainer Read(void)=0
Main topology reading function.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
ConstLinksIterator LinksBegin(void) const
Returns an iterator to the the first link in this block.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.