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 UDPv4SocketHandle and UDPv6SocketHandle public header
31 \todo Implement possibly non-blocking connect and SO_ERROR in the
35 #ifndef HH_SENF_Socket_Protocols_INet_UDPSocketHandle_
36 #define HH_SENF_Socket_Protocols_INet_UDPSocketHandle_ 1
39 #include "INetAddressing.hh"
40 #include "UDPSocketProtocol.hh"
41 #include "MulticastSocketProtocol.hh"
42 #include <senf/Socket/Protocols/BSDSocketProtocol.hh>
43 #include <senf/Socket/Protocols/DatagramSocketProtocol.hh>
44 #include <senf/Socket/FramingPolicy.hh>
45 #include <senf/Socket/CommunicationPolicy.hh>
46 #include <senf/Socket/ReadWritePolicy.hh>
47 #include <senf/Socket/ProtocolClientSocketHandle.hh>
49 //#include "UDPSocketHandle.mpp"
50 //-/////////////////////////////////////////////////////////////////////////////////////////////////
54 /// \addtogroup concrete_protocol_group
57 typedef MakeSocketPolicy<
58 INet4AddressingPolicy,
59 DatagramFramingPolicy,
60 UnconnectedCommunicationPolicy,
63 >::policy UDPv4Socket_Policy; ///< Socket Policy of the UDPv4 Protocol
65 /** \brief IPv4 UDP Socket Protocol
67 \par Socket Handle typedefs:
68 \ref UDPv4ClientSocketHandle (ProtocolClientSocketHandle)
70 \par Policy Interface:
71 ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
72 ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local()
77 UDPv4SocketProtocol provides an internet protocol stream socket based on the UDP protocol
80 This class is utilized as the protocol class of the ProtocolClientSocketHandle
81 via the Socket Handle typedefs above.
83 \see UDPv6SocketProtocol
85 class UDPv4SocketProtocol
86 : public ConcreteSocketProtocol<UDPv4Socket_Policy, UDPv4SocketProtocol>,
87 public UDPSocketProtocol,
88 public INet4MulticastSocketProtocol,
89 public BSDSocketProtocol,
90 public DatagramSocketProtocol,
91 public AddressableBSDSocketProtocol
94 //-////////////////////////////////////////////////////////////////////////
100 void init_client() const; ///< Create unconnected client socket
101 /**< \note This member is implicitly called from the
102 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
104 void init_client(INet4SocketAddress const & address) const;
105 ///< Create client socket and bind
106 /**< Creates a new client socket and bind to the given
108 \param[in] address local address to bind to */
109 /**< \note This member is implicitly called from the
110 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
117 typedef ProtocolClientSocketHandle<UDPv4SocketProtocol> UDPv4ClientSocketHandle;
119 typedef MakeSocketPolicy<
121 INet6AddressingPolicy
122 >::policy UDPv6Socket_Policy;
124 /** \brief IPv6 UDP Socket Protocol
126 \par Socket Handle typedefs:
127 \ref UDPv6ClientSocketHandle (ProtocolClientSocketHandle)
129 \par Policy Interface:
130 ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
131 ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local()
136 UDPv6SocketProtocol provides an internet protocol stream socket based on the UDP protocol
139 This class is utilized as the protocol class of the ProtocolClientSocketHandle
140 via the Socket Handle typedefs above.
142 \see UDPv4SocketProtocol
144 class UDPv6SocketProtocol
145 : public ConcreteSocketProtocol<UDPv6Socket_Policy, UDPv6SocketProtocol>,
146 public UDPSocketProtocol,
147 public INet6MulticastSocketProtocol,
148 public BSDSocketProtocol,
149 public DatagramSocketProtocol,
150 public AddressableBSDSocketProtocol
153 //-////////////////////////////////////////////////////////////////////////
154 // internal interface
156 ///\name Constructors
159 void init_client() const; ///< Create unconnected client socket
160 /**< \note This member is implicitly called from the
161 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
163 void init_client(INet6SocketAddress const & address) const;
164 ///< Create client socket and connect
165 /**< Creates a new client socket and bind to the given
167 \param[in] address local address to bind to */
168 /**< \note This member is implicitly called from the
169 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
175 typedef ProtocolClientSocketHandle<UDPv6SocketProtocol> UDPv6ClientSocketHandle;
181 //-/////////////////////////////////////////////////////////////////////////////////////////////////
182 //#include "UDPSocketHandle.cci"
183 //#include "UDPSocketHandle.ct"
184 //#include "UDPSocketHandle.cti"
191 // c-file-style: "senf"
192 // indent-tabs-mode: nil
193 // ispell-local-dictionary: "american"
194 // compile-command: "scons -u test"
195 // comment-column: 40