28 NS_LOG_COMPONENT_DEFINE(
"SatBbFrame");
34 : m_modCod(
SatEnums::SAT_MODCOD_QPSK_1_TO_2),
35 m_freeSpaceInBytes(0),
37 m_headerSizeInBytes(0),
40 NS_LOG_FUNCTION(
this);
41 NS_FATAL_ERROR(
"Default constructor of SatBbFrame not supported.");
46 Ptr<SatBbFrameConf> conf)
50 NS_LOG_FUNCTION(
this << modCod << type);
60 m_duration = conf->GetBbFrameDuration(modCod, type);
67 switch (conf->GetDvbVersion())
74 m_maxSpaceInBytes = conf->GetBbFramePayloadBits(conf->GetDefaultModCodDummyFramesS2X(),
79 NS_FATAL_ERROR(
"Unknown DVB version");
88 NS_FATAL_ERROR(
"Invalid BBFrame type!!!");
95 NS_LOG_FUNCTION(
this);
101 NS_LOG_FUNCTION(
this);
108 NS_LOG_FUNCTION(
this);
110 uint32_t dataLengthInBytes = data->GetSize();
119 NS_FATAL_ERROR(
"Data cannot be added to BB frame (length, free space): "
129 NS_LOG_FUNCTION(
this);
136 NS_LOG_FUNCTION(
this);
143 NS_LOG_FUNCTION(
this);
150 NS_LOG_FUNCTION(
this);
157 NS_LOG_FUNCTION(
this);
159 double ifMergedOccupancy = 0.0;
161 uint32_t mergedFrameDataBytes =
162 mergedFrame->GetSpaceUsedInBytes() - mergedFrame->GetFrameHeaderSize();
170 return ifMergedOccupancy;
176 NS_LOG_FUNCTION(
this << carrierBandwidthInHz);
179 m_duration.GetSeconds() / carrierBandwidthInHz);
184 TracedCallback<Ptr<SatBbFrame>, Ptr<SatBbFrame>> mergeTraceCb)
186 NS_LOG_FUNCTION(
this);
190 uint32_t dataBytes = mergedFrame->GetSpaceUsedInBytes() - mergedFrame->GetFrameHeaderSize();
194 mergeTraceCb(
this, mergedFrame);
196 mergedFrame->GetPayload().begin(),
197 mergedFrame->GetPayload().end());
208 NS_LOG_FUNCTION(
this);
210 Time durationDecrease(0);
214 uint32_t maxShortFrameSpaceInBytes =
220 if (spaceUsedInbytes < maxShortFrameSpaceInBytes)
232 return durationDecrease;
238 NS_LOG_FUNCTION(
this);
240 Time durationIncrease(0);
256 return durationIncrease;
double GetOccupancy() const
Get the occupancy of the of the BB Frame.
uint32_t m_freeSpaceInBytes
SatEnums::SatModcod_t m_modCod
uint32_t AddPayload(Ptr< Packet > packet)
Add payload (packet) to transmit buffer of this BB Frame info.
uint32_t m_maxSpaceInBytes
double GetOccupancyIfMerged(Ptr< SatBbFrame > mergedFrame) const
Checks occupancy of the frame if given frame would been merged with this frame.
double GetSpectralEfficiency(double carrierBandwidthInHz) const
Get spectra efficiency of the frame.
Time Extend(Ptr< SatBbFrameConf > conf)
Extent BB frame to the longest type.
const SatBbFramePayload_t & GetPayload()
Get the data in the BB Frame info as container of the packet pointers.
uint32_t m_headerSizeInBytes
SatBbFramePayload_t m_framePayload
SatBbFrame()
Default constructor.
uint32_t GetSpaceLeftInBytes() const
Get space left in BB frame transmit buffer in bytes.
Time Shrink(Ptr< SatBbFrameConf > conf)
Shrink BB frame to the shortest type possible according to current load in the frame.
uint32_t GetSpaceUsedInBytes() const
Get space used in BB frame transmit buffer in bytes.
bool MergeWithFrame(Ptr< SatBbFrame > mergedFrame, TracedCallback< Ptr< SatBbFrame >, Ptr< SatBbFrame >> mergeTraceCb)
Merge given frame with this frame.
uint32_t GetMaxSpaceInBytes() const
Get the maximum size of the BB Frame transmit buffer in bytes.
SatEnums::SatBbFrameType_t m_frameType
std::vector< Ptr< Packet > > SatBbFramePayload_t
Define type SatBbFramePayload_t.
virtual ~SatBbFrame()
Destructor fro BB frame.
SatEnums class is for simplifying the use of enumerators in the satellite module.
SatBbFrameType_t
BB frame type used in DVB-S2 FWD link.
SatModcod_t
Modulation scheme and coding rate for DVB-S2.
constexpr uint32_t BITS_PER_BYTE
Number of bits in a byte.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.