A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ctrl-headers.h
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 
27 enum BlockAckType
28 {
29  BASIC_BLOCK_ACK,
30  COMPRESSED_BLOCK_ACK,
31  MULTI_TID_BLOCK_ACK
32 };
33 
47 {
48 public:
51  static TypeId GetTypeId (void);
52  virtual TypeId GetInstanceTypeId (void) const;
53  virtual void Print (std::ostream &os) const;
54  virtual uint32_t GetSerializedSize (void) const;
55  virtual void Serialize (Buffer::Iterator start) const;
56  virtual uint32_t Deserialize (Buffer::Iterator start);
57 
58  void SetHtImmediateAck (bool immediateAck);
59  void SetType (enum BlockAckType type);
60  void SetTidInfo (uint8_t tid);
61  void SetStartingSequence (uint16_t seq);
62 
63  bool MustSendHtImmediateAck (void) const;
64  uint8_t GetTidInfo (void) const;
65  uint16_t GetStartingSequence (void) const;
66  bool IsBasic (void) const;
67  bool IsCompressed (void) const;
68  bool IsMultiTid (void) const;
69 
70  uint16_t GetStartingSequenceControl (void) const;
71 
72 private:
73  void SetStartingSequenceControl (uint16_t seqControl);
74  uint16_t GetBarControl (void) const;
75  void SetBarControl (uint16_t bar);
76 
84  bool m_multiTid;
85  bool m_compressed;
86  uint16_t m_tidInfo;
87  uint16_t m_startingSeq;
88 };
89 
103 {
104 public:
107  static TypeId GetTypeId (void);
108  virtual TypeId GetInstanceTypeId (void) const;
109  virtual void Print (std::ostream &os) const;
110  virtual uint32_t GetSerializedSize (void) const;
111  virtual void Serialize (Buffer::Iterator start) const;
112  virtual uint32_t Deserialize (Buffer::Iterator start);
113 
114  void SetHtImmediateAck (bool immeadiateAck);
115  void SetType (enum BlockAckType type);
116  void SetTidInfo (uint8_t tid);
117  void SetStartingSequence (uint16_t seq);
118 
119  bool MustSendHtImmediateAck (void) const;
120  uint8_t GetTidInfo (void) const;
121  uint16_t GetStartingSequence (void) const;
122  bool IsBasic (void) const;
123  bool IsCompressed (void) const;
124  bool IsMultiTid (void) const;
125 
126  void SetReceivedPacket (uint16_t seq);
127  void SetReceivedFragment (uint16_t seq, uint8_t frag);
128  bool IsPacketReceived (uint16_t seq) const;
129  bool IsFragmentReceived (uint16_t seq, uint8_t frag) const;
130 
131  uint16_t GetStartingSequenceControl (void) const;
132  void SetStartingSequenceControl (uint16_t seqControl);
133  const uint16_t* GetBitmap (void) const;
134  uint64_t GetCompressedBitmap (void) const;
135 
136  void ResetBitmap (void);
137 
138 private:
139  uint16_t GetBaControl (void) const;
140  void SetBaControl (uint16_t bar);
141 
142  Buffer::Iterator SerializeBitmap (Buffer::Iterator start) const;
143  Buffer::Iterator DeserializeBitmap (Buffer::Iterator start);
144 
159  uint8_t IndexInBitmap (uint16_t seq) const;
160 
168  bool IsInBitmap (uint16_t seq) const;
169 
177  bool m_multiTid;
178  bool m_compressed;
179  uint16_t m_tidInfo;
180  uint16_t m_startingSeq;
181 
182  union
183  {
184  uint16_t m_bitmap[64];
185  uint64_t m_compressedBitmap;
186  } bitmap;
187 };
188 
189 } // namespace ns3
190 
191 #endif /* CTRL_HEADERS_H */
Protocol header serialization and deserialization.
Definition: header.h:42
virtual TypeId GetInstanceTypeId(void) const
Definition: ctrl-headers.cc:60
iterator in a Buffer instance
Definition: buffer.h:98
virtual void Print(std::ostream &os) const
Definition: ctrl-headers.cc:67
virtual uint32_t GetSerializedSize(void) const
Definition: ctrl-headers.cc:74
uint8_t IndexInBitmap(uint16_t seq) const
Headers for Block ack response.
Definition: ctrl-headers.h:102
virtual uint32_t GetSerializedSize(void) const
virtual uint32_t Deserialize(Buffer::Iterator start)
virtual void Serialize(Buffer::Iterator start) const
bool IsInBitmap(uint16_t seq) const
virtual void Serialize(Buffer::Iterator start) const
Definition: ctrl-headers.cc:98
virtual uint32_t Deserialize(Buffer::Iterator start)
virtual void Print(std::ostream &os) const
Headers for Block ack request.
Definition: ctrl-headers.h:46
a unique identifier for an interface.
Definition: type-id.h:44
virtual TypeId GetInstanceTypeId(void) const