src/internet/model/tcp-socket-base.h
author Tom Henderson <tomh@tomh.org>
Mon, 04 May 2015 22:39:00 -0700
changeset 11362 917793d13817
parent 11359 c2269e7c4f42
child 11508 e50a1cb4d7db
permissions -rw-r--r--
bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7176
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     2
/*
7608
de67936e4017 Mixed bugfixes on TCP, closes bug 1166, 1227, 1242.
Adrian S Tam <adrian.sw.tam@gmail.com>
parents: 7385
diff changeset
     3
 * Copyright (c) 2007 Georgia Tech Research Corporation
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     4
 * Copyright (c) 2010 Adrian Sai-wah Tam
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     5
 *
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     8
 * published by the Free Software Foundation;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     9
 *
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    13
 * GNU General Public License for more details.
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    14
 *
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    18
 *
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    19
 * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    20
 */
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    21
#ifndef TCP_SOCKET_BASE_H
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    22
#define TCP_SOCKET_BASE_H
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    23
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    24
#include <stdint.h>
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    25
#include <queue>
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    26
#include "ns3/callback.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    27
#include "ns3/traced-value.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    28
#include "ns3/tcp-socket.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    29
#include "ns3/ptr.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    30
#include "ns3/ipv4-address.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    31
#include "ns3/ipv4-header.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    32
#include "ns3/ipv4-interface.h"
9145
5752b425cdf5 Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 9095
diff changeset
    33
#include "ns3/ipv6-header.h"
10528
c1e835b43726 Bug 1796 - Ipv6PacketInfoTag is not filled by UdpSocketImpl::ForwardUp6.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10440
diff changeset
    34
#include "ns3/ipv6-interface.h"
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    35
#include "ns3/event-id.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    36
#include "tcp-tx-buffer.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    37
#include "tcp-rx-buffer.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    38
#include "rtt-estimator.h"
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    39
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    40
namespace ns3 {
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    41
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    42
class Ipv4EndPoint;
7717
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7619
diff changeset
    43
class Ipv6EndPoint;
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    44
class Node;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    45
class Packet;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    46
class TcpL4Protocol;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    47
class TcpHeader;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    48
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    49
/**
11190
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    50
 * \ingroup tcp
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    51
 *
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    52
 * \brief Helper class to store RTT measurements
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    53
 */
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    54
class RttHistory {
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    55
public:
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    56
  /**
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    57
   * \brief Constructor - builds an RttHistory with the given parameters
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    58
   * \param s First sequence number in packet sent
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    59
   * \param c Number of bytes sent
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    60
   * \param t Time this one was sent
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    61
   */
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    62
  RttHistory (SequenceNumber32 s, uint32_t c, Time t);
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    63
  /**
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    64
   * \brief Copy constructor
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    65
   * \param h the object to copy
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    66
   */
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    67
  RttHistory (const RttHistory& h); // Copy constructor
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    68
public:
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    69
  SequenceNumber32  seq;  //!< First sequence number in packet sent
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    70
  uint32_t        count;  //!< Number of bytes sent
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    71
  Time            time;   //!< Time this one was sent
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    72
  bool            retx;   //!< True if this has been retransmitted
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    73
};
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    74
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    75
/// Container for RttHistory objects
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    76
typedef std::deque<RttHistory> RttHistory_t;
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    77
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
    78
/**
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    79
 * \ingroup socket
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    80
 * \ingroup tcp
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    81
 *
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    82
 * \brief A base class for implementation of a stream socket using TCP.
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    83
 *
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    84
 * This class contains the essential components of TCP, as well as a sockets
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    85
 * interface for upper layers to call. This serves as a base for other TCP
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    86
 * functions where the sliding window mechanism is handled here. This class
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    87
 * provides connection orientation and sliding window flow control. Part of
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    88
 * this class is modified from the original NS-3 TCP socket implementation
7608
de67936e4017 Mixed bugfixes on TCP, closes bug 1166, 1227, 1242.
Adrian S Tam <adrian.sw.tam@gmail.com>
parents: 7385
diff changeset
    89
 * (TcpSocketImpl) by Raj Bhattacharjea <raj.b@gatech.edu> of Georgia Tech.
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    90
 */
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    91
class TcpSocketBase : public TcpSocket
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    92
{
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    93
public:
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
    94
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
    95
   * Get the type ID.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
    96
   * \brief Get the type ID.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
    97
   * \return the object TypeId
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
    98
   */
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    99
  static TypeId GetTypeId (void);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   100
  /**
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   101
   * Create an unbound TCP socket
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   102
   */
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   103
  TcpSocketBase (void);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   104
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   105
  /**
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   106
   * Clone a TCP socket, for use upon receiving a connection request in LISTEN state
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   107
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   108
   * \param sock the original Tcp Socket
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   109
   */
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   110
  TcpSocketBase (const TcpSocketBase& sock);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   111
  virtual ~TcpSocketBase (void);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   112
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   113
  // Set associated Node, TcpL4Protocol, RttEstimator to this socket
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   114
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   115
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   116
   * \brief Set the associated node.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   117
   * \param node the node
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   118
   */
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   119
  virtual void SetNode (Ptr<Node> node);
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   120
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   121
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   122
   * \brief Set the associated TCP L4 protocol.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   123
   * \param tcp the TCP L4 protocol
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   124
   */
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   125
  virtual void SetTcp (Ptr<TcpL4Protocol> tcp);
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   126
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   127
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   128
   * \brief Set the associated RTT estimator.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   129
   * \param rtt the RTT estimator
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   130
   */
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   131
  virtual void SetRtt (Ptr<RttEstimator> rtt);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   132
11190
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   133
  /**
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   134
   * \brief Sets the Minimum RTO.
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   135
   * \param minRto The minimum RTO.
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   136
   */
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   137
  void SetMinRto (Time minRto);
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   138
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   139
  /**
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   140
   * \brief Get the Minimum RTO.
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   141
   * \return The minimum RTO.
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   142
   */
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   143
  Time GetMinRto (void) const;
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   144
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   145
  /**
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   146
   * \brief Sets the Clock Granularity (used in RTO calcs).
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   147
   * \param clockGranularity The Clock Granularity
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   148
   */
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   149
  void SetClockGranularity (Time clockGranularity);
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   150
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   151
  /**
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   152
   * \brief Get the Clock Granularity (used in RTO calcs).
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   153
   * \return The Clock Granularity.
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   154
   */
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   155
  Time GetClockGranularity (void) const;
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   156
11195
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   157
  /**
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   158
   * \brief Get a pointer to the Tx buffer
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   159
   * \return a pointer to the tx buffer
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   160
   */
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   161
  Ptr<TcpTxBuffer> GetTxBuffer (void) const;
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   162
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   163
  /**
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   164
   * \brief Get a pointer to the Rx buffer
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   165
   * \return a pointer to the rx buffer
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   166
   */
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   167
  Ptr<TcpRxBuffer> GetRxBuffer (void) const;
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   168
11190
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   169
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   170
  // Necessary implementations of null functions from ns3::Socket
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   171
  virtual enum SocketErrno GetErrno (void) const;    // returns m_errno
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   172
  virtual enum SocketType GetSocketType (void) const; // returns socket type
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   173
  virtual Ptr<Node> GetNode (void) const;            // returns m_node
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   174
  virtual int Bind (void);    // Bind a socket by setting up endpoint in TcpL4Protocol
7717
cfa1741013dd Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents: 7619
diff changeset
   175
  virtual int Bind6 (void);    // Bind a socket by setting up endpoint in TcpL4Protocol
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   176
  virtual int Bind (const Address &address);         // ... endpoint of specific addr or port
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   177
  virtual int Connect (const Address &address);      // Setup endpoint and call ProcessAction() to connect
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   178
  virtual int Listen (void);  // Verify the socket is in a correct state and call ProcessAction() to listen
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   179
  virtual int Close (void);   // Close by app: Kill socket upon tx buffer emptied
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   180
  virtual int ShutdownSend (void);    // Assert the m_shutdownSend flag to prevent send to network
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   181
  virtual int ShutdownRecv (void);    // Assert the m_shutdownRecv flag to prevent forward to app
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   182
  virtual int Send (Ptr<Packet> p, uint32_t flags);  // Call by app to send data to network
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   183
  virtual int SendTo (Ptr<Packet> p, uint32_t flags, const Address &toAddress); // Same as Send(), toAddress is insignificant
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   184
  virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags); // Return a packet to be forwarded to app
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   185
  virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress); // ... and write the remote address at fromAddress
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   186
  virtual uint32_t GetTxAvailable (void) const; // Available Tx buffer size
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   187
  virtual uint32_t GetRxAvailable (void) const; // Available-to-read data size, i.e. value of m_rxAvailable
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   188
  virtual int GetSockName (Address &address) const; // Return local addr:port in address
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   189
  virtual void BindToNetDevice (Ptr<NetDevice> netdevice); // NetDevice with my m_endPoint
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   190
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   191
protected:
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   192
  // Implementing ns3::TcpSocket -- Attribute get/set
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   193
  // inherited, no need to doc
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   194
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   195
  virtual void     SetSndBufSize (uint32_t size);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   196
  virtual uint32_t GetSndBufSize (void) const;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   197
  virtual void     SetRcvBufSize (uint32_t size);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   198
  virtual uint32_t GetRcvBufSize (void) const;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   199
  virtual void     SetSegSize (uint32_t size);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   200
  virtual uint32_t GetSegSize (void) const;
10855
7ef081ddfc7f Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10791
diff changeset
   201
  virtual void     SetInitialSSThresh (uint32_t threshold) = 0;
7ef081ddfc7f Bug 1831 - TcpSocket SlowStartThreshold is not a TraceSource
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10791
diff changeset
   202
  virtual uint32_t GetInitialSSThresh (void) const = 0;
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   203
  virtual void     SetInitialCwnd (uint32_t cwnd) = 0;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   204
  virtual uint32_t GetInitialCwnd (void) const = 0;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   205
  virtual void     SetConnTimeout (Time timeout);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   206
  virtual Time     GetConnTimeout (void) const;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   207
  virtual void     SetConnCount (uint32_t count);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   208
  virtual uint32_t GetConnCount (void) const;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   209
  virtual void     SetDelAckTimeout (Time timeout);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   210
  virtual Time     GetDelAckTimeout (void) const;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   211
  virtual void     SetDelAckMaxCount (uint32_t count);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   212
  virtual uint32_t GetDelAckMaxCount (void) const;
7619
b4dee6307aa7 Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents: 7608
diff changeset
   213
  virtual void     SetTcpNoDelay (bool noDelay);
b4dee6307aa7 Nagle's algorithm in TCP (closes bug 1039)
Adrian S Tam <adrian.sw.tam@gmail.com>
parents: 7608
diff changeset
   214
  virtual bool     GetTcpNoDelay (void) const;
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   215
  virtual void     SetPersistTimeout (Time timeout);
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   216
  virtual Time     GetPersistTimeout (void) const;
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   217
  virtual bool     SetAllowBroadcast (bool allowBroadcast);
7608
de67936e4017 Mixed bugfixes on TCP, closes bug 1166, 1227, 1242.
Adrian S Tam <adrian.sw.tam@gmail.com>
parents: 7385
diff changeset
   218
  virtual bool     GetAllowBroadcast (void) const;
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   219
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   220
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   221
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   222
  // Helper functions: Connection set up
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   223
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   224
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   225
   * \brief Common part of the two Bind(), i.e. set callback and remembering local addr:port
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   226
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   227
   * \returns 0 on success, -1 on failure
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   228
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   229
  int SetupCallback (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   230
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   231
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   232
   * \brief Perform the real connection tasks: Send SYN if allowed, RST if invalid
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   233
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   234
   * \returns 0 on success
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   235
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   236
  int DoConnect (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   237
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   238
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   239
   * \brief Schedule-friendly wrapper for Socket::NotifyConnectionSucceeded()
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   240
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   241
  void ConnectionSucceeded (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   242
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   243
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   244
   * \brief Configure the endpoint to a local address. Called by Connect() if Bind() didn't specify one.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   245
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   246
   * \returns 0 on success
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   247
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   248
  int SetupEndpoint (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   249
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   250
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   251
   * \brief Configure the endpoint v6 to a local address. Called by Connect() if Bind() didn't specify one.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   252
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   253
   * \returns 0 on success
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   254
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   255
  int SetupEndpoint6 (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   256
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   257
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   258
   * \brief Complete a connection by forking the socket
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   259
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   260
   * This function is called only if a SYN received in LISTEN state. After
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   261
   * TcpSocketBase cloned, allocate a new end point to handle the incoming
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   262
   * connection and send a SYN+ACK to complete the handshake.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   263
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   264
   * \param p the packet triggering the fork
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   265
   * \param tcpHeader the TCP header of the triggering packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   266
   * \param fromAddress the address of the remote host
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   267
   * \param toAddress the address the connection is directed to
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   268
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   269
  void CompleteFork (Ptr<Packet> p, const TcpHeader& tcpHeader, const Address& fromAddress, const Address& toAddress);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   270
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   271
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   272
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   273
  // Helper functions: Transfer operation
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   274
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   275
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   276
   * \brief Called by the L3 protocol when it received a packet to pass on to TCP.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   277
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   278
   * \param packet the incoming packet
10440
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10405
diff changeset
   279
   * \param header the packet's IPv4 header
10791
9b29bb9d495b Clarify doxygen for [Tcp,Udp]Socket ForwardUp functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10575
diff changeset
   280
   * \param port the remote port
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   281
   * \param incomingInterface the incoming interface
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   282
   */
7608
de67936e4017 Mixed bugfixes on TCP, closes bug 1166, 1227, 1242.
Adrian S Tam <adrian.sw.tam@gmail.com>
parents: 7385
diff changeset
   283
  void ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface);
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   284
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   285
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   286
   * \brief Called by the L3 protocol when it received a packet to pass on to TCP.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   287
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   288
   * \param packet the incoming packet
10440
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10405
diff changeset
   289
   * \param header the packet's IPv6 header
10791
9b29bb9d495b Clarify doxygen for [Tcp,Udp]Socket ForwardUp functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10575
diff changeset
   290
   * \param port the remote port
10528
c1e835b43726 Bug 1796 - Ipv6PacketInfoTag is not filled by UdpSocketImpl::ForwardUp6.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10440
diff changeset
   291
   * \param incomingInterface the incoming interface
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   292
   */
10528
c1e835b43726 Bug 1796 - Ipv6PacketInfoTag is not filled by UdpSocketImpl::ForwardUp6.
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10440
diff changeset
   293
  void ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface);
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   294
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   295
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   296
   * \brief Called by TcpSocketBase::ForwardUp().
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   297
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   298
   * \param packet the incoming packet
10440
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10405
diff changeset
   299
   * \param header the packet's IPv4 header
10791
9b29bb9d495b Clarify doxygen for [Tcp,Udp]Socket ForwardUp functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10575
diff changeset
   300
   * \param port the remote port
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   301
   * \param incomingInterface the incoming interface
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   302
   */
7608
de67936e4017 Mixed bugfixes on TCP, closes bug 1166, 1227, 1242.
Adrian S Tam <adrian.sw.tam@gmail.com>
parents: 7385
diff changeset
   303
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface); //Get a pkt from L3
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   304
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   305
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   306
   * \brief Called by TcpSocketBase::ForwardUp6().
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   307
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   308
   * \param packet the incoming packet
10440
1e48ff9185f1 Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10405
diff changeset
   309
   * \param header the packet's IPv6 header
10791
9b29bb9d495b Clarify doxygen for [Tcp,Udp]Socket ForwardUp functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10575
diff changeset
   310
   * \param port the remote port
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   311
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   312
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv6Header header, uint16_t port);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   313
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   314
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   315
   * \brief Called by the L3 protocol when it received an ICMP packet to pass on to TCP.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   316
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   317
   * \param icmpSource the ICMP source address
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   318
   * \param icmpTtl the ICMP Time to Live
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   319
   * \param icmpType the ICMP Type
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   320
   * \param icmpCode the ICMP Code
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   321
   * \param icmpInfo the ICMP Info
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   322
   */
9095
8462a1160246 bug 1359 TCP cannot receive ICMP
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7747
diff changeset
   323
  void ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo);
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   324
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   325
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   326
   * \brief Called by the L3 protocol when it received an ICMPv6 packet to pass on to TCP.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   327
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   328
   * \param icmpSource the ICMP source address
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   329
   * \param icmpTtl the ICMP Time to Live
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   330
   * \param icmpType the ICMP Type
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   331
   * \param icmpCode the ICMP Code
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   332
   * \param icmpInfo the ICMP Info
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   333
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   334
  void ForwardIcmp6 (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   335
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   336
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   337
   * \brief Send as much pending data as possible according to the Tx window.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   338
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   339
   * Note that this function did not implement the PSH flag.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   340
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   341
   * \param withAck forces an ACK to be sent
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   342
   * \returns true if some data have been sent
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   343
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   344
  bool SendPendingData (bool withAck = false);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   345
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   346
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   347
   * \brief Extract at most maxSize bytes from the TxBuffer at sequence seq, add the
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   348
   *        TCP header, and send to TcpL4Protocol
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   349
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   350
   * \param seq the sequence number
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   351
   * \param maxSize the maximum data block to be transmitted (in bytes)
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   352
   * \param withAck forces an ACK to be sent
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   353
   * \returns the number of bytes sent
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   354
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   355
  uint32_t SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   356
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   357
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   358
   * \brief Send a empty packet that carries a flag, e.g. ACK
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   359
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   360
   * \param flags the packet's flags
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   361
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   362
  void SendEmptyPacket (uint8_t flags);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   363
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   364
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   365
   * \brief Send reset and tear down this socket
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   366
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   367
  void SendRST (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   368
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   369
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   370
   * \brief Check if a sequence number range is within the rx window
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   371
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   372
   * \param head start of the Sequence window
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   373
   * \param tail end of the Sequence window
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   374
   * \returns true if it is in range
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   375
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   376
  bool OutOfRange (SequenceNumber32 head, SequenceNumber32 tail) const;
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   377
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   378
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   379
  // Helper functions: Connection close
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   380
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   381
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   382
   * \brief Close a socket by sending RST, FIN, or FIN+ACK, depend on the current state
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   383
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   384
   * \returns 0 on success
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   385
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   386
  int DoClose (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   387
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   388
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   389
   * \brief Peacefully close the socket by notifying the upper layer and deallocate end point
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   390
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   391
  void CloseAndNotify (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   392
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   393
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   394
   * \brief Kill this socket by zeroing its attributes (IPv4)
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   395
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   396
   * This is a callback function configured to m_endpoint in
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   397
   * SetupCallback(), invoked when the endpoint is destroyed.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   398
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   399
  void Destroy (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   400
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   401
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   402
   * \brief Kill this socket by zeroing its attributes (IPv6)
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   403
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   404
   * This is a callback function configured to m_endpoint in
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   405
   * SetupCallback(), invoked when the endpoint is destroyed.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   406
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   407
  void Destroy6 (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   408
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   409
  /**
10575
16f8ac386faf Bug 1739 - The endpoint is not deallocated for UDP sockets
Juan C. Granda <jcgranda@uniovi.es>
parents: 10528
diff changeset
   410
   * \brief Deallocate m_endPoint and m_endPoint6
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   411
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   412
  void DeallocateEndPoint (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   413
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   414
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   415
   * \brief Received a FIN from peer, notify rx buffer
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   416
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   417
   * \param p the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   418
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   419
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   420
  void PeerClose (Ptr<Packet> p, const TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   421
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   422
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   423
   * \brief FIN is in sequence, notify app and respond with a FIN
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   424
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   425
  void DoPeerClose (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   426
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   427
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   428
   * \brief Cancel all timer when endpoint is deleted
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   429
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   430
  void CancelAllTimers (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   431
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   432
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   433
   * \brief Move from CLOSING or FIN_WAIT_2 to TIME_WAIT state
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   434
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   435
  void TimeWait (void);
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   436
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   437
  // State transition functions
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   438
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   439
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   440
   * \brief Received a packet upon ESTABLISHED state.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   441
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   442
   * This function is mimicking the role of tcp_rcv_established() in tcp_input.c in Linux kernel.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   443
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   444
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   445
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   446
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   447
  void ProcessEstablished (Ptr<Packet> packet, const TcpHeader& tcpHeader); // Received a packet upon ESTABLISHED state
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   448
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   449
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   450
   * \brief Received a packet upon LISTEN state.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   451
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   452
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   453
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   454
   * \param fromAddress the source address
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   455
   * \param toAddress the destination address
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   456
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   457
  void ProcessListen (Ptr<Packet> packet, const TcpHeader& tcpHeader,
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   458
                      const Address& fromAddress, const Address& toAddress);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   459
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   460
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   461
   * \brief Received a packet upon SYN_SENT
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   462
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   463
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   464
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   465
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   466
  void ProcessSynSent (Ptr<Packet> packet, const TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   467
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   468
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   469
   * \brief Received a packet upon SYN_RCVD.
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   470
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   471
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   472
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   473
   * \param fromAddress the source address
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   474
   * \param toAddress the destination address
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   475
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   476
  void ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   477
                       const Address& fromAddress, const Address& toAddress);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   478
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   479
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   480
   * \brief Received a packet upon CLOSE_WAIT, FIN_WAIT_1, FIN_WAIT_2
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   481
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   482
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   483
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   484
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   485
  void ProcessWait (Ptr<Packet> packet, const TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   486
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   487
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   488
   * \brief Received a packet upon CLOSING
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   489
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   490
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   491
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   492
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   493
  void ProcessClosing (Ptr<Packet> packet, const TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   494
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   495
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   496
   * \brief Received a packet upon LAST_ACK
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   497
   *
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   498
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   499
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   500
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   501
  void ProcessLastAck (Ptr<Packet> packet, const TcpHeader& tcpHeader);
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   502
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   503
  // Window management
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   504
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   505
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   506
   * \brief Return count of number of unacked bytes
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   507
   * \returns count of number of unacked bytes
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   508
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   509
  virtual uint32_t UnAckDataCount (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   510
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   511
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   512
   * \brief Return total bytes in flight
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   513
   * \returns total bytes in flight
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   514
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   515
  virtual uint32_t BytesInFlight (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   516
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   517
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   518
   * \brief Return the max possible number of unacked bytes
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   519
   * \returns the max possible number of unacked bytes
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   520
   */
11359
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   521
  virtual uint32_t Window (void) = 0;
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   522
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   523
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   524
   * \brief Return unfilled portion of window
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   525
   * \return unfilled portion of window
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   526
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   527
  virtual uint32_t AvailableWindow (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   528
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   529
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   530
   * \brief The amount of Rx window announced to the peer
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   531
   * \returns size of Rx window announced to the peer
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   532
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   533
  virtual uint16_t AdvertisedWindowSize (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   534
11362
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   535
  /**
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   536
   * \brief Update the receiver window (RWND) based on the value of the 
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   537
   * window field in the header.
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   538
   *
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   539
   * This method suppresses updates unless one of the following three 
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   540
   * conditions holds:  1) segment contains new data (advancing the right
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   541
   * edge of the receive buffer), 2) segment does not contain new data
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   542
   * but the segment acks new data (highest sequence number acked advances),
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   543
   * or 3) the advertised window is larger than the current send window
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   544
   *
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   545
   * \param header TcpHeader from which to extract the new window value
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   546
   */
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   547
  void UpdateWindowSize (const TcpHeader& header);
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   548
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   549
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   550
  // Manage data tx/rx
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   551
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   552
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   553
   * \brief Call CopyObject<> to clone me
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   554
   * \returns a copy of the socket
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   555
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   556
  virtual Ptr<TcpSocketBase> Fork (void) = 0;
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   557
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   558
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   559
   * \brief Received an ACK packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   560
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   561
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   562
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   563
  virtual void ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   564
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   565
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   566
   * \brief Recv of a data, put into buffer, call L7 to get it if necessary
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   567
   * \param packet the packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   568
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   569
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   570
  virtual void ReceivedData (Ptr<Packet> packet, const TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   571
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   572
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   573
   * \brief Take into account the packet for RTT estimation
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   574
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   575
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   576
  virtual void EstimateRtt (const TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   577
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   578
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   579
   * \brief Update buffers w.r.t. ACK
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   580
   * \param seq the sequence number
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   581
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   582
  virtual void NewAck (SequenceNumber32 const& seq);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   583
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   584
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   585
   * \brief Received dupack (duplicate ACK)
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   586
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   587
   * \param count counter of duplicate ACKs
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   588
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   589
  virtual void DupAck (const TcpHeader& tcpHeader, uint32_t count) = 0;
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   590
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   591
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   592
   * \brief Call Retransmit() upon RTO event
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   593
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   594
  virtual void ReTxTimeout (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   595
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   596
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   597
   * \brief Halving cwnd and call DoRetransmit()
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   598
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   599
  virtual void Retransmit (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   600
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   601
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   602
   * \brief Action upon delay ACK timeout, i.e. send an ACK
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   603
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   604
  virtual void DelAckTimeout (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   605
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   606
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   607
   * \brief Timeout at LAST_ACK, close the connection
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   608
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   609
  virtual void LastAckTimeout (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   610
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   611
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   612
   * \brief Send 1 byte probe to get an updated window size
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   613
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   614
  virtual void PersistTimeout (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   615
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   616
  /**
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   617
   * \brief Retransmit the oldest packet
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   618
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   619
  virtual void DoRetransmit (void);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   620
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   621
  /**
10885
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   622
   * \brief Read TCP options from incoming packets
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   623
   *  
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   624
   * This method sequentially checks each kind of option, and if it
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   625
   * is present in the header, starts its processing.
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   626
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   627
   * To deal with hosts which don't have the option enabled (or
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   628
   * implemented) we disable all options, and then re-enable them
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   629
   * if in the packet there is the option itself.
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   630
   *
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   631
   * \param tcpHeader the packet's TCP header
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   632
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   633
  virtual void ReadOptions (const TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   634
10885
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   635
  /** \brief Add options to TcpHeader
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   636
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   637
   * Test each option, and if it is enabled on our side, add it
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   638
   * to the header
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   639
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   640
   * \param tcpHeader TcpHeader to add options to
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   641
   */
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   642
  virtual void AddOptions (TcpHeader& tcpHeader);
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   643
10885
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   644
  /**
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   645
   * \brief Read and parse the Window scale option
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   646
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   647
   * Read the window scale option (encoded logarithmically) and save it.
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   648
   * Per RFC 1323, the value can't exceed 14.
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   649
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   650
   * \param option Window scale option read from the header
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   651
   */
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   652
  void ProcessOptionWScale (const Ptr<const TcpOption> option);
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   653
  /**
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   654
   * \brief Add the window scale option to the header
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   655
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   656
   * Calculate our factor from the rxBuffer max size, and add it
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   657
   * to the header.
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   658
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   659
   * \param header TcpHeader where the method should add the window scale option
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   660
   */
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   661
  void AddOptionWScale (TcpHeader& header);
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   662
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   663
  /**
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   664
   * \brief Calculate window scale value based on receive buffer space
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   665
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   666
   * Calculate our factor from the rxBuffer max size
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   667
   *
10986
4d7338f5952d [Doxygen] internet module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10885
diff changeset
   668
   * \returns the Window Scale factor
10885
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   669
   */
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   670
  uint8_t CalculateWScale () const;
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   671
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   672
  /** \brief Process the timestamp option from other side
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   673
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   674
   * Get the timestamp and the echo, then save timestamp (which will
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   675
   * be the echo value in our out-packets) and save the echoed timestamp,
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   676
   * to utilize later to calculate RTT.
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   677
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   678
   * \see EstimateRtt
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   679
   * \param option Option from the packet
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   680
   */
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   681
  void ProcessOptionTimestamp (const Ptr<const TcpOption> option);
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   682
  /**
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   683
   * \brief Add the timestamp option to the header
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   684
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   685
   * Set the timestamp as the lower bits of the Simulator::Now time,
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   686
   * and the echo value as the last seen timestamp from the other part.
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   687
   *
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   688
   * \param header TcpHeader to which add the option to
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   689
   */
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   690
  void AddOptionTimestamp (TcpHeader& header);
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   691
11359
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   692
  /**
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   693
   * \brief Scale the initial SsThresh value to the correct one
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   694
   *
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   695
   * Set the initial SsThresh to the largest possible advertised window
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   696
   * according to the sender scale factor.
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   697
   *
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   698
   * \param scaleFactor the sender scale factor
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   699
   */
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   700
  virtual void ScaleSsThresh (uint8_t scaleFactor) = 0;
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   701
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   702
protected:
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   703
  // Counters and events
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   704
  EventId           m_retxEvent;       //!< Retransmission event
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   705
  EventId           m_lastAckEvent;    //!< Last ACK timeout event
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   706
  EventId           m_delAckEvent;     //!< Delayed ACK timeout event
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   707
  EventId           m_persistEvent;    //!< Persist event: Send 1 byte to probe for a non-zero Rx window
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   708
  EventId           m_timewaitEvent;   //!< TIME_WAIT expiration event: Move this socket to CLOSED state
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   709
  uint32_t          m_dupAckCount;     //!< Dupack counter
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   710
  uint32_t          m_delAckCount;     //!< Delayed ACK counter
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   711
  uint32_t          m_delAckMaxCount;  //!< Number of packet to fire an ACK before delay timeout
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   712
  bool              m_noDelay;         //!< Set to true to disable Nagle's algorithm
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   713
  uint32_t          m_cnCount;         //!< Count of remaining connection retries
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   714
  uint32_t          m_cnRetries;       //!< Number of connection retries before giving up
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   715
  TracedValue<Time> m_rto;             //!< Retransmit timeout
11190
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   716
  Time              m_minRto;          //!< minimum value of the Retransmit timeout
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   717
  Time              m_clockGranularity; //!< Clock Granularity used in RTO calcs
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   718
  TracedValue<Time> m_lastRtt;         //!< Last RTT sample collected
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   719
  Time              m_delAckTimeout;   //!< Time to delay an ACK
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   720
  Time              m_persistTimeout;  //!< Time between sending 1-byte probes
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   721
  Time              m_cnTimeout;       //!< Timeout for connection retry
11190
f0458968b67d Bug 1405 - RttEstimator improvements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10986
diff changeset
   722
  RttHistory_t      m_history;         //!< List of sent packet
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   723
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   724
  // Connections to other layers of TCP/IP
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   725
  Ipv4EndPoint*       m_endPoint;   //!< the IPv4 endpoint
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   726
  Ipv6EndPoint*       m_endPoint6;  //!< the IPv6 endpoint
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   727
  Ptr<Node>           m_node;       //!< the associated node
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   728
  Ptr<TcpL4Protocol>  m_tcp;        //!< the associated TCP L4 protocol
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   729
  Callback<void, Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t> m_icmpCallback;  //!< ICMP callback
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   730
  Callback<void, Ipv6Address,uint8_t,uint8_t,uint8_t,uint32_t> m_icmpCallback6; //!< ICMPv6 callback
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   731
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   732
  Ptr<RttEstimator> m_rtt; //!< Round trip time estimator
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   733
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   734
  // Rx and Tx buffer management
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   735
  TracedValue<SequenceNumber32> m_nextTxSequence; //!< Next seqnum to be sent (SND.NXT), ReTx pushes it back
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   736
  TracedValue<SequenceNumber32> m_highTxMark;     //!< Highest seqno ever sent, regardless of ReTx
11195
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   737
  Ptr<TcpRxBuffer>              m_rxBuffer;       //!< Rx buffer (reordering buffer)
0c5e9bfa1b48 Bug 2055 - TxBuffer and RxBuffer traces don't work
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11190
diff changeset
   738
  Ptr<TcpTxBuffer>              m_txBuffer;       //!< Tx buffer
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   739
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   740
  // State-related attributes
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   741
  TracedValue<TcpStates_t> m_state;         //!< TCP state
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   742
  enum SocketErrno         m_errno;         //!< Socket error code
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   743
  bool                     m_closeNotified; //!< Told app to close socket
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   744
  bool                     m_closeOnEmpty;  //!< Close socket upon tx buffer emptied
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   745
  bool                     m_shutdownSend;  //!< Send no longer allowed
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   746
  bool                     m_shutdownRecv;  //!< Receive no longer allowed
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   747
  bool                     m_connected;     //!< Connection established
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   748
  double                   m_msl;           //!< Max segment lifetime
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   749
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   750
  // Window management
10405
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   751
  uint32_t              m_segmentSize; //!< Segment size
45c8fceae24e Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 9145
diff changeset
   752
  uint16_t              m_maxWinSize;  //!< Maximum window size to advertise
11362
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   753
  TracedValue<uint32_t> m_rWnd;        //!< Receiver window (RCV.WND in RFC793)
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   754
  TracedValue<SequenceNumber32> m_highRxMark;     //!< Highest seqno received
917793d13817 bug 2058: TCP window update can shrink the Left Edge of the window which is a bug (patch based on earlier contribution from Evgeny Evstropov)
Tom Henderson <tomh@tomh.org>
parents: 11359
diff changeset
   755
  TracedValue<SequenceNumber32> m_highRxAckMark;  //!< Highest ack received
10885
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   756
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   757
  // Options
10986
4d7338f5952d [Doxygen] internet module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10885
diff changeset
   758
  bool    m_winScalingEnabled;    //!< Window Scale option enabled
4d7338f5952d [Doxygen] internet module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10885
diff changeset
   759
  uint8_t m_sndScaleFactor;       //!< Sent Window Scale (i.e., the one of the node)
4d7338f5952d [Doxygen] internet module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10885
diff changeset
   760
  uint8_t m_rcvScaleFactor;       //!< Received Window Scale (i.e., the one of the peer)
10885
462d70f54ada Support for basic TCP options, window scale, and timestamps, based on original code proposal by Adrian S.-W. Tam
Natale Patriciello <natale.patriciello@gmail.com>
parents: 10855
diff changeset
   761
10986
4d7338f5952d [Doxygen] internet module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10885
diff changeset
   762
  bool     m_timestampEnabled;    //!< Timestamp option enabled
4d7338f5952d [Doxygen] internet module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10885
diff changeset
   763
  uint32_t m_timestampToEcho;     //!< Timestamp to echo
11359
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   764
c2269e7c4f42 Bug 2067 - TCP performances drop when Advertised Window is larger than Sender Buffer size
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 11195
diff changeset
   765
  EventId m_sendPendingDataEvent; //!< micro-delay event to send pending data
6694
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   766
};
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   767
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   768
} // namespace ns3
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   769
a814f37d15bf merge new TCP code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   770
#endif /* TCP_SOCKET_BASE_H */