54 #include "ns3/abort.h"
55 #include "ns3/core-module.h"
56 #include "ns3/internet-module.h"
57 #include "ns3/network-module.h"
58 #include "ns3/emu-module.h"
59 #include "ns3/applications-module.h"
60 #include "ns3/ipv4-static-routing-helper.h"
61 #include "ns3/ipv4-list-routing-helper.h"
74 main (
int argc,
char *argv[])
78 std::string deviceName (
"eth0");
79 std::string remote (
"208.77.188.166");
86 cmd.
AddValue (
"deviceName",
"Device name", deviceName);
87 cmd.
AddValue (
"remote",
"Remote IP address (dotted decimal only please)", remote);
88 cmd.
Parse (argc, argv);
92 NS_ABORT_MSG_IF (localIp ==
"1.2.3.4",
"You must change the local IP address before running this example");
94 Ipv4Mask localMask (
"255.255.255.0");
140 Ptr<Queue> queue = CreateObject<DropTailQueue> ();
150 internetStackHelper.
Install (node);
154 uint32_t
interface = ipv4->AddInterface (device);
158 ipv4->
SetUp (interface);
174 NS_ABORT_MSG_IF (gateway ==
"1.2.3.4",
"You must change the gateway IP address before running this example");
uint32_t AddApplication(Ptr< Application > application)
void SetStopTime(Time stop)
Specify application stop time.
keep track of time values and allow control of global simulation resolution
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
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
a class to represent an Ipv4 address mask
build a set of EmuNetDevice objects
static void Run(void)
Run the simulation until one of:
aggregate IP/TCP/UDP functionality to existing Nodes.
void Connect(std::string path, const CallbackBase &cb)
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr
void SetQueue(Ptr< Queue > queue)
Attach a queue to the EmuNetDevice.
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
virtual void SetUp(uint32_t interface)=0
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
int main(int argc, char *argv[])
static void Bind(std::string name, const AttributeValue &value)
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)
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...
uint32_t AddDevice(Ptr< NetDevice > device)
a class to store IPv4 address information on an interface
Helper class that adds ns3::Ipv4StaticRouting objects.
hold objects of type ns3::Mac48Address
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...
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.
void EnablePcap(std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
Enable pcap output the indicated net device.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if cond is true.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
void SetStartTime(Time start)
Specify application start time.
static void PingRtt(std::string context, Time rtt)