X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FNetdeviceController.hh;h=e969cda37bf0bd13a1927154b6e23b315f52444a;hb=fd3a0e8ac95d1158e9ea661ddf9187b67c70169f;hp=ed74c18f86bdb1ff0401844176b117913a5179b5;hpb=09b4d2c4934a5ea35d208cd22573e0e877ad54c8;p=senf.git diff --git a/Socket/NetdeviceController.hh b/Socket/NetdeviceController.hh index ed74c18..e969cda 100644 --- a/Socket/NetdeviceController.hh +++ b/Socket/NetdeviceController.hh @@ -29,13 +29,16 @@ // Custom includes #include -#include +#include +#include #include "Protocols/Raw/MACAddress.hh" //#include "NetdeviceController.mpp" ///////////////////////////////hh.p//////////////////////////////////////// +struct ifreq; + namespace senf { /** \brief Netdevice Controller @@ -48,12 +51,10 @@ namespace senf { class NetdeviceController { public: - NetdeviceController(std::string const & interface_name); + explicit NetdeviceController(std::string const & interface_name); ///< Construct a new controller for the given interface name. - NetdeviceController(int interface_index); + explicit 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 @@ -89,11 +90,19 @@ namespace senf { void up(); ///< ifconfig up interface void down(); ///< ifconfig down interface + struct SockFd { + typedef boost::shared_ptr ptr; + int fd; + SockFd(); + ~SockFd(); + }; + + static SockFd::ptr sockfd(); + private: - void openSocket(); void doIoctl(ifreq& ifr, int request) const; void ifrName(ifreq& ifr) const; - int sockfd_; + SockFd::ptr sockfd_; int ifindex_; };