2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum NETwork research (NET)
4 // David Wagner <david.wagner@fokus.fraunhofer.de>
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.
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.
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.
21 #ifndef RAWINETSOCKETHANDLE_HH_
22 #define RAWINETSOCKETHANDLE_HH_
26 #include "INetProtocol.hh"
27 #include "RawInetProtocol.hh"
28 #include "../../../Socket/Protocols/BSDSocketProtocol.hh"
29 #include "../../../Socket/FramingPolicy.hh"
30 #include "../../../Socket/CommunicationPolicy.hh"
31 #include "../../../Socket/ReadWritePolicy.hh"
32 #include "../../../Socket/BufferingPolicy.hh"
33 #include "../../../Socket/ProtocolClientSocketHandle.hh"
35 //#include "UDPSocketHandle.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
40 /// \addtogroup concrete_protocol_group
43 typedef MakeSocketPolicy<
44 INet4AddressingPolicy,
45 DatagramFramingPolicy,
46 UnconnectedCommunicationPolicy,
50 >::policy RawV4Socket_Policy; ///< Socket Policy of the RawV4 Protocol
52 /** \brief IPv4 RAW Socket Protocol
54 \par Socket Handle typedefs:
55 \ref RawV4ClientSocketHandle (ProtocolClientSocketHandle)
57 \par Policy Interface:
58 ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
59 ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local(),
60 ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
65 RawV4SocketProtocol provides an internet protocol raw socket based on IPv4 addressing.
67 This class is utilized as the protocol class of the ProtocolClientSocketHandle
68 via the Socket Handle typedefs above.
70 \see RawV6SocketProtocol
72 class RawV4SocketProtocol
73 : public ConcreteSocketProtocol<RawV4Socket_Policy>,
75 public RawInetProtocol,
76 public BSDSocketProtocol,
77 public AddressableBSDSocketProtocol//,
78 // public senf::pool_alloc_mixin<RawV4Socket_Policy>
81 ///////////////////////////////////////////////////////////////////////////
87 void init_client() const; ///< Create unconnected client socket for IPPROTO_RAW
88 /**< \note This member is implicitly called from the
89 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
91 void init_client(int const & protocol) const; ///< Create unconnected client socket for protocol
93 void init_client(int const & protocol, INet4SocketAddress const & address) const;
94 ///< Create client socket and bind
95 /**< Creates a new client socket for the given protocol and binds to the given
97 \param[in] protocol Layer 4 protocol to filter for / to send
98 \param[in] address local address to bind to */
101 ///\name Abstract Interface Implementation
103 std::auto_ptr<SocketProtocol> clone() const;
108 typedef ProtocolClientSocketHandle<RawV4SocketProtocol> RawV4ClientSocketHandle;
113 //////////////////////////////////////////////////////////////////// Raw IPv6 Socket //////////////////////////////////////
114 typedef MakeSocketPolicy<
115 INet6AddressingPolicy,
116 DatagramFramingPolicy,
117 UnconnectedCommunicationPolicy,
120 SocketBufferingPolicy
121 >::policy RawV6Socket_Policy; ///< Socket Policy of the RawV6 Protocol
123 /** \brief IPv6 RAW Socket Protocol
125 \par Socket Handle typedefs:
126 \ref RawV6ClientSocketHandle (ProtocolClientSocketHandle)
128 \par Policy Interface:
129 ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
130 ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local(),
131 ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
136 RawV6SocketProtocol provides an internet protocol stream socket based on IPv6 addressing.
138 This class is utilized as the protocol class of the ProtocolClientSocketHandle
139 via the Socket Handle typedefs above.
141 \see RawV4SocketProtocol
143 class RawV6SocketProtocol
144 : public ConcreteSocketProtocol<RawV6Socket_Policy>,
146 public RawInetProtocol,
147 public BSDSocketProtocol,
148 public AddressableBSDSocketProtocol//,
149 // public senf::pool_alloc_mixin<RawV6SocketProtocol>
152 ///////////////////////////////////////////////////////////////////////////
153 // internal interface
155 ///\name Constructors
158 void init_client() const; ///< Create unconnected client socket for IPPROTO_RAW
159 /**< \note This member is implicitly called from the
160 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
163 void init_client(int const & protocol) const; ///< Create unconnected client socket for protocol
165 void init_client(int const & protocol, INet6SocketAddress const & address) const;
166 ///< Create client socket and bind
167 /**< Creates a new client socket for the given protocol and binds to the given
169 \param[in] protocol Layer 4 protocol to filter for / to send
170 \param[in] address local address to bind to */
171 /**< \note This member is implicitly called from the
172 ProtocolClientSocketHandle::ProtocolClientSocketHandle()
176 ///\name Abstract Interface Implementation
178 std::auto_ptr<SocketProtocol> clone() const;
183 typedef ProtocolClientSocketHandle<RawV6SocketProtocol> RawV6ClientSocketHandle;
189 #endif /*RAWINETSOCKETHANDLE_HH_*/