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
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
* Author: Mirko Banchi <mk.banchi@gmail.com>
19
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
20
*/
21
#include "
originator-block-ack-agreement.h
"
22
23
namespace
ns3 {
24
25
OriginatorBlockAckAgreement::OriginatorBlockAckAgreement
()
26
:
BlockAckAgreement
(),
27
m_state (PENDING),
28
m_sentMpdus (0),
29
m_needBlockAckReq (false)
30
{
31
}
32
OriginatorBlockAckAgreement::OriginatorBlockAckAgreement
(
Mac48Address
recipient, uint8_t tid)
33
:
BlockAckAgreement
(recipient, tid),
34
m_state (PENDING),
35
m_sentMpdus (0),
36
m_needBlockAckReq (false)
37
{
38
}
39
OriginatorBlockAckAgreement::~OriginatorBlockAckAgreement
()
40
{
41
}
42
void
43
OriginatorBlockAckAgreement::SetState
(
enum
State
state)
44
{
45
m_state
= state;
46
if
(state ==
INACTIVE
)
47
{
48
m_needBlockAckReq
=
false
;
49
m_sentMpdus
= 0;
50
}
51
}
52
bool
53
OriginatorBlockAckAgreement::IsPending
(
void
)
const
54
{
55
return
(
m_state
==
PENDING
) ?
true
:
false
;
56
}
57
bool
58
OriginatorBlockAckAgreement::IsEstablished
(
void
)
const
59
{
60
return
(
m_state
==
ESTABLISHED
) ?
true
:
false
;
61
}
62
bool
63
OriginatorBlockAckAgreement::IsInactive
(
void
)
const
64
{
65
return
(
m_state
==
INACTIVE
) ?
true
:
false
;
66
}
67
bool
68
OriginatorBlockAckAgreement::IsUnsuccessful
(
void
)
const
69
{
70
return
(
m_state
==
UNSUCCESSFUL
) ?
true
:
false
;
71
}
72
void
73
OriginatorBlockAckAgreement::NotifyMpduTransmission
(uint16_t nextSeqNumber)
74
{
75
NS_ASSERT
(
m_sentMpdus
<
m_bufferSize
);
76
m_sentMpdus
++;
77
uint16_t delta = (nextSeqNumber -
m_startingSeq
+ 4096) % 4096;
78
uint16_t min =
m_bufferSize
< 64 ?
m_bufferSize
: 64;
79
if
(delta >= min ||
m_sentMpdus
==
m_bufferSize
)
80
{
81
m_needBlockAckReq
=
true
;
82
}
83
}
84
bool
85
OriginatorBlockAckAgreement::IsBlockAckRequestNeeded
(
void
)
const
86
{
87
return
m_needBlockAckReq
;
88
}
89
void
90
OriginatorBlockAckAgreement::CompleteExchange
(
void
)
91
{
92
m_needBlockAckReq
=
false
;
93
m_sentMpdus
= 0;
94
}
95
96
}
// namespace ns3
ns3::OriginatorBlockAckAgreement::m_sentMpdus
uint16_t m_sentMpdus
Definition:
originator-block-ack-agreement.h:143
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
ns3::OriginatorBlockAckAgreement::PENDING
Definition:
originator-block-ack-agreement.h:91
ns3::BlockAckAgreement::m_startingSeq
uint16_t m_startingSeq
Definition:
block-ack-agreement.h:135
ns3::OriginatorBlockAckAgreement::IsInactive
bool IsInactive(void) const
Check if the current state of this agreement is INACTIVE.
Definition:
originator-block-ack-agreement.cc:63
ns3::OriginatorBlockAckAgreement::m_state
enum State m_state
Definition:
originator-block-ack-agreement.h:142
ns3::OriginatorBlockAckAgreement::~OriginatorBlockAckAgreement
~OriginatorBlockAckAgreement()
Definition:
originator-block-ack-agreement.cc:39
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:85
ns3::BlockAckAgreement::m_bufferSize
uint16_t m_bufferSize
Definition:
block-ack-agreement.h:133
ns3::OriginatorBlockAckAgreement::IsPending
bool IsPending(void) const
Check if the current state of this agreement is PENDING.
Definition:
originator-block-ack-agreement.cc:53
ns3::OriginatorBlockAckAgreement::INACTIVE
Definition:
originator-block-ack-agreement.h:93
ns3::OriginatorBlockAckAgreement::OriginatorBlockAckAgreement
OriginatorBlockAckAgreement()
Definition:
originator-block-ack-agreement.cc:25
ns3::OriginatorBlockAckAgreement::IsEstablished
bool IsEstablished(void) const
Check if the current state of this agreement is ESTABLISHED.
Definition:
originator-block-ack-agreement.cc:58
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:41
ns3::OriginatorBlockAckAgreement::State
State
Represents the state for this agreement.
Definition:
originator-block-ack-agreement.h:89
ns3::OriginatorBlockAckAgreement::IsUnsuccessful
bool IsUnsuccessful(void) const
Check if the current state of this agreement is UNSUCCESSFUL.
Definition:
originator-block-ack-agreement.cc:68
ns3::BlockAckAgreement
Maintains information for a block ack agreement.
Definition:
block-ack-agreement.h:31
ns3::OriginatorBlockAckAgreement::NotifyMpduTransmission
void NotifyMpduTransmission(uint16_t nextSeqNumber)
Notifies a packet's transmission with ack policy Block Ack.
Definition:
originator-block-ack-agreement.cc:73
ns3::OriginatorBlockAckAgreement::SetState
void SetState(enum State state)
Definition:
originator-block-ack-agreement.cc:43
ns3::OriginatorBlockAckAgreement::ESTABLISHED
Definition:
originator-block-ack-agreement.h:92
ns3::OriginatorBlockAckAgreement::UNSUCCESSFUL
Definition:
originator-block-ack-agreement.h:94
ns3::OriginatorBlockAckAgreement::m_needBlockAckReq
bool m_needBlockAckReq
Definition:
originator-block-ack-agreement.h:144
originator-block-ack-agreement.h
ns3::OriginatorBlockAckAgreement::CompleteExchange
void CompleteExchange(void)
Definition:
originator-block-ack-agreement.cc:90
src
wifi
model
originator-block-ack-agreement.cc
Generated on Sat Apr 19 2014 14:07:11 for ns-3 by
1.8.6