A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wimax-connection.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008, 2009 INRIA, UDcast
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7 * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
8 */
9
10#ifndef WIMAX_CONNECTION_H
11#define WIMAX_CONNECTION_H
12
13#include "cid.h"
14#include "service-flow.h"
15#include "wimax-mac-header.h"
16#include "wimax-mac-queue.h"
17
18#include "ns3/object.h"
19
20#include <ostream>
21#include <stdint.h>
22
23namespace ns3
24{
25
26class ServiceFlow;
27class Cid;
28
29/**
30 * \ingroup wimax
31 * Class to represent WiMAX connections
32 */
33class WimaxConnection : public Object
34{
35 public:
36 /**
37 * \brief Get the type ID.
38 * \return the object TypeId
39 */
40 static TypeId GetTypeId();
41
42 /**
43 * Constructor
44 *
45 * \param cid connection ID
46 * \param type CID type
47 */
48 WimaxConnection(Cid cid, Cid::Type type);
49 ~WimaxConnection() override;
50
51 /**
52 * Get CID function
53 * \returns the CID
54 */
55 Cid GetCid() const;
56
57 /**
58 * Get type function
59 * \returns the type
60 */
61 Cid::Type GetType() const;
62 /**
63 * \return the queue of the connection
64 */
66 /**
67 * \brief set the service flow associated to this connection
68 * \param serviceFlow The service flow to be associated to this connection
69 */
70 void SetServiceFlow(ServiceFlow* serviceFlow);
71 /**
72 * \return the service flow associated to this connection
73 */
75
76 // wrapper functions
77 /**
78 * \return the scheduling type of this connection
79 */
80 uint8_t GetSchedulingType() const;
81 /**
82 * \brief enqueue a packet in the queue of the connection
83 * \param packet the packet to be enqueued
84 * \param hdrType the header type of the packet
85 * \param hdr the header of the packet
86 * \return true if successful
87 */
88 bool Enqueue(Ptr<Packet> packet, const MacHeaderType& hdrType, const GenericMacHeader& hdr);
89 /**
90 * \brief dequeue a packet from the queue of the connection
91 * \param packetType the type of the packet to dequeue
92 * \return packet dequeued
93 */
95 /**
96 * \brief dequeue a packet from the queue of the connection
97 * Dequeue the first packet in the queue if its size is lower than
98 * availableByte, the first availableByte of the first packet otherwise
99 *
100 * \param packetType the type of the packet to dequeue
101 * \param availableByte the number of available bytes
102 * \return packet dequeued
103 */
104 Ptr<Packet> Dequeue(MacHeaderType::HeaderType packetType, uint32_t availableByte);
105 /**
106 * \return true if the connection has at least one packet in its queue, false otherwise
107 */
108 bool HasPackets() const;
109 /**
110 * \return true if the connection has at least one packet of type packetType in its queue, false
111 * otherwise
112 * \param packetType type of packet to check in the queue
113 * \return true if packets available
114 */
115 bool HasPackets(MacHeaderType::HeaderType packetType) const;
116
117 /**
118 * Get type string
119 * \returns the type string
120 */
121 std::string GetTypeStr() const;
122
123 /// Definition of Fragments Queue data type
124 typedef std::list<Ptr<const Packet>> FragmentsQueue;
125 /**
126 * \brief get a queue of received fragments
127 * \returns the fragments queue
128 */
129 const FragmentsQueue GetFragmentsQueue() const;
130 /**
131 * \brief enqueue a received packet (that is a fragment) into the fragments queue
132 * \param fragment received fragment
133 */
134 void FragmentEnqueue(Ptr<const Packet> fragment);
135 /**
136 * \brief delete all enqueued fragments
137 */
138 void ClearFragmentsQueue();
139
140 private:
141 void DoDispose() override;
142
143 Cid m_cid; ///< CID
144 Cid::Type m_cidType; ///< CID type
146 ServiceFlow* m_serviceFlow; ///< service flow
147
148 // FragmentsQueue stores all received fragments
149 FragmentsQueue m_fragmentsQueue; ///< fragments queue
150};
151
152} // namespace ns3
153
154#endif /* WIMAX_CONNECTION_H */
Cid class.
Definition cid.h:26
Type
Type enumeration.
Definition cid.h:30
This class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
HeaderType
Header type enumeration.
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
This class implements service flows as described by the IEEE-802.16 standard.
a unique identifier for an interface.
Definition type-id.h:48
Class to represent WiMAX connections.
ServiceFlow * m_serviceFlow
service flow
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, const GenericMacHeader &hdr)
enqueue a packet in the queue of the connection
std::string GetTypeStr() const
Get type string.
ServiceFlow * GetServiceFlow() const
void DoDispose() override
Destructor implementation.
Cid::Type GetType() const
Get type function.
Ptr< Packet > Dequeue(MacHeaderType::HeaderType packetType=MacHeaderType::HEADER_TYPE_GENERIC)
dequeue a packet from the queue of the connection
void ClearFragmentsQueue()
delete all enqueued fragments
Cid GetCid() const
Get CID function.
uint8_t GetSchedulingType() const
WimaxConnection(Cid cid, Cid::Type type)
Constructor.
void SetServiceFlow(ServiceFlow *serviceFlow)
set the service flow associated to this connection
Ptr< WimaxMacQueue > GetQueue() const
Ptr< WimaxMacQueue > m_queue
queue
Cid::Type m_cidType
CID type.
static TypeId GetTypeId()
Get the type ID.
std::list< Ptr< const Packet > > FragmentsQueue
Definition of Fragments Queue data type.
FragmentsQueue m_fragmentsQueue
fragments queue
const FragmentsQueue GetFragmentsQueue() const
get a queue of received fragments
void FragmentEnqueue(Ptr< const Packet > fragment)
enqueue a received packet (that is a fragment) into the fragments queue
Every class exported by the ns3 library is enclosed in the ns3 namespace.