TunTapSocketHandle.hh

Go to the documentation of this file.
00001 // $Id:PacketSocketHandle.hh 218 2007-03-20 14:39:32Z tho $
00002 //
00003 // Copyright (C) 2008
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Thorsten Horstmann <tho@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00027 #ifndef HH_SENF_Socket_Protocols_Raw_TunTapSocketHandle_
00028 #define HH_SENF_Socket_Protocols_Raw_TunTapSocketHandle_ 1
00029 
00030 // Custom includes
00031 #include <senf/Socket/SocketPolicy.hh>
00032 #include <senf/Socket/SocketProtocol.hh>
00033 #include <senf/Socket/ProtocolClientSocketHandle.hh>
00034 #include <senf/Socket/FramingPolicy.hh>
00035 #include <senf/Socket/CommunicationPolicy.hh>
00036 #include <senf/Socket/ReadWritePolicy.hh>
00037 #include <senf/Socket/Protocols/BSDSocketProtocol.hh>
00038 
00039 //#include "TunTapSocketHandle.mpp"
00040 //#include "TunTapSocketHandle.ih"
00041 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00042 
00043 namespace senf {
00044 
00046     //\{
00047 
00048     typedef MakeSocketPolicy<
00049         NoAddressingPolicy,
00050         DatagramFramingPolicy,
00051         ConnectedCommunicationPolicy,
00052         ReadablePolicy,
00053         WriteablePolicy
00054         >::policy Tap_Policy;        
00055 
00077     class TapSocketProtocol
00078         : public ConcreteSocketProtocol<Tap_Policy,TapSocketProtocol>,
00079           public BSDSocketProtocol
00080     {
00081     public:
00083         //\{
00084         void init_client() const;       
00085 
00095         void init_client(std::string const & interface_name, bool NO_PI=true) const;
00097 
00112         //\}
00113 
00115         //\{
00116 
00117         unsigned available() const;
00118         bool eof() const;               
00119         unsigned int ifaceIndex() const;
00120         std::string ifaceName() const;  
00121 
00122     private:
00123         mutable unsigned int ifaceIndex_;
00124         //\}
00125     };
00126 
00127     typedef ProtocolClientSocketHandle<TapSocketProtocol> TapSocketHandle;
00129 
00131     //\}
00132 }
00133 
00134 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00135 //#include "TunTapSocketHandle.cci"
00136 //#include "TunTapSocketHandle.ct"
00137 //#include "TunTapSocketHandle.cti"
00138 //#include "TunTapSocketHandle.mpp"
00139 #endif
00140 
00141 
00142 // Local Variables:
00143 // mode: c++
00144 // fill-column: 100
00145 // c-file-style: "senf"
00146 // indent-tabs-mode: nil
00147 // ispell-local-dictionary: "american"
00148 // compile-command: "scons -u test"
00149 // comment-column: 40
00150 // End: