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);
344  const uint16_t* GetBitmap (void) const;
350  uint64_t GetCompressedBitmap (void) const;
356  const uint64_t* GetExtendedCompressedBitmap (void) const;
357 
361  void ResetBitmap (void);
362 
363 
364 private:
370  uint16_t GetBaControl (void) const;
376  void SetBaControl (uint16_t bar);
377 
392 
407  uint16_t IndexInBitmap (uint16_t seq) const;
408 
416  bool IsInBitmap (uint16_t seq) const;
417 
426  uint16_t m_tidInfo;
427  uint16_t m_startingSeq;
428 
429  union
430  {
431  uint16_t m_bitmap[64];
434  } bitmap;
435 };
436 
437 } //namespace ns3
438 
439 #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:1858
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:424
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.
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: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 block ACK response header.
uint16_t m_startingSeq
starting seq
Definition: ctrl-headers.h:177
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: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:426
bool IsCompressed(void) const
Check if the current ACK policy is compressed ACK and not multiple TID.
bool IsExtendedCompressed(void) const
Check if the current BA 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 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.
const uint64_t * GetExtendedCompressedBitmap(void) const
Return the extended compressed bitmap from the block ACK 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 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.
BlockAckType m_baType
BA type.
Definition: ctrl-headers.h:425
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 ACKed in this Block ACK re...
uint16_t m_startingSeq
starting seq
Definition: ctrl-headers.h:427
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:431
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:432
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 block ack bitmap
Definition: ctrl-headers.h:433
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 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.