5G-LENA nr-v4.0
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
traffic-generator-3gpp-pose-control.cc
1// Copyright (c) 2022 CTTC
2// Copyright (c) 2023 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3//
4// SPDX-License-Identifier: GPL-2.0-only
5
6#include "traffic-generator-3gpp-pose-control.h"
7
8#include "ns3/log.h"
9#include "ns3/nstime.h"
10#include "ns3/tcp-socket-factory.h"
11#include "ns3/trace-source-accessor.h"
12#include "ns3/uinteger.h"
13
14namespace ns3
15{
16
17NS_LOG_COMPONENT_DEFINE("TrafficGenerator3gppPoseControl");
18NS_OBJECT_ENSURE_REGISTERED(TrafficGenerator3gppPoseControl);
19
20TypeId
22{
23 static TypeId tid =
24 TypeId("ns3::TrafficGenerator3gppPoseControl")
25 .SetParent<TrafficGenerator>()
26 .SetGroupName("Applications")
27 .AddConstructor<TrafficGenerator3gppPoseControl>()
28 .AddAttribute("PacketSize",
29 "The packet size in bytes.",
30 UintegerValue(100),
31 MakeUintegerAccessor(&TrafficGenerator3gppPoseControl::m_packetSize),
32 MakeUintegerChecker<uint32_t>())
33 .AddAttribute("Periodicity",
34 "The periodicity in milliseconds.",
35 UintegerValue(4),
36 MakeUintegerAccessor(&TrafficGenerator3gppPoseControl::m_periodicity),
37 MakeUintegerChecker<uint32_t>())
38 .AddAttribute("Remote",
39 "The address of the destination",
40 AddressValue(),
41 MakeAddressAccessor(&TrafficGenerator::SetRemote),
42 MakeAddressChecker())
43 .AddAttribute("Protocol",
44 "The type of protocol to use.",
45 TypeIdValue(TcpSocketFactory::GetTypeId()),
46 MakeTypeIdAccessor(&TrafficGenerator::SetProtocol),
47 MakeTypeIdChecker())
48 .AddTraceSource("Tx",
49 "A new packet is created and is sent",
50 MakeTraceSourceAccessor(&TrafficGenerator::m_txTrace),
51 "ns3::TrafficGenerator::TxTracedCallback");
52 return tid;
53}
54
55TrafficGenerator3gppPoseControl::TrafficGenerator3gppPoseControl()
57{
58 NS_LOG_FUNCTION(this);
59}
60
61TrafficGenerator3gppPoseControl::~TrafficGenerator3gppPoseControl()
62{
63 NS_LOG_FUNCTION(this);
64}
65
66void
67TrafficGenerator3gppPoseControl::StartApplication()
68{
69 NS_LOG_FUNCTION(this);
71}
72
73void
74TrafficGenerator3gppPoseControl::PacketBurstSent()
75{
76 NS_LOG_FUNCTION(this);
77 // in 3GPP description of the pose/control traffic there is no notion of frames or packet
78 // bursts, just packets
79 NS_ABORT_MSG("This function should not be called for the pose control traffic");
80}
81
82void
83TrafficGenerator3gppPoseControl::GenerateNextPacketBurstSize()
84{
85 NS_LOG_FUNCTION(this);
86 SetPacketBurstSizeInPackets(1);
87}
88
89uint32_t
90TrafficGenerator3gppPoseControl::GetNextPacketSize() const
91{
92 NS_LOG_FUNCTION(this);
93 return m_packetSize;
94}
95
96Time
97TrafficGenerator3gppPoseControl::GetNextPacketTime() const
98{
99 NS_LOG_FUNCTION(this);
100 return MilliSeconds(m_periodicity);
101}
102
103int64_t
105{
106 return 0;
107}
108
109} // Namespace ns3
void SetRemote(Address remote)
Sets the remote address.
bool SendPacketBurst()
Send another packet burst, which can be e.g., a file, or a video frame.
void SetProtocol(TypeId protocol)
Sets the protocol.