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  BlockAckType GetType (void) const;
101  uint8_t GetTidInfo (void) const;
107  uint16_t GetStartingSequence (void) const;
115  bool IsBasic (void) const;
123  bool IsCompressed (void) const;
130  bool IsExtendedCompressed (void) const;
137  bool IsMultiTid (void) const;
138 
144  uint16_t GetStartingSequenceControl (void) const;
145 
146 
147 private:
154  void SetStartingSequenceControl (uint16_t seqControl);
160  uint16_t GetBarControl (void) const;
166  void SetBarControl (uint16_t bar);
167 
176  uint16_t m_tidInfo;
177  uint16_t m_startingSeq;
178 };
179 
180 
194 {
195 public:
202  static TypeId GetTypeId (void);
203  TypeId GetInstanceTypeId (void) const;
204  void Print (std::ostream &os) const;
205  uint32_t GetSerializedSize (void) const;
206  void Serialize (Buffer::Iterator start) const;
208 
214  void SetHtImmediateAck (bool immediateAck);
220  void SetType (BlockAckType type);
226  void SetTidInfo (uint8_t tid);
233  void SetStartingSequence (uint16_t seq);
234 
241  bool MustSendHtImmediateAck (void) const;
247  BlockAckType GetType (void) const;
253  uint8_t GetTidInfo (void) const;
259  uint16_t GetStartingSequence (void) const;
266  bool IsBasic (void) const;
273  bool IsCompressed (void) const;
280  bool IsExtendedCompressed (void) const;
287  bool IsMultiTid (void) const;
288 
295  void SetReceivedPacket (uint16_t seq);
303  void SetReceivedFragment (uint16_t seq, uint8_t frag);
312  bool IsPacketReceived (uint16_t seq) const;
323  bool IsFragmentReceived (uint16_t seq, uint8_t frag) const;
324 
330  uint16_t GetStartingSequenceControl (void) const;
337  void SetStartingSequenceControl (uint16_t seqControl);
343  const uint16_t* GetBitmap (void) const;
349  uint64_t GetCompressedBitmap (void) const;
355  const uint64_t* GetExtendedCompressedBitmap (void) const;
356 
360  void ResetBitmap (void);
361 
362 
363 private:
369  uint16_t GetBaControl (void) const;
375  void SetBaControl (uint16_t ba);
376 
391 
406  uint16_t IndexInBitmap (uint16_t seq) const;
407 
415  bool IsInBitmap (uint16_t seq) const;
416 
425  uint16_t m_tidInfo;
426  uint16_t m_startingSeq;
427 
428  union
429  {
430  uint16_t m_bitmap[64];
433  } bitmap;
434 };
435 
436 } //namespace ns3
437 
438 #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:54
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.
def start()
Definition: core.py:1855
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:423
void SetStartingSequence(uint16_t seq)
Set the starting sequence number from the given raw sequence control field.
void Serialize(Buffer::Iterator start) const
bool IsExtendedCompressed(void) const
Check if the current BA policy is Extended Compressed Block Ack.
void SetTidInfo(uint8_t tid)
Set Traffic ID (TID).
bool IsBasic(void) const
Check if the current BA policy is Basic Block Ack.
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 BA policy is Compressed Block Ack.
bool MustSendHtImmediateAck(void) const
Check if the current Ack Policy is immediate.
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:174
uint16_t GetStartingSequenceControl(void) const
Return the starting sequence control.
void Print(std::ostream &os) const
Definition: ctrl-headers.cc:60
uint64_t GetCompressedBitmap(void) const
Return the compressed bitmap from the BlockAck response header.
uint16_t m_startingSeq
starting sequence number
Definition: ctrl-headers.h:177
bool IsPacketReceived(uint16_t seq) const
Check if the packet with the given sequence number was acknowledged in this BlockAck response...
Headers for BlockAck response.
Definition: ctrl-headers.h:193
uint32_t GetSerializedSize(void) const
Definition: ctrl-headers.cc:66
static TypeId GetTypeId(void)
Get the type ID.
Definition: ctrl-headers.cc:43
uint16_t m_tidInfo
TID info.
Definition: ctrl-headers.h:425
bool IsCompressed(void) const
Check if the current Ack Policy is Compressed Block Ack and not multi-TID.
bool IsExtendedCompressed(void) const
Check if the current Ack Policy is Extended Compressed Block Ack.
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 BlockAck 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.
const uint64_t * GetExtendedCompressedBitmap(void) const
Return the extended compressed bitmap from the BlockAck response header.
static TypeId GetTypeId(void)
Get the type ID.
BlockAckType GetType(void) const
Return the Block Ack type ID.
void SetType(BlockAckType type)
Set the block ack type.
bool IsMultiTid(void) const
Check if the current Ack Policy has Multi-TID Block Ack.
bool IsBasic(void) const
Check if the current Ack Policy is Basic Block Ack (i.e.
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
BlockAckType m_baType
BA type.
Definition: ctrl-headers.h:424
void ResetBitmap(void)
Reset the bitmap to 0.
bool IsFragmentReceived(uint16_t seq, uint8_t frag) const
Check if the packet with the given sequence number and fragment number was acknowledged in this Block...
uint16_t m_startingSeq
starting sequence number
Definition: ctrl-headers.h:426
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 basic BlockAck bitmap
Definition: ctrl-headers.h:430
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint64_t m_compressedBitmap
the compressed BlockAck bitmap
Definition: ctrl-headers.h:431
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)
uint64_t m_extendedCompressedBitmap[4]
the extended compressed BlockAck bitmap
Definition: ctrl-headers.h:432
uint16_t m_tidInfo
TID info.
Definition: ctrl-headers.h:176
bool IsMultiTid(void) const
Check if the current BA policy is Multi-TID Block Ack.
BlockAckType m_baType
BA type.
Definition: ctrl-headers.h:175
void SetHtImmediateAck(bool immediateAck)
Enable or disable HT immediate Ack.
void Print(std::ostream &os) const
BlockAckType GetType(void) const
Return the block ack type ID.
void Serialize(Buffer::Iterator start) const
Definition: ctrl-headers.cc:88
Headers for BlockAckRequest.
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.
void SetBaControl(uint16_t ba)
Set the Block Ack control.
BlockAckType
The different block ack policies.