Abstraction of a network interface.
More...
#include <network_interface.h>
|
typedef uint32_t | id_type |
| The type used to store the interface's identifier.
|
|
typedef HWAddress< 6 > | address_type |
| The type of this interface's address.
|
|
Abstraction of a network interface.
◆ NetworkInterface() [1/5]
Tins::NetworkInterface::NetworkInterface |
( |
| ) |
|
◆ NetworkInterface() [2/5]
Tins::NetworkInterface::NetworkInterface |
( |
const std::string & | name | ) |
|
Constructor from std::string.
- Parameters
-
name | The name of the interface this object will abstract. |
◆ NetworkInterface() [3/5]
Tins::NetworkInterface::NetworkInterface |
( |
const char * | name | ) |
|
Constructor from const char*.
- Parameters
-
name | The name of the interface this object will abstract. |
◆ NetworkInterface() [4/5]
Tins::NetworkInterface::NetworkInterface |
( |
IPv4Address | ip | ) |
|
Constructs a NetworkInterface from an ip address.
This abstracted interface will be the one that would be the gateway when sending a packet to the given ip.
- Parameters
-
ip | The ip address being looked up. |
◆ NetworkInterface() [5/5]
Tins::NetworkInterface::NetworkInterface |
( |
IPv6Address | ipv6 | ) |
|
Constructs a NetworkInterface from an ipv6 address.
This abstracted interface will be the one that would be the gateway when sending a packet to the given ip.
- Parameters
-
ip | The ipv6 address being looked up. |
◆ addresses()
◆ all()
Returns all available network interfaces.
◆ default_interface()
◆ friendly_name()
wstring Tins::NetworkInterface::friendly_name |
( |
| ) |
const |
Retrieves this interface's friendly name.
The name returned by this method can be more human-friendly than the one returned by NetworkInterface::name, depending on the platform in which it's used.
On GNU/Linux and OSX/FreeBSD, this returns the same string as NetworkInterface::name.
On Windows, this method returns a name such as "Local Area Connection 1".
Note thaat this returns a wstring rather than a string, to comply with Window's adapter's FriendlyName type.
- Returns
- std::wstring containing this interface's name.
◆ from_index()
Returns a network interface for the given index.
◆ id()
id_type Tins::NetworkInterface::id |
( |
| ) |
const |
|
inline |
Getter for this interface's identifier.
- Returns
- id_type containing the identifier.
◆ info()
Retrieve this interface's information.
This method iterates through all the interface's until the correct one is found. Therefore it's O(N), being N the amount of interfaces in the system.
◆ is_loopback()
bool Tins::NetworkInterface::is_loopback |
( |
| ) |
const |
Indicates whether this is a loopback device.
- Returns
- true iff this is a loopback device.
◆ is_up()
bool Tins::NetworkInterface::is_up |
( |
| ) |
const |
Indicates whether this interface is up.
This is equivalent to getting the interface info and checking for the is_up attribute.
◆ name()
string Tins::NetworkInterface::name |
( |
| ) |
const |
Retrieves this interface's name.
This name can be used as the interface name provided to the Sniffer class when starting a sniffing session.
- See also
- Sniffer
- Returns
- std::string containing this interface's name.
◆ operator bool()
Tins::NetworkInterface::operator bool |
( |
| ) |
const |
|
inline |
Tests whether this is a valid interface;.
An interface will not be valid iff it was created using the default constructor.
◆ operator!=()
Compares this interface for inequality.
- Parameters
-
rhs | The interface being compared. |
◆ operator==()
Compares this interface for equality.
- Parameters
-
rhs | The interface being compared. |
The documentation for this class was generated from the following files:
- /builddir/build/BUILD/libtins-4.5-build/libtins-4.5/include/tins/network_interface.h
- /builddir/build/BUILD/libtins-4.5-build/libtins-4.5/src/network_interface.cpp