4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief ProtocolClientSocketHandle public header
27 #ifndef HH_ProtocolClientSocketHandle_
28 #define HH_ProtocolClientSocketHandle_ 1
31 #include "ClientSocketHandle.hh"
32 #include "../config.hh"
34 #include "ProtocolClientSocketHandle.mpp"
35 ///////////////////////////////hh.p////////////////////////////////////////
39 /// \addtogroup handle_group
42 template <class Protocol> class ProtocolServerSocketHandle;
44 /** \brief Protocol specific socket handle (client interface)
46 The ProtocolClientSocketHandle is the client interface leaf class of the handle
47 hierarchy. This is the class to instantiate to open a new socket. This is also the \e only
48 class, which can be used to open a client socket.
50 The \a Protocol template argument defines the protocol of the socket. This protocol provides
51 the protocol interface of the socket as well as the complete socket policy of this protocol.
53 The ProtocolClientSocketHandle adds the protocol interface as an additional interface to the
54 socket handle. This interface is only accessible via the protocol class. All socket
55 functionality not available through the policy interface (see ClientSocketHandle) is
56 accessible via the protocol() member.
58 \see \ref protocol_group
60 template <class SocketProtocol>
61 class ProtocolClientSocketHandle
62 : public ClientSocketHandle<typename SocketProtocol::Policy>
65 ///////////////////////////////////////////////////////////////////////////
68 typedef SocketProtocol Protocol; ///< The sockets protocol
69 enum UninitializedType { Uninitialized }; ///< Flag to call 'uninitialized' constructor
71 ///////////////////////////////////////////////////////////////////////////
72 ///\name Structors and default members
75 /** \brief Create new client socket
77 This constructor is one of the possible constructors. The exact Signature of the
78 constructor (or constructors) is defined by the \c init_client() member (or members) of
79 the \a Protocol class. ProtocolClientSocketHandle defines a number of constructors
80 taking up to 9 arguments which just forward to a corresponding \a Protocol\c
81 ::init_client() member. See the documentation of the respective Protocol class for a
82 detailed documentation of that protocols constructors.
84 ProtocolClientSocketHandle();
86 # define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 9, SENF_ABSOLUTE_INCLUDE_PATH(Socket/ProtocolClientSocketHandle.mpp), 1))
87 # include BOOST_PP_ITERATE()
89 /** \brief Create uninitialized socket variable
91 This special constructor is called when passing
92 ProtocolClientSocketHandle::Uninitialized as only argument to the constructor. This will
93 create an in-\ref valid() socket handle which can however be assigned later with another
96 \implementation The socket handle will have no \c body allocated.
98 ProtocolClientSocketHandle(UninitializedType);
101 ///////////////////////////////////////////////////////////////////////////
103 Protocol const & protocol(); ///< Access the protocol interface
104 /**< The returned protocol class reference gives access to
105 the complete protocol interface as defined by that
106 class. See the respective protocol class documentation.
107 \returns \a Protocol class reference */
109 static ProtocolClientSocketHandle cast_static(FileHandle handle);
110 static ProtocolClientSocketHandle cast_dynamic(FileHandle handle);
112 void state(SocketStateMap & map, unsigned lod=0);
113 std::string dumpState(unsigned lod=0);
116 ProtocolClientSocketHandle(FileHandle other, bool isChecked);
119 friend class ProtocolServerSocketHandle<Protocol>;
125 ///////////////////////////////hh.e////////////////////////////////////////
126 //#include "ProtocolClientSocketHandle.cci"
127 //#include "ProtocolClientSocketHandle.ct"
128 #include "ProtocolClientSocketHandle.cti"
129 #include "ProtocolClientSocketHandle.mpp"
136 // c-file-style: "senf"
137 // indent-tabs-mode: nil
138 // ispell-local-dictionary: "american"
139 // compile-command: "scons -u test"
140 // comment-column: 40