Added in ns-3-tcp (second try)

This commit is contained in:
Raj Bhattacharjea
2008-01-25 13:57:38 -05:00
parent 6292ead1f7
commit 6c3559792c
30 changed files with 4487 additions and 0 deletions

View File

@@ -108,6 +108,12 @@ int Socket::SendTo (const Address &address, const uint8_t* buf, uint32_t size)
return SendTo (address,p);
}
int Socket::Listen(uint32_t queueLimit)
{
return 0; //XXX the base class version does nothing
}
void
Socket::NotifyCloseCompleted (void)
{

View File

@@ -196,6 +196,13 @@ public:
*/
virtual int SendTo(const Address &address,Ptr<Packet> p) = 0;
/**
* \brief Listen for incoming connections.
* \param queueLimit maximum number of incoming request to queue
* \returns XXX an error code
*/
virtual int Listen(uint32_t queueLimit);
/**
* \brief Send data to a specified peer.
* \param address IP Address of remote host

71
src/node/tcp.cc Normal file
View File

@@ -0,0 +1,71 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 Georgia Tech Research Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Raj Bhattacharjea <raj.b@gatech.edu>
*/
#include "tcp.h"
namespace ns3 {
NumericDefaultValue<uint32_t> Tcp::defaultSegSize
("TcpDefaultSegmentSize",
"Default TCP maximum segment size in bytes (may be adjusted based on MTU discovery)",
536);
NumericDefaultValue<uint32_t> Tcp::defaultAdvWin
("TcpDefaultAdvertisedWindowSize",
"Default TCP advertised window size (bytes)",
0xffff);
NumericDefaultValue<uint32_t> Tcp::defaultSSThresh
("TcpDefaultSlowStartThreshold",
"Default TCP slow start threshold (bytes)",
0xffff);
NumericDefaultValue<uint32_t> Tcp::defaultTxBuffer
("TcpDefaultTxBufferSize",
"Default TCP maximum transmit buffer size (bytes)",
0xffffffffl);
NumericDefaultValue<uint32_t> Tcp::defaultRxBuffer
("TcpDefaultRxBufferSize",
"Default TCP maximum receive buffer size (bytes)",
0xffffffffl);
NumericDefaultValue<uint32_t> Tcp::defaultInitialCWnd
("TcpDefaultInitialCongestionWindowSize",
"Default TCP initial congestion window size (segments)",
1);
NumericDefaultValue<uint32_t> Tcp::defaultConnTimeout
("TcpDefaultConnTimeout",
"Default TCP retransmission timeout when opening connection (seconds)",
6);
NumericDefaultValue<uint32_t> Tcp::defaultConnCount
("TcpDefaultConnCount",
"Default number of connection attempts (SYN retransmissions) before returning failure",
3);
const InterfaceId Tcp::iid = MakeInterfaceId ("Tcp", SocketFactory::iid);
Tcp::Tcp ()
{
SetInterfaceId (Tcp::iid);
}
} // namespace ns3

67
src/node/tcp.h Normal file
View File

@@ -0,0 +1,67 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 Georgia Tech Research Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Raj Bhattacharjea <raj.b@gatech.edu>
*/
#ifndef TCP_H
#define TCP_H
#include "ns3/default-value.h"
#include "socket-factory.h"
namespace ns3 {
class Socket;
/**
* \brief API to create TCP socket instances
*
* This abstract class defines the API for TCP sockets.
* This class also holds the global default variables used to
* initialize newly created sockets, such as values that are
* set through the sysctl or proc interfaces in Linux.
* All TCP implementations must provide an implementation of CreateSocket
* below, and should make use of the default values configured below.
*
* \see TcpImpl
*
*/
class Tcp : public SocketFactory
{
public:
static const InterfaceId iid;
Tcp ();
virtual Ptr<Socket> CreateSocket (void) = 0;
public:
static NumericDefaultValue<uint32_t> defaultSegSize;
static NumericDefaultValue<uint32_t> defaultAdvWin;
static NumericDefaultValue<uint32_t> defaultSSThresh;
static NumericDefaultValue<uint32_t> defaultTxBuffer;
static NumericDefaultValue<uint32_t> defaultRxBuffer;
static NumericDefaultValue<uint32_t> defaultInitialCWnd;
static NumericDefaultValue<uint32_t> defaultConnTimeout;
static NumericDefaultValue<uint32_t> defaultConnCount;
};
} // namespace ns3
#endif /* UDP_H */

View File

@@ -25,6 +25,7 @@ def build(bld):
'packet-socket-factory.cc',
'packet-socket.cc',
'udp.cc',
'tcp.cc',
'ipv4.cc',
'application.cc',
]
@@ -52,6 +53,7 @@ def build(bld):
'socket-factory.h',
'packet-socket-factory.h',
'udp.h',
'tcp.h',
'ipv4.h',
'application.h',
]