751aef0876ebdd19338d86f07432386f312c673b
[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 PacketSocketProtocol and PacketSocketHandle public header
25  */
26
27 #ifndef HH_TunTapSocketHandle_
28 #define HH_TunTapSocketHandle_ 1
29
30 // Custom includes
31 #include "../../../Socket/SocketPolicy.hh"
32 #include "../../../Socket/SocketProtocol.hh"
33 #include "../../../Socket/ProtocolClientSocketHandle.hh"
34 #include "../../../Socket/FramingPolicy.hh"
35 #include "../../../Socket/CommunicationPolicy.hh"
36 #include "../../../Socket/ReadWritePolicy.hh"
37 #include "../../../Socket/Protocols/BSDSocketProtocol.hh"
38 #include "LLAddressing.hh"
39
40 //#include "TunTapSocketHandle.mpp"
41 //#include "TunTapSocketHandle.ih"
42 ///////////////////////////////hh.p////////////////////////////////////////
43
44 namespace senf {
45
46     /// \addtogroup concrete_protocol_group
47     /// @{
48
49     typedef MakeSocketPolicy<
50         NoAddressingPolicy,
51         DatagramFramingPolicy,
52         ConnectedCommunicationPolicy,
53         ReadablePolicy,
54         WriteablePolicy
55         >::policy Tap_Policy;        ///< Policy for TAP
56
57     /** \brief TAP
58
59         \todo document me
60
61         \par Socket Handle typedefs:
62
63
64         \par Policy Interface:
65
66
67         \par Address Type:
68
69
70         This class is utilized as the protocol class of the ProtocolClientSocketHandle via the
71         Socket Handle typedefs above.
72      */
73     class TapSocketProtocol
74         : public ConcreteSocketProtocol<Tap_Policy,TapSocketProtocol>,
75           public BSDSocketProtocol
76     {
77     public:
78         ///\name Constructors
79         ///@{
80         void init_client() const;
81                                         ///< Create TAP socket
82                                         /**< \todo document me */
83                                         /**< \note This member is implicitly called from the
84                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
85                                              constructor */
86         void init_client(std::string const & interface_name, bool const NO_PI=true) const;
87                                         ///< Create TAP socket
88                                         /**< \todo document me
89                                              \param[in] address remote address to connect to */
90                                         /**< \note This member is implicitly called from the
91                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
92                                              constructor */
93         
94         ///@}
95
96         ///\name Abstract Interface Implementation
97         ///@{
98
99         unsigned available() const;
100         bool eof() const;
101
102         ///@}
103     };
104
105     typedef ProtocolClientSocketHandle<TapSocketProtocol> TapSocketHandle;
106                                         ///< SocketHandle of TapSocketProtocol
107                                         /**< \related TapPrototol */
108
109     /// @}
110 }
111
112 ///////////////////////////////hh.e////////////////////////////////////////
113 //#include "TunTapSocketHandle.cci"
114 //#include "TunTapSocketHandle.ct"
115 //#include "TunTapSocketHandle.cti"
116 //#include "TunTapSocketHandle.mpp"
117 #endif
118
119 \f
120 // Local Variables:
121 // mode: c++
122 // fill-column: 100
123 // c-file-style: "senf"
124 // indent-tabs-mode: nil
125 // ispell-local-dictionary: "american"
126 // compile-command: "scons -u test"
127 // comment-column: 40
128 // End: