src/internet/model/udp-socket-factory-impl.cc
author Pedro Silva <pmms@inesctec.pt>
Wed, 29 Oct 2014 10:12:53 -0700
changeset 11040 cd2eda848730
parent 7176 9f2663992e99
permissions -rw-r--r--
bug 1791: TCP Endpoint never deallocates when closing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
519
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2007 INRIA
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
3126
68d35477a842 s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents: 3125
diff changeset
    20
#include "udp-socket-factory-impl.h"
741
38ebb2fb16f5 udp.h -> udp-l4-protocol.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 739
diff changeset
    21
#include "udp-l4-protocol.h"
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    22
#include "ns3/socket.h"
519
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include "ns3/assert.h"
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
namespace ns3 {
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
3126
68d35477a842 s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents: 3125
diff changeset
    27
UdpSocketFactoryImpl::UdpSocketFactoryImpl ()
2592
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 750
diff changeset
    28
  : m_udp (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
}
3126
68d35477a842 s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents: 3125
diff changeset
    31
UdpSocketFactoryImpl::~UdpSocketFactoryImpl ()
519
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
{
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
  NS_ASSERT (m_udp == 0);
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
}
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    36
void
3126
68d35477a842 s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents: 3125
diff changeset
    37
UdpSocketFactoryImpl::SetUdp (Ptr<UdpL4Protocol> udp)
2592
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 750
diff changeset
    38
{
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 750
diff changeset
    39
  m_udp = udp;
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 750
diff changeset
    40
}
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 750
diff changeset
    41
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    42
Ptr<Socket>
3126
68d35477a842 s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents: 3125
diff changeset
    43
UdpSocketFactoryImpl::CreateSocket (void)
519
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
{
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
  return m_udp->CreateSocket ();
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
}
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
void 
3126
68d35477a842 s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents: 3125
diff changeset
    49
UdpSocketFactoryImpl::DoDispose (void)
519
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
{
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    51
  m_udp = 0;
3125
d2d8a36cfd23 s/ns3::Udp/ns3::UdpSocketFactory
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    52
  UdpSocketFactory::DoDispose ();
519
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
}
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
b045a3ab4595 define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
} // namespace ns3