4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.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.
26 /** \defgroup protocol_group The Protocol Classes
28 \image html Protocols.png
30 The socket handle classes and templates only implement the most
31 important socket API methods using the policy framework. To access
32 the complete API, the protocol interface is provided. Access to
33 the protocol interface is only possible via
34 senf::ProtocolClientSocketHandle and
35 senf::ProtocolServerSocketHandle which have the necessary \c
36 protocol() member. This member returns a reference to the protocol
37 class instance which contains members covering all the API
38 functions (mostly setsockopt/getsockopt related calls but there
39 may be more, this is completely up to the implementor of the
40 protocol class) not found in the SocketHandle interface. The
41 protocol interface is specific to the protocol. It's
42 implementation is quite free. The standard protocols are
43 implemented using a simple multiple-inheritance hierarchy as shown
46 Since the protocol class is protocol specific (how intelligent
47 ...), the protocol class also defines the complete socket policy
48 to be used with it's protocol. Complete meaning, that every policy
49 axis must be assigned it's the most specific (that is derived)
50 policy class to be used with the protocol.
53 #ifndef HH_SocketProtocol_
54 #define HH_SocketProtocol_ 1
57 #include <boost/utility.hpp>
58 /** \fixme this is not nice. The includes and predefs should be restructured */
59 #include "SocketHandle.ih"
61 //#include "SocketProtocol.mpp"
62 ///////////////////////////////hh.p////////////////////////////////////////
66 /// \addtogroup protocol_group
69 class SocketPolicyBase;
71 class SocketProtocol : boost::noncopyable
74 ///////////////////////////////////////////////////////////////////////////
77 ///////////////////////////////////////////////////////////////////////////
78 ///\name Structors and default members
82 virtual ~SocketProtocol() = 0;
84 // default default constructor
86 // no conversion constructors
89 ///////////////////////////////////////////////////////////////////////////
91 SocketBody & body() const;
92 virtual SocketPolicyBase const & policy() const = 0;
94 ///////////////////////////////////////////////////////////////////////////
97 virtual std::auto_ptr<SocketProtocol> clone() const = 0;
98 virtual unsigned available() const = 0;
99 virtual bool eof() const = 0;
100 virtual void state(SocketStateMap & map, unsigned lod) const;
105 // backpointer to owning SocketBody instance
107 friend class SocketBody;
110 template <class SocketPolicy>
111 class ConcreteSocketProtocol
112 : public virtual SocketProtocol
115 ///////////////////////////////////////////////////////////////////////////
118 typedef SocketPolicy Policy;
120 ///////////////////////////////////////////////////////////////////////////
121 ///\name Structors and default members
124 ~ConcreteSocketProtocol() = 0;
126 // no default constructor
128 // no conversion constructors
131 ///////////////////////////////////////////////////////////////////////////
133 Policy const & policy() const;
145 ///////////////////////////////hh.e////////////////////////////////////////
146 #include "SocketProtocol.cci"
147 //#include "SocketProtocol.ct"
148 #include "SocketProtocol.cti"
154 // c-file-style: "senf"