basic implementation of Unix Domain Sockets, for now Datagram only. docs mostly missing.
[senf.git] / Socket / Protocols / UN / UNDatagramSocketHandle.hh
1 // $Id$
2 //
3 // Copyright (C) 2007 
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the
17 // Free Software Foundation, Inc.,
18 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20 /** \file
21     \brief UNDatagramSocketHandle public header */
22
23 #ifndef HH_UNDatagramSocketHandle_
24 #define HH_UNDatagramSocketHandle_ 1
25
26 // Custom includes
27 #include "UNAddressing.hh"
28 #include "UNProtocol.hh"
29 #include "../../../Socket/Protocols/BSDSocketProtocol.hh"
30 #include "../../../Socket/FramingPolicy.hh"
31 #include "../../../Socket/CommunicationPolicy.hh"
32 #include "../../../Socket/ReadWritePolicy.hh"
33 #include "../../../Socket/BufferingPolicy.hh"
34 #include "../../../Socket/ProtocolClientSocketHandle.hh"
35
36
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         UnconnectedCommunicationPolicy,
50         ReadablePolicy,
51         WriteablePolicy,
52         SocketBufferingPolicy
53         >::policy UNDatagramSocket_Policy;   
54
55     class UNDatagramSocketProtocol
56         : public ConcreteSocketProtocol<UNDatagramSocket_Policy>,
57           public UNProtocol, 
58           public BSDSocketProtocol,
59           public AddressableBSDSocketProtocol
60     {
61     public:
62         ///////////////////////////////////////////////////////////////////////////
63         // internal interface
64
65         ///\name Constructors
66         ///@{
67
68         void init_client() const;       ///< Create unconnected client socket
69                                         /**< \note This member is implicitly called from the
70                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
71                                              constructor */
72         void init_client(UNSocketAddress const & address) const;
73                                         ///< Create client socket and bind
74                                         /**< Creates a new client socket and bind to the given
75                                              address.
76                                              \param[in] local address to bind to */
77                                         /**< \note This member is implicitly called from the
78                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
79                                              constructor */
80         
81         ///@}
82         ///\name Abstract Interface Implementation
83
84         std::auto_ptr<SocketProtocol> clone() const;
85
86         ///@}
87     };
88
89     typedef ProtocolClientSocketHandle<UNDatagramSocketProtocol> UNDatagramClientSocketHandle;
90
91     typedef MakeSocketPolicy<
92         UNDatagramSocket_Policy,
93         UNAddressingPolicy
94         >::policy UDPv6Socket_Policy;
95 }
96 ///////////////////////////////hh.e////////////////////////////////////////
97 //#include "UNDatagramSocketHandle.cci"
98 //#include "UNDatagramSocketHandle.ct"
99 //#include "UNDatagramSocketHandle.cti"
100 #endif
101
102 \f
103 // Local Variables:
104 // mode: c++
105 // fill-column: 100
106 // comment-column: 40
107 // c-file-style: "senf"
108 // indent-tabs-mode: nil
109 // ispell-local-dictionary: "american"
110 // compile-command: "scons -u test"
111 // End: