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 #ifndef TCPOPTIONRFC793_H 21 #define TCPOPTIONRFC793_H 22 23 #include "ns3/tcp-option.h" 24 25 namespace ns3 { 26 27 /** 28 * \ingroup tcp 29 * 30 * Defines the TCP option of kind 0 (end of option list) as in \RFC{793} 31 */ 32 class TcpOptionEnd : public TcpOption 33 { 34 public: 35 TcpOptionEnd (); 36 virtual ~TcpOptionEnd (); 37 38 /** 39 * \brief Get the type ID. 40 * \return the object TypeId 41 */ 42 static TypeId GetTypeId (void); 43 virtual TypeId GetInstanceTypeId (void) const; 44 45 virtual void Print (std::ostream &os) const; 46 virtual void Serialize (Buffer::Iterator start) const; 47 virtual uint32_t Deserialize (Buffer::Iterator start); 48 49 virtual uint8_t GetKind (void) const; 50 virtual uint32_t GetSerializedSize (void) const; 51 52 }; 53 54 /** 55 * Defines the TCP option of kind 1 (no operation) as in \RFC{793} 56 */ 57 class TcpOptionNOP : public TcpOption 58 { 59 public: 60 TcpOptionNOP (); 61 virtual ~TcpOptionNOP (); 62 63 /** 64 * \brief Get the type ID. 65 * \return the object TypeId 66 */ 67 static TypeId GetTypeId (void); 68 virtual TypeId GetInstanceTypeId (void) const; 69 70 virtual void Print (std::ostream &os) const; 71 virtual void Serialize (Buffer::Iterator start) const; 72 virtual uint32_t Deserialize (Buffer::Iterator start); 73 74 virtual uint8_t GetKind (void) const; 75 virtual uint32_t GetSerializedSize (void) const; 76 }; 77 78 /** 79 * Defines the TCP option of kind 2 (maximum segment size) as in \RFC{793} 80 */ 81 class TcpOptionMSS : public TcpOption 82 { 83 public: 84 TcpOptionMSS (); 85 virtual ~TcpOptionMSS (); 86 87 /** 88 * \brief Get the type ID. 89 * \return the object TypeId 90 */ 91 static TypeId GetTypeId (void); 92 virtual TypeId GetInstanceTypeId (void) const; 93 94 virtual void Print (std::ostream &os) const; 95 virtual void Serialize (Buffer::Iterator start) const; 96 virtual uint32_t Deserialize (Buffer::Iterator start); 97 98 virtual uint8_t GetKind (void) const; 99 virtual uint32_t GetSerializedSize (void) const; 100 101 /** 102 * \brief Get the Maximum Segment Size stored in the Option 103 * \return The Maximum Segment Size 104 */ 105 uint16_t GetMSS (void) const; 106 /** 107 * \brief Set the Maximum Segment Size stored in the Option 108 * \param mss The Maximum Segment Size 109 */ 110 void SetMSS (uint16_t mss); 111 112 protected: 113 uint16_t m_mss; //!< maximum segment size 114 }; 115 116 } // namespace ns3 117 118 #endif // TCPOPTIONRFC793_H 119