author | Junling Bu <linlinjavaer@gmail.com> |
Tue, 03 Dec 2013 11:25:59 -0800 | |
changeset 10459 | f2e90c12a44f |
parent 10410 | 4d4eb8097fa3 |
child 10652 | dc18deba4502 |
permissions | -rw-r--r-- |
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 |
*/ |
|
20 |
#include "amsdu-subframe-header.h" |
|
21 |
#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
|
22 |
#include "ns3/log.h" |
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
23 |
|
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
24 |
NS_LOG_COMPONENT_DEFINE ("AmsduSubframeHeader"); |
4408 | 25 |
|
26 |
namespace ns3 { |
|
27 |
||
10410
4d4eb8097fa3
doxygen] Suppress "warning: Member NS_OBJECT_ENSURE_REGISTERED is not documented"
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9705
diff
changeset
|
28 |
NS_OBJECT_ENSURE_REGISTERED (AmsduSubframeHeader) |
4d4eb8097fa3
doxygen] Suppress "warning: Member NS_OBJECT_ENSURE_REGISTERED is not documented"
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9705
diff
changeset
|
29 |
; |
4408 | 30 |
|
31 |
TypeId |
|
32 |
AmsduSubframeHeader::GetTypeId () |
|
33 |
{ |
|
34 |
static TypeId tid = TypeId ("ns3::AmsduSubframeHeader") |
|
35 |
.SetParent<Header> () |
|
36 |
.AddConstructor<AmsduSubframeHeader> () |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
37 |
; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
38 |
return tid; |
4408 | 39 |
} |
40 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
41 |
TypeId |
4408 | 42 |
AmsduSubframeHeader::GetInstanceTypeId (void) const |
43 |
{ |
|
44 |
return GetTypeId (); |
|
45 |
} |
|
46 |
||
47 |
AmsduSubframeHeader::AmsduSubframeHeader () |
|
48 |
: m_length (0) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
49 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
50 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
51 |
} |
4408 | 52 |
|
53 |
AmsduSubframeHeader::~AmsduSubframeHeader () |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
54 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
55 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
56 |
} |
4408 | 57 |
|
58 |
uint32_t |
|
59 |
AmsduSubframeHeader::GetSerializedSize () const |
|
60 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
61 |
NS_LOG_FUNCTION (this); |
4408 | 62 |
return (6 + 6 + 2); |
63 |
} |
|
64 |
||
65 |
void |
|
66 |
AmsduSubframeHeader::Serialize (Buffer::Iterator i) const |
|
67 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
68 |
NS_LOG_FUNCTION (this << &i); |
4408 | 69 |
WriteTo (i, m_da); |
70 |
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
|
71 |
i.WriteHtonU16 (m_length); |
4408 | 72 |
} |
73 |
||
74 |
uint32_t |
|
75 |
AmsduSubframeHeader::Deserialize (Buffer::Iterator start) |
|
76 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
77 |
NS_LOG_FUNCTION (this << &start); |
4408 | 78 |
Buffer::Iterator i = start; |
79 |
ReadFrom (i, m_da); |
|
80 |
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
|
81 |
m_length = i.ReadNtohU16 (); |
4408 | 82 |
return i.GetDistanceFrom (start); |
83 |
} |
|
84 |
||
85 |
void |
|
86 |
AmsduSubframeHeader::Print (std::ostream &os) const |
|
87 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
88 |
NS_LOG_FUNCTION (this << &os); |
4408 | 89 |
os << "DA = " << m_da << ", SA = " << m_sa << ", length = " << m_length; |
90 |
} |
|
91 |
||
92 |
void |
|
93 |
AmsduSubframeHeader::SetDestinationAddr (Mac48Address to) |
|
94 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
95 |
NS_LOG_FUNCTION (this << to); |
4408 | 96 |
m_da = to; |
97 |
} |
|
98 |
||
99 |
void |
|
100 |
AmsduSubframeHeader::SetSourceAddr (Mac48Address from) |
|
101 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
102 |
NS_LOG_FUNCTION (this << from); |
4408 | 103 |
m_sa = from; |
104 |
} |
|
105 |
||
106 |
void |
|
107 |
AmsduSubframeHeader::SetLength (uint16_t length) |
|
108 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
109 |
NS_LOG_FUNCTION (this << length); |
4408 | 110 |
m_length = length; |
111 |
} |
|
112 |
||
113 |
Mac48Address |
|
114 |
AmsduSubframeHeader::GetDestinationAddr (void) const |
|
115 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
116 |
NS_LOG_FUNCTION (this); |
4408 | 117 |
return m_da; |
118 |
} |
|
119 |
||
120 |
Mac48Address |
|
121 |
AmsduSubframeHeader::GetSourceAddr (void) const |
|
122 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
123 |
NS_LOG_FUNCTION (this); |
4408 | 124 |
return m_sa; |
125 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
126 |
|
4408 | 127 |
uint16_t |
128 |
AmsduSubframeHeader::GetLength (void) const |
|
129 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
9237
diff
changeset
|
130 |
NS_LOG_FUNCTION (this); |
4408 | 131 |
return m_length; |
132 |
} |
|
133 |
||
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
134 |
} // namespace ns3 |