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
block-ack-agreement.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 "
block-ack-agreement.h
"
21
#include "ns3/log.h"
22
23
NS_LOG_COMPONENT_DEFINE
(
"BlockAckAgreement"
);
24
25
namespace
ns3 {
26
27
BlockAckAgreement::BlockAckAgreement
()
28
: m_amsduSupported (0),
29
m_blockAckPolicy (1),
30
m_inactivityEvent ()
31
{
32
NS_LOG_FUNCTION
(
this
);
33
}
34
35
BlockAckAgreement::BlockAckAgreement
(
Mac48Address
peer, uint8_t tid)
36
: m_amsduSupported (0),
37
m_blockAckPolicy (1),
38
m_inactivityEvent ()
39
{
40
NS_LOG_FUNCTION
(
this
<< peer << static_cast<uint32_t> (tid));
41
m_tid
= tid;
42
m_peer
= peer;
43
}
44
45
BlockAckAgreement::~BlockAckAgreement
()
46
{
47
NS_LOG_FUNCTION
(
this
);
48
m_inactivityEvent
.
Cancel
();
49
}
50
51
void
52
BlockAckAgreement::SetBufferSize
(uint16_t bufferSize)
53
{
54
NS_LOG_FUNCTION
(
this
<< bufferSize);
55
NS_ASSERT
(bufferSize <= 1024);
56
NS_ASSERT
(bufferSize % 16 == 0);
57
m_bufferSize
= bufferSize;
58
}
59
void
60
BlockAckAgreement::SetTimeout
(uint16_t
timeout
)
61
{
62
NS_LOG_FUNCTION
(
this
<< timeout);
63
m_timeout
=
timeout
;
64
}
65
void
66
BlockAckAgreement::SetStartingSequence
(uint16_t seq)
67
{
68
NS_LOG_FUNCTION
(
this
<< seq);
69
NS_ASSERT
(seq < 4096);
70
m_startingSeq
= seq;
71
}
72
void
73
BlockAckAgreement::SetImmediateBlockAck
(
void
)
74
{
75
NS_LOG_FUNCTION
(
this
);
76
m_blockAckPolicy
= 1;
77
}
78
void
79
BlockAckAgreement::SetDelayedBlockAck
(
void
)
80
{
81
NS_LOG_FUNCTION
(
this
);
82
m_blockAckPolicy
= 0;
83
}
84
void
85
BlockAckAgreement::SetAmsduSupport
(
bool
supported)
86
{
87
NS_LOG_FUNCTION
(
this
<< supported);
88
m_amsduSupported
= supported;
89
}
90
91
uint8_t
92
BlockAckAgreement::GetTid
(
void
)
const
93
{
94
NS_LOG_FUNCTION
(
this
);
95
return
m_tid
;
96
}
97
Mac48Address
98
BlockAckAgreement::GetPeer
(
void
)
const
99
{
100
NS_LOG_FUNCTION
(
this
);
101
return
m_peer
;
102
}
103
uint16_t
104
BlockAckAgreement::GetBufferSize
(
void
)
const
105
{
106
NS_LOG_FUNCTION
(
this
);
107
return
m_bufferSize
;
108
}
109
uint16_t
110
BlockAckAgreement::GetTimeout
(
void
)
const
111
{
112
NS_LOG_FUNCTION
(
this
);
113
return
m_timeout
;
114
}
115
uint16_t
116
BlockAckAgreement::GetStartingSequence
(
void
)
const
117
{
118
NS_LOG_FUNCTION
(
this
);
119
return
m_startingSeq
;
120
}
121
uint16_t
122
BlockAckAgreement::GetStartingSequenceControl
(
void
)
const
123
{
124
NS_LOG_FUNCTION
(
this
);
125
uint16_t seqControl = (
m_startingSeq
<< 4) | 0xfff0;
126
return
seqControl;
127
}
128
bool
129
BlockAckAgreement::IsImmediateBlockAck
(
void
)
const
130
{
131
NS_LOG_FUNCTION
(
this
);
132
return
(
m_blockAckPolicy
== 1);
133
}
134
bool
135
BlockAckAgreement::IsAmsduSupported
(
void
)
const
136
{
137
NS_LOG_FUNCTION
(
this
);
138
return
(
m_amsduSupported
== 1) ?
true
:
false
;
139
}
140
141
}
// namespace ns3
ns3::BlockAckAgreement::BlockAckAgreement
BlockAckAgreement()
Definition:
block-ack-agreement.cc:27
ns3::BlockAckAgreement::GetTid
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Definition:
block-ack-agreement.cc:92
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::BlockAckAgreement::m_peer
Mac48Address m_peer
Definition:
block-ack-agreement.h:129
ns3::BlockAckAgreement::GetTimeout
uint16_t GetTimeout(void) const
Return the timeout.
Definition:
block-ack-agreement.cc:110
ns3::BlockAckAgreement::GetPeer
Mac48Address GetPeer(void) const
Return the peer address.
Definition:
block-ack-agreement.cc:98
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("BlockAckAgreement")
ns3::BlockAckAgreement::IsImmediateBlockAck
bool IsImmediateBlockAck(void) const
Check whether the current ACK policy is immediate block ACK.
Definition:
block-ack-agreement.cc:129
ns3::BlockAckAgreement::m_startingSeq
uint16_t m_startingSeq
Definition:
block-ack-agreement.h:135
timeout
ns3::Time timeout
Definition:
openflow-switch.cc:52
ns3::BlockAckAgreement::GetStartingSequence
uint16_t GetStartingSequence(void) const
Return the starting squence number.
Definition:
block-ack-agreement.cc:116
ns3::BlockAckAgreement::m_timeout
uint16_t m_timeout
Definition:
block-ack-agreement.h:134
ns3::BlockAckAgreement::IsAmsduSupported
bool IsAmsduSupported(void) const
Check whether A-MSDU is supported.
Definition:
block-ack-agreement.cc:135
ns3::BlockAckAgreement::m_tid
uint8_t m_tid
Definition:
block-ack-agreement.h:132
ns3::BlockAckAgreement::m_blockAckPolicy
uint8_t m_blockAckPolicy
Definition:
block-ack-agreement.h:131
ns3::BlockAckAgreement::m_bufferSize
uint16_t m_bufferSize
Definition:
block-ack-agreement.h:133
ns3::BlockAckAgreement::~BlockAckAgreement
~BlockAckAgreement()
Definition:
block-ack-agreement.cc:45
ns3::BlockAckAgreement::SetStartingSequence
void SetStartingSequence(uint16_t seq)
Set starting sequence number.
Definition:
block-ack-agreement.cc:66
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:41
block-ack-agreement.h
ns3::BlockAckAgreement::m_amsduSupported
uint8_t m_amsduSupported
Definition:
block-ack-agreement.h:130
ns3::BlockAckAgreement::SetDelayedBlockAck
void SetDelayedBlockAck(void)
Set Block ACK policy to delayed ACK.
Definition:
block-ack-agreement.cc:79
ns3::BlockAckAgreement::m_inactivityEvent
EventId m_inactivityEvent
Definition:
block-ack-agreement.h:137
ns3::BlockAckAgreement::SetAmsduSupport
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition:
block-ack-agreement.cc:85
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
Definition:
event-id.cc:47
ns3::BlockAckAgreement::SetImmediateBlockAck
void SetImmediateBlockAck(void)
Set Block ACK policy to immediate ACK.
Definition:
block-ack-agreement.cc:73
ns3::BlockAckAgreement::SetTimeout
void SetTimeout(uint16_t timeout)
Set timeout.
Definition:
block-ack-agreement.cc:60
ns3::BlockAckAgreement::GetStartingSequenceControl
uint16_t GetStartingSequenceControl(void) const
Return the starting squence control.
Definition:
block-ack-agreement.cc:122
ns3::BlockAckAgreement::SetBufferSize
void SetBufferSize(uint16_t bufferSize)
Set buffer size.
Definition:
block-ack-agreement.cc:52
ns3::BlockAckAgreement::GetBufferSize
uint16_t GetBufferSize(void) const
Return the buffer size.
Definition:
block-ack-agreement.cc:104
src
wifi
model
block-ack-agreement.cc
Generated on Sat Apr 19 2014 14:07:10 for ns-3 by
1.8.6