Browse Source

change return type of setLinkUp/Down to int instead of bool, remove error argument

master
Brad Parker 11 years ago
parent
commit
63173c54b9
  1. 8
      interface.cpp
  2. 4
      interface.h

8
interface.cpp

@ -44,7 +44,7 @@ m_index(-1)
/*!
Set the interface's administrative link state to up. Requires that the CAP_NET_ADMIN capability be set on the application binary, or run as root (\a not \a recommended). Returns 0 on success, 1 on error.
*/
int Interface::setLinkUp(QString &error) {
int Interface::setLinkUp() {
struct rtnl_link *link, *link_orig = NULL;
struct nl_sock *sock = NULL;
QByteArray interfaceArray = m_interface.toLatin1();
@ -75,7 +75,7 @@ int Interface::setLinkUp(QString &error) {
rtnl_link_set_flags(link, IFF_UP);
if((err = rtnl_link_change(sock, link_orig, link, 0)) < 0) {
error = nl_geterror(err);
//error = nl_geterror(err);
rtnl_link_put(link);
rtnl_link_put(link_orig);
nl_socket_free(sock);
@ -96,7 +96,7 @@ int Interface::setLinkUp(QString &error) {
/*!
Set the interface's administrative link state to down. Requires that the CAP_NET_ADMIN capability be set on the application binary, or run as root (\a not \a recommended). Returns 0 on success, 1 on error.
*/
int Interface::setLinkDown(QString &error) {
int Interface::setLinkDown() {
struct rtnl_link *link, *link_orig = NULL;
struct nl_sock *sock = NULL;
QByteArray interfaceArray = m_interface.toLatin1();
@ -127,7 +127,7 @@ int Interface::setLinkDown(QString &error) {
rtnl_link_unset_flags(link, IFF_UP);
if((err = rtnl_link_change(sock, link_orig, link, 0)) < 0) {
error = nl_geterror(err);
//error = nl_geterror(err);
rtnl_link_put(link);
rtnl_link_put(link_orig);
nl_socket_free(sock);

4
interface.h

@ -13,8 +13,8 @@ public:
QStringList addresses() const;
bool hasCarrier(bool *ok = 0);
bool hasAdminLink(bool *ok = 0);
bool setLinkUp(QString &error);
bool setLinkDown(QString &error);
int setLinkUp();
int setLinkDown();
int addAddress(QString address) const;
int deleteAddress(QString address) const;
const QString& name() const;

Loading…
Cancel
Save