AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::device::NetworkInterface Class Reference

Network interface. More...

#include <networkInterface.hpp>

Collaboration diagram for anch::device::NetworkInterface:

Public Member Functions

const std::string & getName () const
const std::string & getIpAddress () const
const std::vector< std::string > & getIpv6Addresses () const
const std::string & getMacAddress () const
const std::string & getBroadcastAddress () const
const std::string & getNetmask () const
int getMtu () const
int getMetric () const
bool isUp () const
bool isLocalhost () const

Friends

class anch::device::Network

Detailed Description

Network interface.

Snapshot of a network interface configuration built by Network . Every information is optional: an empty string (or 0 ) means that the interface does not have it (no IPv4 address, no broadcast address on a point-to-point interface, no hardware address on a tunnel, ...).

Author
Vincent Lachenal

Member Function Documentation

◆ getBroadcastAddress()

const std::string & anch::device::NetworkInterface::getBroadcastAddress ( ) const
inline

Interface broadcast address getter

Returns
The interface IPv4 broadcast address, empty if none

◆ getIpAddress()

const std::string & anch::device::NetworkInterface::getIpAddress ( ) const
inline

Interface IPv4 address getter. When the interface has several IPv4 addresses, the first one is returned.

Returns
The interface IPv4 address, empty if none

◆ getIpv6Addresses()

const std::vector< std::string > & anch::device::NetworkInterface::getIpv6Addresses ( ) const
inline

Interface IPv6 addresses getter. Link-local addresses have their scope ( %<interface> ).

Returns
The interface IPv6 addresses
Since
0.2

◆ getMacAddress()

const std::string & anch::device::NetworkInterface::getMacAddress ( ) const
inline

MAC address getter

Returns
The hardware address (hexadecimal bytes separated by : ), empty if none

◆ getMetric()

int anch::device::NetworkInterface::getMetric ( ) const
inline

Interface metric getter (Linux always reports 0 )

Returns
The interface metric

◆ getMtu()

int anch::device::NetworkInterface::getMtu ( ) const
inline

Interface MTU getter

Returns
The interface MTU, 0 if unknown

◆ getName()

const std::string & anch::device::NetworkInterface::getName ( ) const
inline

Interface name getter

Returns
The interface name

◆ getNetmask()

const std::string & anch::device::NetworkInterface::getNetmask ( ) const
inline

Interface netmask getter

Returns
The interface IPv4 netmask, empty if none

◆ isLocalhost()

bool anch::device::NetworkInterface::isLocalhost ( ) const
inline

Is interface localhost getter

Returns
true if interface is local loopback, false otherwise

◆ isUp()

bool anch::device::NetworkInterface::isUp ( ) const
inline

Is interface up getter

Returns
true if interface is up, false otherwise
Since
0.2

The documentation for this class was generated from the following file: