author | Vedran Miletić <rivanvx@gmail.com> |
Tue, 02 Aug 2011 17:43:32 -0400 | |
changeset 7386 | 2310ed220a61 |
parent 7385 | 10beb0e53130 |
child 10483 | e3a02ed14587 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7141
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
5948 | 2 |
/* |
3 |
* Copyright (c) 2009 MIRKO BANCHI |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
5948 | 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: Mirko Banchi <mk.banchi@gmail.com> |
|
19 |
*/ |
|
20 |
#ifndef CTRL_HEADERS_H |
|
21 |
#define CTRL_HEADERS_H |
|
22 |
||
23 |
#include "ns3/header.h" |
|
24 |
||
25 |
namespace ns3 { |
|
26 |
||
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
27 |
enum BlockAckType |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
28 |
{ |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
29 |
BASIC_BLOCK_ACK, |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
30 |
COMPRESSED_BLOCK_ACK, |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
31 |
MULTI_TID_BLOCK_ACK |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
32 |
}; |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
33 |
|
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
34 |
/** |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
35 |
* \ingroup wifi |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
36 |
* \brief Headers for Block ack request. |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
37 |
* |
5948 | 38 |
* 802.11n standard includes three types of block ack: |
39 |
* - Basic block ack (unique type in 802.11e) |
|
40 |
* - Compressed block ack |
|
41 |
* - Multi-TID block ack |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
42 |
* For now only basic block ack and compressed block ack |
5948 | 43 |
* are supported. |
44 |
* Basic block ack is also default variant. |
|
45 |
*/ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
46 |
class CtrlBAckRequestHeader : public Header |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
47 |
{ |
5948 | 48 |
public: |
49 |
CtrlBAckRequestHeader (); |
|
50 |
~CtrlBAckRequestHeader (); |
|
51 |
static TypeId GetTypeId (void); |
|
52 |
virtual TypeId GetInstanceTypeId (void) const; |
|
53 |
virtual void Print (std::ostream &os) const; |
|
54 |
virtual uint32_t GetSerializedSize (void) const; |
|
55 |
virtual void Serialize (Buffer::Iterator start) const; |
|
56 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
57 |
||
58 |
void SetHtImmediateAck (bool immediateAck); |
|
59 |
void SetType (enum BlockAckType type); |
|
60 |
void SetTidInfo (uint8_t tid); |
|
61 |
void SetStartingSequence (uint16_t seq); |
|
62 |
||
63 |
bool MustSendHtImmediateAck (void) const; |
|
64 |
uint8_t GetTidInfo (void) const; |
|
65 |
uint16_t GetStartingSequence (void) const; |
|
66 |
bool IsBasic (void) const; |
|
67 |
bool IsCompressed (void) const; |
|
68 |
bool IsMultiTid (void) const; |
|
69 |
||
70 |
uint16_t GetStartingSequenceControl (void) const; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
71 |
|
5948 | 72 |
private: |
73 |
void SetStartingSequenceControl (uint16_t seqControl); |
|
74 |
uint16_t GetBarControl (void) const; |
|
75 |
void SetBarControl (uint16_t bar); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
76 |
|
5948 | 77 |
/** |
78 |
* The lsb bit of the BAR control field is used only for the |
|
79 |
* HT (High Throughput) delayed block ack configuration. |
|
80 |
* For now only non HT immediate block ack is implemented so this field |
|
81 |
* is here only for a future implementation of HT delayed variant. |
|
82 |
*/ |
|
83 |
bool m_barAckPolicy; |
|
84 |
bool m_multiTid; |
|
85 |
bool m_compressed; |
|
86 |
uint16_t m_tidInfo; |
|
87 |
uint16_t m_startingSeq; |
|
88 |
}; |
|
89 |
||
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
90 |
/** |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
91 |
* \ingroup wifi |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
92 |
* \brief Headers for Block ack response. |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
93 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
94 |
* 802.11n standard includes three types of block ack: |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
95 |
* - Basic block ack (unique type in 802.11e) |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
96 |
* - Compressed block ack |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
97 |
* - Multi-TID block ack |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
98 |
* For now only basic block ack and compressed block ack |
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
99 |
* are supported. |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
100 |
* Basic block ack is also default variant. |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
101 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
102 |
class CtrlBAckResponseHeader : public Header |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
103 |
{ |
5948 | 104 |
public: |
105 |
CtrlBAckResponseHeader (); |
|
106 |
~CtrlBAckResponseHeader (); |
|
107 |
static TypeId GetTypeId (void); |
|
108 |
virtual TypeId GetInstanceTypeId (void) const; |
|
109 |
virtual void Print (std::ostream &os) const; |
|
110 |
virtual uint32_t GetSerializedSize (void) const; |
|
111 |
virtual void Serialize (Buffer::Iterator start) const; |
|
112 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
113 |
||
114 |
void SetHtImmediateAck (bool immeadiateAck); |
|
115 |
void SetType (enum BlockAckType type); |
|
116 |
void SetTidInfo (uint8_t tid); |
|
117 |
void SetStartingSequence (uint16_t seq); |
|
118 |
||
119 |
bool MustSendHtImmediateAck (void) const; |
|
120 |
uint8_t GetTidInfo (void) const; |
|
121 |
uint16_t GetStartingSequence (void) const; |
|
122 |
bool IsBasic (void) const; |
|
123 |
bool IsCompressed (void) const; |
|
124 |
bool IsMultiTid (void) const; |
|
125 |
||
126 |
void SetReceivedPacket (uint16_t seq); |
|
127 |
void SetReceivedFragment (uint16_t seq, uint8_t frag); |
|
128 |
bool IsPacketReceived (uint16_t seq) const; |
|
129 |
bool IsFragmentReceived (uint16_t seq, uint8_t frag) const; |
|
130 |
||
131 |
uint16_t GetStartingSequenceControl (void) const; |
|
132 |
void SetStartingSequenceControl (uint16_t seqControl); |
|
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
133 |
const uint16_t* GetBitmap (void) const; |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
134 |
uint64_t GetCompressedBitmap (void) const; |
6589
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
135 |
|
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
136 |
void ResetBitmap (void); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
137 |
|
5948 | 138 |
private: |
139 |
uint16_t GetBaControl (void) const; |
|
140 |
void SetBaControl (uint16_t bar); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
141 |
|
5948 | 142 |
Buffer::Iterator SerializeBitmap (Buffer::Iterator start) const; |
143 |
Buffer::Iterator DeserializeBitmap (Buffer::Iterator start); |
|
144 |
||
145 |
/** |
|
146 |
* This function is used to correctly index in both bitmap |
|
6273
8d70de29d514
spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents:
5948
diff
changeset
|
147 |
* and compressed bitmap, one bit or one block of 16 bits respectively. |
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
148 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
149 |
* for more details see 7.2.1.8 in IEEE 802.11n/D4.00 |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
150 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
151 |
* \param seq the sequence number |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
152 |
* |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
153 |
* \return If we are using basic block ack, return value represents index of |
5948 | 154 |
* block of 16 bits for packet having sequence number equals to <i>seq</i>. |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
155 |
* If we are using compressed block ack, return value represents bit |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
156 |
* to set to 1 in the compressed bitmap to indicate that packet having |
5948 | 157 |
* sequence number equals to <i>seq</i> was correctly received. |
158 |
*/ |
|
159 |
uint8_t IndexInBitmap (uint16_t seq) const; |
|
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
160 |
|
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
161 |
/** |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
162 |
* Checks if sequence number <i>seq</i> can be acknowledged in the bitmap. |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
163 |
* |
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
164 |
* \param seq the sequence number |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
165 |
* |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
166 |
* \return |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
167 |
*/ |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
168 |
bool IsInBitmap (uint16_t seq) const; |
5948 | 169 |
|
170 |
/** |
|
171 |
* The lsb bit of the BA control field is used only for the |
|
172 |
* HT (High Throughput) delayed block ack configuration. |
|
173 |
* For now only non HT immediate block ack is implemented so this field |
|
174 |
* is here only for a future implementation of HT delayed variant. |
|
175 |
*/ |
|
176 |
bool m_baAckPolicy; |
|
177 |
bool m_multiTid; |
|
178 |
bool m_compressed; |
|
179 |
uint16_t m_tidInfo; |
|
180 |
uint16_t m_startingSeq; |
|
181 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
182 |
union |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
183 |
{ |
5948 | 184 |
uint16_t m_bitmap[64]; |
185 |
uint64_t m_compressedBitmap; |
|
186 |
} bitmap; |
|
187 |
}; |
|
188 |
||
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
189 |
} // namespace ns3 |
5948 | 190 |
|
191 |
#endif /* CTRL_HEADERS_H */ |