A Discrete-Event Network Simulator
API
ampdu-tag.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013
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  * Authors: Ghada Badawy <gbadawy@gmail.com>
19  * Sébastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #include "ampdu-tag.h"
23 
24 namespace ns3 {
25 
27 
28 TypeId
30 {
31  static TypeId tid = TypeId ("ns3::AmpduTag")
32  .SetParent<Tag> ()
33  .SetGroupName ("Wifi")
34  .AddConstructor<AmpduTag> ()
35  ;
36  return tid;
37 }
38 
39 TypeId
41 {
42  return GetTypeId ();
43 }
44 
46  : m_nbOfMpdus (0),
47  m_duration (Seconds(0))
48 {
49 }
50 
51 void
53 {
54  m_nbOfMpdus = nbOfMpdus;
55 }
56 
57 void
59 {
61  m_duration = duration;
62 }
63 
64 uint32_t
66 {
67  return (1 + sizeof (Time));
68 }
69 
70 void
72 {
73  i.WriteU8 (m_nbOfMpdus);
74  int64_t duration = m_duration.GetTimeStep ();
75  i.Write ((const uint8_t *)&duration, sizeof(int64_t));
76 }
77 
78 void
80 {
81  m_nbOfMpdus = i.ReadU8 ();
82  int64_t duration;
83  i.Read ((uint8_t *)&duration, sizeof(int64_t));
84  m_duration = Time (duration);
85 }
86 
87 uint8_t
89 {
90  return m_nbOfMpdus;
91 }
92 
93 Time
95 {
96  return m_duration;
97 }
98 
99 void
100 AmpduTag::Print (std::ostream &os) const
101 {
102  os << "Remaining number of MPDUs=" << m_nbOfMpdus
103  << " Remaining A-MPDU duration=" << m_duration;
104 }
105 
106 } //namespace ns3
The aim of the AmpduTag is to provide means for a MAC to specify that a packet includes A-MPDU since ...
Definition: ampdu-tag.h:37
uint8_t GetRemainingNbOfMpdus(void) const
Definition: ampdu-tag.cc:88
static TypeId GetTypeId(void)
Get the type ID.
Definition: ampdu-tag.cc:29
uint32_t GetSerializedSize() const override
Definition: ampdu-tag.cc:65
AmpduTag()
Create a AmpduTag with the default =0 no A-MPDU.
Definition: ampdu-tag.cc:45
TypeId GetInstanceTypeId(void) const override
Get the most derived TypeId for this Object.
Definition: ampdu-tag.cc:40
void SetRemainingNbOfMpdus(uint8_t nbOfMpdus)
Definition: ampdu-tag.cc:52
Time m_duration
Remaining duration of the A-MPDU.
Definition: ampdu-tag.h:84
void Deserialize(TagBuffer i) override
Definition: ampdu-tag.cc:79
void SetRemainingAmpduDuration(Time duration)
Definition: ampdu-tag.cc:58
void Serialize(TagBuffer i) const override
Definition: ampdu-tag.cc:71
Time GetRemainingAmpduDuration(void) const
Definition: ampdu-tag.cc:94
void Print(std::ostream &os) const override
Definition: ampdu-tag.cc:100
uint8_t m_nbOfMpdus
Remaining number of MPDUs in the A-MPDU.
Definition: ampdu-tag.h:83
read and write tag data
Definition: tag-buffer.h:52
void Read(uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:176
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:172
void Write(const uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:125
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition: tag-buffer.h:195
tag a set of bytes in a packet
Definition: tag.h:37
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
int64_t GetTimeStep(void) const
Get the raw time value, in the current resolution unit.
Definition: nstime.h:415
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1252
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:793
Every class exported by the ns3 library is enclosed in the ns3 namespace.