A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
fcfs-wifi-queue-scheduler.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
10
11#include "wifi-mac-queue.h"
12
13#include "ns3/log.h"
14
15namespace ns3
16{
17
18NS_LOG_COMPONENT_DEFINE("FcfsWifiQueueScheduler");
19
21
24{
25 static TypeId tid = TypeId("ns3::FcfsWifiQueueScheduler")
27 .SetGroupName("Wifi")
28 .AddConstructor<FcfsWifiQueueScheduler>();
29 return tid;
30}
31
36
37void
39{
40 NS_LOG_FUNCTION(this << ac << *mpdu);
41
42 const auto queueId = WifiMacQueueContainer::GetQueueId(mpdu);
43
44 // priority is determined by the head of the queue
45 auto item = GetWifiMacQueue(ac)->PeekByQueueId(queueId);
46 NS_ASSERT(item);
47
48 SetPriority(ac, queueId, {item->GetTimestamp(), queueId.type});
49}
50
51void
53{
54 NS_LOG_FUNCTION(this << ac << mpdus.size());
55
56 std::set<WifiContainerQueueId> queueIds;
57
58 for (const auto& mpdu : mpdus)
59 {
60 queueIds.insert(WifiMacQueueContainer::GetQueueId(mpdu));
61 }
62
63 for (const auto& queueId : queueIds)
64 {
65 if (auto item = GetWifiMacQueue(ac)->PeekByQueueId(queueId))
66 {
67 SetPriority(ac, queueId, {item->GetTimestamp(), queueId.type});
68 }
69 }
70}
71
72void
74{
75 NS_LOG_FUNCTION(this << ac << mpdus.size());
76
77 std::set<WifiContainerQueueId> queueIds;
78
79 for (const auto& mpdu : mpdus)
80 {
81 queueIds.insert(WifiMacQueueContainer::GetQueueId(mpdu));
82 }
83
84 for (const auto& queueId : queueIds)
85 {
86 if (auto item = GetWifiMacQueue(ac)->PeekByQueueId(queueId))
87 {
88 SetPriority(ac, queueId, {item->GetTimestamp(), queueId.type});
89 }
90 }
91}
92
93} // namespace ns3
FcfsWifiQueueScheduler is a wifi queue scheduler that serves data frames in a first come first serve ...
static TypeId GetTypeId()
Get the type ID.
void DoNotifyEnqueue(AcIndex ac, Ptr< WifiMpdu > mpdu) override
Notify the scheduler that the given MPDU has been enqueued by the given Access Category.
void DoNotifyDequeue(AcIndex ac, const std::list< Ptr< WifiMpdu > > &mpdus) override
Notify the scheduler that the given list of MPDUs have been dequeued by the given Access Category.
void DoNotifyRemove(AcIndex ac, const std::list< Ptr< WifiMpdu > > &mpdus) override
Notify the scheduler that the given list of MPDUs have been removed by the given Access Category.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
a unique identifier for an interface.
Definition type-id.h:50
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:999
static WifiContainerQueueId GetQueueId(Ptr< const WifiMpdu > mpdu)
Return the QueueId identifying the container queue in which the given MPDU is (or is to be) enqueued.
void SetPriority(AcIndex ac, const WifiContainerQueueId &queueId, const WifiSchedPrecedence< Time > &priority)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
Definition log.h:228
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:64
Every class exported by the ns3 library is enclosed in the ns3 namespace.