author | Junling Bu <linlinjavaer@gmail.com> |
Tue, 03 Dec 2013 11:25:59 -0800 | |
changeset 10459 | f2e90c12a44f |
parent 7386 | 2310ed220a61 |
child 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; -*- */ |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
2 |
/* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 MIRKO BANCHI |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
4 |
* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
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 |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
8 |
* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
13 |
* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
17 |
* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
18 |
* Author: Mirko Banchi <mk.banchi@gmail.com> |
5956
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
19 |
* Author: Cecchi Niccolò <insa@igeek.it> |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
20 |
*/ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
21 |
#include "qos-utils.h" |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
22 |
#include "qos-tag.h" |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
23 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
24 |
namespace ns3 { |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
25 |
|
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
5956
diff
changeset
|
26 |
AcIndex |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
27 |
QosUtilsMapTidToAc (uint8_t tid) |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
28 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
29 |
switch (tid) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
30 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
31 |
case 0: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
32 |
return AC_BE; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
33 |
break; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
34 |
case 1: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
35 |
return AC_BK; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
36 |
break; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
37 |
case 2: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
38 |
return AC_BK; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
39 |
break; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
40 |
case 3: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
41 |
return AC_BE; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
42 |
break; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
43 |
case 4: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
44 |
return AC_VI; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
45 |
break; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
46 |
case 5: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
47 |
return AC_VI; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
48 |
break; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
49 |
case 6: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
50 |
return AC_VO; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
51 |
break; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
52 |
case 7: |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
53 |
return AC_VO; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
54 |
break; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
55 |
} |
5143
8b5055542351
Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents:
5115
diff
changeset
|
56 |
return AC_UNDEF; |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
57 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
58 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
59 |
uint8_t |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
60 |
QosUtilsGetTidForPacket (Ptr<const Packet> packet) |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
61 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
62 |
QosTag qos; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
63 |
uint8_t tid = 8; |
4502 | 64 |
if (packet->PeekPacketTag (qos)) |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
65 |
{ |
5774 | 66 |
if (qos.GetTid () < 8) |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
67 |
{ |
5774 | 68 |
tid = qos.GetTid (); |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
69 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
70 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
71 |
return tid; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
72 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
73 |
|
5956
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
74 |
uint32_t |
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
75 |
QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence) |
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
76 |
{ |
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
77 |
uint32_t integer = 0; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
78 |
uint16_t numberSeq = (seqControl >> 4) & 0x0fff; |
5956
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
79 |
integer = (4096 - (endSequence + 1) + numberSeq) % 4096; |
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
80 |
integer *= 16; |
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
81 |
integer += (seqControl & 0x000f); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
82 |
return integer; |
5956
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
83 |
} |
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
84 |
|
6600
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
6331
diff
changeset
|
85 |
bool |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
6331
diff
changeset
|
86 |
QosUtilsIsOldPacket (uint16_t startingSeq, uint16_t seqNumber) |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
6331
diff
changeset
|
87 |
{ |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
6331
diff
changeset
|
88 |
NS_ASSERT (startingSeq < 4096); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
6331
diff
changeset
|
89 |
NS_ASSERT (seqNumber < 4096); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
6331
diff
changeset
|
90 |
uint16_t distance = ((seqNumber - startingSeq) + 4096) % 4096; |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
6331
diff
changeset
|
91 |
return (distance >= 2048); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
6331
diff
changeset
|
92 |
} |
5956
e9918be47f78
MacLow now buffers QoS MPDUs under Block Ack
Mirko Banchi <mk.banchi@gmail.com>
parents:
5774
diff
changeset
|
93 |
|
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
94 |
} // namespace ns3 |