A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
mac-low-transmission-parameters.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005,2006 INRIA
4
* Copyright (c) 2009 MIRKO BANCHI
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20
* Mirko Banchi <mk.banchi@gmail.com>
21
*/
22
23
#include "
mac-low-transmission-parameters.h
"
24
25
namespace
ns3
{
26
27
MacLowTransmissionParameters::MacLowTransmissionParameters
()
28
: m_nextSize (0),
29
m_waitAck (ACK_NONE),
30
m_sendRts (false)
31
{
32
}
33
34
void
35
MacLowTransmissionParameters::EnableNextData
(uint32_t size)
36
{
37
m_nextSize
= size;
38
}
39
40
void
41
MacLowTransmissionParameters::DisableNextData
(
void
)
42
{
43
m_nextSize
= 0;
44
}
45
46
void
47
MacLowTransmissionParameters::EnableBasicBlockAck
(
void
)
48
{
49
m_waitAck
=
BLOCK_ACK_BASIC
;
50
}
51
52
void
53
MacLowTransmissionParameters::EnableCompressedBlockAck
(
void
)
54
{
55
m_waitAck
=
BLOCK_ACK_COMPRESSED
;
56
}
57
58
void
59
MacLowTransmissionParameters::EnableExtendedCompressedBlockAck
(
void
)
60
{
61
m_waitAck
=
BLOCK_ACK_EXTENDED_COMPRESSED
;
62
}
63
64
void
65
MacLowTransmissionParameters::EnableMultiTidBlockAck
(
void
)
66
{
67
m_waitAck
=
BLOCK_ACK_MULTI_TID
;
68
}
69
70
void
71
MacLowTransmissionParameters::EnableAck
(
void
)
72
{
73
m_waitAck
=
ACK_NORMAL
;
74
}
75
76
void
77
MacLowTransmissionParameters::DisableAck
(
void
)
78
{
79
m_waitAck
=
ACK_NONE
;
80
}
81
82
void
83
MacLowTransmissionParameters::EnableRts
(
void
)
84
{
85
m_sendRts
=
true
;
86
}
87
88
void
89
MacLowTransmissionParameters::DisableRts
(
void
)
90
{
91
m_sendRts
=
false
;
92
}
93
94
bool
95
MacLowTransmissionParameters::MustWaitNormalAck
(
void
)
const
96
{
97
return
(
m_waitAck
==
ACK_NORMAL
);
98
}
99
100
bool
101
MacLowTransmissionParameters::MustWaitBlockAck
(
void
)
const
102
{
103
bool
ret;
104
switch
(
m_waitAck
)
105
{
106
case
BLOCK_ACK_BASIC
:
107
case
BLOCK_ACK_COMPRESSED
:
108
case
BLOCK_ACK_EXTENDED_COMPRESSED
:
109
case
BLOCK_ACK_MULTI_TID
:
110
ret =
true
;
111
break
;
112
default
:
113
ret =
false
;
114
break
;
115
}
116
return
ret;
117
}
118
119
BlockAckType
120
MacLowTransmissionParameters::GetBlockAckType
(
void
)
const
121
{
122
BlockAckType
type;
123
switch
(
m_waitAck
)
124
{
125
case
BLOCK_ACK_BASIC
:
126
type =
BlockAckType::BASIC_BLOCK_ACK
;
127
break
;
128
case
BLOCK_ACK_COMPRESSED
:
129
type =
BlockAckType::COMPRESSED_BLOCK_ACK
;
130
break
;
131
case
BLOCK_ACK_EXTENDED_COMPRESSED
:
132
type =
BlockAckType::EXTENDED_COMPRESSED_BLOCK_ACK
;
133
break
;
134
case
BLOCK_ACK_MULTI_TID
:
135
type =
BlockAckType::MULTI_TID_BLOCK_ACK
;
136
break
;
137
default
:
138
NS_FATAL_ERROR
(
"Block ack is not used"
);
139
break
;
140
}
141
return
type;
142
}
143
144
bool
145
MacLowTransmissionParameters::MustSendRts
(
void
)
const
146
{
147
return
m_sendRts
;
148
}
149
150
bool
151
MacLowTransmissionParameters::HasNextPacket
(
void
)
const
152
{
153
return
(
m_nextSize
!= 0);
154
}
155
156
uint32_t
157
MacLowTransmissionParameters::GetNextPacketSize
(
void
)
const
158
{
159
NS_ASSERT
(
HasNextPacket
());
160
return
m_nextSize
;
161
}
162
163
std::ostream &
operator <<
(std::ostream &os,
const
MacLowTransmissionParameters
¶ms)
164
{
165
os <<
"["
166
<<
"send rts="
<< params.
m_sendRts
<<
", "
167
<<
"next size="
<< params.
m_nextSize
<<
", "
168
<<
"ack="
;
169
switch
(params.
m_waitAck
)
170
{
171
case
MacLowTransmissionParameters::ACK_NONE
:
172
os <<
"none"
;
173
break
;
174
case
MacLowTransmissionParameters::ACK_NORMAL
:
175
os <<
"normal"
;
176
break
;
177
case
MacLowTransmissionParameters::BLOCK_ACK_BASIC
:
178
os <<
"basic-block-ack"
;
179
break
;
180
case
MacLowTransmissionParameters::BLOCK_ACK_COMPRESSED
:
181
os <<
"compressed-block-ack"
;
182
break
;
183
case
MacLowTransmissionParameters::BLOCK_ACK_EXTENDED_COMPRESSED
:
184
os <<
"extended-compressed-block-ack"
;
185
break
;
186
case
MacLowTransmissionParameters::BLOCK_ACK_MULTI_TID
:
187
os <<
"multi-tid-block-ack"
;
188
break
;
189
}
190
os <<
"]"
;
191
return
os;
192
}
193
194
}
//namespace ns3
ns3::MacLowTransmissionParameters::BLOCK_ACK_BASIC
Definition:
mac-low-transmission-parameters.h:137
ns3::MacLowTransmissionParameters::EnableBasicBlockAck
void EnableBasicBlockAck(void)
Wait BASICBLOCKACKTimeout for a Basic Block Ack Response frame.
Definition:
mac-low-transmission-parameters.cc:47
ns3::MULTI_TID_BLOCK_ACK
Definition:
block-ack-type.h:35
ns3::MacLowTransmissionParameters::m_nextSize
uint32_t m_nextSize
the next size
Definition:
mac-low-transmission-parameters.h:131
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition:
assert.h:67
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition:
fatal-error.h:162
ns3::MacLowTransmissionParameters::MustWaitBlockAck
bool MustWaitBlockAck(void) const
Definition:
mac-low-transmission-parameters.cc:101
ns3::MacLowTransmissionParameters::MustSendRts
bool MustSendRts(void) const
Definition:
mac-low-transmission-parameters.cc:145
ns3::MacLowTransmissionParameters
control how a packet is transmitted.
Definition:
mac-low-transmission-parameters.h:39
ns3::MacLowTransmissionParameters::MacLowTransmissionParameters
MacLowTransmissionParameters()
Definition:
mac-low-transmission-parameters.cc:27
mac-low-transmission-parameters.h
ns3::MacLowTransmissionParameters::GetNextPacketSize
uint32_t GetNextPacketSize(void) const
Definition:
mac-low-transmission-parameters.cc:157
ns3::MacLowTransmissionParameters::BLOCK_ACK_EXTENDED_COMPRESSED
Definition:
mac-low-transmission-parameters.h:139
ns3::MacLowTransmissionParameters::MustWaitNormalAck
bool MustWaitNormalAck(void) const
Definition:
mac-low-transmission-parameters.cc:95
ns3::MacLowTransmissionParameters::EnableExtendedCompressedBlockAck
void EnableExtendedCompressedBlockAck(void)
Wait COMPRESSEDBLOCKACKTimeout for an Extended Compressed Block Ack Response frame.
Definition:
mac-low-transmission-parameters.cc:59
ns3::EXTENDED_COMPRESSED_BLOCK_ACK
Definition:
block-ack-type.h:34
ns3::MacLowTransmissionParameters::HasNextPacket
bool HasNextPacket(void) const
Definition:
mac-low-transmission-parameters.cc:151
ns3::MacLowTransmissionParameters::BLOCK_ACK_COMPRESSED
Definition:
mac-low-transmission-parameters.h:138
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition:
angles.cc:42
ns3::MacLowTransmissionParameters::EnableCompressedBlockAck
void EnableCompressedBlockAck(void)
Wait COMPRESSEDBLOCKACKTimeout for a Compressed Block Ack Response frame.
Definition:
mac-low-transmission-parameters.cc:53
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::COMPRESSED_BLOCK_ACK
Definition:
block-ack-type.h:33
ns3::MacLowTransmissionParameters::EnableAck
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition:
mac-low-transmission-parameters.cc:71
ns3::MacLowTransmissionParameters::BLOCK_ACK_MULTI_TID
Definition:
mac-low-transmission-parameters.h:140
ns3::MacLowTransmissionParameters::m_sendRts
bool m_sendRts
send an RTS?
Definition:
mac-low-transmission-parameters.h:142
ns3::MacLowTransmissionParameters::DisableRts
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition:
mac-low-transmission-parameters.cc:89
ns3::MacLowTransmissionParameters::EnableMultiTidBlockAck
void EnableMultiTidBlockAck(void)
NOT IMPLEMENTED FOR NOW.
Definition:
mac-low-transmission-parameters.cc:65
ns3::MacLowTransmissionParameters::ACK_NORMAL
Definition:
mac-low-transmission-parameters.h:136
ns3::MacLowTransmissionParameters::m_waitAck
enum ns3::MacLowTransmissionParameters::@73 m_waitAck
wait ack enumerated type
ns3::BASIC_BLOCK_ACK
Definition:
block-ack-type.h:32
ns3::MacLowTransmissionParameters::EnableRts
void EnableRts(void)
Send a RTS, and wait CTSTimeout for a CTS.
Definition:
mac-low-transmission-parameters.cc:83
ns3::MacLowTransmissionParameters::EnableNextData
void EnableNextData(uint32_t size)
Definition:
mac-low-transmission-parameters.cc:35
ns3::MacLowTransmissionParameters::DisableNextData
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition:
mac-low-transmission-parameters.cc:41
ns3::MacLowTransmissionParameters::ACK_NONE
Definition:
mac-low-transmission-parameters.h:135
ns3::MacLowTransmissionParameters::GetBlockAckType
BlockAckType GetBlockAckType(void) const
Definition:
mac-low-transmission-parameters.cc:120
ns3::MacLowTransmissionParameters::DisableAck
void DisableAck(void)
Do not wait for Ack after data transmission.
Definition:
mac-low-transmission-parameters.cc:77
ns3::BlockAckType
BlockAckType
The different block ACK policies.
Definition:
block-ack-type.h:30
src
wifi
model
mac-low-transmission-parameters.cc
Generated on Wed Aug 21 2019 03:38:28 for ns-3 by
1.8.14