A Discrete-Event Network Simulator
API
 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 
22 namespace ns3 {
23 
25  : m_amsduSupported (0),
26  m_blockAckPolicy (1),
27  m_inactivityEvent ()
28 {
29 }
30 
32  : m_amsduSupported (0),
33  m_blockAckPolicy (1),
34  m_inactivityEvent ()
35 {
36  m_tid = tid;
37  m_peer = peer;
38 }
39 
41 {
43 }
44 
45 void
46 BlockAckAgreement::SetBufferSize (uint16_t bufferSize)
47 {
48  NS_ASSERT (bufferSize <= 1024);
49  NS_ASSERT (bufferSize % 16 == 0);
50  m_bufferSize = bufferSize;
51 }
52 void
54 {
56 }
57 void
59 {
60  NS_ASSERT (seq < 4096);
61  m_startingSeq = seq;
62 }
63 void
65 {
66  m_blockAckPolicy = 1;
67 }
68 void
70 {
71  m_blockAckPolicy = 0;
72 }
73 void
75 {
76  m_amsduSupported = supported;
77 }
78 
79 uint8_t
81 {
82  return m_tid;
83 }
86 {
87  return m_peer;
88 }
89 uint16_t
91 {
92  return m_bufferSize;
93 }
94 uint16_t
96 {
97  return m_timeout;
98 }
99 uint16_t
101 {
102  return m_startingSeq;
103 }
104 uint16_t
106 {
107  uint16_t seqControl = (m_startingSeq << 4) | 0xfff0;
108  return seqControl;
109 }
110 bool
112 {
113  return (m_blockAckPolicy == 1);
114 }
115 bool
117 {
118  return (m_amsduSupported == 1) ? true : false;
119 }
120 
121 } // namespace ns3