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) 2010 Adrian Sai-wah Tam | 3 * Copyright (c) 2010 Adrian Sai-wah Tam |
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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com> | 18 * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com> |
19 */ | 19 */ |
20 | 20 |
21 #include "ns3/packet.h" | 21 #include "ns3/packet.h" |
22 #include "ns3/fatal-error.h" | 22 #include "ns3/fatal-error.h" |
23 #include "ns3/log.h" | 23 #include "ns3/log.h" |
24 #include "tcp-rx-buffer.h" | 24 #include "tcp-rx-buffer.h" |
25 | 25 |
26 NS_LOG_COMPONENT_DEFINE ("TcpRxBuffer"); | 26 NS_LOG_COMPONENT_DEFINE ("TcpRxBuffer"); |
27 | 27 |
28 namespace ns3 { | 28 namespace ns3 { |
| 29 |
| 30 TypeId |
| 31 TcpRxBuffer::GetTypeId (void) |
| 32 { |
| 33 static TypeId tid = TypeId ("ns3::TcpRxBuffer") |
| 34 .SetParent<Object> () |
| 35 .AddConstructor<TcpRxBuffer> () |
| 36 .AddTraceSource ("NextRxSequence", |
| 37 "Next sequence number expected (RCV.NXT)", |
| 38 MakeTraceSourceAccessor (&TcpRxBuffer::m_nextRxSeq)) |
| 39 ; |
| 40 return tid; |
| 41 } |
29 | 42 |
30 /* A user is supposed to create a TcpSocket through a factory. In TcpSocket, | 43 /* A user is supposed to create a TcpSocket through a factory. In TcpSocket, |
31 * there are attributes SndBufSize and RcvBufSize to control the default Tx and | 44 * there are attributes SndBufSize and RcvBufSize to control the default Tx and |
32 * Rx window sizes respectively, with default of 128 KiByte. The attribute | 45 * Rx window sizes respectively, with default of 128 KiByte. The attribute |
33 * RcvBufSize is passed to TcpRxBuffer by TcpSocketBase::SetRcvBufSize() and in | 46 * RcvBufSize is passed to TcpRxBuffer by TcpSocketBase::SetRcvBufSize() and in |
34 * turn, TcpRxBuffer:SetMaxBufferSize(). Therefore, the m_maxBuffer value | 47 * turn, TcpRxBuffer:SetMaxBufferSize(). Therefore, the m_maxBuffer value |
35 * initialized below is insignificant. | 48 * initialized below is insignificant. |
36 */ | 49 */ |
37 TcpRxBuffer::TcpRxBuffer (uint32_t n) | 50 TcpRxBuffer::TcpRxBuffer (uint32_t n) |
38 : m_nextRxSeq(n), m_gotFin(false), m_size(0), m_maxBuffer(32768), m_availBytes
(0) | 51 : m_nextRxSeq(n), m_gotFin(false), m_size(0), m_maxBuffer(32768), m_availBytes
(0) |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 { | 255 { |
243 NS_LOG_LOGIC ("Nothing extracted."); | 256 NS_LOG_LOGIC ("Nothing extracted."); |
244 return 0; | 257 return 0; |
245 } | 258 } |
246 NS_LOG_LOGIC ("Extracted " << outPkt->GetSize( ) << " bytes, bufsize=" << m_si
ze | 259 NS_LOG_LOGIC ("Extracted " << outPkt->GetSize( ) << " bytes, bufsize=" << m_si
ze |
247 << ", num pkts in buffer=" << m_data.size ()); | 260 << ", num pkts in buffer=" << m_data.size ()); |
248 return outPkt; | 261 return outPkt; |
249 } | 262 } |
250 | 263 |
251 } //namepsace ns3 | 264 } //namepsace ns3 |
LEFT | RIGHT |