src/internet/model/tcp-socket-factory-impl.cc
author Adrian S Tam <adrian.sw.tam@gmail.com>
Wed, 07 Dec 2011 11:22:10 -0500
changeset 7619 b4dee6307aa7
parent 7176 9f2663992e99
permissions -rw-r--r--
Nagle's algorithm in TCP (closes bug 1039)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3133
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * Copyright (c) 2007 Georgia Tech Research Corporation
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 *
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 *
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * GNU General Public License for more details.
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 *
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
 *
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
 * Author: Raj Bhattacharjea <raj.b@gatech.edu>
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
 */
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
#include "tcp-socket-factory-impl.h"
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    21
#include "tcp-l4-protocol.h"
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    22
#include "ns3/socket.h"
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    23
#include "ns3/assert.h"
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    24
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
namespace ns3 {
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    27
TcpSocketFactoryImpl::TcpSocketFactoryImpl ()
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    28
  : m_tcp (0)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    29
{
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    30
}
3133
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    31
TcpSocketFactoryImpl::~TcpSocketFactoryImpl ()
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    32
{
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    33
  NS_ASSERT (m_tcp == 0);
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    34
}
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    35
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    36
void
3133
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    37
TcpSocketFactoryImpl::SetTcp (Ptr<TcpL4Protocol> tcp)
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    38
{
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    39
  m_tcp = tcp;
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    40
}
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    41
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    42
Ptr<Socket>
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    43
TcpSocketFactoryImpl::CreateSocket (void)
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    44
{
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    45
  return m_tcp->CreateSocket ();
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    46
}
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    47
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    48
void 
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    49
TcpSocketFactoryImpl::DoDispose (void)
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    50
{
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    51
  m_tcp = 0;
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    52
  TcpSocketFactory::DoDispose ();
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    53
}
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    54
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    55
} // namespace ns3