4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief ProtocolClientSocketHandle public header
32 #ifndef HH_SENF_Socket_ProtocolClientSocketHandle_
33 #define HH_SENF_Socket_ProtocolClientSocketHandle_ 1
36 #include "ClientSocketHandle.hh"
37 #include <senf/config.hh>
38 #include <senf/Utils/Tags.hh>
40 #include "ProtocolClientSocketHandle.mpp"
41 //-/////////////////////////////////////////////////////////////////////////////////////////////////
45 /// \addtogroup handle_group
48 template <class Protocol> class ProtocolServerSocketHandle;
50 /** \brief Protocol specific socket handle (client interface)
52 The ProtocolClientSocketHandle is the client interface leaf class of the handle
53 hierarchy. This is the class to instantiate to open a new socket. This is also the \e only
54 class, which can be used to open a client socket.
56 The \a Protocol template argument defines the protocol of the socket. This protocol provides
57 the protocol interface of the socket as well as the complete socket policy of this protocol.
59 The ProtocolClientSocketHandle adds the protocol interface as an additional interface to the
60 socket handle. This interface is only accessible via the protocol class. All socket
61 functionality not available through the policy interface (see ClientSocketHandle) is
62 accessible via the protocol() member.
64 \see \ref protocol_group
66 template <class SocketProtocol>
67 class ProtocolClientSocketHandle
68 : public ClientSocketHandle<typename SocketProtocol::Policy>
71 //-////////////////////////////////////////////////////////////////////////
74 typedef SocketProtocol Protocol; ///< The sockets protocol
76 //-////////////////////////////////////////////////////////////////////////
77 ///\name Structors and default members
80 /** \brief Create new client socket
82 This constructor is one of the possible constructors. The exact Signature of the
83 constructor (or constructors) is defined by the \c init_client() member (or members) of
84 the \a Protocol class. ProtocolClientSocketHandle defines a number of constructors
85 taking up to 9 arguments which just forward to a corresponding \a Protocol\c
86 ::init_client() member. See the documentation of the respective Protocol class for a
87 detailed documentation of that protocols constructors.
89 ProtocolClientSocketHandle();
91 # define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 9, SENF_ABSOLUTE_INCLUDE_PATH(Socket/ProtocolClientSocketHandle.mpp), 1))
92 # include BOOST_PP_ITERATE()
94 /** \brief Create uninitialized socket variable
96 This special constructor is called when passing \c senf::noinit as only argument to
97 the constructor. This will create an in-\ref valid() socket handle which can however
98 be assigned later with another socket instance.
100 \implementation The socket handle will have no \c body allocated.
102 ProtocolClientSocketHandle(senf::NoInit_t);
105 //-////////////////////////////////////////////////////////////////////////
107 Protocol & protocol(); ///< Access the protocol interface
108 /**< The returned protocol class reference gives access to
109 the complete protocol interface as defined by that
110 class. See the respective protocol class documentation.
111 \returns \a Protocol class reference */
113 static ProtocolClientSocketHandle cast_static(FileHandle handle);
114 static ProtocolClientSocketHandle cast_dynamic(FileHandle handle);
116 void state(SocketStateMap & map, unsigned lod=0);
117 std::string dumpState(unsigned lod=0);
120 ProtocolClientSocketHandle(FileHandle other, bool isChecked);
123 friend class ProtocolServerSocketHandle<Protocol>;
129 //-/////////////////////////////////////////////////////////////////////////////////////////////////
130 //#include "ProtocolClientSocketHandle.cci"
131 //#include "ProtocolClientSocketHandle.ct"
132 #include "ProtocolClientSocketHandle.cti"
133 #include "ProtocolClientSocketHandle.mpp"
140 // c-file-style: "senf"
141 // indent-tabs-mode: nil
142 // ispell-local-dictionary: "american"
143 // compile-command: "scons -u test"
144 // comment-column: 40