A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
wimax-mac-queue.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007,2008 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19
*/
20
21
#ifndef WIMAX_MAC_QUEUE_H
22
#define WIMAX_MAC_QUEUE_H
23
24
#include <queue>
25
#include <stdint.h>
26
#include "
wimax-mac-header.h
"
27
#include "ns3/packet.h"
28
#include "ns3/object.h"
29
#include "ns3/traced-callback.h"
30
#include "ns3/nstime.h"
31
32
namespace
ns3 {
33
37
class
WimaxMacQueue
:
public
Object
38
{
39
public
:
40
static
TypeId
GetTypeId
(
void
);
41
WimaxMacQueue
(
void
);
42
WimaxMacQueue
(uint32_t maxSize);
43
~WimaxMacQueue
(
void
);
48
void
SetMaxSize
(uint32_t maxSize);
52
uint32_t
GetMaxSize
(
void
)
const
;
59
bool
Enqueue
(
Ptr<Packet>
packet,
const
MacHeaderType
&hdrType,
60
const
GenericMacHeader
&hdr);
66
Ptr<Packet>
Dequeue
(
MacHeaderType::HeaderType
packetType);
74
Ptr<Packet>
Dequeue
(
MacHeaderType::HeaderType
packetType,
75
uint32_t availableByte);
76
86
Ptr<Packet>
Peek
(
GenericMacHeader
&hdr)
const
;
87
Ptr<Packet>
Peek
(
GenericMacHeader
&hdr,
Time
&timeStamp)
const
;
88
93
Ptr<Packet>
Peek
(
MacHeaderType::HeaderType
packetType)
const
;
94
Ptr<Packet>
Peek
(
MacHeaderType::HeaderType
packetType,
Time
&timeStamp)
const
;
95
96
97
bool
IsEmpty
(
void
)
const
;
98
99
/*
100
Exclusive for SS.
101
*/
102
bool
IsEmpty
(
MacHeaderType::HeaderType
packetType)
const
;
103
104
uint32_t
GetSize
(
void
)
const
;
105
uint32_t
GetNBytes
(
void
)
const
;
106
110
bool
CheckForFragmentation
(
MacHeaderType::HeaderType
packetType);
111
uint32_t
GetFirstPacketHdrSize
(
MacHeaderType::HeaderType
packetType);
112
uint32_t
GetFirstPacketPayloadSize
(
MacHeaderType::HeaderType
packetType);
113
uint32_t
GetFirstPacketRequiredByte
(
MacHeaderType::HeaderType
packetType);
114
115
uint32_t
GetQueueLengthWithMACOverhead
(
void
);
116
117
void
SetFragmentation
(
MacHeaderType::HeaderType
packetType);
118
void
SetFragmentNumber
(
MacHeaderType::HeaderType
packetType);
119
void
SetFragmentOffset
(
MacHeaderType::HeaderType
packetType, uint32_t offset);
120
121
struct
QueueElement
122
{
123
QueueElement
(
void
);
124
QueueElement
(
Ptr<Packet>
packet,
125
const
MacHeaderType
&hdrType,
126
const
GenericMacHeader
&hdr,
127
Time
timeStamp);
128
uint32_t
GetSize
(
void
)
const
;
129
Ptr<Packet>
m_packet
;
130
MacHeaderType
m_hdrType
;
131
GenericMacHeader
m_hdr
;
132
Time
m_timeStamp
;
133
134
/*
135
To manage fragmentation feature, each QueueElement have 3 new fields:
136
m_fragmentation that became true when the fragmentation starts;
137
m_fragmentNumber that are incremented when a new fragment is sent
138
m_fragmentOffset that describe the start of the next fragment into the packet
139
*/
140
bool
m_fragmentation
;
141
uint32_t
m_fragmentNumber
;
142
uint32_t
m_fragmentOffset
;
143
144
void
SetFragmentation
(
void
);
145
void
SetFragmentNumber
(
void
);
146
void
SetFragmentOffset
(uint32_t offset);
147
};
148
149
private
:
150
151
/*
152
In the case of non-UGS service flows at the SS side the queue will store both data packets
153
and bandwidth request packets. The two are distinguished by their headers. The below two functions
154
are for this purpose exclusively. The Front function returns the first packet of a specific packet
155
type from the queue (which may not necessarily be at the front of the queue), and the Pop function
156
pops that elements.
157
*/
158
WimaxMacQueue::QueueElement
Front
(
MacHeaderType::HeaderType
packetType)
const
;
159
void
Pop
(
MacHeaderType::HeaderType
packetType);
160
161
typedef
std::deque<QueueElement>
PacketQueue
;
162
PacketQueue
m_queue
;
163
uint32_t
m_maxSize
;
164
uint32_t
m_bytes
;
165
uint32_t
m_nrDataPackets
;
166
uint32_t
m_nrRequestPackets
;
167
168
TracedCallback<Ptr<const Packet>
>
m_traceEnqueue
;
169
TracedCallback<Ptr<const Packet>
>
m_traceDequeue
;
170
TracedCallback<Ptr<const Packet>
>
m_traceDrop
;
171
public
:
172
const
WimaxMacQueue::PacketQueue
&
GetPacketQueue
(
void
)
const
;
173
};
174
175
}
// namespace ns3
176
177
#endif
/* WIMAX_MAC_QUEUE_H */
ns3::MacHeaderType::HeaderType
HeaderType
this class implements the mac header type field.
Definition:
wimax-mac-header.h:42
ns3::WimaxMacQueue::GetFirstPacketHdrSize
uint32_t GetFirstPacketHdrSize(MacHeaderType::HeaderType packetType)
Definition:
wimax-mac-queue.cc:516
ns3::WimaxMacQueue::SetFragmentOffset
void SetFragmentOffset(MacHeaderType::HeaderType packetType, uint32_t offset)
Definition:
wimax-mac-queue.cc:627
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr< Packet >
ns3::WimaxMacQueue::QueueElement::m_packet
Ptr< Packet > m_packet
Definition:
wimax-mac-queue.h:129
ns3::WimaxMacQueue::m_traceDrop
TracedCallback< Ptr< const Packet > > m_traceDrop
Definition:
wimax-mac-queue.h:170
ns3::WimaxMacQueue::PacketQueue
std::deque< QueueElement > PacketQueue
Definition:
wimax-mac-queue.h:161
ns3::WimaxMacQueue::m_traceDequeue
TracedCallback< Ptr< const Packet > > m_traceDequeue
Definition:
wimax-mac-queue.h:169
ns3::TracedCallback
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
Definition:
traced-callback.h:43
ns3::WimaxMacQueue::QueueElement::GetSize
uint32_t GetSize(void) const
Definition:
wimax-mac-queue.cc:63
ns3::WimaxMacQueue::GetNBytes
uint32_t GetNBytes(void) const
Definition:
wimax-mac-queue.cc:412
ns3::WimaxMacQueue::Peek
Ptr< Packet > Peek(GenericMacHeader &hdr) const
Same as Dequeue but does not pop from queue.
Definition:
wimax-mac-queue.cc:327
ns3::WimaxMacQueue::QueueElement::m_hdr
GenericMacHeader m_hdr
Definition:
wimax-mac-queue.h:131
ns3::WimaxMacQueue::QueueElement::SetFragmentOffset
void SetFragmentOffset(uint32_t offset)
Definition:
wimax-mac-queue.cc:653
ns3::WimaxMacQueue
Definition:
wimax-mac-queue.h:37
ns3::GenericMacHeader
this class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
Definition:
wimax-mac-header.h:84
ns3::WimaxMacQueue::GetSize
uint32_t GetSize(void) const
Definition:
wimax-mac-queue.cc:406
ns3::WimaxMacQueue::WimaxMacQueue
WimaxMacQueue(void)
Definition:
wimax-mac-queue.cc:103
ns3::WimaxMacQueue::QueueElement::SetFragmentation
void SetFragmentation(void)
Definition:
wimax-mac-queue.cc:641
ns3::WimaxMacQueue::m_traceEnqueue
TracedCallback< Ptr< const Packet > > m_traceEnqueue
Definition:
wimax-mac-queue.h:168
ns3::WimaxMacQueue::QueueElement::SetFragmentNumber
void SetFragmentNumber(void)
Definition:
wimax-mac-queue.cc:647
ns3::WimaxMacQueue::GetQueueLengthWithMACOverhead
uint32_t GetQueueLengthWithMACOverhead(void)
Definition:
wimax-mac-queue.cc:417
ns3::WimaxMacQueue::CheckForFragmentation
bool CheckForFragmentation(MacHeaderType::HeaderType packetType)
Fragmentation utilities.
Definition:
wimax-mac-queue.cc:493
ns3::WimaxMacQueue::QueueElement::m_fragmentNumber
uint32_t m_fragmentNumber
Definition:
wimax-mac-queue.h:141
ns3::WimaxMacQueue::Enqueue
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, const GenericMacHeader &hdr)
Enqueue a packet.
Definition:
wimax-mac-queue.cc:136
ns3::WimaxMacQueue::QueueElement::QueueElement
QueueElement(void)
Definition:
wimax-mac-queue.cc:37
ns3::WimaxMacQueue::GetFirstPacketRequiredByte
uint32_t GetFirstPacketRequiredByte(MacHeaderType::HeaderType packetType)
Definition:
wimax-mac-queue.cc:586
ns3::MacHeaderType
Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
Definition:
wimax-mac-header.h:34
ns3::WimaxMacQueue::m_queue
PacketQueue m_queue
Definition:
wimax-mac-queue.h:162
ns3::WimaxMacQueue::QueueElement::m_timeStamp
Time m_timeStamp
Definition:
wimax-mac-queue.h:132
ns3::WimaxMacQueue::m_nrRequestPackets
uint32_t m_nrRequestPackets
Definition:
wimax-mac-queue.h:166
wimax-mac-header.h
ns3::WimaxMacQueue::IsEmpty
bool IsEmpty(void) const
Definition:
wimax-mac-queue.cc:466
ns3::WimaxMacQueue::QueueElement::m_hdrType
MacHeaderType m_hdrType
Definition:
wimax-mac-queue.h:130
ns3::WimaxMacQueue::QueueElement::m_fragmentOffset
uint32_t m_fragmentOffset
Definition:
wimax-mac-queue.h:142
ns3::WimaxMacQueue::Front
WimaxMacQueue::QueueElement Front(MacHeaderType::HeaderType packetType) const
Definition:
wimax-mac-queue.cc:431
ns3::WimaxMacQueue::m_nrDataPackets
uint32_t m_nrDataPackets
Definition:
wimax-mac-queue.h:165
ns3::WimaxMacQueue::SetFragmentation
void SetFragmentation(MacHeaderType::HeaderType packetType)
Definition:
wimax-mac-queue.cc:599
ns3::WimaxMacQueue::QueueElement::m_fragmentation
bool m_fragmentation
Definition:
wimax-mac-queue.h:140
ns3::WimaxMacQueue::~WimaxMacQueue
~WimaxMacQueue(void)
Definition:
wimax-mac-queue.cc:119
ns3::WimaxMacQueue::GetMaxSize
uint32_t GetMaxSize(void) const
Definition:
wimax-mac-queue.cc:130
ns3::WimaxMacQueue::SetMaxSize
void SetMaxSize(uint32_t maxSize)
set the maximum queue size
Definition:
wimax-mac-queue.cc:124
ns3::WimaxMacQueue::GetPacketQueue
const WimaxMacQueue::PacketQueue & GetPacketQueue(void) const
Definition:
wimax-mac-queue.cc:487
ns3::WimaxMacQueue::GetTypeId
static TypeId GetTypeId(void)
Definition:
wimax-mac-queue.cc:79
ns3::WimaxMacQueue::Pop
void Pop(MacHeaderType::HeaderType packetType)
Definition:
wimax-mac-queue.cc:449
ns3::WimaxMacQueue::SetFragmentNumber
void SetFragmentNumber(MacHeaderType::HeaderType packetType)
Definition:
wimax-mac-queue.cc:613
ns3::WimaxMacQueue::QueueElement
Definition:
wimax-mac-queue.h:121
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
ns3::WimaxMacQueue::Dequeue
Ptr< Packet > Dequeue(MacHeaderType::HeaderType packetType)
Dequeue a packet of type packetType from the queue.
Definition:
wimax-mac-queue.cc:165
ns3::WimaxMacQueue::GetFirstPacketPayloadSize
uint32_t GetFirstPacketPayloadSize(MacHeaderType::HeaderType packetType)
Definition:
wimax-mac-queue.cc:555
ns3::WimaxMacQueue::m_maxSize
uint32_t m_maxSize
Definition:
wimax-mac-queue.h:163
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::WimaxMacQueue::m_bytes
uint32_t m_bytes
Definition:
wimax-mac-queue.h:164
src
wimax
model
wimax-mac-queue.h
Generated on Sat Apr 19 2014 14:07:13 for ns-3 by
1.8.6