author | Mirko Banchi <mk.banchi@gmail.com> |
Wed, 03 Feb 2010 20:34:52 +0100 | |
changeset 5959 | 66bc2d3da45f |
parent 5951 | 083b4c1ec98d |
child 6592 | 6ef5141e7bcf |
permissions | -rw-r--r-- |
5951
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
2 |
/* |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 MIRKO BANCHI |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
4 |
* |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
8 |
* |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
13 |
* |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
17 |
* |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
18 |
* Author: Mirko Banchi <mk.banchi@gmail.com> |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
19 |
*/ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
20 |
#include "originator-block-ack-agreement.h" |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
21 |
|
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
22 |
namespace ns3 { |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
23 |
|
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
24 |
OriginatorBlockAckAgreement::OriginatorBlockAckAgreement () |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
25 |
: BlockAckAgreement (), |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
26 |
m_state (PENDING), |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
27 |
m_sentMpdus (0) |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
28 |
{} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
29 |
OriginatorBlockAckAgreement::OriginatorBlockAckAgreement (Mac48Address recipient, uint8_t tid) |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
30 |
: BlockAckAgreement (recipient, tid), |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
31 |
m_state (PENDING), |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
32 |
m_sentMpdus (0) |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
33 |
{} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
34 |
OriginatorBlockAckAgreement::~OriginatorBlockAckAgreement () |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
35 |
{} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
36 |
void |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
37 |
OriginatorBlockAckAgreement::SetState (enum State state) |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
38 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
39 |
m_state = state; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
40 |
if (state == INACTIVE) |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
41 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
42 |
m_sentMpdus = 0; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
43 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
44 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
45 |
bool |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
46 |
OriginatorBlockAckAgreement::IsPending (void) const |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
47 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
48 |
return (m_state == PENDING)?true:false; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
49 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
50 |
bool |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
51 |
OriginatorBlockAckAgreement::IsEstablished (void) const |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
52 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
53 |
return (m_state == ESTABLISHED)?true:false; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
54 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
55 |
bool |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
56 |
OriginatorBlockAckAgreement::IsInactive (void) const |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
57 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
58 |
return (m_state == INACTIVE)?true:false; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
59 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
60 |
bool |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
61 |
OriginatorBlockAckAgreement::IsUnsuccessful (void) const |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
62 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
63 |
return (m_state == UNSUCCESSFUL)?true:false; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
64 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
65 |
void |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
66 |
OriginatorBlockAckAgreement::NotifyMpduTransmission (void) |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
67 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
68 |
NS_ASSERT (m_sentMpdus < m_bufferSize); |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
69 |
m_sentMpdus++; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
70 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
71 |
bool |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
72 |
OriginatorBlockAckAgreement::NeedBlockAckRequest (void) const |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
73 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
74 |
return (m_sentMpdus == m_bufferSize/2)?true:false; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
75 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
76 |
void |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
77 |
OriginatorBlockAckAgreement::CompleteExchange (void) |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
78 |
{ |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
79 |
m_sentMpdus = 0; |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
80 |
} |
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
81 |
|
083b4c1ec98d
add BlockAckAgreement and OriginatorBlockAckAgreement objects
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
82 |
} //namespace ns3 |