27 #include <ns3/boolean.h>
29 #include <ns3/packet.h>
30 #include <ns3/uinteger.h>
34 NS_LOG_COMPONENT_DEFINE(
"SatUtScheduler");
39 NS_OBJECT_ENSURE_REGISTERED(SatUtScheduler);
45 TypeId(
"ns3::SatUtScheduler")
47 .AddConstructor<SatUtScheduler>()
48 .AddAttribute(
"StrictPriorityForControl",
49 "Utilize strict priority for control packets",
53 .AddAttribute(
"FramePduHeaderSize",
54 "Frame PDU header size in bytes",
57 MakeUintegerChecker<uint32_t>());
64 NS_LOG_FUNCTION(
this);
70 : m_schedContextCallback(),
71 m_txOpportunityCallback(),
73 m_prioritizeControl(true),
74 m_framePduHeaderSizeInBytes(1),
80 : m_schedContextCallback(),
81 m_txOpportunityCallback(),
83 m_prioritizeControl(true),
84 m_framePduHeaderSizeInBytes(1),
87 NS_LOG_FUNCTION(
this);
89 ObjectBase::ConstructSelf(AttributeConstructionList());
101 NS_LOG_FUNCTION(
this);
107 NS_LOG_FUNCTION(
this);
120 NS_LOG_FUNCTION(
this << &cb);
127 NS_LOG_FUNCTION(
this << &cb);
134 uint32_t payloadBytes,
139 NS_LOG_FUNCTION(
this << payloadBytes << (uint32_t)rcIndex << policy);
141 NS_LOG_INFO(
"UT scheduling RC: " << (uint32_t)(rcIndex) <<
" with " << payloadBytes
146 NS_FATAL_ERROR(
"Conflict in time slot data between RC index and slot type!");
156 if (payloadBytes > 0)
173 for (std::vector<uint8_t>::const_iterator it = rcIndices.begin(); it != rcIndices.end();
179 NS_LOG_INFO(
"UT scheduling RC: " << (uint32_t)(rcIndex) <<
" with " << payloadBytes
192 if (payloadBytes == 0)
202 uint32_t& payloadBytes,
205 NS_LOG_FUNCTION(
this << payloadBytes << (uint32_t)rcIndex);
207 uint32_t schedBytes(0);
208 uint32_t bytesLeft(0);
209 uint32_t nextMinTxO(0);
217 while (payloadBytes > 0)
226 NS_LOG_INFO(
"Created a packet from RC: " << (uint32_t)(rcIndex)
227 <<
" size: " << p->GetSize());
229 packets.push_back(p);
231 NS_ASSERT(payloadBytes >= p->GetSize());
233 schedBytes += p->GetSize();
234 payloadBytes -= p->GetSize();
256 NS_LOG_FUNCTION(
this);
264 NS_LOG_FUNCTION(
this);
SatTimeSlotType_t
Types for time slot.
@ SLOT_TYPE_TRC
Control or traffic slot.
@ SLOT_TYPE_C
Control slot.
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.
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.
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.
virtual TypeId GetInstanceTypeId(void) const
Derived from Object.
std::vector< uint8_t > GetPrioritizedRcIndexOrder()
Get a prioritized order of the available RC indices for LOOSE policy UT scheduling.
void SetTxOpportunityCallback(SatUtScheduler::TxOpportunityCallback cb)
Method to set Tx opportunity callback.
uint32_t DoSchedulingForRcIndex(std::vector< Ptr< Packet >> &packets, uint32_t &payloadBytes, uint8_t rcIndex)
Do scheduling for a given RC index.
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.
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...
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.