00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00084 void set_reuse_address( bool set=true );
00085
00086 protected:
00087 TCP::pointer m_listener;
00088 int m_backlog;
00089
00090 virtual void pre_start();
00091
00092 virtual void post_stop();
00093
00094 virtual void service_thread_main();
00095
00096 virtual TCP::pointer create_accepted_endpoint( int fd );
00097
00098 };
00099
00100 }
00101
00102 }
00103
00104 #endif