27#include "ns3/boolean.h"
29#include "ns3/packet.h"
30#include "ns3/uinteger.h"
35NS_LOG_COMPONENT_DEFINE(
"SatUtScheduler");
46 TypeId(
"ns3::SatUtScheduler")
48 .AddConstructor<SatUtScheduler>()
49 .AddAttribute(
"StrictPriorityForControl",
50 "Utilize strict priority for control packets",
54 .AddAttribute(
"FramePduHeaderSize",
55 "Frame PDU header size in bytes",
58 MakeUintegerChecker<uint32_t>());
80 NS_LOG_FUNCTION(
this);
86 NS_LOG_FUNCTION(
this);
88 Object::NotifyConstructionCompleted();
100 NS_LOG_FUNCTION(
this);
106 NS_LOG_FUNCTION(
this);
119 NS_LOG_FUNCTION(
this << &cb);
126 NS_LOG_FUNCTION(
this << &cb);
133 uint32_t payloadBytes,
138 NS_LOG_FUNCTION(
this << payloadBytes << (uint32_t)rcIndex << policy);
140 NS_LOG_INFO(
"UT scheduling RC: " << (uint32_t)(rcIndex) <<
" with " << payloadBytes
145 NS_FATAL_ERROR(
"Conflict in time slot data between RC index and slot type!");
155 if (payloadBytes > 0)
172 for (std::vector<uint8_t>::const_iterator it = rcIndices.begin(); it != rcIndices.end();
178 NS_LOG_INFO(
"UT scheduling RC: " << (uint32_t)(rcIndex) <<
" with " << payloadBytes
191 if (payloadBytes == 0)
201 uint32_t& payloadBytes,
204 NS_LOG_FUNCTION(
this << payloadBytes << (uint32_t)rcIndex);
206 uint32_t schedBytes(0);
207 uint32_t bytesLeft(0);
208 uint32_t nextMinTxO(0);
216 while (payloadBytes > 0)
225 NS_LOG_INFO(
"Created a packet from RC: " << (uint32_t)(rcIndex)
226 <<
" size: " << p->GetSize());
228 packets.push_back(p);
230 NS_ASSERT(payloadBytes >= p->GetSize());
232 schedBytes += p->GetSize();
233 payloadBytes -= p->GetSize();
255 NS_LOG_FUNCTION(
this);
263 NS_LOG_FUNCTION(
this);
SatTimeSlotType_t
Types for time slot.
@ SLOT_TYPE_TRC
Control or traffic slot.
@ SLOT_TYPE_C
Control slot.
The SatUtScheduler is responsible of getting a packet of proper size from higher protocol layer.
SatUtScheduler()
Default constructor.
static TypeId GetTypeId(void)
Derived from Object.
virtual void DoDispose(void)
Dispose of SatUtScheduler.
void SetSchedContextCallback(SatUtScheduler::SchedContextCallback cb)
Method to set Tx opportunity callback.
bool m_prioritizeControl
Strictly prioritize the control message scheduling regardless of the time slot information given from...
SatCompliancePolicy_t
Enum describing the wanted scheduler policy.
uint32_t DoSchedulingForRcIndex(std::vector< Ptr< Packet > > &packets, uint32_t &payloadBytes, uint8_t rcIndex)
Do scheduling for a given RC index.
std::vector< uint8_t > m_rcIndices
Available RC indices for scheduling.
SatUtScheduler::TxOpportunityCallback m_txOpportunityCallback
Callback to notify the txOpportunity to upper layer Returns a packet Attributes: payload in bytes.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
Ptr< SatLowerLayerServiceConf > m_llsConf
The configured lower layer service configuration for this UT MAC.
virtual ~SatUtScheduler()
Destructor.
Callback< void, std::vector< Ptr< SatSchedulingObject > > & > SchedContextCallback
Callback to get scheduling contexts from upper layer.
SatUtScheduler::SchedContextCallback m_schedContextCallback
The scheduling context getter callback.
std::vector< uint8_t > GetPrioritizedRcIndexOrder()
Get a prioritized order of the available RC indices for LOOSE policy UT scheduling.
void DoScheduling(std::vector< Ptr< Packet > > &packets, uint32_t payloadBytes, SatTimeSlotConf::SatTimeSlotType_t type, uint8_t rcIndex, SatCompliancePolicy_t policy)
UT scheduling is responsible of selecting with which RC index to use when requesting packets from hig...
void SetTxOpportunityCallback(SatUtScheduler::TxOpportunityCallback cb)
Method to set Tx opportunity callback.
ByteCounterContainer_t m_utScheduledByteCounters
Byte counters for RC indices.
virtual void SetNodeInfo(Ptr< SatNodeInfo > nodeInfo)
Set the node info.
Callback< Ptr< Packet >, uint32_t, Mac48Address, uint8_t, uint32_t &, uint32_t & > TxOpportunityCallback
Callback to notify upper layer about Tx opportunity.
Ptr< SatNodeInfo > m_nodeInfo
Node information.
uint32_t m_framePduHeaderSizeInBytes
Frame PDU header size.
Sort metric which sorts a vector available RC indices based on "unallocated load".
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.