1 // $Id: ConnectedUDPSocketHandle.hh 357 2007-07-26 22:48:39Z g0dil $
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.
24 \brief UDPv4SocketHandle and UDPv6SocketHandle public header
26 \todo Implement possibly non-blocking connect and SO_ERROR in the
30 #ifndef HH_ConnectedUDPSocketHandle_
31 #define HH_ConnectedUDPSocketHandle_ 1
34 #include "INetProtocol.hh"
35 #include "UDPProtocol.hh"
36 #include "Socket/Protocols/BSDSocketProtocol.hh"
37 #include "Socket/FramingPolicy.hh"
38 #include "Socket/CommunicationPolicy.hh"
39 #include "Socket/ReadWritePolicy.hh"
40 #include "Socket/BufferingPolicy.hh"
41 #include "Socket/ProtocolClientSocketHandle.hh"
43 //#include "ConnectedUDPSocketHandle.mpp"
44 ///////////////////////////////hh.p////////////////////////////////////////
48 /// \addtogroup concrete_protocol_group
51 typedef MakeSocketPolicy<
52 INet4AddressingPolicy,
53 DatagramFramingPolicy,
54 ConnectedCommunicationPolicy,
58 >::policy ConnectedUDPv4Socket_Policy; ///< Socket Policy of the UDPv4 Protocol
60 /** \brief IPv4 UDP Socket Protocol, connected
62 \par Socket Handle typedefs:
63 \ref ConnectedUDPv4ClientSocketHandle (ProtocolClientSocketHandle)
65 \par Policy Interface:
66 ClientSocketHandle::read(), ClientSocketHandle::write(), ClientSocketHandle::bind(),
67 ClientSocketHandle::local(), ClientSocketHandle::connect(), ClientSocketHandle::peer(),
68 ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
73 ConnectedUDPv4SocketProtocol provides an internet protocol stream socket based on the UDP
74 protocol and IPv4 addressing.
76 This class is utilized as the protocol class of the ProtocolClientSocketHandle
77 via the Socket Handle typedefs above.
79 \see ConnectedUDPv6SocketProtocol
81 class ConnectedUDPv4SocketProtocol
82 : public ConcreteSocketProtocol<ConnectedUDPv4Socket_Policy>,
85 public BSDSocketProtocol,
86 public AddressableBSDSocketProtocol,
87 public senf::pool_alloc_mixin<ConnectedUDPv4SocketProtocol>
90 ///////////////////////////////////////////////////////////////////////////
96 void init_client() const; ///< Create unconnected client socket
97 /**< \note This member is implicitly called from the
98 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
100 void init_client(INet4SocketAddress const & address) const;
101 ///< Create client socket and connect
102 /**< Creates a new client socket and connects to the given
105 \param[in] address remote address to connect to */
106 /**< \note This member is implicitly called from the
107 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
111 ///\name Abstract Interface Implementation
113 std::auto_ptr<SocketProtocol> clone() const;
118 typedef ProtocolClientSocketHandle<
119 ConnectedUDPv4SocketProtocol> ConnectedUDPv4ClientSocketHandle;
121 typedef MakeSocketPolicy<
122 ConnectedUDPv4Socket_Policy,
123 INet6AddressingPolicy
124 >::policy ConnectedUDPv6Socket_Policy;
126 /** \brief IPv6 UDP Socket Protocol, connected
128 \par Socket Handle typedefs:
129 \ref ConnectedUDPv6ClientSocketHandle (ProtocolClientSocketHandle)
131 \par Policy Interface:
132 ClientSocketHandle::read(), ClientSocketHandle::write(), ClientSocketHandle::bind(),
133 ClientSocketHandle::local(), ClientSocketHandle::connect(), ClientSocketHandle::peer(),
134 ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
139 ConnectedUDPv6SocketProtocol provides an internet protocol stream socket based on the UDP
140 protocol and IPv6 addressing.
142 This class is utilized as the protocol class of the ProtocolClientSocketHandle
143 via the Socket Handle typedefs above.
145 \see ConnectedUDPv4SocketProtocol
147 class ConnectedUDPv6SocketProtocol
148 : public ConcreteSocketProtocol<ConnectedUDPv6Socket_Policy>,
151 public BSDSocketProtocol,
152 public AddressableBSDSocketProtocol,
153 public senf::pool_alloc_mixin<ConnectedUDPv6SocketProtocol>
156 ///////////////////////////////////////////////////////////////////////////
157 // internal interface
159 ///\name Constructors
162 void init_client() const; ///< Create unconnected client socket
163 /**< \note This member is implicitly called from the
164 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
166 void init_client(INet6SocketAddress const & address) const;
167 ///< Create client socket and connect
168 /**< Creates a new client socket and connects to the given
171 \param[in] address remote address to connect to */
172 /**< \note This member is implicitly called from the
173 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
177 ///\name Abstract Interface Implementation
179 std::auto_ptr<SocketProtocol> clone() const;
184 typedef ProtocolClientSocketHandle<
185 ConnectedUDPv6SocketProtocol> ConnectedUDPv6ClientSocketHandle;
191 ///////////////////////////////hh.e////////////////////////////////////////
192 //#include "ConnectedUDPSocketHandle.cci"
193 //#include "ConnectedUDPSocketHandle.ct"
194 //#include "ConnectedUDPSocketHandle.cti"
201 // c-file-style: "senf"
202 // indent-tabs-mode: nil
203 // ispell-local-dictionary: "american"
204 // compile-command: "scons -u test"
205 // comment-column: 40