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 <vector>
25 #include "ns3/header.h"
26 #include "block-ack-type.h"
27 
28 namespace ns3 {
29 
43 {
44 public:
51  static TypeId GetTypeId (void);
52  TypeId GetInstanceTypeId (void) const;
53  void Print (std::ostream &os) const;
54  uint32_t GetSerializedSize (void) const;
55  void Serialize (Buffer::Iterator start) const;
57 
63  void SetHtImmediateAck (bool immediateAck);
69  void SetType (BlockAckReqType type);
75  void SetTidInfo (uint8_t tid);
82  void SetStartingSequence (uint16_t seq);
83 
90  bool MustSendHtImmediateAck (void) const;
96  BlockAckReqType GetType (void) const;
102  uint8_t GetTidInfo (void) const;
108  uint16_t GetStartingSequence (void) const;
116  bool IsBasic (void) const;
124  bool IsCompressed (void) const;
131  bool IsExtendedCompressed (void) const;
138  bool IsMultiTid (void) const;
139 
145  uint16_t GetStartingSequenceControl (void) const;
146 
147 
148 private:
155  void SetStartingSequenceControl (uint16_t seqControl);
161  uint16_t GetBarControl (void) const;
167  void SetBarControl (uint16_t bar);
168 
177  uint16_t m_tidInfo;
178  uint16_t m_startingSeq;
179 };
180 
181 
195 {
196 public:
203  static TypeId GetTypeId (void);
204  TypeId GetInstanceTypeId (void) const;
205  void Print (std::ostream &os) const;
206  uint32_t GetSerializedSize (void) const;
207  void Serialize (Buffer::Iterator start) const;
209 
215  void SetHtImmediateAck (bool immediateAck);
221  void SetType (BlockAckType type);
227  void SetTidInfo (uint8_t tid);
234  void SetStartingSequence (uint16_t seq);
235 
242  bool MustSendHtImmediateAck (void) const;
248  BlockAckType GetType (void) const;
254  uint8_t GetTidInfo (void) const;
260  uint16_t GetStartingSequence (void) const;
267  bool IsBasic (void) const;
274  bool IsCompressed (void) const;
281  bool IsExtendedCompressed (void) const;
288  bool IsMultiTid (void) const;
289 
296  void SetReceivedPacket (uint16_t seq);
304  void SetReceivedFragment (uint16_t seq, uint8_t frag);
313  bool IsPacketReceived (uint16_t seq) const;
324  bool IsFragmentReceived (uint16_t seq, uint8_t frag) const;
325 
331  uint16_t GetStartingSequenceControl (void) const;
338  void SetStartingSequenceControl (uint16_t seqControl);
344  const std::vector<uint8_t>& GetBitmap (void) const;
345 
349  void ResetBitmap (void);
350 
351 
352 private:
358  uint16_t GetBaControl (void) const;
364  void SetBaControl (uint16_t ba);
365 
380 
395  uint16_t IndexInBitmap (uint16_t seq) const;
396 
404  bool IsInBitmap (uint16_t seq) const;
405 
414  uint16_t m_tidInfo;
415  uint16_t m_startingSeq;
416  std::vector<uint8_t> m_bitmap;
417 };
418 
419 } //namespace ns3
420 
421 #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.
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.
The different BlockAckRequest variants.
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:412
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.
iterator in a Buffer instance
Definition: buffer.h:98
uint8_t GetTidInfo(void) const
Return the Traffic ID (TID).
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 SetType(BlockAckReqType type)
Set the BlockAckRequest type.
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:175
uint16_t GetStartingSequenceControl(void) const
Return the starting sequence control.
void Print(std::ostream &os) const
Definition: ctrl-headers.cc:61
uint16_t m_startingSeq
starting seq
Definition: ctrl-headers.h:178
bool IsPacketReceived(uint16_t seq) const
Check if the packet with the given sequence number was acknowledged in this BlockAck response...
const std::vector< uint8_t > & GetBitmap(void) const
Return a const reference to the bitmap from the BlockAck response header.
BlockAckReqType m_barType
BAR type.
Definition: ctrl-headers.h:176
Headers for BlockAck response.
Definition: ctrl-headers.h:194
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:414
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...
BlockAckReqType GetType(void) const
Return the BlockAckRequest type.
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 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:413
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 seq
Definition: ctrl-headers.h:415
void SetReceivedFragment(uint16_t seq, uint8_t frag)
Set the bitmap that the packet with the given sequence number and fragment number was received...
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
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.
The different BlockAck variants.
bool IsInBitmap(uint16_t seq) const
Checks if sequence number seq can be acknowledged in the bitmap.
std::vector< uint8_t > m_bitmap
block ack bitmap
Definition: ctrl-headers.h:416
uint32_t Deserialize(Buffer::Iterator start)
uint16_t m_tidInfo
TID info.
Definition: ctrl-headers.h:177
bool IsMultiTid(void) const
Check if the current BA policy is Multi-TID Block Ack.
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:89
Headers for BlockAckRequest.
Definition: ctrl-headers.h:42
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.