Base Framework
Public Types | Public Member Functions | Static Public Member Functions | List of all members
InetInterface Class Reference

Internet Protocol network interface. More...

#include <base/net/InetInterface.h>

Inherits Object.

Public Types

enum  Flag {
  UP = 1, LOOPBACK = 2, POINT_TO_POINT = 4, BROADCAST = 8,
  MULTICAST = 16, DYNAMIC = 32
}
 

Public Member Functions

 InetInterface () noexcept
 
 InetInterface (const String &name)
 
 InetInterface (const InetAddress &address) noexcept
 
 InetInterface (const InetInterface &copy) noexcept
 
unsigned int getIndex () const noexcept
 
const StringgetName () const noexcept
 
unsigned int getFlags () const noexcept
 
const InetAddressgetAddress () const noexcept
 
const InetAddressgetNetmask () const noexcept
 
const InetAddressgetBroadcast () const noexcept
 
const InetAddressgetDestination () const noexcept
 
const EUI64getEthernetAddress () const noexcept
 
unsigned int getMetric () const noexcept
 

Static Public Member Functions

static ArrayMap< String, unsigned int > getInterfaceNames ()
 
static List< InetInterfacegetInterfaces ()
 
static unsigned int getIndexByName (const String &name)
 
static unsigned int getIndexByAddress (const InetAddress &address)
 
static String getName (unsigned int index)
 
static InetAddress getAddress (unsigned int index)
 

Detailed Description

Internet Protocol network interface.

This class represents an Internet Protocol network interface.

Version
1.0
Examples
testsuite/server.cpp.

Constructor & Destructor Documentation

◆ InetInterface() [1/4]

InetInterface::InetInterface ( )
noexcept

Initializes interface.

◆ InetInterface() [2/4]

InetInterface::InetInterface ( const String name)

Initializes interface by name.

◆ InetInterface() [3/4]

InetInterface::InetInterface ( const InetAddress address)
noexcept

Initializes interface by address.

◆ InetInterface() [4/4]

InetInterface::InetInterface ( const InetInterface copy)
noexcept

Copy constructor.

Member Function Documentation

◆ getAddress() [1/2]

const InetAddress& InetInterface::getAddress ( ) const
inlinenoexcept

Returns the address.

◆ getAddress() [2/2]

static InetAddress InetInterface::getAddress ( unsigned int  index)
static

Returns the address of the specified interface.

◆ getBroadcast()

const InetAddress& InetInterface::getBroadcast ( ) const
inlinenoexcept

Returns the broadcast address. Only valid if BROADCAST is set.

◆ getDestination()

const InetAddress& InetInterface::getDestination ( ) const
inlinenoexcept

Returns the destination address. Only valid if POINT_TO_POINT is set.

◆ getEthernetAddress()

const EUI64& InetInterface::getEthernetAddress ( ) const
inlinenoexcept

Returns the ethernet address.

◆ getFlags()

unsigned int InetInterface::getFlags ( ) const
inlinenoexcept

Returns the flags.

◆ getIndex()

unsigned int InetInterface::getIndex ( ) const
inlinenoexcept

Returns the index of the network interface.

Examples
testsuite/server.cpp.

◆ getIndexByAddress()

static unsigned int InetInterface::getIndexByAddress ( const InetAddress address)
static

Returns the index of the interface associated with the specified address.

◆ getIndexByName()

static unsigned int InetInterface::getIndexByName ( const String name)
static

Returns the index of the specified interface.

◆ getInterfaceNames()

static ArrayMap<String, unsigned int> InetInterface::getInterfaceNames ( )
static

Returns the names and indices of the available interfaces.

◆ getInterfaces()

static List<InetInterface> InetInterface::getInterfaces ( )
static

Returns all of the Internet Protocol network interfaces of the host.

Examples
testsuite/server.cpp.

◆ getMetric()

unsigned int InetInterface::getMetric ( ) const
inlinenoexcept

Returns the metric.

◆ getName() [1/2]

const String& InetInterface::getName ( ) const
inlinenoexcept

Returns the name of the network interface.

◆ getName() [2/2]

static String InetInterface::getName ( unsigned int  index)
static

Returns the name of the specified interface.

Examples
testsuite/server.cpp.

◆ getNetmask()

const InetAddress& InetInterface::getNetmask ( ) const
inlinenoexcept

Returns the network mask.