6f597350eb93a7bdfc87f9c9306f555ccc90993b
[senf.git] / senf / Socket / Protocols / UN / UNDatagramSocketHandle.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 UNDatagramSocketHandle public header */
25
26 #ifndef HH_SENF_Socket_Protocols_UN_UNDatagramSocketHandle_
27 #define HH_SENF_Socket_Protocols_UN_UNDatagramSocketHandle_ 1
28
29 // Custom includes
30 #include "UNAddressing.hh"
31 #include "UNSocketProtocol.hh"
32 #include <senf/Socket/Protocols/BSDSocketProtocol.hh>
33 #include <senf/Socket/FramingPolicy.hh>
34 #include <senf/Socket/CommunicationPolicy.hh>
35 #include <senf/Socket/ReadWritePolicy.hh>
36 #include <senf/Socket/ProtocolClientSocketHandle.hh>
37
38 //#include "UNDatagramSocketHandle.mpp"
39 //-/////////////////////////////////////////////////////////////////////////////////////////////////
40
41 namespace senf {
42
43     /// \addtogroup concrete_protocol_group
44     //\{
45
46     typedef MakeSocketPolicy<
47         UNAddressingPolicy,
48         DatagramFramingPolicy,
49         UnconnectedCommunicationPolicy,
50         ReadablePolicy,
51         WriteablePolicy
52         >::policy UNDatagramSocket_Policy;   ///< Socket Policy of the Unix Domain Datagram Protocol
53
54     /** \brief Unix Domain Datagram Socket Protocol
55
56         \par Socket Handle typedefs:
57             \ref UNDatagramClientSocketHandle (ProtocolClientSocketHandle)
58
59         \par Policy Interface: (to be checked)
60             ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
61             ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local()
62
63         \par Address Type:
64             UNSocketAddress
65
66         UNDatagramSocketProtocol provides an datagram protocol socket based on the unix domain
67         addressing.
68
69         This class is utilized as the protocol class of the ProtocolClientSocketHandle via the
70         Socket Handle typedefs above.
71     */
72     class UNDatagramSocketProtocol
73         : public ConcreteSocketProtocol<UNDatagramSocket_Policy,
74                                         UNDatagramSocketProtocol>,
75           public UNSocketProtocol,
76           public BSDSocketProtocol,
77           public AddressableBSDSocketProtocol
78     {
79     public:
80         //-////////////////////////////////////////////////////////////////////////
81         // internal interface
82
83         ///\name Constructors
84         //\{
85
86         void init_client() const;       ///< Create unconnected client socket
87                                         /**< \note This member is implicitly called from the
88                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
89                                              constructor */
90         void init_client(UNSocketAddress const & address) const;
91                                         ///< Create client socket and bind
92                                         /**< Creates a new client socket and bind to the given
93                                              address.
94                                              \param[in] address local address to bind to */
95                                         /**< \note This member is implicitly called from the
96                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
97                                              constructor */
98
99         //\}
100     };
101
102     typedef ProtocolClientSocketHandle<UNDatagramSocketProtocol> UNDatagramClientSocketHandle;
103
104     //\}
105
106 }
107 //-/////////////////////////////////////////////////////////////////////////////////////////////////
108 //#include "UNDatagramSocketHandle.cci"
109 //#include "UNDatagramSocketHandle.ct"
110 //#include "UNDatagramSocketHandle.cti"
111 #endif
112
113 \f
114 // Local Variables:
115 // mode: c++
116 // fill-column: 100
117 // comment-column: 40
118 // c-file-style: "senf"
119 // indent-tabs-mode: nil
120 // ispell-local-dictionary: "american"
121 // compile-command: "scons -u test"
122 // End: