TCPSocketHandle.hh

Go to the documentation of this file.
00001 // $Id: TCPSocketHandle.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2006
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00030 #ifndef HH_SENF_Socket_Protocols_INet_TCPSocketHandle_
00031 #define HH_SENF_Socket_Protocols_INet_TCPSocketHandle_ 1
00032 
00033 // Custom includes
00034 #include "INetSocketProtocol.hh"
00035 #include "TCPSocketProtocol.hh"
00036 #include "INetAddressing.hh"
00037 #include <senf/Socket/Protocols/BSDSocketProtocol.hh>
00038 #include <senf/Socket/FramingPolicy.hh>
00039 #include <senf/Socket/CommunicationPolicy.hh>
00040 #include <senf/Socket/ReadWritePolicy.hh>
00041 #include <senf/Socket/ProtocolClientSocketHandle.hh>
00042 #include <senf/Socket/ProtocolServerSocketHandle.hh>
00043 
00044 //#include "TCPSocketHandle.mpp"
00045 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00046 
00047 namespace senf {
00048 
00050     //\{
00051 
00052     typedef MakeSocketPolicy<
00053         INet4AddressingPolicy,
00054         StreamFramingPolicy,
00055         ConnectedCommunicationPolicy,
00056         ReadablePolicy,
00057         WriteablePolicy
00058         >::policy TCPv4Socket_Policy;   
00059 
00081     class TCPv4SocketProtocol
00082         : public ConcreteSocketProtocol<TCPv4Socket_Policy,TCPv4SocketProtocol>,
00083           public TCPSocketProtocol,
00084           public BSDSocketProtocol,
00085           public AddressableBSDSocketProtocol
00086     {
00087     public:
00088         //-////////////////////////////////////////////////////////////////////////
00089         // internal interface
00090 
00092         //\{
00093 
00094         void init_client() const;       
00095 
00098         void init_client(INet4SocketAddress const & address) const;
00100 
00107         void init_server() const;       
00108 
00111         void init_server(INet4SocketAddress const & address, unsigned backlog=1) const;
00113 
00123         //\}
00124     };
00125 
00126     typedef ProtocolClientSocketHandle<TCPv4SocketProtocol> TCPv4ClientSocketHandle;
00127     typedef ProtocolServerSocketHandle<TCPv4SocketProtocol> TCPv4ServerSocketHandle;
00128 
00129     typedef MakeSocketPolicy<
00130         TCPv4Socket_Policy,
00131         INet6AddressingPolicy
00132         >::policy TCPv6Socket_Policy;
00133 
00155     class TCPv6SocketProtocol
00156         : public ConcreteSocketProtocol<TCPv6Socket_Policy,TCPv6SocketProtocol>,
00157           public TCPSocketProtocol,
00158           public BSDSocketProtocol,
00159           public AddressableBSDSocketProtocol
00160     {
00161     public:
00162         //-////////////////////////////////////////////////////////////////////////
00163         // internal interface
00164 
00166         //\{
00167 
00168         void init_client() const;       
00169 
00172         void init_client(INet6SocketAddress const & address) const;
00174 
00181         void init_server() const;       
00182 
00185         void init_server(INet6SocketAddress const & address, unsigned backlog=1) const;
00187 
00197         //\}
00198     };
00199 
00200     typedef ProtocolClientSocketHandle<TCPv6SocketProtocol> TCPv6ClientSocketHandle;
00201     typedef ProtocolServerSocketHandle<TCPv6SocketProtocol> TCPv6ServerSocketHandle;
00202 
00203     //\}
00204 
00205 }
00206 
00207 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00208 //#include "TCPSocketHandle.cci"
00209 //#include "TCPSocketHandle.ct"
00210 //#include "TCPSocketHandle.cti"
00211 #endif
00212 
00213 
00214 // Local Variables:
00215 // mode: c++
00216 // fill-column: 100
00217 // c-file-style: "senf"
00218 // indent-tabs-mode: nil
00219 // ispell-local-dictionary: "american"
00220 // compile-command: "scons -u test"
00221 // comment-column: 40
00222 // End: