Generate video traffic. More...
#include "tgax-video-traffic.h"
Classes | |
| struct | TrafficModelParameters |
| List of parameters for a given traffic model. More... | |
| struct | UnsentPacketInfo |
| Structure to store information about packets that are not successfully transmitted. More... | |
Public Types | |
| enum class | TrafficModelClassIdentifier : uint8_t { CUSTOM = 0 , BUFFERED_VIDEO_1 , BUFFERED_VIDEO_2 , BUFFERED_VIDEO_3 , BUFFERED_VIDEO_4 , BUFFERED_VIDEO_5 , BUFFERED_VIDEO_6 , MULTICAST_VIDEO_1 , MULTICAST_VIDEO_2 } |
| TrafficModelClassIdentifier enumeration. More... | |
| using | TrafficModels = std::map<TrafficModelClassIdentifier, TrafficModelParameters> |
| Parameters for each traffic model. | |
| Public Types inherited from ns3::Application | |
| typedef void(* | DelayAddressCallback) (const Time &delay, const Address &from) |
| Common callback signature for packet delay and address. | |
| typedef void(* | StateTransitionCallback) (const std::string &oldState, const std::string &newState) |
| Common signature used by callbacks to application's state transition trace source. | |
Public Member Functions | |
| TgaxVideoTraffic () | |
| ~TgaxVideoTraffic () override | |
| int64_t | AssignStreams (int64_t stream) override |
| Assign a fixed random variable stream number to the random variables used by this Application object. | |
| Public Member Functions inherited from ns3::SourceApplication | |
| SourceApplication (bool allowPacketSocket=true) | |
| Constructor. | |
| ~SourceApplication () override | |
| Address | GetRemote () const |
| get the remote address | |
| Ptr< Socket > | GetSocket () const |
| Get the socket this application is attached to. | |
| virtual void | SetRemote (const Address &addr) |
| set the remote address | |
| Public Member Functions inherited from ns3::Application | |
| Application () | |
| ~Application () override | |
| Ptr< Node > | GetNode () const |
| void | SetNode (Ptr< Node > node) |
| void | SetStartTime (Time start) |
| Specify application start time. | |
| void | SetStopTime (Time stop) |
| Specify application stop time. | |
| Public Member Functions inherited from ns3::Object | |
| Object () | |
| Caller graph was not generated because of its size. | |
| ~Object () override | |
| Destructor. | |
| void | AggregateObject (Ptr< Object > other) |
| Aggregate two Objects together. | |
| void | Dispose () |
| Dispose of this Object. | |
| AggregateIterator | GetAggregateIterator () const |
| Get an iterator to the Objects aggregated to this one. | |
| TypeId | GetInstanceTypeId () const final |
| Get the most derived TypeId for this Object. | |
| template<> | |
| Ptr< Object > | GetObject () const |
| Specialization of () for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject () const |
| Get a pointer to the requested aggregated Object. | |
| template<> | |
| Ptr< Object > | GetObject (TypeId tid) const |
| Specialization of (TypeId tid) for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject (TypeId tid) const |
| Get a pointer to the requested aggregated Object by TypeId. | |
| void | Initialize () |
| Invoke DoInitialize on all Objects aggregated to this one. | |
| bool | IsInitialized () const |
| Check if the object has been initialized. | |
| void | UnidirectionalAggregateObject (Ptr< Object > other) |
| Aggregate an Object to another Object. | |
| Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
| SimpleRefCount () | |
| Default constructor. | |
| uint32_t | GetReferenceCount () const |
| Get the reference count of the object. | |
| SimpleRefCount & | operator= (const SimpleRefCount &o) |
| Assignment operator. | |
| void | Ref () const |
| Increment the reference count. | |
| void | Unref () const |
| Decrement the reference count. | |
| Public Member Functions inherited from ns3::ObjectBase | |
| virtual | ~ObjectBase () |
| Virtual destructor. | |
| void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
| Get the value of an attribute, raising fatal errors if unsuccessful. | |
| bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
| Get the value of an attribute without raising errors. | |
| void | SetAttribute (std::string name, const AttributeValue &value) |
| Set a single attribute, raising fatal errors if unsuccessful. | |
| bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
| Set a single attribute without raising errors. | |
| bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
| Connect a TraceSource to a Callback with a context. | |
| bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
| Connect a TraceSource to a Callback without a context. | |
| bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
| Disconnect from a TraceSource a Callback previously connected with a context. | |
| bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
| Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
| Static Public Member Functions inherited from ns3::SourceApplication | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
| Static Public Member Functions inherited from ns3::Application | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
| Static Public Member Functions inherited from ns3::Object | |
| static TypeId | GetTypeId () |
| Register this type. | |
| Static Public Member Functions inherited from ns3::ObjectBase | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
Static Public Attributes | |
| static const TrafficModels | m_trafficModels |
| Traffic models as defined in Table 5 from IEEE 802.11-14/0571r12 - 11ax Evaluation Methodology. | |
Protected Member Functions | |
| void | DoInitialize () override |
| Initialize() implementation. | |
| Protected Member Functions inherited from ns3::SourceApplication | |
| bool | CloseSocket () |
| Close the socket. | |
| void | DoDispose () override |
| Destructor implementation. | |
| Protected Member Functions inherited from ns3::Object | |
| Object (const Object &o) | |
| Copy an Object. | |
| virtual void | NotifyNewAggregate () |
| Notify all Objects aggregated to this one of a new Object being aggregated. | |
| Protected Member Functions inherited from ns3::ObjectBase | |
| void | ConstructSelf (const AttributeConstructionList &attributes) |
| Complete construction of ObjectBase; invoked by derived classes. | |
| virtual void | NotifyConstructionCompleted () |
| Notifier called once the ObjectBase is fully constructed. | |
Private Types | |
| typedef void(* | TxTracedCallback) (Ptr< const Packet > packet, Time latency) |
| TracedCallback signature for packet and latency. | |
Private Member Functions | |
| void | CancelEvents () override |
| Cancel all pending events. | |
| void | DoConnectionSucceeded (Ptr< Socket > socket) override |
| Application specific code for child subclasses upon a Connection Succeed event. | |
| void | DoStartApplication () override |
| Application specific startup code for child subclasses. | |
| void | GenerateVideoFrame () |
| Generate new video frame. | |
| uint32_t | GetNextPayloadSize () |
| void | ScheduleNextFrame () |
| Schedule the next frame generation. | |
| void | Send (uint64_t eventId, uint32_t size, Time latency) |
| Effectively send a packet once the latency has elapsed. | |
| void | SendWithLatency () |
| Schedule send of a packet with a random latency. | |
| void | TxAvailable (Ptr< Socket > socket, uint32_t available) |
| Handle a Send event. | |
| void | TxDone (Ptr< Socket > socket, uint32_t size) |
| Handle a Data Sent event. | |
Private Attributes | |
| DataRate | m_bitRate |
| Video bit rate (if model is custom). | |
| TracedCallback< uint32_t > | m_frameGeneratedTrace |
| Traced Callback: generated frames (amount of payload bytes). | |
| Ptr< WeibullRandomVariable > | m_frameSizeBytes |
| Weibull random variable to generate size of video frames (in bytes). | |
| double | m_frameSizeBytesScale |
| Scale parameter for the Weibull distribution used to generate size of video frames (if model is custom). | |
| double | m_frameSizeBytesShape |
| Shape parameter for the Weibull distribution used to generate size of video frames (if model is custom). | |
| std::deque< uint32_t > | m_generatedFrames |
| Hold size of generated video frames. | |
| EventId | m_generateFrameEvent |
| Event ID of pending frame generation event. | |
| Time | m_interArrival |
| Calculated inter arrival duration between two generated packets. | |
| Ptr< GammaRandomVariable > | m_latencyMs |
| Gamma random variable to generate latency (in milliseconds). | |
| double | m_latencyMsScale |
| Scale parameter for the Gamma distribution used to generate latency. | |
| double | m_latencyMsShape |
| Shape parameter for the Gamma distribution used to generate latency. | |
| std::optional< uint32_t > | m_maxSize |
| Limit on the number of bytes that can be sent at once over the network, hence we limit at application level to apply the latency to each transmitted packet. | |
| uint64_t | m_nextEventId {0} |
| The next event ID. | |
| uint32_t | m_remainingSize {0} |
| Number of bytes to send directly to the socket because current video frame is too large to be sent at once. | |
| std::map< uint64_t, EventId > | m_sendEvents |
| Event IDs of pending TX events. | |
| TrafficModelClassIdentifier | m_trafficModelClassId |
| The Traffic Model Class Identifier. | |
| TracedCallback< Ptr< const Packet >, Time > | m_txLatencyTrace |
| Traced Callback: transmitted packets and their latencies. | |
| std::deque< UnsentPacketInfo > | m_unsentPackets |
| Hold unsent packet for later attempt. | |
Additional Inherited Members | |
| Protected Types inherited from ns3::SourceApplication | |
| typedef void(* | ConnectionEventCallback) (Ptr< Socket > socket, const Address &local, const Address &remote) |
| TracedCallback signature for connection success/failure event. | |
| Protected Attributes inherited from ns3::SourceApplication | |
| bool | m_connected {false} |
| flag whether socket is connected | |
| TracedCallback< Ptr< Socket >, const Address &, const Address & > | m_connectionFailure |
| Traced Callback: connection failure event. | |
| TracedCallback< Ptr< Socket >, const Address &, const Address & > | m_connectionSuccess |
| Traced Callback: connection success event. | |
| Address | m_local |
| Local address to bind to. | |
| Address | m_peer |
| Peer address. | |
| TypeId | m_protocolTid |
| Protocol TypeId value. | |
| Ptr< Socket > | m_socket |
| Socket. | |
| uint8_t | m_tos |
| The packets Type of Service. | |
| TracedCallback< Ptr< const Packet > > | m_txTrace |
| Traced Callback: transmitted packets. | |
| Protected Attributes inherited from ns3::Application | |
| Ptr< Node > | m_node |
| The node that this application is installed on. | |
| EventId | m_startEvent |
| The event that will fire at m_startTime to start the application. | |
| Time | m_startTime |
| The simulation time that the application will start. | |
| EventId | m_stopEvent |
| The event that will fire at m_stopTime to end the application. | |
| Time | m_stopTime |
| The simulation time that the application will end. | |
| Related Symbols inherited from ns3::ObjectBase | |
| static TypeId | GetObjectIid () |
| Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Generate video traffic.
This video traffic generator implements the Buffered Video Steaming model from IEEE 802.11-14/0571r12 - 11ax Evaluation Methodology (see applications documentation for full citation).
ns3::TgaxVideoTraffic is accessible through the following paths with Config::Set and Config::Connect:
DataRate TypeId Custom|BV1|BV2|BV3|BV4|BV5|BV6|MC1|MC2 Address Address Time -9.22337e+18ns:+9.22337e+18ns Time -9.22337e+18ns:+9.22337e+18ns Group: Applications
Size of this type is 632 bytes (on a 64-bit architecture).
Definition at line 36 of file tgax-video-traffic.h.
| using ns3::TgaxVideoTraffic::TrafficModels = std::map<TrafficModelClassIdentifier, TrafficModelParameters> |
Parameters for each traffic model.
Definition at line 77 of file tgax-video-traffic.h.
|
private |
TracedCallback signature for packet and latency.
| [in] | packet | The packet. |
| [in] | latency | The networking latency. |
Definition at line 181 of file tgax-video-traffic.h.
|
strong |
TrafficModelClassIdentifier enumeration.
| Enumerator | |
|---|---|
| CUSTOM | |
| BUFFERED_VIDEO_1 | |
| BUFFERED_VIDEO_2 | |
| BUFFERED_VIDEO_3 | |
| BUFFERED_VIDEO_4 | |
| BUFFERED_VIDEO_5 | |
| BUFFERED_VIDEO_6 | |
| MULTICAST_VIDEO_1 | |
| MULTICAST_VIDEO_2 | |
Definition at line 49 of file tgax-video-traffic.h.
| ns3::TgaxVideoTraffic::TgaxVideoTraffic | ( | ) |
Definition at line 147 of file tgax-video-traffic.cc.
References ns3::CreateObject(), m_frameSizeBytes, m_latencyMs, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
override |
Definition at line 154 of file tgax-video-traffic.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
Assign a fixed random variable stream number to the random variables used by this Application object.
| stream | first stream index to use |
Reimplemented from ns3::Application.
Definition at line 160 of file tgax-video-traffic.cc.
References m_frameSizeBytes, m_latencyMs, and NS_LOG_FUNCTION.
|
overrideprivatevirtual |
Cancel all pending events.
Implements ns3::SourceApplication.
Definition at line 222 of file tgax-video-traffic.cc.
References m_generateFrameEvent, m_sendEvents, m_unsentPackets, and NS_LOG_FUNCTION.
Application specific code for child subclasses upon a Connection Succeed event.
| socket | the connected socket |
Reimplemented from ns3::SourceApplication.
Definition at line 352 of file tgax-video-traffic.cc.
References NS_LOG_FUNCTION, and ScheduleNextFrame().
|
overrideprotectedvirtual |
Initialize() implementation.
This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.
Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.
Reimplemented from ns3::Application.
Definition at line 170 of file tgax-video-traffic.cc.
References CUSTOM, ns3::Object::DoInitialize(), ns3::TcpSocketFactory::GetTypeId(), m_bitRate, m_frameSizeBytes, m_frameSizeBytesScale, m_frameSizeBytesShape, m_interArrival, m_latencyMs, m_latencyMsScale, m_latencyMsShape, ns3::SourceApplication::m_protocolTid, m_trafficModelClassId, m_trafficModels, MULTICAST_VIDEO_1, MULTICAST_VIDEO_2, NS_ABORT_MSG_IF, NS_ASSERT, and NS_LOG_FUNCTION.
|
overrideprivatevirtual |
Application specific startup code for child subclasses.
Reimplemented from ns3::SourceApplication.
Definition at line 199 of file tgax-video-traffic.cc.
References ns3::UintegerValue::Get(), ns3::TcpSocketFactory::GetTypeId(), ns3::SourceApplication::m_connected, m_maxSize, ns3::SourceApplication::m_protocolTid, ns3::SourceApplication::m_socket, ns3::MakeCallback(), NS_LOG_FUNCTION, ScheduleNextFrame(), TxAvailable(), and TxDone().
|
private |
Generate new video frame.
Definition at line 245 of file tgax-video-traffic.cc.
References m_frameGeneratedTrace, m_frameSizeBytes, m_generatedFrames, NS_LOG_FUNCTION, ScheduleNextFrame(), and SendWithLatency().
Referenced by ScheduleNextFrame().
|
private |
Definition at line 264 of file tgax-video-traffic.cc.
References m_generatedFrames, m_maxSize, m_remainingSize, ns3::SourceApplication::m_socket, and NS_ASSERT.
Referenced by SendWithLatency().
|
static |
Get the type ID.
Definition at line 54 of file tgax-video-traffic.cc.
References ns3::SourceApplication::SourceApplication(), TgaxVideoTraffic(), ns3::TypeId::ATTR_CONSTRUCT, ns3::TypeId::ATTR_GET, BUFFERED_VIDEO_1, BUFFERED_VIDEO_2, BUFFERED_VIDEO_3, BUFFERED_VIDEO_4, BUFFERED_VIDEO_5, BUFFERED_VIDEO_6, CUSTOM, ns3::TcpSocketFactory::GetTypeId(), m_bitRate, m_frameGeneratedTrace, m_frameSizeBytesScale, m_frameSizeBytesShape, m_latencyMsScale, m_latencyMsShape, ns3::SourceApplication::m_protocolTid, m_trafficModelClassId, m_txLatencyTrace, ns3::MakeDataRateAccessor(), ns3::MakeDataRateChecker(), ns3::MakeDoubleAccessor(), ns3::MakeDoubleChecker(), ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), ns3::MakeTraceSourceAccessor(), ns3::MakeTypeIdAccessor(), ns3::MakeTypeIdChecker(), MULTICAST_VIDEO_1, MULTICAST_VIDEO_2, and ns3::TypeId::SetParent().
Referenced by TgaxVideoTrafficTestCase::DoSetup().
|
private |
Schedule the next frame generation.
Definition at line 235 of file tgax-video-traffic.cc.
References GenerateVideoFrame(), m_generateFrameEvent, m_interArrival, NS_ASSERT, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by DoConnectionSucceeded(), DoStartApplication(), and GenerateVideoFrame().
Effectively send a packet once the latency has elapsed.
| eventId | the event ID |
| size | the size of the packet to send (in bytes) |
| latency | the latency applied to that packet |
Definition at line 306 of file tgax-video-traffic.cc.
References ns3::Inet6SocketAddress::ConvertFrom(), ns3::InetSocketAddress::ConvertFrom(), ns3::Create(), ns3::Inet6SocketAddress::IsMatchingType(), ns3::InetSocketAddress::IsMatchingType(), ns3::SourceApplication::m_peer, m_sendEvents, ns3::SourceApplication::m_socket, m_txLatencyTrace, ns3::SourceApplication::m_txTrace, m_unsentPackets, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::Time::S.
Referenced by SendWithLatency(), and TxAvailable().
|
private |
Schedule send of a packet with a random latency.
Definition at line 288 of file tgax-video-traffic.cc.
References ns3::Time::FromDouble(), GetNextPayloadSize(), m_latencyMs, m_nextEventId, m_sendEvents, ns3::Time::MS, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::Time::S, ns3::Simulator::Schedule(), Send(), and ns3::Time::US.
Referenced by GenerateVideoFrame(), TxAvailable(), and TxDone().
Handle a Send event.
| socket | the connected socket |
| available | the amount of available bytes for transmission |
Definition at line 369 of file tgax-video-traffic.cc.
References m_generatedFrames, ns3::SourceApplication::m_socket, m_unsentPackets, NS_LOG_DEBUG, NS_LOG_FUNCTION, Send(), and SendWithLatency().
Referenced by DoStartApplication().
Handle a Data Sent event.
| socket | the connected socket |
| size | the amount of transmitted bytes |
Definition at line 359 of file tgax-video-traffic.cc.
References m_generatedFrames, ns3::SourceApplication::m_socket, m_unsentPackets, NS_LOG_FUNCTION, and SendWithLatency().
Referenced by DoStartApplication().
|
private |
Video bit rate (if model is custom).
Definition at line 137 of file tgax-video-traffic.h.
Referenced by DoInitialize(), and GetTypeId().
|
private |
Traced Callback: generated frames (amount of payload bytes).
Definition at line 187 of file tgax-video-traffic.h.
Referenced by GenerateVideoFrame(), and GetTypeId().
|
private |
Weibull random variable to generate size of video frames (in bytes).
Definition at line 148 of file tgax-video-traffic.h.
Referenced by TgaxVideoTraffic(), AssignStreams(), DoInitialize(), and GenerateVideoFrame().
|
private |
Scale parameter for the Weibull distribution used to generate size of video frames (if model is custom).
Definition at line 138 of file tgax-video-traffic.h.
Referenced by DoInitialize(), and GetTypeId().
|
private |
Shape parameter for the Weibull distribution used to generate size of video frames (if model is custom).
Definition at line 140 of file tgax-video-traffic.h.
Referenced by DoInitialize(), and GetTypeId().
|
private |
Hold size of generated video frames.
Definition at line 160 of file tgax-video-traffic.h.
Referenced by GenerateVideoFrame(), GetNextPayloadSize(), TxAvailable(), and TxDone().
|
private |
Event ID of pending frame generation event.
Definition at line 159 of file tgax-video-traffic.h.
Referenced by CancelEvents(), and ScheduleNextFrame().
|
private |
Calculated inter arrival duration between two generated packets.
Definition at line 157 of file tgax-video-traffic.h.
Referenced by DoInitialize(), and ScheduleNextFrame().
|
private |
Gamma random variable to generate latency (in milliseconds).
Definition at line 150 of file tgax-video-traffic.h.
Referenced by TgaxVideoTraffic(), AssignStreams(), DoInitialize(), and SendWithLatency().
|
private |
Scale parameter for the Gamma distribution used to generate latency.
Definition at line 143 of file tgax-video-traffic.h.
Referenced by DoInitialize(), and GetTypeId().
|
private |
Shape parameter for the Gamma distribution used to generate latency.
Definition at line 145 of file tgax-video-traffic.h.
Referenced by DoInitialize(), and GetTypeId().
|
private |
Limit on the number of bytes that can be sent at once over the network, hence we limit at application level to apply the latency to each transmitted packet.
Definition at line 152 of file tgax-video-traffic.h.
Referenced by DoStartApplication(), and GetNextPayloadSize().
|
private |
The next event ID.
Definition at line 163 of file tgax-video-traffic.h.
Referenced by SendWithLatency().
|
private |
Number of bytes to send directly to the socket because current video frame is too large to be sent at once.
Definition at line 155 of file tgax-video-traffic.h.
Referenced by GetNextPayloadSize().
|
private |
Event IDs of pending TX events.
Definition at line 162 of file tgax-video-traffic.h.
Referenced by CancelEvents(), Send(), and SendWithLatency().
|
private |
The Traffic Model Class Identifier.
Definition at line 136 of file tgax-video-traffic.h.
Referenced by DoInitialize(), and GetTypeId().
|
static |
Traffic models as defined in Table 5 from IEEE 802.11-14/0571r12 - 11ax Evaluation Methodology.
Definition at line 79 of file tgax-video-traffic.h.
Referenced by DoInitialize(), and TgaxVideoTrafficTestCase::DoRun().
|
private |
Traced Callback: transmitted packets and their latencies.
Definition at line 184 of file tgax-video-traffic.h.
Referenced by GetTypeId(), and Send().
|
private |
Hold unsent packet for later attempt.
Definition at line 173 of file tgax-video-traffic.h.
Referenced by CancelEvents(), Send(), TxAvailable(), and TxDone().