1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added NetworkInterface::is_loopback.

This commit is contained in:
Matias Fontanini
2014-10-19 09:13:28 -03:00
parent 9ee90755d1
commit 64fac4f255
2 changed files with 10 additions and 0 deletions

View File

@@ -144,6 +144,12 @@ public:
operator bool() const {
return iface_id != 0;
}
/**
* \brief Indicates whether this is a loopback device.
* @return true iff this is a loopback device.
*/
bool is_loopback() const;
/**
* \brief Compares this interface for equality.

View File

@@ -215,6 +215,10 @@ NetworkInterface::Info NetworkInterface::addresses() const {
return info;
}
bool NetworkInterface::is_loopback() const {
return addresses().ip_addr.is_loopback();
}
NetworkInterface::id_type NetworkInterface::resolve_index(const char *name) {
#ifndef WIN32
id_type id = if_nametoindex(name);