Merged revisions 570-572,574-575,578-579,581-595,598-611 via svnmerge from
[senf.git] / Socket / Protocols / UN / ConnectedUNDatagramSocketHandle.hh
1 // $Id$
2 //
3 // Copyright (C) 2007 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS) 
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY 
6 //     David Wagner <dw6@berlios.de>
7 //
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.
12 //
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.
17 //
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.
22
23 /** \file
24     \brief ConnectedUNDatagramSocketHandle public header */
25
26 #ifndef CONNECTEDUNDATAGRAMSOCKETHANDLE_HH_
27 #define CONNECTEDUNDATAGRAMSOCKETHANDLE_HH_
28
29 // Custom includes
30 #include "UNAddressing.hh"
31 #include "UNProtocol.hh"
32 #include "../../../Socket/Protocols/BSDSocketProtocol.hh"
33 #include "../../../Socket/FramingPolicy.hh"
34 #include "../../../Socket/CommunicationPolicy.hh"
35 #include "../../../Socket/ReadWritePolicy.hh"
36 #include "../../../Socket/ProtocolClientSocketHandle.hh"
37
38 //#include "UNDatagramSocketHandle.mpp"
39 ///////////////////////////////hh.p////////////////////////////////////////
40
41 namespace senf {
42
43     /// \addtogroup concrete_protocol_group
44     /// @{
45
46     typedef MakeSocketPolicy<
47         UNAddressingPolicy,
48         DatagramFramingPolicy,
49         ConnectedCommunicationPolicy,
50         ReadablePolicy,
51         WriteablePolicy
52         >::policy ConnectedUNDatagramSocket_Policy;   ///< Socket Policy of the Unix Domain Datagram Protocol (connected)
53
54     /** \brief Unix Domain Datagram Socket Protocol (connected)
55
56         \par Socket Handle typedefs:
57             \ref ConnectedUNDatagramClientSocketHandle (ProtocolClientSocketHandle)
58
59         \par Policy Interface: (to be checked)
60             ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
61             ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local(),
62             ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
63
64         \par Address Type:
65             UNAddress
66
67         ConnectedUNDatagramSocketProtocol provides an datagram protocol socket based on the unix domain  addressing which operates in a connected mode.
68
69         This class is utilized as the protocol class of the ProtocolClientSocketHandle
70         via the Socket Handle typedefs above.
71
72     */
73     class ConnectedUNDatagramSocketProtocol
74         : public ConcreteSocketProtocol<ConnectedUNDatagramSocket_Policy>,
75           public UNProtocol, 
76           public BSDSocketProtocol,
77           public AddressableBSDSocketProtocol,
78           public senf::pool_alloc_mixin<ConnectedUNDatagramSocketProtocol>
79     {
80     public:
81         ///////////////////////////////////////////////////////////////////////////
82         // internal interface
83
84         ///\name Constructors
85         ///@{
86
87         void init_client() const;       ///< Create unconnected client socket
88                                         /**< \note This member is implicitly called from the
89                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
90                                              constructor */
91         void init_client(UNSocketAddress const & address) const; 
92                                         ///< Create client socket and connect
93                                         /**< Creates a new client socket and connects to the given
94                                              address.
95                                              \param[in] address peer address to connect to */
96                                         /**< \note This member is implicitly called from the
97                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
98                                              constructor */
99         
100         ///@}
101         ///\name Abstract Interface Implementation
102
103         std::auto_ptr<SocketProtocol> clone() const;
104
105         ///@}
106     };
107
108     typedef ProtocolClientSocketHandle<ConnectedUNDatagramSocketProtocol> ConnectedUNDatagramClientSocketHandle;
109
110 }
111
112 ///////////////////////////////hh.e////////////////////////////////////////
113 //#include "ConnectedUNDatagramSocketHandle.cci"
114 //#include "ConnectedUNDatagramSocketHandle.ct"
115 //#include "ConnectedUNDatagramSocketHandle.cti"
116 #endif
117
118 \f
119 // Local Variables:
120 // mode: c++
121 // fill-column: 100
122 // comment-column: 40
123 // c-file-style: "senf"
124 // indent-tabs-mode: nil
125 // ispell-local-dictionary: "american"
126 // compile-command: "scons -u test"
127 // End: