1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 12:14:26 +01:00

EthernetII, IEEE802_3 and Dot11(and subclasses) now use NetworkInterface and HWAddress.

This commit is contained in:
Matias Fontanini
2012-08-09 12:00:29 -03:00
parent 29c5a696e5
commit 91af0f9cc2
17 changed files with 278 additions and 600 deletions

View File

@@ -52,6 +52,11 @@ public:
address_type hw_addr;
};
/**
* \brief Default constructor.
*/
NetworkInterface();
/**
* \brief Constructor from std::string.
*
@@ -59,6 +64,13 @@ public:
*/
NetworkInterface(const std::string &name);
/**
* \brief Constructor to allow implicit conversions from const char*.
*
* \param name The name of the interface this object will abstract.
*/
NetworkInterface(const char *name);
/**
* \brief Constructs a NetworkInterface from an ip address.
*
@@ -94,6 +106,16 @@ public:
*/
Info addresses() const;
/**
* \brief Tests whether this is a valid interface;
*
* An interface will not be valid iff it was created using the
* default constructor.
*/
operator bool() const {
return iface_id != 0;
}
/**
* \brief Compares this interface for equality.
*
@@ -112,6 +134,8 @@ public:
return !(*this == rhs);
}
private:
id_type resolve_index(const char *name);
id_type iface_id;
};
}