Fix documentation build under maverick (doxygen 1.7.1)
[senf.git] / senf / Socket / Protocols / INet / ConnectedRawINetSocketHandle.hh
1 // $Id: ConnectedRawINetSocketHandle.hh 597 2008-01-15 09:16:20Z g0dil $
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 #ifndef CONNECTEDHH_SENF_Socket_Protocols_INet_RawINetSocketHandle_
24 #define CONNECTEDHH_SENF_Socket_Protocols_INet_RawINetSocketHandle_
25
26 // Custom includes
27 #include "INetAddressing.hh"
28 #include "RawINetSocketProtocol.hh"
29 #include <senf/Socket/Protocols/BSDSocketProtocol.hh>
30 #include <senf/Socket/Protocols/DatagramSocketProtocol.hh>
31 #include <senf/Socket/FramingPolicy.hh>
32 #include <senf/Socket/CommunicationPolicy.hh>
33 #include <senf/Socket/ReadWritePolicy.hh>
34 #include <senf/Socket/ProtocolClientSocketHandle.hh>
35
36
37 //-/////////////////////////////////////////////////////////////////////////////////////////////////
38
39 namespace senf {
40
41     /// \addtogroup concrete_protocol_group
42     //\{
43
44     typedef MakeSocketPolicy<
45         INet4AddressingPolicy,
46         DatagramFramingPolicy,
47         ConnectedCommunicationPolicy,
48         ReadablePolicy,
49         WriteablePolicy
50         >::policy ConnectedRawV4Socket_Policy;   ///< Socket Policy of the Connected RawV4 Protocol
51
52     /** \brief IPv4 RAW Socket Protocol, connected
53
54         \par Socket Handle typedefs:
55             \ref ConnectedRawV4ClientSocketHandle (ProtocolClientSocketHandle)
56
57         \par Policy Interface:
58             ClientSocketHandle::read(), ClientSocketHandle::write(), ClientSocketHandle::bind(),
59             ClientSocketHandle::local(), ClientSocketHandle::connect(), ClientSocketHandle::peer()
60
61         \par Address Type:
62             INet4SocketAddress
63
64         ConnectedRawV4SocketProtocol provides an Internet protocol raw socket based on IPv4
65         addressing. This socket will put data written to it onto the IPv4 layer: if you call
66         writeto don't include the header!
67
68         On the other hand `read` will return the packet data including the IP header.
69         This behaviour is strange and differs from the behaviour of IPv6 RAW sockets and should be
70         changed in the future.
71
72         This class is utilized as the protocol class of the ProtocolClientSocketHandle
73         via the Socket Handle typedefs above.
74
75         \attention If socket handle with ConnectedRawV4SocketProtocol is connected via
76             INet4SocketAddress, the port number is interpreted as protocol number for IPv4
77             layer. Please refer manpage: "man 7 raw".
78
79         \see ConnectedRawV6SocketProtocol
80         \see RawV4SocketProtocol
81         \see RawV6SocketProtocol
82      */
83     class ConnectedRawV4SocketProtocol
84         : public ConcreteSocketProtocol<ConnectedRawV4Socket_Policy, ConnectedRawV4SocketProtocol>,
85           public RawINetSocketProtocol,
86           public BSDSocketProtocol,
87           public DatagramSocketProtocol,
88           public AddressableBSDSocketProtocol
89     {
90     public:
91         //-////////////////////////////////////////////////////////////////////////
92         // internal interface
93
94         ///\name Constructors
95         //\{
96
97         void init_client() const;       ///< Create unconnected client socket for IPPROTO_RAW
98                                         /**< \note This member is implicitly called from the
99                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
100                                              constructor */
101         void init_client(int const & protocol) const;
102                                         ///< Create unconnected client socket for protocol
103
104         void init_client(int const & protocol, INet4SocketAddress const & address) const;
105                                         ///< Create client socket and connect
106                                         /**< Creates a new client socket for the given protocol and
107                                              connects to the given address.
108                                              \param[in] protocol Layer 4 protocol to filter for / to
109                                                  send
110                                              \param[in] address local address to connect to */
111
112         //\}
113     };
114
115     typedef ProtocolClientSocketHandle<ConnectedRawV4SocketProtocol>
116         ConnectedRawV4ClientSocketHandle;
117
118
119
120
121 //-/////////////////////////////////////////////////////////////////////////////////////////////////
122     typedef MakeSocketPolicy<
123         INet6AddressingPolicy,
124         DatagramFramingPolicy,
125         ConnectedCommunicationPolicy,
126         ReadablePolicy,
127         WriteablePolicy
128         >::policy ConnectedRawV6Socket_Policy;   ///< Socket Policy of the RawV6 Protocol
129
130     /** \brief IPv6 RAW Socket Protocol, connected
131
132         \par Socket Handle typedefs:
133         \ref ConnectedRawV6ClientSocketHandle (ProtocolClientSocketHandle)
134
135         \par Policy Interface:
136             ClientSocketHandle::read(), ClientSocketHandle::write(), ClientSocketHandle::bind(),
137             ClientSocketHandle::local(), ClientSocketHandle::connect(), ClientSocketHandle::peer()
138
139         \par Address Type:
140             INet6Address
141
142         ConnectedRawV6SocketProtocol provides an internet protocol raw socket based on IPv6
143         addressing which is connected to certain peer.  This socket will put data written to it onto
144         the IPv6 layer: if you call writeto don't include the header!  On the other hand `read` will
145         return the packet data on top of the IPv6 layer, excluding the IP header.  Note: This
146         behaviour is differs from the behaviour of IPv4 RAW sockets.
147
148         This class is utilized as the protocol class of the ProtocolClientSocketHandle
149         via the Socket Handle typedefs above.
150
151         \attention If socket handle with ConnectedRawV6SocketProtocol is connected via
152             INet6SocketAddress, the port number is interpreted as protocol number for IPv6
153             layer. Please refer manpage: "man 7 ipv6".
154
155         \see ConnectedRawV4SocketProtocol
156         \see RawV4SocketProtocol
157         \see RawV6SocketProtocol
158      */
159     class ConnectedRawV6SocketProtocol
160         : public ConcreteSocketProtocol<ConnectedRawV6Socket_Policy, ConnectedRawV6SocketProtocol>,
161           public RawINetSocketProtocol,
162           public BSDSocketProtocol,
163           public DatagramSocketProtocol,
164           public AddressableBSDSocketProtocol
165     {
166     public:
167         //-////////////////////////////////////////////////////////////////////////
168         // internal interface
169
170         ///\name Constructors
171         //\{
172
173         void init_client() const;       ///< Create unconnected client socket for IPPROTO_RAW
174                                         /**< \note This member is implicitly called from the
175                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
176                                              constructor */
177
178         void init_client(int const & protocol) const;
179                                         ///< Create unconnected client socket for protocol
180
181         void init_client(int const & protocol, INet6SocketAddress const & address) const;
182                                         ///< Create client socket and connect
183                                         /**< Creates a new client socket for the given protocol and
184                                              connects to the given address.
185                                              \param[in] protocol Layer 4 protocol to filter for / to
186                                                  send
187                                              \param[in] address local address to connect to
188                                              \note This member is implicitly called from the //
189                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
190                                              constructor (??) */
191
192         //\}
193     };
194
195     typedef ProtocolClientSocketHandle<ConnectedRawV6SocketProtocol>
196         ConnectedRawV6ClientSocketHandle;
197
198     //\}
199
200 }
201
202 #endif /*CONNECTEDHH_SENF_Socket_Protocols_INet_RawINetSocketHandle_*/
203
204 \f
205 // Local Variables:
206 // mode: c++
207 // fill-column: 100
208 // c-file-style: "senf"
209 // indent-tabs-mode: nil
210 // ispell-local-dictionary: "american"
211 // compile-command: "scons -u test"
212 // comment-column: 40
213 // End: