20c9977dc5dce1e603aa478e5903b035f9d38d91
[senf.git] / Socket / Protocols / UN / UNDatagramSocketHandle.hh
1 // Copyright (C) 2007 
2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum NETwork research (NET)
4 //     David Wagner <david.wagner@fokus.fraunhofer.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 /** \file
22     \brief UNDatagramSocketHandle public header */
23
24 #ifndef HH_UNDatagramSocketHandle_
25 #define HH_UNDatagramSocketHandle_ 1
26
27 // Custom includes
28 #include "UNAddressing.hh"
29 #include "UNProtocol.hh"
30 #include "../../../Socket/Protocols/BSDSocketProtocol.hh"
31 #include "../../../Socket/FramingPolicy.hh"
32 #include "../../../Socket/CommunicationPolicy.hh"
33 #include "../../../Socket/ReadWritePolicy.hh"
34 #include "../../../Socket/BufferingPolicy.hh"
35 #include "../../../Socket/ProtocolClientSocketHandle.hh"
36
37
38
39 //#include "UNDatagramSocketHandle.mpp"
40 ///////////////////////////////hh.p////////////////////////////////////////
41
42 namespace senf {
43
44     /// \addtogroup concrete_protocol_group
45     /// @{
46
47     typedef MakeSocketPolicy<
48         UNAddressingPolicy,
49         DatagramFramingPolicy,
50         UnconnectedCommunicationPolicy,
51         ReadablePolicy,
52         WriteablePolicy,
53         SocketBufferingPolicy
54         >::policy UNDatagramSocket_Policy;   ///< Socket Policy of the Unix Domain Datagram Protocol
55
56     /** \brief Unix Domain Datagram Socket Protocol
57
58         \par Socket Handle typedefs:
59             \ref UNDatagramSocketHandle (ProtocolClientSocketHandle)
60
61         \par Policy Interface: (to be checked)
62             ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
63             ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local(),
64             ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
65
66         \par Address Type:
67             UNAddress
68
69         UNDatagramSocketProtocol provides an datagram protocol socket based on the unix domain  addressing.
70
71         This class is utilized as the protocol class of the ProtocolClientSocketHandle
72         via the Socket Handle typedefs above.
73
74     */
75     class UNDatagramSocketProtocol
76         : public ConcreteSocketProtocol<UNDatagramSocket_Policy>,
77           public UNProtocol, 
78           public BSDSocketProtocol,
79           public AddressableBSDSocketProtocol
80     {
81     public:
82         ///////////////////////////////////////////////////////////////////////////
83         // internal interface
84
85         ///\name Constructors
86         ///@{
87
88         void init_client() const;       ///< Create unconnected client socket
89                                         /**< \note This member is implicitly called from the
90                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
91                                              constructor */
92         void init_client(UNSocketAddress const & address) const;
93                                         ///< Create client socket and bind
94                                         /**< Creates a new client socket and bind to the given
95                                              address.
96                                              \param[in] local address to bind to */
97                                         /**< \note This member is implicitly called from the
98                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
99                                              constructor */
100         
101         ///@}
102         ///\name Abstract Interface Implementation
103
104         std::auto_ptr<SocketProtocol> clone() const;
105
106         ///@}
107     };
108
109     typedef ProtocolClientSocketHandle<UNDatagramSocketProtocol> UNDatagramClientSocketHandle;
110
111 }
112 ///////////////////////////////hh.e////////////////////////////////////////
113 //#include "UNDatagramSocketHandle.cci"
114 //#include "UNDatagramSocketHandle.ct"
115 //#include "UNDatagramSocketHandle.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: