X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FNetdeviceController.hh;h=6e8c06c87529bbef186ed8e5191255954b7a9543;hb=82e8df5de8b11448423388632e8602ad97bc7885;hp=babe980fbd38663c664d26095e70ee88b65a629c;hpb=ef0be4d0484ff659d17e02a421ad5beaaa76e646;p=senf.git diff --git a/Socket/NetdeviceController.hh b/Socket/NetdeviceController.hh index babe980..6e8c06c 100644 --- a/Socket/NetdeviceController.hh +++ b/Socket/NetdeviceController.hh @@ -29,13 +29,14 @@ // Custom includes #include -#include #include "Protocols/Raw/MACAddress.hh" //#include "NetdeviceController.mpp" ///////////////////////////////hh.p//////////////////////////////////////// +struct ifreq; + namespace senf { /** \brief Netdevice Controller @@ -44,8 +45,6 @@ namespace senf { devices. Note, that some setting members are privileged operations. \see manual page netdevice(7) for more informations. - - \todo Add 'promisc' member to enable/disable promiscuous mode */ class NetdeviceController { @@ -61,18 +60,36 @@ namespace senf { ///< return hardware address void hardwareAddress(const MACAddress &newAddress); ///< set hardware address - /**< Note, that setting the hardware address is a privileged operation. */ + /**< Changes the hardware address of the interface. + Note, that setting the hardware address is a privileged + operation. It is only allowed when the interface is not + up. If the interface is up, this call will cause an + SystemException to be thrown. */ std::string interfaceName() const; ///< return interface name void interfaceName(const std::string &newName); ///< set interface name - /**< Changes the name of the interface. Note, that this is a - privileged operation. It is only allowed when the interface is not up. */ + /**< Changes the name of the interface. + Note, that setting the name is a privileged operation. + It is only allowed when the interface is not up. If + the interface is up, this call will cause an + SystemException to be thrown. */ + int mtu() const; ///< return the Maximum Transmission Unit void mtu(int new_mtu); ///< set the Maximum Transmission Unit /**< Set the MTU (Maximum Transfer Unit) of the device. Note, that this is a privileged operation. - Setting the MTU to too small values may cause kernel crashes. */ + Setting the MTU to too small values may cause kernel + crashes. */ + + bool promisc() const; ///< return \c true if interface is in promiscuous mode + void promisc(bool mode); ///< enable/disable promiscuous mode of the interface + /**< Note, that this is a privileged operation. */ + + bool isUp() const; ///< return \c true if interface is up + void up(); ///< ifconfig up interface + void down(); ///< ifconfig down interface + private: void openSocket(); void doIoctl(ifreq& ifr, int request) const;