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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18 * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19 */
20
21#ifndef WIMAX_CONNECTION_H
22#define WIMAX_CONNECTION_H
23
24#include "cid.h"
25#include "service-flow.h"
26#include "wimax-mac-header.h"
27#include "wimax-mac-queue.h"
28
29#include "ns3/object.h"
30
31#include <ostream>
32#include <stdint.h>
33
34namespace ns3
35{
36
37class ServiceFlow;
38class Cid;
39
40/**
41 * \ingroup wimax
42 * Class to represent WiMAX connections
43 */
44class WimaxConnection : public Object
45{
46 public:
47 /**
48 * \brief Get the type ID.
49 * \return the object TypeId
50 */
51 static TypeId GetTypeId();
52
53 /**
54 * Constructor
55 *
56 * \param cid connection ID
57 * \param type CID type
58 */
59 WimaxConnection(Cid cid, Cid::Type type);
60 ~WimaxConnection() override;
61
62 /**
63 * Get CID function
64 * \returns the CID
65 */
66 Cid GetCid() const;
67
68 /**
69 * Get type function
70 * \returns the type
71 */
72 Cid::Type GetType() const;
73 /**
74 * \return the queue of the connection
75 */
77 /**
78 * \brief set the service flow associated to this connection
79 * \param serviceFlow The service flow to be associated to this connection
80 */
81 void SetServiceFlow(ServiceFlow* serviceFlow);
82 /**
83 * \return the service flow associated to this connection
84 */
86
87 // wrapper functions
88 /**
89 * \return the scheduling type of this connection
90 */
91 uint8_t GetSchedulingType() const;
92 /**
93 * \brief enqueue a packet in the queue of the connection
94 * \param packet the packet to be enqueued
95 * \param hdrType the header type of the packet
96 * \param hdr the header of the packet
97 * \return true if successful
98 */
99 bool Enqueue(Ptr<Packet> packet, const MacHeaderType& hdrType, const GenericMacHeader& hdr);
100 /**
101 * \brief dequeue a packet from the queue of the connection
102 * \param packetType the type of the packet to dequeue
103 * \return packet dequeued
104 */
106 /**
107 * \brief dequeue a packet from the queue of the connection
108 * Dequeue the first packet in the queue if its size is lower than
109 * availableByte, the first availableByte of the first packet otherwise
110 *
111 * \param packetType the type of the packet to dequeue
112 * \param availableByte the number of available bytes
113 * \return packet dequeued
114 */
115 Ptr<Packet> Dequeue(MacHeaderType::HeaderType packetType, uint32_t availableByte);
116 /**
117 * \return true if the connection has at least one packet in its queue, false otherwise
118 */
119 bool HasPackets() const;
120 /**
121 * \return true if the connection has at least one packet of type packetType in its queue, false
122 * otherwise
123 * \param packetType type of packet to check in the queue
124 * \return true if packets available
125 */
126 bool HasPackets(MacHeaderType::HeaderType packetType) const;
127
128 /**
129 * Get type string
130 * \returns the type string
131 */
132 std::string GetTypeStr() const;
133
134 /// Definition of Fragments Queue data type
135 typedef std::list<Ptr<const Packet>> FragmentsQueue;
136 /**
137 * \brief get a queue of received fragments
138 * \returns the fragments queue
139 */
140 const FragmentsQueue GetFragmentsQueue() const;
141 /**
142 * \brief enqueue a received packet (that is a fragment) into the fragments queue
143 * \param fragment received fragment
144 */
145 void FragmentEnqueue(Ptr<const Packet> fragment);
146 /**
147 * \brief delete all enqueued fragments
148 */
149 void ClearFragmentsQueue();
150
151 private:
152 void DoDispose() override;
153
154 Cid m_cid; ///< CID
155 Cid::Type m_cidType; ///< CID type
157 ServiceFlow* m_serviceFlow; ///< service flow
158
159 // FragmentsQueue stores all received fragments
160 FragmentsQueue m_fragmentsQueue; ///< fragments queue
161};
162
163} // namespace ns3
164
165#endif /* WIMAX_CONNECTION_H */
Cid class.
Definition: cid.h:37
Type
Type enumeration.
Definition: cid.h:41
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:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:43
a unique identifier for an interface.
Definition: type-id.h:59
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
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.