27 #include "ns3/core-module.h"
28 #include "ns3/csma-module.h"
29 #include "ns3/applications-module.h"
30 #include "ns3/internet-module.h"
31 #include "ns3/network-module.h"
54 uint32_t pktCount,
Time pktInterval )
60 socket,
pktSize,pktCount - 1, pktInterval);
69 main (
int argc,
char *argv[])
76 uint32_t packetCount = 10;
77 double packetInterval = 1.0;
80 uint32_t ipv6Tclass = 0;
81 bool ipv6RecvTclass =
true;
82 uint32_t ipv6Hoplimit = 0;
83 bool ipv6RecvHoplimit =
true;
86 cmd.AddValue (
"PacketSize",
"Packet size in bytes",
packetSize);
87 cmd.AddValue (
"PacketCount",
"Number of packets to send", packetCount);
88 cmd.AddValue (
"Interval",
"Interval between packets", packetInterval);
89 cmd.AddValue (
"IPV6_TCLASS",
"IPV6_TCLASS", ipv6Tclass);
90 cmd.AddValue (
"IPV6_RECVTCLASS",
"IPV6_RECVTCLASS", ipv6RecvTclass);
91 cmd.AddValue (
"IPV6_HOPLIMIT",
"IPV6_HOPLIMIT", ipv6Hoplimit);
92 cmd.AddValue (
"IPV6_RECVHOPLIMIT",
"IPV6_RECVHOPLIMIT", ipv6RecvHoplimit);
93 cmd.Parse (argc, argv);
125 recvSink->
Bind (local);
137 if (ipv6Hoplimit > 0)
145 csma.EnablePcapAll (
"socket-options-ipv6",
false);
148 Time interPacketInterval =
Seconds (packetInterval);
151 source,
packetSize, packetCount, interPacketInterval);
a polymophic address class
Manage ASCII trace files for device models.
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
Parse command-line arguments.
build a set of CsmaNetDevice objects
Class for representing data rates.
AttributeValue implementation for DataRate.
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Helper class to auto-assign global IPv6 unicast addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
Keep track of a set of IPv6 interfaces.
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
Describes an IPv6 prefix.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t GetId(void) const
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void ScheduleWithContext(uint32_t context, Time const &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
static void Run(void)
Run the simulation.
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual void SetIpv6HopLimit(uint8_t ipHopLimit)
Manually set IPv6 Hop Limit.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
virtual int Close(void)=0
Close a socket.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
void SetIpv6RecvHopLimit(bool ipv6RecvHopLimit)
Tells a socket to pass information about IPv6 Hop Limit up the stack.
void SetIpv6Tclass(int ipTclass)
Manually set IPv6 Traffic Class field.
void SetIpv6RecvTclass(bool ipv6RecvTclass)
Tells a socket to pass information about IPv6 Traffic Class up the stack.
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
uint8_t GetHopLimit(void) const
Get the tag's Hop Limit.
indicates whether the socket has IPV6_TCLASS set.
uint8_t GetTclass(void) const
Get the tag's Tclass.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
a unique identifier for an interface.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Hold an unsigned integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
void ReceivePacket(Ptr< Socket > socket)
static void SendPacket(Ptr< Socket > socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
uint32_t pktSize
packet size used for the simulation (in bytes)
static const uint32_t packetSize