author | Sébastien Deronne <sebastien.deronne@gmail.com> |
Sun, 21 Jun 2015 00:23:45 +0200 | |
changeset 11450 | 9f4ae69f12b7 |
parent 11245 | 5c781d7e5a25 |
permissions | -rwxr-xr-x |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7141
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4408 | 2 |
/* |
3 |
* Copyright (c) 2009 MIRKO BANCHI |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
4408 | 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 |
*/ |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
20 |
|
4408 | 21 |
#include "amsdu-subframe-header.h" |
22 |
#include "ns3/address-utils.h" |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
23 |
#include "ns3/log.h" |
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
24 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10652
diff
changeset
|
25 |
namespace ns3 { |
4408 | 26 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10652
diff
changeset
|
27 |
NS_LOG_COMPONENT_DEFINE ("AmsduSubframeHeader"); |
4408 | 28 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
29 |
NS_OBJECT_ENSURE_REGISTERED (AmsduSubframeHeader); |
4408 | 30 |
|
31 |
TypeId |
|
32 |
AmsduSubframeHeader::GetTypeId () |
|
33 |
{ |
|
34 |
static TypeId tid = TypeId ("ns3::AmsduSubframeHeader") |
|
35 |
.SetParent<Header> () |
|
11245
5c781d7e5a25
SetGroupName for wifi module
Tom Henderson <tomh@tomh.org>
parents:
10968
diff
changeset
|
36 |
.SetGroupName ("Wifi") |
4408 | 37 |
.AddConstructor<AmsduSubframeHeader> () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
38 |
; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
39 |
return tid; |
4408 | 40 |
} |
41 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
42 |
TypeId |
4408 | 43 |
AmsduSubframeHeader::GetInstanceTypeId (void) const |
44 |
{ |
|
45 |
return GetTypeId (); |
|
46 |
} |
|
47 |
||
48 |
AmsduSubframeHeader::AmsduSubframeHeader () |
|
49 |
: m_length (0) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
50 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
51 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
52 |
} |
4408 | 53 |
|
54 |
AmsduSubframeHeader::~AmsduSubframeHeader () |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
55 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
56 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
57 |
} |
4408 | 58 |
|
59 |
uint32_t |
|
60 |
AmsduSubframeHeader::GetSerializedSize () const |
|
61 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
62 |
NS_LOG_FUNCTION (this); |
4408 | 63 |
return (6 + 6 + 2); |
64 |
} |
|
65 |
||
66 |
void |
|
67 |
AmsduSubframeHeader::Serialize (Buffer::Iterator i) const |
|
68 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
69 |
NS_LOG_FUNCTION (this << &i); |
4408 | 70 |
WriteTo (i, m_da); |
71 |
WriteTo (i, m_sa); |
|
9237
db83a668984c
Bug 1585 - Length field of A-MSDU subframe header endianness
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7386
diff
changeset
|
72 |
i.WriteHtonU16 (m_length); |
4408 | 73 |
} |
74 |
||
75 |
uint32_t |
|
76 |
AmsduSubframeHeader::Deserialize (Buffer::Iterator start) |
|
77 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
78 |
NS_LOG_FUNCTION (this << &start); |
4408 | 79 |
Buffer::Iterator i = start; |
80 |
ReadFrom (i, m_da); |
|
81 |
ReadFrom (i, m_sa); |
|
9237
db83a668984c
Bug 1585 - Length field of A-MSDU subframe header endianness
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7386
diff
changeset
|
82 |
m_length = i.ReadNtohU16 (); |
4408 | 83 |
return i.GetDistanceFrom (start); |
84 |
} |
|
85 |
||
86 |
void |
|
87 |
AmsduSubframeHeader::Print (std::ostream &os) const |
|
88 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
89 |
NS_LOG_FUNCTION (this << &os); |
4408 | 90 |
os << "DA = " << m_da << ", SA = " << m_sa << ", length = " << m_length; |
91 |
} |
|
92 |
||
93 |
void |
|
94 |
AmsduSubframeHeader::SetDestinationAddr (Mac48Address to) |
|
95 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
96 |
NS_LOG_FUNCTION (this << to); |
4408 | 97 |
m_da = to; |
98 |
} |
|
99 |
||
100 |
void |
|
101 |
AmsduSubframeHeader::SetSourceAddr (Mac48Address from) |
|
102 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
103 |
NS_LOG_FUNCTION (this << from); |
4408 | 104 |
m_sa = from; |
105 |
} |
|
106 |
||
107 |
void |
|
108 |
AmsduSubframeHeader::SetLength (uint16_t length) |
|
109 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
110 |
NS_LOG_FUNCTION (this << length); |
4408 | 111 |
m_length = length; |
112 |
} |
|
113 |
||
114 |
Mac48Address |
|
115 |
AmsduSubframeHeader::GetDestinationAddr (void) const |
|
116 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
117 |
NS_LOG_FUNCTION (this); |
4408 | 118 |
return m_da; |
119 |
} |
|
120 |
||
121 |
Mac48Address |
|
122 |
AmsduSubframeHeader::GetSourceAddr (void) const |
|
123 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
124 |
NS_LOG_FUNCTION (this); |
4408 | 125 |
return m_sa; |
126 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
127 |
|
4408 | 128 |
uint16_t |
129 |
AmsduSubframeHeader::GetLength (void) const |
|
130 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
131 |
NS_LOG_FUNCTION (this); |
4408 | 132 |
return m_length; |
133 |
} |
|
134 |
||
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
135 |
} //namespace ns3 |