A Discrete-Event Network Simulator
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 
24 
25 namespace ns3 {
26 
28  : m_nextSize (0),
29  m_waitAck (ACK_NONE),
30  m_sendBar (BLOCK_ACK_REQUEST_NONE),
31  m_sendRts (false)
32 {
33 }
34 
35 void
37 {
38  m_nextSize = size;
39 }
40 
41 void
43 {
44  m_nextSize = 0;
45 }
46 
47 void
49 {
50  switch (type)
51  {
54  break;
57  break;
60  break;
63  break;
64  default:
65  NS_FATAL_ERROR ("Unknown Block ack type");
66  break;
67  }
68 
69  // Reset m_sendBar
71 }
72 
73 void
75 {
76  switch (type)
77  {
80  break;
83  break;
86  break;
89  break;
90  default:
91  NS_FATAL_ERROR ("Unknown Block Ack Request type");
92  break;
93  }
94 
95  // Reset m_waitAck
97 }
98 
99 void
101 {
103  // Reset m_sendBar
105 }
106 
107 void
109 {
111 }
112 
113 void
115 {
117 }
118 
119 void
121 {
122  m_sendRts = true;
123 }
124 
125 void
127 {
128  m_sendRts = false;
129 }
130 
131 bool
133 {
134  return (m_waitAck == ACK_NORMAL);
135 }
136 
137 bool
139 {
140  bool ret;
141  switch (m_waitAck)
142  {
143  case BLOCK_ACK_BASIC:
146  case BLOCK_ACK_MULTI_TID:
147  ret = true;
148  break;
149  default:
150  ret = false;
151  break;
152  }
153  return ret;
154 }
155 
158 {
159  BlockAckType type;
160  switch (m_waitAck)
161  {
162  case BLOCK_ACK_BASIC:
164  break;
167  break;
170  break;
171  case BLOCK_ACK_MULTI_TID:
173  break;
174  default:
175  NS_FATAL_ERROR ("Block ack is not used");
176  break;
177  }
178  return type;
179 }
180 
181 bool
183 {
184  bool ret;
185  switch (m_sendBar)
186  {
191  ret = true;
192  break;
193  default:
194  ret = false;
195  break;
196  }
197  return ret;
198 }
199 
202 {
203  BlockAckType type;
204  switch (m_sendBar)
205  {
208  break;
211  break;
214  break;
217  break;
218  default:
219  NS_FATAL_ERROR ("Block ack request must not be sent");
220  break;
221  }
222  return type;
223 }
224 
225 bool
227 {
228  return m_sendRts;
229 }
230 
231 bool
233 {
234  return (m_nextSize != 0);
235 }
236 
237 uint32_t
239 {
241  return m_nextSize;
242 }
243 
244 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters &params)
245 {
246  os << "["
247  << "send rts=" << params.m_sendRts << ", "
248  << "next size=" << params.m_nextSize << ", "
249  << "ack=";
250  switch (params.m_waitAck)
251  {
253  os << "none, ";
254  break;
256  os << "normal, ";
257  break;
259  os << "basic-block-ack, ";
260  break;
262  os << "compressed-block-ack, ";
263  break;
265  os << "extended-compressed-block-ack, ";
266  break;
268  os << "multi-tid-block-ack, ";
269  break;
270  }
271  os << "bar=";
272  switch (params.m_sendBar)
273  {
275  os << "none";
276  break;
278  os << "basic";
279  break;
281  os << "compressed";
282  break;
284  os << "extended-compressed";
285  break;
287  os << "multi-tid";
288  break;
289  }
290  os << "]";
291  return os;
292 }
293 
294 } //namespace ns3
#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
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
control how a packet is transmitted.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void EnableAck(void)
Wait ACKTimeout for an ACK.
void DisableRts(void)
Do not send rts and wait for cts before sending data.
enum ns3::MacLowTransmissionParameters::@73 m_waitAck
wait ack enumerated type
enum ns3::MacLowTransmissionParameters::@74 m_sendBar
send bar enumerated type
void EnableRts(void)
Send a RTS, and wait CTSTimeout for a CTS.
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
void DisableBlockAckRequest(void)
Do not send Block Ack Request after data transmission.
void EnableBlockAck(BlockAckType type)
Wait the timeout corresponding to the given Block Ack Response type.
void EnableBlockAckRequest(BlockAckType type)
Schedule the transmission of a Block Ack Request of the given type.
void DisableAck(void)
Do not wait for Ack after data transmission.
BlockAckType
The different block ACK policies.