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 
26 namespace ns3 {
27 
32 {
36 };
37 
51 {
52 public:
55  static TypeId GetTypeId (void);
56  virtual TypeId GetInstanceTypeId (void) const;
57  virtual void Print (std::ostream &os) const;
58  virtual uint32_t GetSerializedSize (void) const;
59  virtual void Serialize (Buffer::Iterator start) const;
60  virtual uint32_t Deserialize (Buffer::Iterator start);
61 
67  void SetHtImmediateAck (bool immediateAck);
73  void SetType (enum BlockAckType type);
79  void SetTidInfo (uint8_t tid);
86  void SetStartingSequence (uint16_t seq);
87 
94  bool MustSendHtImmediateAck (void) const;
100  uint8_t GetTidInfo (void) const;
106  uint16_t GetStartingSequence (void) const;
114  bool IsBasic (void) const;
122  bool IsCompressed (void) const;
129  bool IsMultiTid (void) const;
130 
136  uint16_t GetStartingSequenceControl (void) const;
137 
138 
139 private:
146  void SetStartingSequenceControl (uint16_t seqControl);
152  uint16_t GetBarControl (void) const;
158  void SetBarControl (uint16_t bar);
159 
169  uint16_t m_tidInfo;
170  uint16_t m_startingSeq;
171 };
172 
173 
187 {
188 public:
191  static TypeId GetTypeId (void);
192  virtual TypeId GetInstanceTypeId (void) const;
193  virtual void Print (std::ostream &os) const;
194  virtual uint32_t GetSerializedSize (void) const;
195  virtual void Serialize (Buffer::Iterator start) const;
196  virtual uint32_t Deserialize (Buffer::Iterator start);
197 
203  void SetHtImmediateAck (bool immediateAck);
209  void SetType (enum BlockAckType type);
215  void SetTidInfo (uint8_t tid);
222  void SetStartingSequence (uint16_t seq);
223 
230  bool MustSendHtImmediateAck (void) const;
236  uint8_t GetTidInfo (void) const;
242  uint16_t GetStartingSequence (void) const;
250  bool IsBasic (void) const;
258  bool IsCompressed (void) const;
265  bool IsMultiTid (void) const;
266 
273  void SetReceivedPacket (uint16_t seq);
281  void SetReceivedFragment (uint16_t seq, uint8_t frag);
290  bool IsPacketReceived (uint16_t seq) const;
301  bool IsFragmentReceived (uint16_t seq, uint8_t frag) const;
302 
308  uint16_t GetStartingSequenceControl (void) const;
315  void SetStartingSequenceControl (uint16_t seqControl);
321  const uint16_t* GetBitmap (void) const;
327  uint64_t GetCompressedBitmap (void) const;
328 
332  void ResetBitmap (void);
333 
334 
335 private:
341  uint16_t GetBaControl (void) const;
347  void SetBaControl (uint16_t bar);
348 
363 
378  uint8_t IndexInBitmap (uint16_t seq) const;
379 
387  bool IsInBitmap (uint16_t seq) const;
388 
398  uint16_t m_tidInfo;
399  uint16_t m_startingSeq;
400 
401  union
402  {
403  uint16_t m_bitmap[64];
405  } bitmap;
406 };
407 
408 } //namespace ns3
409 
410 #endif /* CTRL_HEADERS_H */
Protocol header serialization and deserialization.
Definition: header.h:42
void SetType(enum BlockAckType type)
Set the block ACK type.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: ctrl-headers.cc:61
bool IsBasic(void) const
Check if the current ACK policy is basic (i.e.
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
def start()
Definition: core.py:1482
void SetStartingSequenceControl(uint16_t seqControl)
Set the starting sequence control with the given sequence control value.
bool IsMultiTid(void) const
Check if the current ACK policy has multiple TID.
void SetBarControl(uint16_t bar)
Set the Block ACK control.
bool IsPacketReceived(uint16_t seq) const
Check if the packet with the given sequence number was ACKed in this Block ACK response.
bool IsCompressed(void) const
Check if the current ACK policy is compressed ACK and not multiple TID.
void SetHtImmediateAck(bool immediateAck)
Enable or disable HT immediate ACK.
BlockAckType
Enumeration for different block ACK policies.
Definition: ctrl-headers.h:31
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:395
void SetStartingSequence(uint16_t seq)
Set the starting sequence number from the given raw sequence control field.
void SetTidInfo(uint8_t tid)
Set Traffic ID (TID).
iterator in a Buffer instance
Definition: buffer.h:98
uint8_t GetTidInfo(void) const
Return the Traffic ID (TID).
virtual void Print(std::ostream &os) const
Definition: ctrl-headers.cc:68
void SetBaControl(uint16_t bar)
Set the block ACK control.
uint16_t GetBaControl(void) const
Return 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:166
virtual uint32_t GetSerializedSize(void) const
Definition: ctrl-headers.cc:75
uint8_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...
Headers for Block ack response.
Definition: ctrl-headers.h:186
static TypeId GetTypeId(void)
Definition: ctrl-headers.cc:49
uint16_t GetStartingSequenceControl(void) const
Return the starting sequence control.
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...
virtual uint32_t GetSerializedSize(void) const
Buffer::Iterator SerializeBitmap(Buffer::Iterator start) const
Serialize bitmap to the given buffer.
virtual uint32_t Deserialize(Buffer::Iterator start)
void SetTidInfo(uint8_t tid)
Set Traffic ID (TID).
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
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)
void SetType(enum BlockAckType type)
Set the block ACK type.
bool IsBasic(void) const
Check if the current ACK policy is basic (i.e.
uint16_t GetStartingSequenceControl(void) const
Return the starting sequence control.
virtual void Serialize(Buffer::Iterator start) const
void ResetBitmap(void)
Reset the bitmap to 0.
bool IsInBitmap(uint16_t seq) const
Checks if sequence number seq can be acknowledged in the bitmap.
uint8_t GetTidInfo(void) const
Return the Traffic ID (TID).
void SetReceivedFragment(uint16_t seq, uint8_t frag)
Set the bitmap that the packet with the given sequence number and fragment number was received...
virtual void Serialize(Buffer::Iterator start) const
Definition: ctrl-headers.cc:99
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 MustSendHtImmediateAck(void) const
Check if the current ACK policy is immediate.
union ns3::CtrlBAckResponseHeader::@83 bitmap
const uint16_t * GetBitmap(void) const
Return the bitmap from the block ACK response header.
virtual uint32_t Deserialize(Buffer::Iterator start)
void SetHtImmediateAck(bool immediateAck)
Enable or disable HT immediate ACK.
virtual void Print(std::ostream &os) const
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.
Headers for Block ack request.
Definition: ctrl-headers.h:50
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.
bool IsMultiTid(void) const
Check if the current ACK policy has multiple TID.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint64_t GetCompressedBitmap(void) const
Return the compressed bitmap from the block ACK response header.