From e6ed2a6d7c2d8cd8bc088887fc94f46d54a47d47 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Sat, 31 Aug 2013 21:03:59 -0400 Subject: [PATCH] add member list() function for Neighbor so we don't have to specify an interface --- neighbor.cpp | 7 +++++++ neighbor.h | 1 + 2 files changed, 8 insertions(+) diff --git a/neighbor.cpp b/neighbor.cpp index f978e99..611ef34 100644 --- a/neighbor.cpp +++ b/neighbor.cpp @@ -194,6 +194,13 @@ QString Neighbor::macOfIP(QString ip, bool *ok) const { return macStr; } +/*! + Returns a string hash consisting of IP addresses (both IPv4 and IPv6) in the ARP cache as the keys, and their corresponding MAC addresses as the values. If there are no entries found or if there was an error obtaining the list, an empty hash with no keys are returned. If there was an error, *ok will be set to false, otherwise it will be true. +*/ +QHash Neighbor::list(bool *ok) { + return list(m_interface, ok); +} + /*! Returns a string hash consisting of IP addresses (both IPv4 and IPv6) in the ARP cache as the keys, and their corresponding MAC addresses as the values. By specifying \a interfaceString the returned list is confined to addresses seen from that named interface. If there are no entries found or if there was an error obtaining the list, an empty hash with no keys are returned. If there was an error, *ok will be set to false, otherwise it will be true. */ diff --git a/neighbor.h b/neighbor.h index 0ea0f28..74baa58 100644 --- a/neighbor.h +++ b/neighbor.h @@ -11,6 +11,7 @@ Q_OBJECT public: Neighbor(QString interface = QString()); QString macOfIP(QString ip, bool *ok = 0) const; + QHash list(bool *ok = 0); static QHash list(QString interface = QString(), bool *ok = 0); const QString& name() const;