27 #include <ns3/boolean.h>
29 #include <ns3/packet.h>
30 #include <ns3/uinteger.h>
35 NS_LOG_COMPONENT_DEFINE(
"SatUtScheduler");
40 NS_OBJECT_ENSURE_REGISTERED(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>());
65 NS_LOG_FUNCTION(
this);
71 : m_schedContextCallback(),
72 m_txOpportunityCallback(),
74 m_prioritizeControl(true),
75 m_framePduHeaderSizeInBytes(1),
81 : m_schedContextCallback(),
82 m_txOpportunityCallback(),
84 m_prioritizeControl(true),
85 m_framePduHeaderSizeInBytes(1),
88 NS_LOG_FUNCTION(
this);
90 ObjectBase::ConstructSelf(AttributeConstructionList());
102 NS_LOG_FUNCTION(
this);
108 NS_LOG_FUNCTION(
this);
121 NS_LOG_FUNCTION(
this << &cb);
128 NS_LOG_FUNCTION(
this << &cb);
135 uint32_t payloadBytes,
140 NS_LOG_FUNCTION(
this << payloadBytes << (uint32_t)rcIndex << policy);
142 NS_LOG_INFO(
"UT scheduling RC: " << (uint32_t)(rcIndex) <<
" with " << payloadBytes
147 NS_FATAL_ERROR(
"Conflict in time slot data between RC index and slot type!");
157 if (payloadBytes > 0)
174 for (std::vector<uint8_t>::const_iterator it = rcIndices.begin(); it != rcIndices.end();
180 NS_LOG_INFO(
"UT scheduling RC: " << (uint32_t)(rcIndex) <<
" with " << payloadBytes
193 if (payloadBytes == 0)
203 uint32_t& payloadBytes,
206 NS_LOG_FUNCTION(
this << payloadBytes << (uint32_t)rcIndex);
208 uint32_t schedBytes(0);
209 uint32_t bytesLeft(0);
210 uint32_t nextMinTxO(0);
218 while (payloadBytes > 0)
227 NS_LOG_INFO(
"Created a packet from RC: " << (uint32_t)(rcIndex)
228 <<
" size: " << p->GetSize());
230 packets.push_back(p);
232 NS_ASSERT(payloadBytes >= p->GetSize());
234 schedBytes += p->GetSize();
235 payloadBytes -= p->GetSize();
257 NS_LOG_FUNCTION(
this);
265 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.