83 #include "ns3/core-module.h"
84 #include "ns3/network-module.h"
85 #include "ns3/internet-module.h"
86 #include "ns3/applications-module.h"
87 #include "ns3/config-store-module.h"
88 #include "ns3/fd-net-device-module.h"
95 main (
int argc,
char *argv[])
97 uint16_t sinkPort = 8000;
98 uint32_t packetSize = 10000;
99 std::string dataRate(
"1000Mb/s");
100 bool serverMode =
false;
102 std::string deviceName (
"eth0");
103 std::string client (
"10.1.1.1");
104 std::string server (
"10.1.1.2");
105 std::string netmask (
"255.255.255.0");
106 std::string macClient (
"00:00:00:00:00:01");
107 std::string macServer (
"00:00:00:00:00:02");
110 cmd.
AddValue (
"deviceName",
"Device name", deviceName);
111 cmd.
AddValue (
"client",
"Local IP address (dotted decimal only please)", client);
112 cmd.
AddValue (
"server",
"Remote IP address (dotted decimal only please)", server);
113 cmd.
AddValue (
"localmask",
"Local mask address (dotted decimal only please)", netmask);
114 cmd.
AddValue (
"serverMode",
"1:true, 0:false, default client", serverMode);
115 cmd.
AddValue (
"mac-client",
"Mac Address for Server Client : 00:00:00:00:00:01", macClient);
116 cmd.
AddValue (
"mac-server",
"Mac Address for Server Default : 00:00:00:00:00:02", macServer);
117 cmd.
AddValue (
"data-rate",
"Data rate defaults to 1000Mb/s", dataRate);
118 cmd.
Parse (argc, argv);
137 Ipv4Mask localMask (netmask.c_str ());
156 internetStackHelper.
Install (node);
160 uint32_t
interface = ipv4->AddInterface (device);
164 ipv4->
SetUp (interface);
holds a vector of ns3::Application pointers.
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
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.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
a polymophic address class
virtual void SetUp(uint32_t interface)=0
Hold an unsigned integer type.
void SetIpv4StackInstall(bool enable)
Enable/disable IPv4 stack install.
holds a vector of ns3::NetDevice pointers
static void Bind(std::string name, const AttributeValue &value)
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.
void SetDeviceName(std::string deviceName)
Set the device name of this device.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Ipv4 addresses are stored in host order in this class.
hold objects of type ns3::Address
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
int main(int argc, char *argv[])
a class to store IPv4 address information on an interface
hold objects of type ns3::DataRate
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...
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
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.
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
build a set of FdNetDevice objects attached to a physical network interface
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.