11#include "ns3/double.h"
13#include "ns3/inet-socket-address.h"
14#include "ns3/inet6-socket-address.h"
17#include "ns3/nstime.h"
18#include "ns3/packet-socket-address.h"
19#include "ns3/packet.h"
20#include "ns3/pointer.h"
21#include "ns3/random-variable-stream.h"
22#include "ns3/simulator.h"
23#include "ns3/socket-factory.h"
24#include "ns3/socket.h"
25#include "ns3/string.h"
26#include "ns3/udp-socket-factory.h"
41 TypeId(
"ns3::RtaTigMobileGaming")
43 .SetGroupName(
"Applications")
45 .AddAttribute(
"ModelPresets",
46 "The model presets to use (Custom for custom settings)",
63 "The type of protocol to use. This should be a subclass of ns3::SocketFactory",
68 "CustomInitialPacketSize",
69 "A uniform random variable to generate size in bytes for initial packet payload.",
70 StringValue(
"ns3::UniformRandomVariable[Min=0|Max=20]"),
74 "CustomEndPacketSize",
75 "A uniform random variable to generate size in bytes for end packet payload.",
76 StringValue(
"ns3::UniformRandomVariable[Min=500|Max=600]"),
80 "CustomPacketSizeLev",
81 "A largest extreme value random variable to calculate packet sizes in bytes.",
82 StringValue(
"ns3::LargestExtremeValueRandomVariable[Location=50|Scale=11.0]"),
86 "CustomPacketArrivalLev",
87 "A largest extreme value random variable to calculate packet packet arrivals in "
89 StringValue(
"ns3::LargestExtremeValueRandomVariable[Location=13000|Scale=3700]"),
92 .AddTraceSource(
"TxWithStage",
93 "A packet is sent, this trace also reports the current stage",
95 "ns3::RtaTigMobileGaming::TxTracedCallback");
113 auto currentStream = stream;
118 return (currentStream - stream);
247 "Sent size " << actualSize <<
" does not match expected size " <<
packetSize);
254 <<
packetSize <<
" bytes during stage " << stage <<
" to "
261 <<
packetSize <<
" bytes during stage " << stage <<
" to "
295 os <<
"Initial stage";
298 os <<
"Gaming stage";
301 os <<
"Ending stage";
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
static bool IsMatchingType(const Address &addr)
If the address match.
static bool IsMatchingType(const Address &address)
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
virtual void DoInitialize()
Initialize() implementation.
Smart pointer class similar to boost::intrusive_ptr.
Generate RT mobile gaming traffic.
void DoStartApplication() override
Application specific startup code for child subclasses.
~RtaTigMobileGaming() override
TracedCallback< Ptr< const Packet >, TrafficModelStage > m_txStageTrace
Traced Callback: transmitted packets and their stage.
void CancelEvents() override
Cancel all pending events.
EventId m_txEvent
Event ID of pending TX event scheduling.
Ptr< UniformRandomVariable > m_endSizeUniform
Uniform random variable to generate the end packet size.
TrafficModelStage m_currentStage
Hold the current stage.
void DoInitialize() override
Initialize() implementation.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this Application object.
void SendPacket()
Transmit one initial, gaming or ending packet.
Ptr< LargestExtremeValueRandomVariable > m_levArrivals
Largest extreme value random variable to generate packet arrival times.
static TypeId GetTypeId()
Get the type ID.
ModelPresets m_modelPresets
Model presets to use to configure the traffic generator.
void ScheduleNext()
Schedule the next packet transmission.
Ptr< LargestExtremeValueRandomVariable > m_levSizes
Largest extreme value random variable to generate packet sizes.
TrafficModelStage
Traffic model stages.
void DoConnectionSucceeded(Ptr< Socket > socket) override
Application specific code for child subclasses upon a Connection Succeed event.
void DoStopApplication() override
Application specific shutdown code for child subclasses.
Ptr< UniformRandomVariable > m_initialSizeUniform
Uniform random variable to generate the initial packet size.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
TypeId m_protocolTid
Protocol TypeId value.
SourceApplication(bool allowPacketSocket=true)
Constructor.
Ptr< Socket > m_socket
Socket.
TracedCallback< Ptr< const Packet > > m_txTrace
Traced Callback: transmitted packets.
bool m_connected
flag whether socket is connected
Address m_peer
Peer address.
bool CloseSocket()
Close the socket.
Hold variables of type string.
a unique identifier for an interface.
@ ATTR_GET
The attribute can be read.
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
AttributeValue implementation for TypeId.
static TypeId GetTypeId()
Get the type ID.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Ptr< const AttributeChecker > MakeTypeIdChecker()
Ptr< const AttributeAccessor > MakeTypeIdAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
static const uint32_t packetSize
Packet size generated at the AP.