Browse Source

add member list() function for Neighbor so we don't have to specify an interface

master
Brad Parker 11 years ago
parent
commit
e6ed2a6d7c
  1. 7
      neighbor.cpp
  2. 1
      neighbor.h

7
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<QString, QString> 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.
*/

1
neighbor.h

@ -11,6 +11,7 @@ Q_OBJECT
public:
Neighbor(QString interface = QString());
QString macOfIP(QString ip, bool *ok = 0) const;
QHash<QString, QString> list(bool *ok = 0);
static QHash<QString, QString> list(QString interface = QString(), bool *ok = 0);
const QString& name() const;

Loading…
Cancel
Save