A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ampdu-tag.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Ghada Badawy <gbadawy@gmail.com>
18 * Sébastien Deronne <sebastien.deronne@gmail.com>
19 */
20
21#include "ampdu-tag.h"
22
23namespace ns3
24{
25
27
28TypeId
30{
31 static TypeId tid =
32 TypeId("ns3::AmpduTag").SetParent<Tag>().SetGroupName("Wifi").AddConstructor<AmpduTag>();
33 return tid;
34}
35
38{
39 return GetTypeId();
40}
41
43 : m_nbOfMpdus(0),
44 m_duration(Seconds(0))
45{
46}
47
48void
50{
51 m_nbOfMpdus = nbOfMpdus;
52}
53
54void
56{
58 m_duration = duration;
59}
60
63{
64 return (1 + sizeof(Time));
65}
66
67void
69{
71 int64_t duration = m_duration.GetTimeStep();
72 i.Write((const uint8_t*)&duration, sizeof(int64_t));
73}
74
75void
77{
78 m_nbOfMpdus = i.ReadU8();
79 int64_t duration;
80 i.Read((uint8_t*)&duration, sizeof(int64_t));
81 m_duration = Time(duration);
82}
83
84uint8_t
86{
87 return m_nbOfMpdus;
88}
89
90Time
92{
93 return m_duration;
94}
95
96void
97AmpduTag::Print(std::ostream& os) const
98{
99 os << "Remaining number of MPDUs=" << m_nbOfMpdus
100 << " Remaining A-MPDU duration=" << m_duration;
101}
102
103} // 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
uint32_t GetSerializedSize() const override
Definition: ampdu-tag.cc:62
AmpduTag()
Create a AmpduTag with the default =0 no A-MPDU.
Definition: ampdu-tag.cc:42
void SetRemainingNbOfMpdus(uint8_t nbOfMpdus)
Definition: ampdu-tag.cc:49
Time m_duration
Remaining duration of the A-MPDU.
Definition: ampdu-tag.h:83
static TypeId GetTypeId()
Get the type ID.
Definition: ampdu-tag.cc:29
Time GetRemainingAmpduDuration() const
Definition: ampdu-tag.cc:91
void Deserialize(TagBuffer i) override
Definition: ampdu-tag.cc:76
void SetRemainingAmpduDuration(Time duration)
Definition: ampdu-tag.cc:55
void Serialize(TagBuffer i) const override
Definition: ampdu-tag.cc:68
void Print(std::ostream &os) const override
Definition: ampdu-tag.cc:97
uint8_t GetRemainingNbOfMpdus() const
Definition: ampdu-tag.cc:85
uint8_t m_nbOfMpdus
Remaining number of MPDUs in the A-MPDU.
Definition: ampdu-tag.h:82
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: ampdu-tag.cc:37
read and write tag data
Definition: tag-buffer.h:52
void Read(uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:183
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:172
TAG_BUFFER_INLINE uint8_t ReadU8()
Definition: tag-buffer.h:196
void Write(const uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:129
tag a set of bytes in a packet
Definition: tag.h:39
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
int64_t GetTimeStep() const
Get the raw time value, in the current resolution unit.
Definition: nstime.h:445
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1319
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1331
Every class exported by the ns3 library is enclosed in the ns3 namespace.