Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2009 MIRKO BANCHI | 3 * Copyright (c) 2009 MIRKO BANCHI |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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· | 6 * it under the terms of the GNU General Public License version 2 as· |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Mirko Banchi <mk.banchi@gmail.com> | 18 * Author: Mirko Banchi <mk.banchi@gmail.com> |
19 */ | 19 */ |
20 #ifndef BLOCK_ACK_AGREEMENT_H | 20 #ifndef BLOCK_ACK_AGREEMENT_H |
21 #define BLOCK_ACK_AGREEMENT_H | 21 #define BLOCK_ACK_AGREEMENT_H |
22 | 22 |
23 #include "ns3/mac48-address.h" | 23 #include "ns3/mac48-address.h" |
24 #include "ns3/event-id.h" | 24 #include "ns3/event-id.h" |
25 | 25 |
26 namespace ns3 { | 26 namespace ns3 { |
27 /** | 27 /** |
faker.moatamri
2009/11/03 14:10:49
No doxygen here! can you please add doxygen?
| |
28 * Mantains the state and informations for a block ack agreement. | 28 * \brief Mantains informations for a block ack agreement. |
29 */ | 29 */ |
30 class BlockAckAgreement· | 30 class BlockAckAgreement· |
31 { | 31 { |
32 friend class BlockAckManager; | |
33 friend class MacLow; | 32 friend class MacLow; |
34 public: | 33 public: |
35 BlockAckAgreement (); | 34 BlockAckAgreement (); |
36 BlockAckAgreement (Mac48Address peer, uint8_t tid); | 35 BlockAckAgreement (Mac48Address peer, uint8_t tid); |
37 ~BlockAckAgreement (); | 36 ~BlockAckAgreement (); |
38 void SetTid (uint8_t tid); | |
39 void SetPeer (Mac48Address peer); | |
40 void SetBufferSize (uint16_t bufferSize); | 37 void SetBufferSize (uint16_t bufferSize); |
41 void SetTimeout (uint16_t timeout); | 38 void SetTimeout (uint16_t timeout); |
42 void SetStartingSequence (uint16_t seq); | 39 void SetStartingSequence (uint16_t seq); |
43 void SetImmediateBlockAck (void); | 40 void SetImmediateBlockAck (void); |
44 void SetDelayedBlockAck (void); | 41 void SetDelayedBlockAck (void); |
45 void SetAmsduSupported (void); | 42 void SetAmsduSupport (bool supported); |
46 void SetAmsduNotSupported (void); | |
47 void SetPendingState (); | |
48 void SetEstablishedState (void); | |
49 void SetInactiveState (void); | |
50 void SetUnsuccessfulState (void); | |
51 | 43 |
52 uint8_t GetTid (void) const; | 44 uint8_t GetTid (void) const; |
53 Mac48Address GetPeer (void) const; | 45 Mac48Address GetPeer (void) const; |
54 uint16_t GetBufferSize (void) const; | 46 uint16_t GetBufferSize (void) const; |
55 uint16_t GetTimeout (void) const; | 47 uint16_t GetTimeout (void) const; |
56 uint16_t GetStartingSequence (void) const; | 48 uint16_t GetStartingSequence (void) const; |
57 uint16_t GetStartingSequenceControl (void) const; | 49 uint16_t GetStartingSequenceControl (void) const; |
58 bool IsImmediateBlockAck (void) const; | 50 bool IsImmediateBlockAck (void) const; |
59 bool IsAmsduSupported (void) const; | 51 bool IsAmsduSupported (void) const; |
60 bool IsPending (void) const; | |
61 bool IsEstablished (void) const; | |
62 bool IsInactive (void) const; | |
63 bool IsUnsuccessful (void) const; | |
64 | 52 |
65 /** | 53 protected: |
66 * Notifies a packet's transmission with ack policy Block Ack. | 54 · |
67 */ | |
68 void NotifyMpduTransmission (void); | |
69 /** | |
70 * Returns true if all packets for which a block ack was negotiated have been transmitted so | |
71 * a block ack request is needed in order to acknowledge them. | |
72 */ | |
73 bool NeedBlockAckRequest (void) const; | |
74 void CompleteExchange (void); | |
75 | |
76 /* Two agreements are considered equals if have same tid and same peer */ | |
77 bool operator== (BlockAckAgreement const &agreement); | |
78 | |
79 private: | |
80 /* represents the state for this agreement. | |
faker.moatamri
2009/11/03 14:10:49
I think that doxygen style is
/**
*
**/
| |
81 * | |
82 * PENDING: | |
83 * If an agreement is in PENDING state it means that an ADDBARequest frame was sent to | |
84 * recipient in order to setup the block ack and the originator is waiting for the relative | |
85 * ADDBAResponse frame. | |
86 *·· | |
87 * ESTABLISHED: | |
88 * The block ack is active and all packets relative to this agreement are t rasmitted | |
89 * with ack policy set to block ack. | |
90 *·· | |
91 * INACTIVE: | |
92 * In our implementation, block ack tear-down happens only if an inactivity timeout occurs | |
93 * so we could have an active block ack but a number of packets that doesn' t reach the value of | |
94 * m_blockAckThreshold (see ns3::BlocAckManager). In these conditions the a greement becomes | |
95 * INACTIVE until that the number of packets reaches the value of m_blockAc kThreshold again. | |
96 * | |
97 * UNSUCCESSFUL (not used for now): | |
98 * The agremeent's state becomes UNSUCCESSFUL if: | |
99 *····· | |
100 * - its previous state was PENDING and an ADDBAResponse frame wasn't recei ved from | |
101 * recipient station within an interval of time defined by m_bAckSetupTim eout attribute | |
102 * in ns3::WifiMac. | |
103 * - an ADDBAResponse frame is received from recipient and the Status Code field is set | |
104 * to failure. | |
105 *···· | |
106 * In both cases for station addressed by m_peer and for TID m_tid block ac k mechanism won't be used. | |
107 */ | |
108 enum State { | |
109 PENDING, | |
110 ESTABLISHED, | |
111 INACTIVE, | |
112 UNSUCCESSFUL | |
113 }; | |
114 ·· | |
115 Mac48Address m_peer; | 55 Mac48Address m_peer; |
116 uint8_t m_amsduSupported; | 56 uint8_t m_amsduSupported; |
117 uint8_t m_blockAckPolicy; /* represents type of block ack: immediate or delaye d */ | 57 uint8_t m_blockAckPolicy; /* represents type of block ack: immediate or delaye d */ |
118 uint8_t m_tid; | 58 uint8_t m_tid; |
119 uint16_t m_bufferSize; | 59 uint16_t m_bufferSize; |
120 uint16_t m_timeout; | 60 uint16_t m_timeout; |
121 uint16_t m_startingSeq; | 61 uint16_t m_startingSeq; |
122 enum State m_state; | 62 ·· |
123 | |
124 uint8_t m_sentMpdus; | |
125 EventId m_inactivityEvent; | 63 EventId m_inactivityEvent; |
126 }; | 64 }; |
127 | |
128 bool operator< (BlockAckAgreement const &agreement1, BlockAckAgreement const &ag reement2); | |
129 | 65 |
130 } //namespace ns3 | 66 } //namespace ns3 |
131 | 67 |
132 #endif /* BLOCK_ACK_AGREEMENT_H */ | 68 #endif /* BLOCK_ACK_AGREEMENT_H */ |
LEFT | RIGHT |