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 UDPv4SocketHandle and UDPv6SocketHandle public header
26 \todo Implement possibly non-blocking connect and SO_ERROR in the
30 #ifndef HH_UDPSocketHandle_
31 #define HH_UDPSocketHandle_ 1
34 #include "INetProtocol.hh"
35 #include "UDPProtocol.hh"
36 #include "MulticastProtocol.hh"
37 #include "../../../Socket/Protocols/BSDSocketProtocol.hh"
38 #include "../../../Socket/Protocols/DatagramSocketProtocol.hh"
39 #include "../../../Socket/FramingPolicy.hh"
40 #include "../../../Socket/CommunicationPolicy.hh"
41 #include "../../../Socket/ReadWritePolicy.hh"
42 #include "../../../Socket/ProtocolClientSocketHandle.hh"
44 //#include "UDPSocketHandle.mpp"
45 ///////////////////////////////hh.p////////////////////////////////////////
49 /// \addtogroup concrete_protocol_group
52 typedef MakeSocketPolicy<
53 INet4AddressingPolicy,
54 DatagramFramingPolicy,
55 UnconnectedCommunicationPolicy,
58 >::policy UDPv4Socket_Policy; ///< Socket Policy of the UDPv4 Protocol
60 /** \brief IPv4 UDP Socket Protocol
62 \par Socket Handle typedefs:
63 \ref UDPv4ClientSocketHandle (ProtocolClientSocketHandle)
65 \par Policy Interface:
66 ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
67 ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local(),
68 ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
73 UDPv4SocketProtocol provides an internet protocol stream socket based on the UDP protocol
76 This class is utilized as the protocol class of the ProtocolClientSocketHandle
77 via the Socket Handle typedefs above.
79 \see UDPv6SocketProtocol
81 class UDPv4SocketProtocol
82 : public ConcreteSocketProtocol<UDPv4Socket_Policy, UDPv4SocketProtocol>,
85 public MulticastProtocol,
86 public INet4MulticastProtocol,
87 public BSDSocketProtocol,
88 public DatagramSocketProtocol,
89 public AddressableBSDSocketProtocol
92 ///////////////////////////////////////////////////////////////////////////
98 void init_client() const; ///< Create unconnected client socket
99 /**< \note This member is implicitly called from the
100 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
102 void init_client(INet4SocketAddress const & address) const;
103 ///< Create client socket and bind
104 /**< Creates a new client socket and bind to the given
106 \param[in] address local address to bind to */
107 /**< \note This member is implicitly called from the
108 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
115 typedef ProtocolClientSocketHandle<UDPv4SocketProtocol> UDPv4ClientSocketHandle;
117 typedef MakeSocketPolicy<
119 INet6AddressingPolicy
120 >::policy UDPv6Socket_Policy;
122 /** \brief IPv6 UDP Socket Protocol
124 \par Socket Handle typedefs:
125 \ref UDPv6ClientSocketHandle (ProtocolClientSocketHandle)
127 \par Policy Interface:
128 ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
129 ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local(),
130 ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
135 UDPv6SocketProtocol provides an internet protocol stream socket based on the UDP protocol
138 This class is utilized as the protocol class of the ProtocolClientSocketHandle
139 via the Socket Handle typedefs above.
141 \see UDPv4SocketProtocol
143 class UDPv6SocketProtocol
144 : public ConcreteSocketProtocol<UDPv6Socket_Policy, UDPv6SocketProtocol>,
147 public MulticastProtocol,
148 public INet6MulticastProtocol,
149 public BSDSocketProtocol,
150 public DatagramSocketProtocol,
151 public AddressableBSDSocketProtocol
154 ///////////////////////////////////////////////////////////////////////////
155 // internal interface
157 ///\name Constructors
160 void init_client() const; ///< Create unconnected client socket
161 /**< \note This member is implicitly called from the
162 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
164 void init_client(INet6SocketAddress const & address) const;
165 ///< Create client socket and connect
166 /**< Creates a new client socket and bind to the given
168 \param[in] address local address to bind to */
169 /**< \note This member is implicitly called from the
170 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
176 typedef ProtocolClientSocketHandle<UDPv6SocketProtocol> UDPv6ClientSocketHandle;
182 ///////////////////////////////hh.e////////////////////////////////////////
183 //#include "UDPSocketHandle.cci"
184 //#include "UDPSocketHandle.ct"
185 //#include "UDPSocketHandle.cti"
192 // c-file-style: "senf"
193 // indent-tabs-mode: nil
194 // ispell-local-dictionary: "american"
195 // compile-command: "scons -u test"
196 // comment-column: 40