48 pNumUnicastPacketsUnsupported_{},
49 pNumUnicastBytesUnsupported_{},
50 pNumBroadcastPacketsUnsupported_{},
51 pNumBroadcastBytesUnsupported_{}
55 categories_[u8Category].
category_ = u8Category;
72 pNumUnicastPacketsUnsupported_ =
73 statisticRegistrar.
registerNumeric<std::uint32_t>(
"numUnicastPacketsUnsupported",
75 pNumUnicastBytesUnsupported_ =
76 statisticRegistrar.
registerNumeric<std::uint32_t>(
"numUnicastBytesUnsupported",
78 pNumBroadcastPacketsUnsupported_ =
79 statisticRegistrar.
registerNumeric<std::uint32_t>(
"numBroadcastPacketsUnsupported",
81 pNumBroadcastBytesUnsupported_ =
82 statisticRegistrar.
registerNumeric<std::uint32_t>(
"numBroadcastBytesUnsupported",
104 if(u8Category < numActiveCategories_)
107 while(maxEntries < categories_[u8Category].queue_.size())
109 categories_[u8Category].
queue_.pop();
129 for(std::uint8_t u8Category = 0; u8Category < numActiveCategories_; ++u8Category)
132 while(maxEntries < categories_[u8Category].queue_.size())
134 categories_[u8Category].
queue_.pop();
171 for(std::uint8_t u8Category = 0; u8Category < numActiveCategories_; ++u8Category)
193 if(u8Category < numActiveCategories_)
213 for(std::uint8_t u8Category = 0; u8Category < numActiveCategories_; ++u8Category)
237 if(u8Category < numActiveCategories_)
239 result = categories_[u8Category].
queue_.size();
257 for(std::uint8_t u8Category = 0; u8Category < numActiveCategories_; ++u8Category)
259 result += categories_[u8Category].
queue_.size();
272 if(u8Category < numActiveCategories_)
287 for(std::uint8_t u8Category = 0; u8Category < numActiveCategories_; ++u8Category)
311 for(std::uint8_t u8Category = u8NumCategories; u8Category < numActiveCategories_; ++u8Category)
314 while(categories_[numActiveCategories_ - u8Category].queue_.empty() ==
false)
316 categories_[numActiveCategories_ - u8Category].
queue_.pop();
321 numActiveCategories_ = u8NumCategories;
333 std::pair<EMANE::Models::IEEE80211ABG::DownstreamQueueEntry, bool>
337 for(
int iIndex = numActiveCategories_ - 1; iIndex >= 0; --iIndex)
340 if(categories_[iIndex].queue_.empty() ==
false)
345 categories_[iIndex].
queue_.pop();
347 return {std::move(entry),
true};
359 std::vector<EMANE::Models::IEEE80211ABG::DownstreamQueueEntry>
362 std::vector<DownstreamQueueEntry> result;
369 if(p->u8MaxQueueCapacity_ == 0)
372 result.push_back(std::move(entry));
375 else if((p->u16MaxPacketSize_ != 0) && (entry.
pkt_.
length() > p->u16MaxPacketSize_))
381 p->pNumBroadcastBytesTooLarge_ += entry.
pkt_.
length();
385 ++*p->pNumUnicastPacketsTooLarge_;
386 *p->pNumUnicastBytesTooLarge_ += entry.
pkt_.
length();
390 result.push_back(std::move(entry));
395 while(p->queue_.size() >= p->u8MaxQueueCapacity_)
398 result.push_back(std::move(p->queue_.front()));
404 p->queue_.push(std::move(entry));
407 if(p->queue_.size() > p->pNumHighWaterMark_->get())
409 *p->pNumHighWaterMark_ = p->queue_.size();
410 *p->pNumHighWaterMax_ = p->u8MaxQueueCapacity_;
418 ++*pNumBroadcastPacketsUnsupported_;
419 *pNumBroadcastBytesUnsupported_ += entry.
pkt_.
length();
423 ++*pNumUnicastPacketsUnsupported_;
424 *pNumUnicastBytesUnsupported_ += entry.
pkt_.
length();
428 result.push_back(std::move(entry));
447 if(u8Category < numActiveCategories_)
466 for(std::uint8_t u8Category = 0; u8Category < numActiveCategories_; ++u8Category)
const PacketInfo & getPacketInfo() const
EMANE::DownstreamPacket pkt_
size_t numPacketOverFlow_
IEEE80211abgDownstreamPacketQueue queue_
NEMId getDestination() const
structure defines the mac downstream packet queue entry
constexpr NEMId NEM_BROADCAST_MAC_ADDRESS
const std::uint8_t MAX_ACCESS_CATEGORIES
size_t getDepth()
get the number of entries for all active queues
StatisticNumeric< std::uint32_t > * pNumBroadcastPacketsTooLarge_
std::pair< DownstreamQueueEntry, bool > dequeue()
blocking dequeue, returns highest priority item first
void setMaxEntrySize(size_t)
set the max entry size for all queues
The StatisticRegistrar allows NEM layers to register statistics and statistic tables. Statistics and Statistic tables are owned by the emulator framework and a borrowed reference is returned to the registering NEM layer.
~DownstreamQueue()
queue destructor
size_t getAvailableSpace()
StatisticNumeric< T > * registerNumeric(const std::string &sName, const StatisticProperties &properties=StatisticProperties::NONE, const std::string &sDescription="")
Defines an access category container.
void registerStatistics(StatisticRegistrar &statisticRegistrar)
std::uint16_t u16MaxPacketSize_
DownstreamQueue(EMANE::NEMId id)
queue constructor
std::vector< DownstreamQueueEntry > enqueue(DownstreamQueueEntry &entry)
enqueue, inserts items by priority, signals on success.
void setMaxCapacity(size_t)
set the max number of entries for all queues
size_t getMaxCapacity()
get the max number of entries for all queues
std::uint8_t u8MaxQueueCapacity_
void setCategories(std::uint8_t u8Category)
set the number of categories (queues)
void registerStatistics(StatisticRegistrar &statisticRegistrar)
size_t getNumOverFlow(bool bClear)