A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
qkd-kms-queue-logic.h
Go to the documentation of this file.
1/*
2 * Copyright(c) 2022 DOTFEESA www.tk.etf.unsa.ba
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 *
7 *
8 * Author: Miralem Mehic <miralem.mehic@ieee.org>
9 * Emir Dervisevic <emir.dervisevic@etf.unsa.ba>
10 */
11
12#ifndef QKD_KMS_QUEUE_LOGIC_H
13#define QKD_KMS_QUEUE_LOGIC_H
14
15#include <queue>
16#include "ns3/packet.h"
17#include "ns3/object.h"
18#include "http.h"
19#include "ns3/socket.h"
20#include "json.h"
21
22namespace ns3 {
23
24
25/**
26 * @ingroup traffic-control
27 *
28 * Linux pfifo_fast is the default priority queue enabled on Linux
29 * systems. Packets are enqueued in three FIFO droptail queues according
30 * to three priority bands based on the packet priority.
31 *
32 * The system behaves similar to three ns3::DropTail queues operating
33 * together, in which packets from higher priority bands are always
34 * dequeued before a packet from a lower priority band is dequeued.
35 *
36 * The queue disc capacity, i.e., the maximum number of packets that can
37 * be enqueued in the queue disc, is set through the limit attribute, which
38 * plays the same role as txqueuelen in Linux. If no internal queue is
39 * provided, three DropTail queues having each a capacity equal to limit are
40 * created by default. User is allowed to provide queues, but they must be
41 * three, operate in packet mode and each have a capacity not less
42 * than limit.
43 *
44 * @note Additional waiting queues are installed between the L3
45 * and ISO/OSI layer to avoid conflicts in decision making
46 * which could lead to inaccurate routing. Experimental testing and usage!
47 */
48class QKDKMSQueueLogic: public Object {
49public:
50
58
59 /**
60 * @brief Get the type ID.
61 * @return the object TypeId
62 */
63 static TypeId GetTypeId();
64 /**
65 * @brief QKDKMSQueueLogic constructor
66 *
67 * Creates a queue with a depth of 1000 packets per band by default
68 */
70
71 ~QKDKMSQueueLogic() override;
72
75
76private:
77
78 /// Traced callback: fired when a packet is enqueued
80 /// Traced callback: fired when a packet is dequeued
82 /// Traced callback: fired when a packet is dropped
84
85 TracedValue<uint32_t> m_nPackets; //!< Number of packets in the queue
86
88
90
91 std::vector<std::vector<QKDKMSQueueEntry> > m_queues;
92
93};
94
95} // namespace ns3
96
97#endif /* QKD_KMS_QUEUE_LOGIC_H */
The basic class to represent both HTTP requests and responses.
Definition http.h:77
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
Linux pfifo_fast is the default priority queue enabled on Linux systems.
QKDKMSQueueLogic()
QKDKMSQueueLogic constructor.
TracedCallback< const HTTPMessage > m_traceDequeue
Traced callback: fired when a packet is dequeued.
TracedValue< uint32_t > m_nPackets
Number of packets in the queue.
TracedCallback< const HTTPMessage > m_traceDroped
Traced callback: fired when a packet is dropped.
bool Enqueue(QKDKMSQueueEntry item)
QKDKMSQueueLogic::QKDKMSQueueEntry Dequeue()
std::vector< std::vector< QKDKMSQueueEntry > > m_queues
static TypeId GetTypeId()
Get the type ID.
TracedCallback< const HTTPMessage > m_traceEnqueue
Traced callback: fired when a packet is enqueued.
Forward calls to a chain of Callback.
Trace classes with value semantics.
a unique identifier for an interface.
Definition type-id.h:49
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string ksid
Ptr< Socket > socket
Ptr< Packet > packet
HTTPMessage httpMessage