00001 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2007 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 00019 */ 00020 #ifndef UDP_SOCKET_FACTORY_IMPL_H 00021 #define UDP_SOCKET_FACTORY_IMPL_H 00022 00023 #include "ns3/udp-socket-factory.h" 00024 #include "ns3/ptr.h" 00025 00026 namespace ns3 { 00027 00028 class UdpL4Protocol; 00029 00030 /** 00031 * \ingroup internetStack 00032 * \defgroup udp Udp 00033 * 00034 * This is an implementation of the User Datagram Protocol described in 00035 * RFC 768. It implements a connectionless, unreliable datagram packet 00036 * service. Packets may be reordered or duplicated before they arrive. 00037 * UDP generates and checks checksums to catch transmission errors. 00038 * 00039 * The following options are not presently part of this implementation: 00040 * UDP_CORK, MSG_DONTROUTE, path MTU discovery control (e.g. 00041 * IP_MTU_DISCOVER). MTU handling is also weak in ns-3 for the moment; 00042 * it is best to send datagrams that do not exceed 1500 byte MTU (e.g. 00043 * 1472 byte UDP datagrams) 00044 */ 00045 00046 /** 00047 * \ingroup udp 00048 * \brief Object to create UDP socket instances 00049 * \internal 00050 * 00051 * This class implements the API for creating UDP sockets. 00052 * It is a socket factory (deriving from class SocketFactory). 00053 */ 00054 class UdpSocketFactoryImpl : public UdpSocketFactory 00055 { 00056 public: 00057 UdpSocketFactoryImpl (); 00058 virtual ~UdpSocketFactoryImpl (); 00059 00060 void SetUdp (Ptr<UdpL4Protocol> udp); 00061 00062 /** 00063 * \brief Implements a method to create a Udp-based socket and return 00064 * a base class smart pointer to the socket. 00065 * \internal 00066 * 00067 * \return smart pointer to Socket 00068 */ 00069 virtual Ptr<Socket> CreateSocket (void); 00070 00071 protected: 00072 virtual void DoDispose (void); 00073 private: 00074 Ptr<UdpL4Protocol> m_udp; 00075 }; 00076 00077 } // namespace ns3 00078 00079 #endif /* UDP_SOCKET_FACTORY_IMPL_H */