A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
* Author: Ghada Badawy <gbadawy@gmail.com>
19
*/
20
#include "
ampdu-tag.h
"
21
#include "ns3/tag.h"
22
#include "ns3/uinteger.h"
23
24
namespace
ns3
{
25
26
NS_OBJECT_ENSURE_REGISTERED
(AmpduTag);
27
28
TypeId
29
AmpduTag::GetTypeId
(
void
)
30
{
31
static
TypeId
tid =
TypeId
(
"ns3::AmpduTag"
)
32
.
SetParent
<
Tag
> ()
33
.AddConstructor<AmpduTag> ()
34
.AddAttribute (
"Ampdu Exists"
,
"The value that indicates that the packet contains an AMPDU"
,
35
UintegerValue
(
false
),
36
MakeUintegerAccessor
(&
AmpduTag::GetAmpdu
),
37
MakeUintegerChecker<uint8_t> ())
38
;
39
return
tid;
40
}
41
42
TypeId
43
AmpduTag::GetInstanceTypeId
(
void
)
const
44
{
45
return
GetTypeId
();
46
}
47
48
AmpduTag::AmpduTag
()
49
: m_ampdu (0)
50
{
51
}
52
53
void
54
AmpduTag::SetAmpdu
(
bool
supported)
55
{
56
m_ampdu
= supported;
57
}
58
59
void
60
AmpduTag::SetNoOfMpdus
(uint8_t noofmpdus)
61
{
62
NS_ASSERT
(noofmpdus <= 64);
63
m_noOfMpdus
= noofmpdus;
64
}
65
66
uint32_t
67
AmpduTag::GetSerializedSize
(
void
)
const
68
{
69
return
2;
70
}
71
72
void
73
AmpduTag::Serialize
(
TagBuffer
i)
const
74
{
75
i.
WriteU8
(
m_ampdu
);
76
i.
WriteU8
(
m_noOfMpdus
);
77
}
78
79
void
80
AmpduTag::Deserialize
(
TagBuffer
i)
81
{
82
m_ampdu
= i.
ReadU8
();
83
m_noOfMpdus
= i.
ReadU8
();
84
}
85
86
bool
87
AmpduTag::GetAmpdu
()
const
88
{
89
return
(
m_ampdu
== 1) ?
true
:
false
;
90
}
91
92
uint8_t
93
AmpduTag::GetNoOfMpdus
()
const
94
{
95
return
m_noOfMpdus
;
96
}
97
98
void
99
AmpduTag::Print
(std::ostream &os)
const
100
{
101
os <<
"A-MPDU exists="
<<
m_ampdu
;
102
}
103
104
}
// namespace ns3
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:44
ns3::AmpduTag::Print
virtual void Print(std::ostream &os) const
Definition:
ampdu-tag.cc:99
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition:
assert.h:61
ns3::AmpduTag::GetAmpdu
bool GetAmpdu(void) const
Definition:
ampdu-tag.cc:87
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition:
tag-buffer.h:195
ns3::AmpduTag::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Definition:
ampdu-tag.cc:67
ns3::AmpduTag::SetNoOfMpdus
void SetNoOfMpdus(uint8_t noofmpdus)
Definition:
ampdu-tag.cc:60
ns3::AmpduTag::SetAmpdu
void SetAmpdu(bool supported)
Set m_ampdu to 1.
Definition:
ampdu-tag.cc:54
ns3::AmpduTag::AmpduTag
AmpduTag()
Create a AmpduTag with the default =0 no Ampdu.
Definition:
ampdu-tag.cc:48
ns3::UintegerValue
Hold an unsigned integer type.
Definition:
uinteger.h:44
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition:
tag-buffer.h:172
ns3::AmpduTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
ampdu-tag.cc:43
ns3::AmpduTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition:
ampdu-tag.cc:80
ampdu-tag.h
ns3::AmpduTag::m_ampdu
uint8_t m_ampdu
Flag whether it is an A-MPDU.
Definition:
ampdu-tag.h:76
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::AmpduTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition:
ampdu-tag.cc:73
ns3::AmpduTag::m_noOfMpdus
uint8_t m_noOfMpdus
number of MPDUs in the A-MPDU
Definition:
ampdu-tag.h:77
ns3::AmpduTag::GetTypeId
static TypeId GetTypeId(void)
Definition:
ampdu-tag.cc:29
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition:
uinteger.h:45
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:51
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:631
ns3::AmpduTag::GetNoOfMpdus
uint8_t GetNoOfMpdus(void) const
Definition:
ampdu-tag.cc:93
src
wifi
model
ampdu-tag.cc
Generated on Thu Feb 5 2015 18:33:56 for ns-3 by
1.8.9.1