conexus logo

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  ***************************************************************************/
00020 #ifndef CONEXUSNSPR_TCPSERVER_H
00021 #define CONEXUSNSPR_TCPSERVER_H
00022 
00023 #include <conexus/endpointserver.h>
00024 #include <conexus-nspr/tcp.h>
00025 
00026 namespace Conexus
00027 {
00028 
00029   namespace NSPR
00030   {
00031 
00039     class TCPServer: public Conexus::EndpointServer
00040     {
00041       protected:
00042 
00043         TCPServer( uint32_t address, uint16_t port, int backlog );
00044 
00045         TCPServer( const std::string& address, uint16_t port, int backlog );
00046 
00047       public:
00048 
00049         typedef ConexusPointer<TCPServer> pointer;
00050 
00051         CONEXUS_ENDPOINTSERVER_GENERIC_CREATE();
00052 
00053         static pointer create( uint16_t port = 0, int backlog = 5 );
00054 
00055         static pointer create( uint32_t address, uint16_t port, int backlog = 5 );
00056 
00057         static pointer create( const std::string& address, uint16_t port=0, int backlog = 5 );
00058 
00059         virtual ~TCPServer();
00060 
00061         virtual Conexus::IPv4::Address& address();
00062 
00063         virtual void set_address( Conexus::IPv4::Address addr );
00064 
00065         int backlog();
00066 
00067         TCP::pointer listener();
00068 
00069         const TCP::pointer listener() const;
00070 
00071       protected:
00072         TCP::pointer m_listener;
00073 
00074         int m_backlog;
00075 
00076         virtual void service_thread_main();
00077 
00078         virtual void pre_start();
00079         
00080         virtual void post_stop();
00081 
00082     };
00083 
00084   } // namespace IPv4
00085 
00086 } // namespace Conexus
00087 
00088 #endif
00089 

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