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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
amsdu-subframe-header.cc
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
#include "
amsdu-subframe-header.h
"
21
#include "ns3/address-utils.h"
22
23
namespace
ns3 {
24
25
NS_OBJECT_ENSURE_REGISTERED
(AmsduSubframeHeader);
26
27
TypeId
28
AmsduSubframeHeader::GetTypeId
()
29
{
30
static
TypeId
tid =
TypeId
(
"ns3::AmsduSubframeHeader"
)
31
.
SetParent
<
Header
> ()
32
.AddConstructor<AmsduSubframeHeader> ()
33
;
34
return
tid;
35
}
36
37
TypeId
38
AmsduSubframeHeader::GetInstanceTypeId
(
void
)
const
39
{
40
return
GetTypeId
();
41
}
42
43
AmsduSubframeHeader::AmsduSubframeHeader
()
44
: m_length (0)
45
{
46
}
47
48
AmsduSubframeHeader::~AmsduSubframeHeader
()
49
{
50
}
51
52
uint32_t
53
AmsduSubframeHeader::GetSerializedSize
()
const
54
{
55
return
(6 + 6 + 2);
56
}
57
58
void
59
AmsduSubframeHeader::Serialize
(
Buffer::Iterator
i)
const
60
{
61
WriteTo
(i,
m_da
);
62
WriteTo
(i,
m_sa
);
63
i.
WriteHtolsbU16
(
m_length
);
64
}
65
66
uint32_t
67
AmsduSubframeHeader::Deserialize
(
Buffer::Iterator
start
)
68
{
69
Buffer::Iterator
i =
start
;
70
ReadFrom
(i,
m_da
);
71
ReadFrom
(i,
m_sa
);
72
m_length
= i.
ReadLsbtohU16
();
73
return
i.
GetDistanceFrom
(start);
74
}
75
76
void
77
AmsduSubframeHeader::Print
(std::ostream &os)
const
78
{
79
os <<
"DA = "
<<
m_da
<<
", SA = "
<<
m_sa
<<
", length = "
<<
m_length
;
80
}
81
82
void
83
AmsduSubframeHeader::SetDestinationAddr
(
Mac48Address
to)
84
{
85
m_da
= to;
86
}
87
88
void
89
AmsduSubframeHeader::SetSourceAddr
(
Mac48Address
from)
90
{
91
m_sa
= from;
92
}
93
94
void
95
AmsduSubframeHeader::SetLength
(uint16_t length)
96
{
97
m_length
= length;
98
}
99
100
Mac48Address
101
AmsduSubframeHeader::GetDestinationAddr
(
void
)
const
102
{
103
return
m_da
;
104
}
105
106
Mac48Address
107
AmsduSubframeHeader::GetSourceAddr
(
void
)
const
108
{
109
return
m_sa
;
110
}
111
112
uint16_t
113
AmsduSubframeHeader::GetLength
(
void
)
const
114
{
115
return
m_length
;
116
}
117
118
}
// namespace ns3
src
wifi
model
amsdu-subframe-header.cc
Generated on Tue Oct 9 2012 16:45:48 for ns-3 by
1.8.1.2