libnpupnp: NetIF::Interface Class Reference

libnpupnp 4.1.0 An almost compatible successor for the Portable UPnP reference library

Public Types | Public Member Functions | Friends | List of all members
NetIF::Interface Class Reference

Represent a system network interface, its attributes and its addresses. Usually built by the module internal code by querying the system interfaces. More...

`#include <netif.h>`

## Public Types
enum | Flags { NONE = 0, HASIPV4 = 1, HASIPV6 = 2, LOOPBACK =4, UP =8, MULTICAST =0x10, HASHWADDR =0x20 }
| Interface attributes.

## Public Member Functions
| Interface (const char *nm)
| Construct empty interface with just the name set.
| Interface (const std::string &nm)
| Construct empty interface with just the name set.
| Interface (const Interface &)
Interface & | operator= (const Interface &)
const std::string & | getname () const
| Return the interface name.
const std::string & | getfriendlyname () const
| Return the interface friendly name (same as name except on Windows).
const std::string & | gethwaddr () const
std::string | gethexhwaddr () const
| Return hardware address in traditional colon-separated hex.
bool | hasflag (Flags f) const
| test if flag is set
bool | trimto (const std::vector< IPAddr > &keep)
| Remove all addresses not in the input vector.
const IPAddr * | firstipv4addr () const
| Return the first ipv4 address if any, or nullptr.
const IPAddr * | firstipv6addr (IPAddr::Scope scope=IPAddr::Scope::Invalid) const
| Return the first ipv6 address if any, or nullptr.
std::pair< const std::vector< IPAddr > &, const std::vector< IPAddr > & > | getaddresses () const
| Return the interface addresses and the corresponding netmasks, as parallel arrays.
int | getindex () const
| Return the interface index.
std::ostream & | print (std::ostream &) const
| Print out, a bit like "ip addr" output.

## Friends
class | Interfaces

## Detailed Description

Represent a system network interface, its attributes and its addresses. Usually built by the module internal code by querying the system interfaces.

## Member Function Documentation

## ◆ gethwaddr()

const std::string& NetIF::Interface::gethwaddr | ( |  | ) | const

Return the hardware (ethernet) address as a binary string (can have embedded null characters). Empty if no hardware address was found for this interface

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

- /home/dockes/projets/mpdupnp/npupnp/src/inc/netif.h