ndn::net::NetworkInterface Class Reference

Represents one network interface attached to the host. More...

#include <ndn-cxx/net/network-interface.hpp>

+ Collaboration diagram for ndn::net::NetworkInterface:

Public Member Functions

bool addNetworkAddress (const NetworkAddress &address)
 
bool canBroadcast () const
 Returns true if the interface supports broadcast communication. More...
 
bool canMulticast () const
 Returns true if the interface supports multicast communication. More...
 
ethernet::Address getEthernetAddress () const
 Returns the link-layer (Ethernet) address of the interface. More...
 
ethernet::Address getEthernetBroadcastAddress () const
 Returns the link-layer (Ethernet) broadcast address of the interface. More...
 
uint32_t getFlags () const
 Returns a bitset of platform-specific flags enabled on the interface. More...
 
int getIndex () const
 Returns an opaque ID that uniquely identifies the interface on the system. More...
 
uint32_t getMtu () const
 Returns the MTU (maximum transmission unit) of the interface. More...
 
std::string getName () const
 Returns the name of the interface, unique on the system. More...
 
const std::set< NetworkAddress > & getNetworkAddresses () const
 Returns all network-layer addresses present on the interface. More...
 
InterfaceState getState () const
 Returns the current state of the interface. More...
 
InterfaceType getType () const
 Returns the hardware type of the interface. More...
 
bool isLoopback () const
 Returns true if the interface is a loopback interface. More...
 
bool isPointToPoint () const
 Returns true if the interface is a point-to-point interface. More...
 
bool isUp () const
 Returns true if the interface is administratively "up". More...
 
bool removeNetworkAddress (const NetworkAddress &address)
 
void setEthernetAddress (const ethernet::Address &address)
 
void setEthernetBroadcastAddress (const ethernet::Address &address)
 
void setFlags (uint32_t flags)
 
void setIndex (int index)
 
void setMtu (uint32_t mtu)
 
void setName (const std::string &name)
 
void setState (InterfaceState state)
 
void setType (InterfaceType type)
 

Public Attributes

signal::Signal< NetworkInterface, NetworkAddressonAddressAdded
 Fires when a network-layer address is added to the interface. More...
 
signal::Signal< NetworkInterface, NetworkAddressonAddressRemoved
 Fires when a network-layer address is removed from the interface. More...
 
signal::Signal< NetworkInterface, uint32_t, uint32_t > onMtuChanged
 Fires when the interface MTU changes. More...
 
signal::Signal< NetworkInterface, InterfaceState, InterfaceStateonStateChanged
 Fires when the interface state changes. More...
 

Friends

class NetworkMonitorImpl
 

Detailed Description

Represents one network interface attached to the host.

Each network interface has a unique index, a name, and a set of flags indicating its capabilities and current state. It may contain one link-layer (Ethernet) address, and zero or more network-layer (IP) addresses. Specific signals are emitted when the interface data change.

Definition at line 70 of file network-interface.hpp.

Member Function Documentation

◆ addNetworkAddress()

bool ndn::net::NetworkInterface::addNetworkAddress ( const NetworkAddress address)

Definition at line 38 of file network-interface.cpp.

◆ canBroadcast()

bool ndn::net::NetworkInterface::canBroadcast ( ) const
inline

Returns true if the interface supports broadcast communication.

Definition at line 189 of file network-interface.hpp.

◆ canMulticast()

bool ndn::net::NetworkInterface::canMulticast ( ) const
inline

Returns true if the interface supports multicast communication.

Definition at line 198 of file network-interface.hpp.

◆ getEthernetAddress()

ethernet::Address ndn::net::NetworkInterface::getEthernetAddress ( ) const
inline

Returns the link-layer (Ethernet) address of the interface.

Definition at line 144 of file network-interface.hpp.

◆ getEthernetBroadcastAddress()

ethernet::Address ndn::net::NetworkInterface::getEthernetBroadcastAddress ( ) const
inline

Returns the link-layer (Ethernet) broadcast address of the interface.

Definition at line 153 of file network-interface.hpp.

◆ getFlags()

uint32_t ndn::net::NetworkInterface::getFlags ( ) const
inline

Returns a bitset of platform-specific flags enabled on the interface.

Definition at line 117 of file network-interface.hpp.

◆ getIndex()

int ndn::net::NetworkInterface::getIndex ( ) const
inline

Returns an opaque ID that uniquely identifies the interface on the system.

Definition at line 90 of file network-interface.hpp.

◆ getMtu()

uint32_t ndn::net::NetworkInterface::getMtu ( ) const
inline

Returns the MTU (maximum transmission unit) of the interface.

Definition at line 135 of file network-interface.hpp.

◆ getName()

std::string ndn::net::NetworkInterface::getName ( ) const
inline

Returns the name of the interface, unique on the system.

Definition at line 99 of file network-interface.hpp.

◆ getNetworkAddresses()

const std::set<NetworkAddress>& ndn::net::NetworkInterface::getNetworkAddresses ( ) const
inline

Returns all network-layer addresses present on the interface.

Definition at line 162 of file network-interface.hpp.

◆ getState()

InterfaceState ndn::net::NetworkInterface::getState ( ) const
inline

Returns the current state of the interface.

Definition at line 126 of file network-interface.hpp.

◆ getType()

InterfaceType ndn::net::NetworkInterface::getType ( ) const
inline

Returns the hardware type of the interface.

Definition at line 108 of file network-interface.hpp.

◆ isLoopback()

bool ndn::net::NetworkInterface::isLoopback ( ) const
inline

Returns true if the interface is a loopback interface.

Definition at line 171 of file network-interface.hpp.

◆ isPointToPoint()

bool ndn::net::NetworkInterface::isPointToPoint ( ) const
inline

Returns true if the interface is a point-to-point interface.

Definition at line 180 of file network-interface.hpp.

◆ isUp()

bool ndn::net::NetworkInterface::isUp ( ) const
inline

Returns true if the interface is administratively "up".

Definition at line 207 of file network-interface.hpp.

◆ removeNetworkAddress()

bool ndn::net::NetworkInterface::removeNetworkAddress ( const NetworkAddress address)

Definition at line 55 of file network-interface.cpp.

◆ setEthernetAddress()

void ndn::net::NetworkInterface::setEthernetAddress ( const ethernet::Address address)

Definition at line 109 of file network-interface.cpp.

◆ setEthernetBroadcastAddress()

void ndn::net::NetworkInterface::setEthernetBroadcastAddress ( const ethernet::Address address)

Definition at line 115 of file network-interface.cpp.

◆ setFlags()

void ndn::net::NetworkInterface::setFlags ( uint32_t  flags)

Definition at line 85 of file network-interface.cpp.

◆ setIndex()

void ndn::net::NetworkInterface::setIndex ( int  index)

Definition at line 66 of file network-interface.cpp.

◆ setMtu()

void ndn::net::NetworkInterface::setMtu ( uint32_t  mtu)

Definition at line 100 of file network-interface.cpp.

◆ setName()

void ndn::net::NetworkInterface::setName ( const std::string &  name)

Definition at line 72 of file network-interface.cpp.

◆ setState()

void ndn::net::NetworkInterface::setState ( InterfaceState  state)

Definition at line 91 of file network-interface.cpp.

◆ setType()

void ndn::net::NetworkInterface::setType ( InterfaceType  type)

Definition at line 79 of file network-interface.cpp.

Friends And Related Function Documentation

◆ NetworkMonitorImpl

friend class NetworkMonitorImpl
friend

Definition at line 257 of file network-interface.hpp.

Member Data Documentation

◆ onAddressAdded

signal::Signal<NetworkInterface, NetworkAddress> ndn::net::NetworkInterface::onAddressAdded
mutable

Fires when a network-layer address is added to the interface.

Definition at line 80 of file network-interface.hpp.

◆ onAddressRemoved

signal::Signal<NetworkInterface, NetworkAddress> ndn::net::NetworkInterface::onAddressRemoved
mutable

Fires when a network-layer address is removed from the interface.

Definition at line 83 of file network-interface.hpp.

◆ onMtuChanged

signal::Signal<NetworkInterface, uint32_t , uint32_t > ndn::net::NetworkInterface::onMtuChanged
mutable

Fires when the interface MTU changes.

Definition at line 77 of file network-interface.hpp.

◆ onStateChanged

signal::Signal<NetworkInterface, InterfaceState , InterfaceState > ndn::net::NetworkInterface::onStateChanged
mutable

Fires when the interface state changes.

Definition at line 74 of file network-interface.hpp.