src/internet-stack/tcp-socket-impl.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 09 Jun 2008 15:40:22 -0700
changeset 3260 8c0ab08144e6
parent 3252 src/internet-node/tcp-socket-impl.h@5c53412347ac
child 3266 1ae7df5cf87b
permissions -rw-r--r--
bug 186: internet-node directory must be renamed to internet-stack
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * Copyright (c) 2007 Georgia Tech Research Corporation
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 *
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 *
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * GNU General Public License for more details.
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 *
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
 *
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
 * Author: Raj Bhattacharjea <raj.b@gatech.edu>
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
 */
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
#ifndef TCP_SOCKET_IMPL_H
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    21
#define TCP_SOCKET_IMPL_H
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    22
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    23
#include <stdint.h>
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    24
#include <queue>
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
#include "ns3/callback.h"
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
#include "ns3/traced-value.h"
3134
1890d6ee27a1 Add abstract base class TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3131
diff changeset
    27
#include "ns3/tcp-socket.h"
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    28
#include "ns3/ptr.h"
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    29
#include "ns3/ipv4-address.h"
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    30
#include "ns3/event-id.h"
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    31
#include "tcp-typedefs.h"
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    32
#include "pending-data.h"
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    33
#include "sequence-number.h"
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    34
#include "rtt-estimator.h"
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    35
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    36
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    37
namespace ns3 {
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    38
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    39
class Ipv4EndPoint;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    40
class Node;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    41
class Packet;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    42
class TcpL4Protocol;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    43
class TcpHeader;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    44
3134
1890d6ee27a1 Add abstract base class TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3131
diff changeset
    45
class TcpSocketImpl : public TcpSocket
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    46
{
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    47
public:
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    48
  static TypeId GetTypeId (void);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    49
  /**
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    50
   * Create an unbound tcp socket.
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    51
   */
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    52
  TcpSocketImpl ();
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    53
  TcpSocketImpl (const TcpSocketImpl& sock);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    54
  virtual ~TcpSocketImpl ();
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    55
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    56
  void SetNode (Ptr<Node> node);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    57
  void SetTcp (Ptr<TcpL4Protocol> tcp);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    58
  void SetRtt (Ptr<RttEstimator> rtt);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    59
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    60
  virtual enum SocketErrno GetErrno (void) const;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    61
  virtual Ptr<Node> GetNode (void) const;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    62
  virtual int Bind (void);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    63
  virtual int Bind (const Address &address);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    64
  virtual int Close (void);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    65
  virtual int ShutdownSend (void);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    66
  virtual int ShutdownRecv (void);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    67
  virtual int Connect(const Address &address);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    68
  virtual int Send (Ptr<Packet> p);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    69
  virtual int Send (const uint8_t* buf, uint32_t size);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    70
  virtual int SendTo(Ptr<Packet> p, const Address &address);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    71
  virtual uint32_t GetTxAvailable (void) const;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    72
  virtual int Listen(uint32_t queueLimit);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    73
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    74
  virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    75
  virtual uint32_t GetRxAvailable (void) const;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    76
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    77
private:
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    78
  friend class Tcp;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    79
  // invoked by Tcp class
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    80
  int FinishBind (void);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    81
  void ForwardUp (Ptr<Packet> p, Ipv4Address ipv4, uint16_t port);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    82
  void Destroy (void);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    83
  int DoSendTo (Ptr<Packet> p, const Address &daddr);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    84
  int DoSendTo (Ptr<Packet> p, Ipv4Address daddr, uint16_t dport);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    85
  void SendEmptyPacket(uint8_t flags);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    86
  //methods for state
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    87
  bool ProcessAction (Actions_t a);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    88
  bool ProcessAction (Actions_t a, const TcpHeader& tcpHeader,
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    89
                      Ipv4Address saddr, Ipv4Address daddr);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    90
  bool ProcessPacketAction (Actions_t a, Ptr<Packet> p,
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    91
                                       const TcpHeader& tcpHeader,
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    92
                                       const Address& fromAddress);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    93
  Actions_t ProcessEvent (Events_t e);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    94
  bool SendPendingData(bool withAck = false);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    95
  void CompleteFork(Ptr<Packet>, const TcpHeader&, const Address& fromAddress);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    96
  void ConnectionSucceeded();
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    97
  
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    98
  //methods for window management
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    99
  virtual uint32_t  UnAckDataCount(); // Return count of number of unacked bytes
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   100
  virtual uint32_t  BytesInFlight();  // Return total bytes in flight
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   101
  virtual uint32_t  Window();         // Return window size (integer)
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   102
  virtual uint32_t  AvailableWindow();// Return unfilled portion of window
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   103
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   104
  // Manage data tx/rx
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   105
  void NewRx (Ptr<Packet>, const TcpHeader&, const Address&);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   106
  // XXX This should be virtual and overridden
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   107
  Ptr<TcpSocketImpl> Copy ();
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   108
  void NewAck (SequenceNumber seq); 
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   109
  // XXX This should be virtual and overridden
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   110
  void DupAck (const TcpHeader& t, uint32_t count); 
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   111
  void ReTxTimeout ();
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   112
  void DelAckTimeout ();
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   113
  void LastAckTimeout ();
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   114
  void Retransmit ();
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   115
  void CommonNewAck (SequenceNumber seq, bool skipTimer = false);
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   116
3136
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   117
  // attribute related
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   118
  virtual void SetSndBufSize (uint32_t size);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   119
  virtual uint32_t GetSndBufSize (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   120
  virtual void SetRcvBufSize (uint32_t size);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   121
  virtual uint32_t GetRcvBufSize (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   122
  virtual void SetSegSize (uint32_t size);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   123
  virtual uint32_t GetSegSize (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   124
  virtual void SetAdvWin (uint32_t window);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   125
  virtual uint32_t GetAdvWin (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   126
  virtual void SetSSThresh (uint32_t threshold);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   127
  virtual uint32_t GetSSThresh (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   128
  virtual void SetInitialCwnd (uint32_t cwnd);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   129
  virtual uint32_t GetInitialCwnd (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   130
  virtual void SetConnTimeout (Time timeout);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   131
  virtual Time GetConnTimeout (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   132
  virtual void SetConnCount (uint32_t count);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   133
  virtual uint32_t GetConnCount (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   134
  virtual void SetDelAckTimeout (Time timeout);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   135
  virtual Time GetDelAckTimeout (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   136
  virtual void SetDelAckMaxCount (uint32_t count);
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   137
  virtual uint32_t GetDelAckMaxCount (void) const;
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   138
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   139
  bool m_skipRetxResched;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   140
  uint32_t m_dupAckCount;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   141
  EventId m_retxEvent;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   142
  EventId m_lastAckEvent;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   143
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   144
  EventId m_delAckEvent;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   145
  uint32_t m_delAckCount;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   146
  uint32_t m_delAckMaxCount;
3136
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   147
  Time m_delAckTimeout;
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   148
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   149
  Ipv4EndPoint *m_endPoint;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   150
  Ptr<Node> m_node;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   151
  Ptr<TcpL4Protocol> m_tcp;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   152
  Ipv4Address m_remoteAddress;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   153
  uint16_t m_remotePort;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   154
  //these two are so that the socket/endpoint cloning works
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   155
  Ipv4Address m_localAddress;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   156
  uint16_t m_localPort;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   157
  enum SocketErrno m_errno;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   158
  bool m_shutdownSend;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   159
  bool m_shutdownRecv;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   160
  bool m_connected;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   161
  
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   162
  //manage the state infomation
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   163
  States_t m_state;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   164
  bool m_closeNotified;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   165
  bool m_closeRequestNotified;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   166
  bool m_closeOnEmpty;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   167
  bool m_pendingClose;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   168
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   169
  
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   170
  //sequence info, sender side
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   171
  SequenceNumber m_nextTxSequence;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   172
  SequenceNumber m_highTxMark;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   173
  SequenceNumber m_highestRxAck;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   174
  SequenceNumber m_lastRxAck;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   175
  
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   176
  //sequence info, reciever side
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   177
  SequenceNumber m_nextRxSequence;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   178
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   179
  //history data
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   180
  //this is the incoming data buffer which sorts out of sequence data
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   181
  UnAckData_t m_bufferedData;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   182
  //this is kind of the tx buffer
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   183
  PendingData* m_pendingData;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   184
  SequenceNumber m_firstPendingSequence;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   185
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   186
  // Window management
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   187
  uint32_t                       m_segmentSize;          //SegmentSize
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   188
  uint32_t                       m_rxWindowSize;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   189
  uint32_t                       m_advertisedWindowSize; //Window to advertise
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   190
  TracedValue<uint32_t>          m_cWnd;                 //Congestion window
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   191
  uint32_t                       m_ssThresh;             //Slow Start Threshold
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   192
  uint32_t                       m_initialCWnd;          //Initial cWnd value
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   193
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   194
  // Round trip time estimation
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   195
  Ptr<RttEstimator> m_rtt;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   196
  Time m_lastMeasuredRtt;
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   197
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   198
  // Timer-related members
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   199
  Time              m_cnTimeout; 
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   200
  uint32_t          m_cnCount;
3244
dbf56f98a11d Fix tcp rx buffer semantics; fromaddress tagging is broken at the moment
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3136
diff changeset
   201
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   202
  // Temporary queue for delivering data to application
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   203
  uint32_t m_rxAvailable;
3244
dbf56f98a11d Fix tcp rx buffer semantics; fromaddress tagging is broken at the moment
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3136
diff changeset
   204
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   205
  bool m_wouldBlock;  // set to true whenever socket would block on send()
3136
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   206
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   207
  // Attributes
3252
5c53412347ac Fix compile warning
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3244
diff changeset
   208
  uint32_t m_sndBufSize;   // buffer limit for the outgoing queue
3136
a59b9ce95b6b Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents: 3134
diff changeset
   209
  uint32_t m_rcvBufSize;   // maximum receive socket buffer size
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   210
};
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   211
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   212
}//namespace ns3
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   213
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   214
#endif /* TCP_SOCKET_IMPL_H */