author | Tom Henderson <tomh@tomh.org> |
Mon, 28 Sep 2015 20:27:25 -0700 | |
changeset 11676 | 05ea1489e509 |
parent 11450 | 9f4ae69f12b7 |
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 |
*/ |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
20 |
|
4408 | 21 |
#include "ns3/log.h" |
22 |
||
23 |
#include "msdu-aggregator.h" |
|
24 |
#include "wifi-mac-header.h" |
|
25 |
||
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
|
26 |
namespace ns3 { |
4408 | 27 |
|
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
|
28 |
NS_LOG_COMPONENT_DEFINE ("MsduAggregator"); |
4408 | 29 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
30 |
NS_OBJECT_ENSURE_REGISTERED (MsduAggregator); |
4408 | 31 |
|
32 |
TypeId |
|
33 |
MsduAggregator::GetTypeId (void) |
|
34 |
{ |
|
35 |
static TypeId tid = TypeId ("ns3::MsduAggregator") |
|
36 |
.SetParent<Object> () |
|
11245
5c781d7e5a25
SetGroupName for wifi module
Tom Henderson <tomh@tomh.org>
parents:
10968
diff
changeset
|
37 |
.SetGroupName ("Wifi") |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
38 |
; |
4408 | 39 |
return tid; |
40 |
} |
|
41 |
||
42 |
MsduAggregator::DeaggregatedMsdus |
|
43 |
MsduAggregator::Deaggregate (Ptr<Packet> aggregatedPacket) |
|
44 |
{ |
|
45 |
NS_LOG_FUNCTION_NOARGS (); |
|
46 |
DeaggregatedMsdus set; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
47 |
|
4408 | 48 |
AmsduSubframeHeader hdr; |
4499
3b5ef83fae25
aggregated MSDUs must not lose their tags
Mirko Banchi <mk.banchi@gmail.com>
parents:
4458
diff
changeset
|
49 |
Ptr<Packet> extractedMsdu = Create<Packet> (); |
4408 | 50 |
uint32_t maxSize = aggregatedPacket->GetSize (); |
4499
3b5ef83fae25
aggregated MSDUs must not lose their tags
Mirko Banchi <mk.banchi@gmail.com>
parents:
4458
diff
changeset
|
51 |
uint16_t extractedLength; |
4408 | 52 |
uint32_t padding; |
53 |
uint32_t deserialized = 0; |
|
54 |
||
55 |
while (deserialized < maxSize) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
56 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
57 |
deserialized += aggregatedPacket->RemoveHeader (hdr); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
58 |
extractedLength = hdr.GetLength (); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
59 |
extractedMsdu = aggregatedPacket->CreateFragment (0, static_cast<uint32_t> (extractedLength)); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
60 |
aggregatedPacket->RemoveAtStart (extractedLength); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
61 |
deserialized += extractedLength; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
62 |
|
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
63 |
padding = (4 - ((extractedLength + 14) % 4 )) % 4; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
64 |
|
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
65 |
if (padding > 0 && deserialized < maxSize) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
66 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
67 |
aggregatedPacket->RemoveAtStart (padding); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
68 |
deserialized += padding; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
69 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
70 |
|
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
71 |
std::pair<Ptr<Packet>, AmsduSubframeHeader> packetHdr (extractedMsdu, hdr); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
72 |
set.push_back (packetHdr); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
73 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
74 |
NS_LOG_INFO ("Deaggreated A-MSDU: extracted " << set.size () << " MSDUs"); |
4408 | 75 |
return set; |
76 |
} |
|
77 |
||
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11245
diff
changeset
|
78 |
} //namespace ns3 |