NEW FILE HEADER / COPYRIGHT FORMAT
[senf.git] / Socket / Protocols / Raw / TunTapSocketHandle.hh
1 // $Id:PacketSocketHandle.hh 218 2007-03-20 14:39:32Z tho $
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institute for Open Communication Systems (FOKUS) 
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY 
6 //     Stefan Bund <g0dil@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 PacketProtocol and PacketSocketHandle public header
25
26     \todo Implement global promisc() helper based on ioctl() interface.
27  */
28
29 #ifndef HH_TunTapSocketHandle_
30 #define HH_TunTapSocketHandle_ 1
31
32 // Custom includes
33 #include "../../../Socket/SocketPolicy.hh"
34 #include "../../../Socket/SocketProtocol.hh"
35 #include "../../../Socket/ProtocolClientSocketHandle.hh"
36 #include "../../../Socket/FramingPolicy.hh"
37 #include "../../../Socket/CommunicationPolicy.hh"
38 #include "../../../Socket/ReadWritePolicy.hh"
39 #include "../../../Socket/BufferingPolicy.hh"
40 #include "../../../Socket/Protocols/BSDSocketProtocol.hh"
41 #include "LLAddressing.hh"
42
43 //#include "TunTapSocketHandle.mpp"
44 //#include "TunTapSocketHandle.ih"
45 ///////////////////////////////hh.p////////////////////////////////////////
46
47 namespace senf {
48
49     /// \addtogroup concrete_protocol_group
50     /// @{
51
52     typedef MakeSocketPolicy<
53         NoAddressingPolicy,
54         DatagramFramingPolicy,
55         ConnectedCommunicationPolicy,
56         ReadablePolicy,
57         WriteablePolicy,
58         SocketBufferingPolicy
59         >::policy Tap_Policy;        ///< Policy for TAP
60
61     /** \brief TAP
62
63         \todo document me
64
65         \par Socket Handle typedefs:
66
67
68         \par Policy Interface:
69
70
71         \par Address Type:
72
73
74         This class is utilized as the protocol class of the ProtocolClientSocketHandle via the
75         Socket Handle typedefs above.
76      */
77     class TapProtocol
78         : public ConcreteSocketProtocol<Tap_Policy>,
79           public BSDSocketProtocol,
80           public senf::pool_alloc_mixin<TapProtocol>
81     {
82     public:
83         ///\name Constructors
84         ///@{
85         void init_client() const;
86                                         ///< Create TAP socket
87                                         /**< \todo document me */
88                                         /**< \note This member is implicitly called from the
89                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
90                                              constructor */
91         void init_client(std::string const & interface_name, bool const NO_PI=true) const;
92                                         ///< Create TAP socket
93                                         /**< \todo document me
94                                              \param[in] address remote address to connect to */
95                                         /**< \note This member is implicitly called from the
96                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
97                                              constructor */
98         
99         ///@}
100
101         ///\name Abstract Interface Implementation
102         ///@{
103
104         std::auto_ptr<SocketProtocol> clone() const;
105         unsigned available() const;
106         bool eof() const;
107
108         ///@}
109     };
110
111     typedef ProtocolClientSocketHandle<TapProtocol> TapSocketHandle;
112                                         ///< SocketHandle of TapProtocol
113                                         /**< \related TapPrototol */
114
115     /// @}
116 }
117
118 ///////////////////////////////hh.e////////////////////////////////////////
119 //#include "TunTapSocketHandle.cci"
120 //#include "TunTapSocketHandle.ct"
121 //#include "TunTapSocketHandle.cti"
122 //#include "TunTapSocketHandle.mpp"
123 #endif
124
125 \f
126 // Local Variables:
127 // mode: c++
128 // fill-column: 100
129 // c-file-style: "senf"
130 // indent-tabs-mode: nil
131 // ispell-local-dictionary: "american"
132 // compile-command: "scons -u test"
133 // comment-column: 40
134 // End: