Utils: Removed ErrnoException and implemented generic Exception base-class
[senf.git] / Socket / Protocols / Raw / TunTapSocketHandle.cc
index 80d72bc..564a8b5 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
 // 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
@@ -50,7 +50,7 @@ prefix_ void senf::TapProtocol::init_client(std::string const & interface_name,
 {
     int f;
     if ( (f = ::open("/dev/net/tun", O_RDWR)) < 0 )
-        throwErrno();
+        throw SystemException();
     struct ifreq ifr;
     ::memset( &ifr, 0, sizeof(ifr));
     ifr.ifr_flags = IFF_TAP;
@@ -58,16 +58,10 @@ prefix_ void senf::TapProtocol::init_client(std::string const & interface_name,
         ifr.ifr_flags |= IFF_NO_PI;
     interface_name.copy( ifr.ifr_name, IFNAMSIZ);
     if (::ioctl(f, TUNSETIFF, (void *) &ifr) < 0 )
-        throwErrno();
+        throw SystemException();
     fd(f);
 }
 
-prefix_ std::auto_ptr<senf::SocketProtocol> senf::TapProtocol::clone()
-    const
-{
-    return std::auto_ptr<SocketProtocol>(new TapProtocol());
-}
-
 prefix_ unsigned senf::TapProtocol::available()
   const
 {
@@ -75,7 +69,7 @@ prefix_ unsigned senf::TapProtocol::available()
       return 0;
   ssize_t l = ::recv(fd(),0,0,MSG_PEEK | MSG_TRUNC);
   if (l < 0)
-      //throwErrno();
+      //throw SystemException();
       return 1588;
   return l;
 }
@@ -90,7 +84,7 @@ prefix_ unsigned senf::TapProtocol::available()
       return 0;
   int n;
   if (::ioctl(body().fd(),SIOCINQ,&n) < 0)
-      throwErrno();
+      throw SystemException();
   return n;
 }
 */