conexus logo

ipv6_tcpserver.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the conexus library.                             *
00006  *                                                                         *
00007  *   The conexus library is free software; you can redistribute it and/or  *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The conexus library is distributed in the hope that it will be        *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
00018  ***************************************************************************/
00019 #ifndef IPV6IPV6_TCPSERVER_H
00020 #define IPV6IPV6_TCPSERVER_H
00021 
00022 #include <conexus/ipv6_address.h>
00023 #include <conexus/endpointserver.h>
00024 #include <conexus/ipv6_tcp.h>
00025 
00034 namespace Conexus
00035 {
00036 
00037   namespace IPv6
00038   {
00039 
00047     class TCPServer: public Conexus::EndpointServer
00048     {
00049 
00050       protected:
00051 
00052         TCPServer( uint32_t address, uint16_t port, int backlog=5 );
00053 
00054         TCPServer( const struct in6_addr& address, uint16_t port, int backlog=5 );
00055 
00056         TCPServer( const std::string& address, uint16_t port, int backlog=5 );
00057 
00058       public:
00059 
00060         typedef ConexusPointer<TCPServer> pointer;
00061 
00062         CONEXUS_ENDPOINTSERVER_GENERIC_CREATE();
00063 
00064         static TCPServer::pointer create( uint16_t port = 0, int backlog=5 );
00065 
00066         static TCPServer::pointer create( uint32_t address, uint16_t port, int backlog=5 );
00067 
00068         static TCPServer::pointer create( const struct in6_addr& address, uint16_t port = 0, int backlog=5 );
00069 
00070         static TCPServer::pointer create( const std::string& address, uint16_t port = 0, int backlog=5 );
00071 
00072         virtual ~TCPServer();
00073 
00074         virtual Address& address();
00075 
00076         virtual void set_address( Address addr );
00077 
00078         int backlog();
00079 
00080         TCP::pointer listener();
00081 
00082         const TCP::pointer listener() const;
00083 
00085         TCP& listener_ref();
00086 
00087         void enable_reuse_address( bool enable=true );
00088 
00089       protected:
00090         TCP::pointer m_listener;
00091         int m_backlog;
00092 
00093         virtual void pre_start();
00094         
00095         virtual void post_stop();
00096 
00097         virtual void service_thread_main();
00098 
00099         virtual TCP::pointer create_accepted_endpoint( int fd );
00100 
00101     };
00102 
00103   } // namespace IPv6
00104 
00105 } // namespace Conexus
00106 
00107 #endif

Generated on Wed Jul 8 15:50:07 2009 for conexus by doxygen 1.5.8