A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #ifndef CTRL_HEADERS_H
21 #define CTRL_HEADERS_H
22 
23 #include "ns3/header.h"
24 
25 namespace ns3 {
26 
31 {
35 };
36 
50 {
51 public:
54  static TypeId GetTypeId (void);
55  virtual TypeId GetInstanceTypeId (void) const;
56  virtual void Print (std::ostream &os) const;
57  virtual uint32_t GetSerializedSize (void) const;
58  virtual void Serialize (Buffer::Iterator start) const;
59  virtual uint32_t Deserialize (Buffer::Iterator start);
60 
66  void SetHtImmediateAck (bool immediateAck);
72  void SetType (enum BlockAckType type);
78  void SetTidInfo (uint8_t tid);
85  void SetStartingSequence (uint16_t seq);
86 
93  bool MustSendHtImmediateAck (void) const;
99  uint8_t GetTidInfo (void) const;
105  uint16_t GetStartingSequence (void) const;
113  bool IsBasic (void) const;
121  bool IsCompressed (void) const;
128  bool IsMultiTid (void) const;
129 
135  uint16_t GetStartingSequenceControl (void) const;
136 
137 private:
144  void SetStartingSequenceControl (uint16_t seqControl);
150  uint16_t GetBarControl (void) const;
156  void SetBarControl (uint16_t bar);
157 
167  uint16_t m_tidInfo;
168  uint16_t m_startingSeq;
169 };
170 
184 {
185 public:
188  static TypeId GetTypeId (void);
189  virtual TypeId GetInstanceTypeId (void) const;
190  virtual void Print (std::ostream &os) const;
191  virtual uint32_t GetSerializedSize (void) const;
192  virtual void Serialize (Buffer::Iterator start) const;
193  virtual uint32_t Deserialize (Buffer::Iterator start);
194 
200  void SetHtImmediateAck (bool immediateAck);
206  void SetType (enum BlockAckType type);
212  void SetTidInfo (uint8_t tid);
219  void SetStartingSequence (uint16_t seq);
220 
227  bool MustSendHtImmediateAck (void) const;
233  uint8_t GetTidInfo (void) const;
239  uint16_t GetStartingSequence (void) const;
247  bool IsBasic (void) const;
255  bool IsCompressed (void) const;
262  bool IsMultiTid (void) const;
263 
270  void SetReceivedPacket (uint16_t seq);
278  void SetReceivedFragment (uint16_t seq, uint8_t frag);
287  bool IsPacketReceived (uint16_t seq) const;
298  bool IsFragmentReceived (uint16_t seq, uint8_t frag) const;
299 
305  uint16_t GetStartingSequenceControl (void) const;
312  void SetStartingSequenceControl (uint16_t seqControl);
318  const uint16_t* GetBitmap (void) const;
324  uint64_t GetCompressedBitmap (void) const;
325 
329  void ResetBitmap (void);
330 
331 private:
337  uint16_t GetBaControl (void) const;
343  void SetBaControl (uint16_t bar);
344 
359 
374  uint8_t IndexInBitmap (uint16_t seq) const;
375 
383  bool IsInBitmap (uint16_t seq) const;
384 
394  uint16_t m_tidInfo;
395  uint16_t m_startingSeq;
396 
397  union
398  {
399  uint16_t m_bitmap[64];
401  } bitmap;
402 };
403 
404 } // namespace ns3
405 
406 #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
Definition: ctrl-headers.cc:60
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 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:30
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:391
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:67
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:164
virtual uint32_t GetSerializedSize(void) const
Definition: ctrl-headers.cc:74
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:183
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.
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:98
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.
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.
union ns3::CtrlBAckResponseHeader::@88 bitmap
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:49
a unique identifier for an interface.
Definition: type-id.h:49
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
uint64_t GetCompressedBitmap(void) const
Return the compressed bitmap from the block ACK response header.