55 #include "ns3/abort.h"
56 #include "ns3/core-module.h"
57 #include "ns3/internet-module.h"
58 #include "ns3/network-module.h"
59 #include "ns3/fd-net-device-module.h"
60 #include "ns3/applications-module.h"
61 #include "ns3/ipv4-static-routing-helper.h"
62 #include "ns3/ipv4-list-routing-helper.h"
75 main (
int argc,
char *argv[])
77 NS_LOG_INFO (
"Ping Emulation Example with TAP on PlanetLab host" );
79 std::string remote (
"173.194.34.51" );
86 std::string network (
"1.2.3.4" );
87 std::string mask (
"255.255.255.0" );
94 cmd.
AddValue (
"remote" ,
"Remote IP address (dotted decimal only please)" , remote);
95 cmd.
AddValue (
"tapNetwork" ,
"Network address to assign the TAP device IP address (dotted decimal only please). Note that the network address must be that from the vsys_vnet tag which must exist in your PlanetLab slice." , network);
96 cmd.
AddValue (
"tapMask" ,
"Network mask for configure the TAP device (dotted decimal only please)" , mask);
97 cmd.
Parse (argc, argv);
99 NS_ABORT_MSG_IF (network ==
"1.2.3.4" ,
"You must change the local IP address before running this example" );
132 addresses.
SetBase (tapNetwork, tapMask);
148 internetStackHelper.
Install (node);
156 uint32_t
interface = ipv4->AddInterface (device);
161 ipv4->
SetUp (interface);
199 helper.
EnablePcap (
"fd-planete-ping" , device,
true );
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
void SetStopTime(Time stop)
Specify application stop time.
Simulation virtual time values and global simulation resolution.
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table.
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
a class to represent an Ipv4 address mask
static void Run(void)
Run the simulation until one of:
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
void Connect(std::string path, const CallbackBase &cb)
void SetTapMask(Ipv4Mask mask)
Set the network mask for the TAP device.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr obj.
static void PingRtt(std::string context, Time rtt)
build a set of FdNetDevice objects attached to a virtual TAP network interface
virtual void SetUp(uint32_t interface)=0
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
static void Bind(std::string name, const AttributeValue &value)
int main(int argc, char *argv[])
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.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionaly.
hold objects of type ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if cond is true.
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.
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual void SetMetric(uint32_t interface, uint16_t metric)=0
virtual bool AddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
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.
void SetTapIpAddress(Ipv4Address address)
Set the device IPv4 address.
void EnablePcap(std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
Enable pcap output the indicated net device.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
void SetStartTime(Time start)
Specify application start time.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.