Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Directories
  • File List
  • File Members

NetdeviceController.hh

Go to the documentation of this file.
00001 // $Id: NetdeviceController.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2007
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_NetdeviceController_
00028 #define HH_SENF_Socket_NetdeviceController_ 1
00029 
00030 // Custom includes
00031 #include <string>
00032 #include <boost/shared_ptr.hpp>
00033 
00034 //#include "NetdeviceController.mpp"
00035 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00036 
00037 struct ifreq;
00038 
00039 namespace senf {
00040 
00041     class MACAddress;
00042 
00043 
00051     class NetdeviceController
00052     {
00053     public:
00054         explicit NetdeviceController(std::string const & interface_name);
00056         explicit NetdeviceController(int interface_index);
00058         int interfaceIndex() const;     
00059         MACAddress hardwareAddress() const;
00061         void hardwareAddress(MACAddress const & newAddress);
00063 
00068         std::string interfaceName() const;
00070         void interfaceName(std::string const & newName);
00072 
00078         int mtu() const;                
00079         void mtu(int new_mtu);          
00080 
00085         int txqueuelen() const;         
00086         void txqueuelen(int new_mtu);   
00087 
00091         bool promisc() const;           
00092         void promisc(bool mode);        
00093 
00095         bool isUp() const;              
00096         void up();                      
00097         void down();                    
00098 
00099         struct SockFd {
00100             typedef boost::shared_ptr<SockFd> ptr;
00101             int fd;
00102             SockFd();
00103             ~SockFd();
00104         };
00105 
00106         static SockFd::ptr sockfd();
00107 
00108     private:
00109         void ifrName(ifreq & ifr) const;
00110         SockFd::ptr sockfd_;
00111         int ifindex_;
00112     };
00113 
00114 }
00115 
00116 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00117 //#include "NetdeviceController.cci"
00118 //#include "NetdeviceController.ct"
00119 //#include "NetdeviceController.cti"
00120 //#include "NetdeviceController.mpp"
00121 #endif
00122 
00123 
00124 // Local Variables:
00125 // mode: c++
00126 // fill-column: 100
00127 // c-file-style: "senf"
00128 // indent-tabs-mode: nil
00129 // ispell-local-dictionary: "american"
00130 // compile-command: "scons -u test"
00131 // comment-column: 40
00132 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research