OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2011 Adrian Sai-wah Tam |
| 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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com> |
| 19 * |
| 20 * Documentation, test cases: Truc Anh N. Nguyen <annguyen@ittc.ku.edu> |
| 21 * ResiliNets Research Group http://wiki.ittc.ku.ed
u/resilinets |
| 22 * The University of Kansas |
| 23 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director |
| 24 */ |
| 25 |
| 26 #ifndef TCP_OPTION_SACK_H |
| 27 #define TCP_OPTION_SACK_H |
| 28 |
| 29 #include "ns3/tcp-option.h" |
| 30 #include "ns3/sequence-number.h" |
| 31 |
| 32 namespace ns3 { |
| 33 |
| 34 /** |
| 35 * \brief Defines the TCP option of kind 5 (selective acknowledgment option) as
in \RFC{2018} |
| 36 * |
| 37 * TCP SACK Option is used by a receiver to report non-contiguous blocks of data
that have |
| 38 * been received and queued in the receiving buffer. Using the information conv
eyed in SACK option, |
| 39 * a sender retransmits only the segments that have actually been lost, allowing
the recovery of |
| 40 * multiple packet losses per sending window. |
| 41 * |
| 42 * Each SACK block is defined by two 32-bit unsigned integers specifying the lef
t and the right |
| 43 * edge of the block. It means that with the 40-byte TCP option limitation in a
ddition to the |
| 44 * presence of TCP Timestamp Option, the maximum number of SACK blocks that can
be appended |
| 45 * to each segment is 3. |
| 46 */ |
| 47 |
| 48 typedef std::pair<SequenceNumber32, SequenceNumber32> SackBlock; |
| 49 typedef std::list<SackBlock> SackList; |
| 50 |
| 51 class TcpOptionSack : public TcpOption |
| 52 { |
| 53 public: |
| 54 /** |
| 55 * \brief Get the type ID. |
| 56 * \return the object TypeId |
| 57 */ |
| 58 static TypeId GetTypeId (void); |
| 59 virtual TypeId GetInstanceTypeId (void) const; |
| 60 |
| 61 TcpOptionSack (); |
| 62 virtual ~TcpOptionSack (); |
| 63 |
| 64 virtual void Print (std::ostream &os) const; |
| 65 virtual void Serialize (Buffer::Iterator start) const; |
| 66 virtual uint32_t Deserialize (Buffer::Iterator start); |
| 67 |
| 68 virtual uint8_t GetKind (void) const; |
| 69 virtual uint32_t GetSerializedSize (void) const; |
| 70 |
| 71 /** |
| 72 * \brief Add a SACK block |
| 73 * \param s the SACK block to be added |
| 74 */ |
| 75 void AddSackBlock (SackBlock s); |
| 76 |
| 77 /** |
| 78 * \brief Count the total number of SACK blocks |
| 79 * \return the total number of SACK blocks |
| 80 */ |
| 81 uint32_t GetNumSackBlocks (void) const; |
| 82 |
| 83 /** |
| 84 * \brief Clear the SACK list |
| 85 */ |
| 86 void ClearSackList (void); |
| 87 |
| 88 /** |
| 89 * \brief Get the SACK list |
| 90 * \return the SACK list |
| 91 */ |
| 92 SackList GetSackList (void) const; |
| 93 |
| 94 protected: |
| 95 SackList m_sackList; //!< the list of SACK blocks |
| 96 }; |
| 97 |
| 98 } // namespace ns3 |
| 99 |
| 100 #endif /* TCP_OPTION_SACK */ |
OLD | NEW |