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 ProtocolServerSocketHandle public header
32 #ifndef HH_SENF_Socket_ProtocolServerSocketHandle_
33 #define HH_SENF_Socket_ProtocolServerSocketHandle_ 1
36 #include "ServerSocketHandle.hh"
37 #include <senf/config.hh>
38 #include <senf/Utils/Tags.hh>
40 #include "ProtocolServerSocketHandle.mpp"
41 //-/////////////////////////////////////////////////////////////////////////////////////////////////
45 /// \addtogroup handle_group
48 template <class Protocol> class ProtocolClientSocketHandle;
50 /** \brief Protocol specific socket handle (server interface)
52 The ProtocolServerSocketHandle is the server 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 server 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 ProtocolServerSocketHandle 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 ServerSocketHandle) is
62 accessible via the protocol() member.
64 A ProtocolServerSocketHandle is only meaningful for connection oriented addressable
65 protocols (CommunicationPolicy is ConnectedCommunicationPolicy and AddressingPolicy is not
68 \see \ref protocol_group
70 template <class SocketProtocol>
71 class ProtocolServerSocketHandle
72 : public ServerSocketHandle<typename SocketProtocol::Policy>
75 //-////////////////////////////////////////////////////////////////////////
78 typedef SocketProtocol Protocol; ///< The socket protocol
80 //-////////////////////////////////////////////////////////////////////////
81 ///\name Structors and default members
84 /** \brief Create new server socket
86 This constructor is one of the possible constructors. The exact Signature of the
87 constructor (or constructors) is defined by the \c init_server() member (or members) of
88 the \a Protocol class. ProtocolClientSocketHandle defines a number of constructors
89 taking up to 9 arguments which just forward to a corresponding \a Protocol\c
90 ::init_server() member. See the documentation of the respective Protocol class for a
91 detailed documentation of that protocols constructors.
94 ProtocolServerSocketHandle();
96 # define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 9, SENF_ABSOLUTE_INCLUDE_PATH(Socket/ProtocolServerSocketHandle.mpp), 1))
97 # include BOOST_PP_ITERATE()
99 /** \brief Create uninitialized socket variable
101 This special constructor is called when passing
102 ProtocolServerSocketHandle::Uninitialized as only argument to the constructor. This will
103 create an in-\ref valid() socket handle which can however be assigned later with another
106 \implementation The socket handle will have no \c body allocated.
108 ProtocolServerSocketHandle(senf::NoInit_t);
110 //-////////////////////////////////////////////////////////////////////////
112 Protocol & protocol(); ///< Access the protocol interface
113 /**< The returned protocol class reference gives access to
114 the complete protocol interface as defined by that
115 class. See the respective protocol class documentation.
116 \returns \a Protocol class reference */
118 ProtocolClientSocketHandle<SocketProtocol> accept();
120 static ProtocolServerSocketHandle cast_static(FileHandle handle);
121 static ProtocolServerSocketHandle cast_dynamic(FileHandle handle);
123 void state(SocketStateMap & map, unsigned lod=0);
124 std::string dumpState(unsigned lod=0);
127 ProtocolServerSocketHandle(FileHandle other, bool isChecked);
136 //-/////////////////////////////////////////////////////////////////////////////////////////////////
137 //#include "ProtocolServerSocketHandle.cci"
138 //#include "ProtocolServerSocketHandle.ct"
139 #include "ProtocolServerSocketHandle.cti"
146 // c-file-style: "senf"
147 // indent-tabs-mode: nil
148 // ispell-local-dictionary: "american"
149 // compile-command: "scons -u test"
150 // comment-column: 40