X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FNetdeviceController.hh;h=6e8c06c87529bbef186ed8e5191255954b7a9543;hb=b8ca4a544cce3e6023bb56b712a03d6362f2bb79;hp=cabf6a448743dc2530676cf2afff0053965fec23;hpb=6f838e26e6cfee2f1b429e3ddd096e3a0d80d0a5;p=senf.git diff --git a/Socket/NetdeviceController.hh b/Socket/NetdeviceController.hh index cabf6a4..6e8c06c 100644 --- a/Socket/NetdeviceController.hh +++ b/Socket/NetdeviceController.hh @@ -24,42 +24,71 @@ \brief NetdeviceController public header */ -#ifndef HH_NetdeviceController_ -#define HH_NetdeviceController_ 1 +#ifndef HH_SENF_Socket_NetdeviceController_ +#define HH_SENF_Socket_NetdeviceController_ 1 // Custom includes #include -#include #include "Protocols/Raw/MACAddress.hh" //#include "NetdeviceController.mpp" ///////////////////////////////hh.p//////////////////////////////////////// +struct ifreq; + namespace senf { - /** \brief NetdeviceController - - \todo document me - \todo Add 'promisc' member to enable/disable promiscuous mode + /** \brief Netdevice Controller + + This controller provides an interface which can be used to configure network + devices. Note, that some setting members are privileged operations. + + \see manual page netdevice(7) for more informations. */ class NetdeviceController { public: NetdeviceController(std::string const & interface_name); + ///< Construct a new controller for the given interface name. NetdeviceController(int interface_index); + ///< Construct a new controller for the given interface index. virtual ~NetdeviceController(); - - int interfaceIndex() const; ///< return the interface index - - MACAddress hardwareAddress() const; ///< return hardware address - void hardwareAddress(const MACAddress &newAddress); ///< set hardware address - std::string interfaceName() const; ///< return interface name - void interfaceName(const std::string &newName) const; ///< set interface name + int interfaceIndex() const; ///< return the interface index + MACAddress hardwareAddress() const; + ///< return hardware address + void hardwareAddress(const MACAddress &newAddress); + ///< set hardware address + /**< 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 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) const; //< set the Maximum Transmission Unit + 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. */ + + 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(); @@ -78,7 +107,7 @@ namespace senf { //#include "NetdeviceController.mpp" #endif - + // Local Variables: // mode: c++ // fill-column: 100