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
originator-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, 2010 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
* Authors: Mirko Banchi <mk.banchi@gmail.com>
19
* Tommaso Pecorella <tommaso.pecorella@unifi.it>
20
*/
21
22
#include "
originator-block-ack-agreement.h
"
23
24
namespace
ns3
{
25
26
OriginatorBlockAckAgreement::OriginatorBlockAckAgreement
()
27
:
BlockAckAgreement
(),
28
m_state (PENDING),
29
m_sentMpdus (0),
30
m_needBlockAckReq (false)
31
{
32
}
33
34
OriginatorBlockAckAgreement::OriginatorBlockAckAgreement
(
Mac48Address
recipient, uint8_t tid)
35
:
BlockAckAgreement
(recipient, tid),
36
m_state (PENDING),
37
m_sentMpdus (0),
38
m_needBlockAckReq (false)
39
{
40
}
41
42
OriginatorBlockAckAgreement::~OriginatorBlockAckAgreement
()
43
{
44
}
45
46
void
47
OriginatorBlockAckAgreement::SetState
(
enum
State
state)
48
{
49
m_state
= state;
50
if
(state ==
INACTIVE
)
51
{
52
m_needBlockAckReq
=
false
;
53
m_sentMpdus
= 0;
54
}
55
}
56
57
bool
58
OriginatorBlockAckAgreement::IsPending
(
void
)
const
59
{
60
return
(
m_state
==
PENDING
) ?
true
:
false
;
61
}
62
63
bool
64
OriginatorBlockAckAgreement::IsEstablished
(
void
)
const
65
{
66
return
(
m_state
==
ESTABLISHED
) ?
true
:
false
;
67
}
68
69
bool
70
OriginatorBlockAckAgreement::IsInactive
(
void
)
const
71
{
72
return
(
m_state
==
INACTIVE
) ?
true
:
false
;
73
}
74
75
bool
76
OriginatorBlockAckAgreement::IsUnsuccessful
(
void
)
const
77
{
78
return
(
m_state
==
UNSUCCESSFUL
) ?
true
:
false
;
79
}
80
81
void
82
OriginatorBlockAckAgreement::NotifyMpduTransmission
(uint16_t nextSeqNumber)
83
{
84
NS_ASSERT
(
m_sentMpdus
<
m_bufferSize
);
85
m_sentMpdus
++;
86
uint16_t delta = (nextSeqNumber -
m_startingSeq
+ 4096) % 4096;
87
uint16_t min =
m_bufferSize
< 64 ?
m_bufferSize
: 64;
88
if
(delta >= min ||
m_sentMpdus
==
m_bufferSize
)
89
{
90
m_needBlockAckReq
=
true
;
91
}
92
}
93
94
bool
95
OriginatorBlockAckAgreement::IsBlockAckRequestNeeded
(
void
)
const
96
{
97
return
m_needBlockAckReq
;
98
}
99
100
void
101
OriginatorBlockAckAgreement::CompleteExchange
(
void
)
102
{
103
m_needBlockAckReq
=
false
;
104
m_sentMpdus
= 0;
105
}
106
107
}
//namespace ns3
ns3::OriginatorBlockAckAgreement::INACTIVE
Definition:
originator-block-ack-agreement.h:95
ns3::OriginatorBlockAckAgreement::m_sentMpdus
uint16_t m_sentMpdus
Definition:
originator-block-ack-agreement.h:146
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition:
assert.h:67
ns3::BlockAckAgreement::m_startingSeq
uint16_t m_startingSeq
Starting squence control.
Definition:
block-ack-agreement.h:169
ns3::OriginatorBlockAckAgreement::IsInactive
bool IsInactive(void) const
Check if the current state of this agreement is INACTIVE.
Definition:
originator-block-ack-agreement.cc:70
ns3::OriginatorBlockAckAgreement::m_state
enum State m_state
Definition:
originator-block-ack-agreement.h:145
ns3::OriginatorBlockAckAgreement::~OriginatorBlockAckAgreement
~OriginatorBlockAckAgreement()
Definition:
originator-block-ack-agreement.cc:42
ns3::OriginatorBlockAckAgreement::IsBlockAckRequestNeeded
bool IsBlockAckRequestNeeded(void) const
Returns true if all packets for which a block ack was negotiated have been transmitted so a block ack...
Definition:
originator-block-ack-agreement.cc:95
ns3::OriginatorBlockAckAgreement::UNSUCCESSFUL
Definition:
originator-block-ack-agreement.h:96
ns3::BlockAckAgreement::m_bufferSize
uint16_t m_bufferSize
Buffer size.
Definition:
block-ack-agreement.h:167
ns3::OriginatorBlockAckAgreement::ESTABLISHED
Definition:
originator-block-ack-agreement.h:94
ns3::OriginatorBlockAckAgreement::IsPending
bool IsPending(void) const
Check if the current state of this agreement is PENDING.
Definition:
originator-block-ack-agreement.cc:58
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::OriginatorBlockAckAgreement::OriginatorBlockAckAgreement
OriginatorBlockAckAgreement()
Definition:
originator-block-ack-agreement.cc:26
ns3::OriginatorBlockAckAgreement::IsEstablished
bool IsEstablished(void) const
Check if the current state of this agreement is ESTABLISHED.
Definition:
originator-block-ack-agreement.cc:64
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:43
ns3::OriginatorBlockAckAgreement::IsUnsuccessful
bool IsUnsuccessful(void) const
Check if the current state of this agreement is UNSUCCESSFUL.
Definition:
originator-block-ack-agreement.cc:76
ns3::BlockAckAgreement
Maintains information for a block ack agreement.
Definition:
block-ack-agreement.h:32
ns3::OriginatorBlockAckAgreement::PENDING
Definition:
originator-block-ack-agreement.h:93
ns3::OriginatorBlockAckAgreement::State
State
Represents the state for this agreement.
Definition:
originator-block-ack-agreement.h:91
ns3::OriginatorBlockAckAgreement::NotifyMpduTransmission
void NotifyMpduTransmission(uint16_t nextSeqNumber)
Notifies a packet's transmission with ack policy Block Ack.
Definition:
originator-block-ack-agreement.cc:82
ns3::OriginatorBlockAckAgreement::SetState
void SetState(enum State state)
Definition:
originator-block-ack-agreement.cc:47
ns3::OriginatorBlockAckAgreement::m_needBlockAckReq
bool m_needBlockAckReq
Definition:
originator-block-ack-agreement.h:147
originator-block-ack-agreement.h
ns3::OriginatorBlockAckAgreement::CompleteExchange
void CompleteExchange(void)
Definition:
originator-block-ack-agreement.cc:101
src
wifi
model
originator-block-ack-agreement.cc
Generated on Wed Sep 30 2015 15:55:53 for ns-3 by
1.8.9.1