From: tho Date: Fri, 29 Feb 2008 15:11:20 +0000 (+0000) Subject: added some const's to the NetdeviceController X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=ab05c3d687d911b4d204aa20bf900dc23d174545;p=senf.git added some const's to the NetdeviceController git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@720 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/NetdeviceController.cc b/Socket/NetdeviceController.cc index a11c494..b93998c 100644 --- a/Socket/NetdeviceController.cc +++ b/Socket/NetdeviceController.cc @@ -52,6 +52,7 @@ prefix_ senf::NetdeviceController::NetdeviceController(int interface_index) } prefix_ std::string senf::NetdeviceController::interfaceName() + const { struct ifreq ifr; ifrName( ifr); @@ -59,6 +60,7 @@ prefix_ std::string senf::NetdeviceController::interfaceName() } prefix_ senf::MACAddress senf::NetdeviceController::hardwareAddress() + const { struct ifreq ifr; ifrName( ifr); @@ -67,6 +69,7 @@ prefix_ senf::MACAddress senf::NetdeviceController::hardwareAddress() } prefix_ int senf::NetdeviceController::mtu() + const { struct ifreq ifr; ifrName( ifr); @@ -75,6 +78,7 @@ prefix_ int senf::NetdeviceController::mtu() } prefix_ void senf::NetdeviceController::mtu(int new_mtu) + const { struct ifreq ifr; ifrName( ifr); @@ -83,6 +87,7 @@ prefix_ void senf::NetdeviceController::mtu(int new_mtu) } prefix_ int senf::NetdeviceController::interfaceIndex() + const { return ifindex_; } @@ -100,6 +105,7 @@ prefix_ void senf::NetdeviceController::openSocket() } prefix_ void senf::NetdeviceController::ifrName(ifreq& ifr) + const { ::memset( &ifr, 0, sizeof(ifr)); ifr.ifr_ifindex = ifindex_; @@ -109,6 +115,7 @@ prefix_ void senf::NetdeviceController::ifrName(ifreq& ifr) prefix_ void senf::NetdeviceController::doIoctl(ifreq& ifr, int request) + const { if ( ::ioctl( sockfd_, request, &ifr ) < 0 ) throw SystemException(); diff --git a/Socket/NetdeviceController.hh b/Socket/NetdeviceController.hh index 1db8655..dbc5ce6 100644 --- a/Socket/NetdeviceController.hh +++ b/Socket/NetdeviceController.hh @@ -50,16 +50,16 @@ namespace senf { NetdeviceController(int interface_index); virtual ~NetdeviceController(); - MACAddress hardwareAddress(); - std::string interfaceName(); - int interfaceIndex(); ///< return the interface index of the interface - int mtu(); - void mtu(int new_mtu); + MACAddress hardwareAddress() const; + std::string interfaceName() const; + int interfaceIndex() const; ///< return the interface index of the interface + int mtu() const; + void mtu(int new_mtu) const; private: void openSocket(); - void doIoctl(ifreq& ifr, int request); - void ifrName(ifreq& ifr); + void doIoctl(ifreq& ifr, int request) const; + void ifrName(ifreq& ifr) const; int sockfd_; int ifindex_; };