change to tapSocketProtocol to save interface index
[senf.git] / Socket / Protocols / Raw / TunTapSocketHandle.hh
index 51f9fe7..41c422f 100644 (file)
@@ -1,9 +1,9 @@
 // $Id:PacketSocketHandle.hh 218 2007-03-20 14:39:32Z tho $
 //
 // Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief PacketProtocol and PacketSocketHandle public header
-
-    \todo Implement global promisc() helper based on ioctl() interface.
+    \brief PacketSocketProtocol and PacketSocketHandle public header
  */
 
-#ifndef HH_TunTapSocketHandle_
-#define HH_TunTapSocketHandle_ 1
+#ifndef HH_SENF_Socket_Protocols_Raw_TunTapSocketHandle_
+#define HH_SENF_Socket_Protocols_Raw_TunTapSocketHandle_ 1
 
 // Custom includes
 #include "../../../Socket/SocketPolicy.hh"
@@ -36,7 +34,6 @@
 #include "../../../Socket/FramingPolicy.hh"
 #include "../../../Socket/CommunicationPolicy.hh"
 #include "../../../Socket/ReadWritePolicy.hh"
-#include "../../../Socket/BufferingPolicy.hh"
 #include "../../../Socket/Protocols/BSDSocketProtocol.hh"
 #include "LLAddressing.hh"
 
@@ -54,8 +51,7 @@ namespace senf {
         DatagramFramingPolicy,
         ConnectedCommunicationPolicy,
         ReadablePolicy,
-        WriteablePolicy,
-        SocketBufferingPolicy
+        WriteablePolicy
         >::policy Tap_Policy;        ///< Policy for TAP
 
     /** \brief TAP
@@ -74,42 +70,44 @@ namespace senf {
         This class is utilized as the protocol class of the ProtocolClientSocketHandle via the
         Socket Handle typedefs above.
      */
-    class TapProtocol
-        : public ConcreteSocketProtocol<Tap_Policy>,
-          public BSDSocketProtocol,
-          public senf::pool_alloc_mixin<TapProtocol>
+    class TapSocketProtocol
+        : public ConcreteSocketProtocol<Tap_Policy,TapSocketProtocol>,
+          public BSDSocketProtocol
     {
     public:
         ///\name Constructors
         ///@{
-        void init_client() const;
+        std::string init_client() const;
                                         ///< Create TAP socket
                                         /**< \todo document me */
                                         /**< \note This member is implicitly called from the
                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
                                              constructor */
-        void init_client(std::string const & interface_name, bool const NO_PI=true) const;
+        std::string init_client(std::string const & interface_name, bool const NO_PI=true) const;
                                         ///< Create TAP socket
                                         /**< \todo document me
                                              \param[in] address remote address to connect to */
                                         /**< \note This member is implicitly called from the
                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
                                              constructor */
-        
+
         ///@}
 
         ///\name Abstract Interface Implementation
         ///@{
 
-        std::auto_ptr<SocketProtocol> clone() const;
         unsigned available() const;
         bool eof() const;
+        unsigned int ifaceIndex() const;
+        std::string ifaceName() const;
 
+    private:
+       mutable unsigned int ifaceIndex_;
         ///@}
     };
 
-    typedef ProtocolClientSocketHandle<TapProtocol> TapSocketHandle;
-                                        ///< SocketHandle of TapProtocol
+    typedef ProtocolClientSocketHandle<TapSocketProtocol> TapSocketHandle;
+                                        ///< SocketHandle of TapSocketProtocol
                                         /**< \related TapPrototol */
 
     /// @}
@@ -122,7 +120,7 @@ namespace senf {
 //#include "TunTapSocketHandle.mpp"
 #endif
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100