A Discrete-Event Network Simulator
API
ctrl-headers.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 MIRKO BANCHI
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: Mirko Banchi <mk.banchi@gmail.com>
19  */
20 
21 #ifndef CTRL_HEADERS_H
22 #define CTRL_HEADERS_H
23 
24 #include "ns3/header.h"
25 #include "block-ack-type.h"
26 
27 namespace ns3 {
28 
42 {
43 public:
50  static TypeId GetTypeId (void);
51  TypeId GetInstanceTypeId (void) const;
52  void Print (std::ostream &os) const;
53  uint32_t GetSerializedSize (void) const;
54  void Serialize (Buffer::Iterator start) const;
56 
62  void SetHtImmediateAck (bool immediateAck);
68  void SetType (BlockAckType type);
74  void SetTidInfo (uint8_t tid);
81  void SetStartingSequence (uint16_t seq);
82 
89  bool MustSendHtImmediateAck (void) const;
95  uint8_t GetTidInfo (void) const;
101  uint16_t GetStartingSequence (void) const;
109  bool IsBasic (void) const;
117  bool IsCompressed (void) const;
124  bool IsMultiTid (void) const;
125 
131  uint16_t GetStartingSequenceControl (void) const;
132 
133 
134 private:
141  void SetStartingSequenceControl (uint16_t seqControl);
147  uint16_t GetBarControl (void) const;
153  void SetBarControl (uint16_t bar);
154 
162  bool m_multiTid;
164  uint16_t m_tidInfo;
165  uint16_t m_startingSeq;
166 };
167 
168 
182 {
183 public:
190  static TypeId GetTypeId (void);
191  TypeId GetInstanceTypeId (void) const;
192  void Print (std::ostream &os) const;
193  uint32_t GetSerializedSize (void) const;
194  void Serialize (Buffer::Iterator start) const;
196 
202  void SetHtImmediateAck (bool immediateAck);
208  void SetType (BlockAckType type);
214  void SetTidInfo (uint8_t tid);
221  void SetStartingSequence (uint16_t seq);
222 
229  bool MustSendHtImmediateAck (void) const;
235  uint8_t GetTidInfo (void) const;
241  uint16_t GetStartingSequence (void) const;
249  bool IsBasic (void) const;
257  bool IsCompressed (void) const;
264  bool IsMultiTid (void) const;
265 
272  void SetReceivedPacket (uint16_t seq);
280  void SetReceivedFragment (uint16_t seq, uint8_t frag);
289  bool IsPacketReceived (uint16_t seq) const;
300  bool IsFragmentReceived (uint16_t seq, uint8_t frag) const;
301 
307  uint16_t GetStartingSequenceControl (void) const;
314  void SetStartingSequenceControl (uint16_t seqControl);
320  const uint16_t* GetBitmap (void) const;
326  uint64_t GetCompressedBitmap (void) const;
327 
331  void ResetBitmap (void);
332 
333 
334 private:
340  uint16_t GetBaControl (void) const;
346  void SetBaControl (uint16_t bar);
347 
362 
377  uint16_t IndexInBitmap (uint16_t seq) const;
378 
386  bool IsInBitmap (uint16_t seq) const;
387 
395  bool m_multiTid;
397  uint16_t m_tidInfo;
398  uint16_t m_startingSeq;
399 
400  union
401  {
402  uint16_t m_bitmap[64];
404  } bitmap;
405 };
406 
407 } //namespace ns3
408 
409 #endif /* CTRL_HEADERS_H */
Protocol header serialization and deserialization.
Definition: header.h:42
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: ctrl-headers.cc:55
uint8_t GetTidInfo(void) const
Return the Traffic ID (TID).
Buffer::Iterator SerializeBitmap(Buffer::Iterator start) const
Serialize bitmap to the given buffer.
uint16_t GetBaControl(void) const
Return the block ACK control.
bool m_compressed
compressed
Definition: ctrl-headers.h:163
def start()
Definition: core.py:1844
uint32_t GetSerializedSize(void) const
void SetStartingSequenceControl(uint16_t seqControl)
Set the starting sequence control with the given sequence control value.
void SetBarControl(uint16_t bar)
Set the Block ACK control.
void SetHtImmediateAck(bool immediateAck)
Enable or disable HT immediate ACK.
bool m_baAckPolicy
The lsb bit of the BA control field is used only for the HT (High Throughput) delayed block ack confi...
Definition: ctrl-headers.h:394
void SetStartingSequence(uint16_t seq)
Set the starting sequence number from the given raw sequence control field.
void Serialize(Buffer::Iterator start) const
void SetTidInfo(uint8_t tid)
Set Traffic ID (TID).
bool IsBasic(void) const
Check if the current ACK policy is basic (i.e.
void SetType(BlockAckType type)
Set the block ACK type.
iterator in a Buffer instance
Definition: buffer.h:98
uint8_t GetTidInfo(void) const
Return the Traffic ID (TID).
union ns3::CtrlBAckResponseHeader::@72 bitmap
bitmap union type
bool IsCompressed(void) const
Check if the current ACK policy is compressed ACK and not multiple TID.
bool MustSendHtImmediateAck(void) const
Check if the current ACK policy is immediate.
void SetBaControl(uint16_t bar)
Set the block ACK control.
bool m_barAckPolicy
The lsb bit of the BAR control field is used only for the HT (High Throughput) delayed block ack conf...
Definition: ctrl-headers.h:161
uint16_t GetStartingSequenceControl(void) const
Return the starting sequence control.
void Print(std::ostream &os) const
Definition: ctrl-headers.cc:61
uint64_t GetCompressedBitmap(void) const
Return the compressed bitmap from the block ACK response header.
uint16_t m_startingSeq
starting seq
Definition: ctrl-headers.h:165
bool IsPacketReceived(uint16_t seq) const
Check if the packet with the given sequence number was ACKed in this Block ACK response.
Headers for Block ack response.
Definition: ctrl-headers.h:181
uint32_t GetSerializedSize(void) const
Definition: ctrl-headers.cc:67
static TypeId GetTypeId(void)
Get the type ID.
Definition: ctrl-headers.cc:44
uint16_t m_tidInfo
TID info.
Definition: ctrl-headers.h:397
bool IsCompressed(void) const
Check if the current ACK policy is compressed ACK and not multiple TID.
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
uint16_t IndexInBitmap(uint16_t seq) const
This function is used to correctly index in both bitmap and compressed bitmap, one bit or one block o...
const uint16_t * GetBitmap(void) const
Return the bitmap from the block ACK response header.
uint32_t Deserialize(Buffer::Iterator start)
void SetTidInfo(uint8_t tid)
Set Traffic ID (TID).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Buffer::Iterator DeserializeBitmap(Buffer::Iterator start)
Deserialize bitmap from the given buffer.
static TypeId GetTypeId(void)
Get the type ID.
void SetType(BlockAckType type)
Set the block ACK type.
bool IsMultiTid(void) const
Check if the current ACK policy has multiple TID.
bool IsBasic(void) const
Check if the current ACK policy is basic (i.e.
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
void ResetBitmap(void)
Reset the bitmap to 0.
bool m_compressed
compressed
Definition: ctrl-headers.h:396
bool IsFragmentReceived(uint16_t seq, uint8_t frag) const
Check if the packet with the given sequence number and fragment number was ACKed in this Block ACK re...
uint16_t m_startingSeq
starting seq
Definition: ctrl-headers.h:398
void SetReceivedFragment(uint16_t seq, uint8_t frag)
Set the bitmap that the packet with the given sequence number and fragment number was received...
uint16_t m_bitmap[64]
the block ack bitmap
Definition: ctrl-headers.h:402
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint64_t m_compressedBitmap
the compressed block ack bitmap
Definition: ctrl-headers.h:403
void SetStartingSequenceControl(uint16_t seqControl)
Set the starting sequence control with the given sequence control value.
void SetReceivedPacket(uint16_t seq)
Set the bitmap that the packet with the given sequence number was received.
uint16_t GetBarControl(void) const
Return the Block ACK control.
bool IsInBitmap(uint16_t seq) const
Checks if sequence number seq can be acknowledged in the bitmap.
uint32_t Deserialize(Buffer::Iterator start)
uint16_t m_tidInfo
TID info.
Definition: ctrl-headers.h:164
bool IsMultiTid(void) const
Check if the current ACK policy has multiple TID.
void SetHtImmediateAck(bool immediateAck)
Enable or disable HT immediate ACK.
void Print(std::ostream &os) const
void Serialize(Buffer::Iterator start) const
Definition: ctrl-headers.cc:87
Headers for Block ack request.
Definition: ctrl-headers.h:41
a unique identifier for an interface.
Definition: type-id.h:58
void SetStartingSequence(uint16_t seq)
Set the starting sequence number from the given raw sequence control field.
uint16_t GetStartingSequenceControl(void) const
Return the starting sequence control.
bool MustSendHtImmediateAck(void) const
Check if the current ACK policy is immediate.
BlockAckType
The different block ACK policies.