Represents one network interface attached to the host. More...
#include <network-interface.hpp>
Public Member Functions | |
int | getIndex () const |
Returns an opaque ID that uniquely identifies the interface on the system. More... | |
std::string | getName () const |
Returns the name of the interface, unique on the system. More... | |
InterfaceType | getType () const |
Returns the hardware type of the interface. More... | |
uint32_t | getFlags () const |
Returns a bitset of platform-specific flags enabled on the interface. More... | |
InterfaceState | getState () const |
Returns the current state of the interface. More... | |
uint32_t | getMtu () const |
Returns the MTU (maximum transmission unit) of the interface. 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... | |
const std::set< NetworkAddress > & | getNetworkAddresses () const |
Returns a list of all network-layer addresses present on 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 | canBroadcast () const |
Returns true if the interface supports broadcast communication. More... | |
bool | canMulticast () const |
Returns true if the interface supports multicast communication. More... | |
bool | isUp () const |
Returns true if the interface is administratively up. More... | |
bool | addNetworkAddress (const NetworkAddress &address) |
bool | removeNetworkAddress (const NetworkAddress &address) |
void | setIndex (int index) |
void | setName (const std::string &name) |
void | setType (InterfaceType type) |
void | setFlags (uint32_t flags) |
void | setState (InterfaceState state) |
void | setMtu (uint32_t mtu) |
void | setEthernetAddress (const ethernet::Address &address) |
void | setEthernetBroadcastAddress (const ethernet::Address &address) |
Public Attributes | |
util::Signal< NetworkInterface, InterfaceState, InterfaceState > | onStateChanged |
Fires when interface state changes. More... | |
util::Signal< NetworkInterface, uint32_t, uint32_t > | onMtuChanged |
Fires when interface mtu changes. More... | |
util::Signal< NetworkInterface, NetworkAddress > | onAddressAdded |
Fires when a network-layer address is added to the interface. More... | |
util::Signal< NetworkInterface, NetworkAddress > | onAddressRemoved |
Fires when a network-layer address is removed from the interface. More... | |
Friends | |
class | NetworkMonitorImpl |
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 hardware (Ethernet) address, and zero or more network-layer (IP) addresses. Specific signals are emitted when the interface data change.
Definition at line 68 of file network-interface.hpp.
|
inline |
Returns an opaque ID that uniquely identifies the interface on the system.
Definition at line 91 of file network-interface.hpp.
Referenced by ndn::net::operator<<().
|
inline |
Returns the name of the interface, unique on the system.
Definition at line 99 of file network-interface.hpp.
Referenced by ndn::net::computePrefixLength(), ndn::net::convertToStdString(), nfd::face::EthernetFactory::createMulticastFace(), nfd::doesMatchRule(), and ndn::net::operator<<().
|
inline |
Returns the hardware type of the interface.
Definition at line 107 of file network-interface.hpp.
Referenced by nfd::face::EthernetFactory::createMulticastFace(), and ndn::net::operator<<().
|
inline |
Returns a bitset of platform-specific flags enabled on the interface.
Definition at line 115 of file network-interface.hpp.
Referenced by ndn::net::ifaScopeToAddressScope(), and ndn::net::operator<<().
|
inline |
Returns the current state of the interface.
Definition at line 123 of file network-interface.hpp.
Referenced by ndn::net::computePrefixLength(), and ndn::net::operator<<().
|
inline |
Returns the MTU (maximum transmission unit) of the interface.
Definition at line 131 of file network-interface.hpp.
Referenced by nfd::face::MulticastEthernetTransport::MulticastEthernetTransport(), ndn::net::operator<<(), and nfd::face::UnicastEthernetTransport::UnicastEthernetTransport().
|
inline |
Returns the link-layer (Ethernet) address of the interface.
Definition at line 139 of file network-interface.hpp.
Referenced by ndn::net::computePrefixLength(), nfd::face::EthernetFactory::createMulticastFace(), nfd::doesMatchRule(), and ndn::net::operator<<().
|
inline |
Returns the link-layer (Ethernet) broadcast address of the interface.
Definition at line 147 of file network-interface.hpp.
Referenced by ndn::net::operator<<().
|
inline |
Returns a list of all network-layer addresses present on the interface.
Definition at line 155 of file network-interface.hpp.
Referenced by ndn::net::computePrefixLength(), nfd::doesMatchRule(), nfd::face::getV4Address(), and ndn::net::operator<<().
|
inline |
Returns true if the interface is a loopback interface.
Definition at line 163 of file network-interface.hpp.
|
inline |
Returns true if the interface is a point-to-point interface.
Definition at line 171 of file network-interface.hpp.
|
inline |
Returns true if the interface supports broadcast communication.
Definition at line 179 of file network-interface.hpp.
Referenced by ndn::net::computePrefixLength(), and ndn::net::operator<<().
|
inline |
Returns true if the interface supports multicast communication.
Definition at line 187 of file network-interface.hpp.
Referenced by nfd::face::EthernetFactory::createMulticastFace().
|
inline |
Returns true if the interface is administratively up.
Definition at line 195 of file network-interface.hpp.
Referenced by nfd::face::EthernetFactory::createMulticastFace().
bool ndn::net::NetworkInterface::addNetworkAddress | ( | const NetworkAddress & | address | ) |
Definition at line 46 of file network-interface.cpp.
References ndn::net::NetworkAddress::getIp(), and NDN_LOG_DEBUG.
Referenced by ndn::net::computePrefixLength().
bool ndn::net::NetworkInterface::removeNetworkAddress | ( | const NetworkAddress & | address | ) |
Definition at line 63 of file network-interface.cpp.
References NDN_LOG_DEBUG.
Referenced by ndn::net::computePrefixLength().
void ndn::net::NetworkInterface::setIndex | ( | int | index | ) |
Definition at line 74 of file network-interface.cpp.
Referenced by ndn::net::computePrefixLength().
void ndn::net::NetworkInterface::setName | ( | const std::string & | name | ) |
Definition at line 80 of file network-interface.cpp.
void ndn::net::NetworkInterface::setType | ( | InterfaceType | type | ) |
Definition at line 87 of file network-interface.cpp.
Referenced by ndn::net::computePrefixLength().
void ndn::net::NetworkInterface::setFlags | ( | uint32_t | flags | ) |
Definition at line 93 of file network-interface.cpp.
Referenced by ndn::net::computePrefixLength().
void ndn::net::NetworkInterface::setState | ( | InterfaceState | state | ) |
Definition at line 99 of file network-interface.cpp.
Referenced by ndn::net::computePrefixLength(), and ndn::net::ifaScopeToAddressScope().
void ndn::net::NetworkInterface::setMtu | ( | uint32_t | mtu | ) |
Definition at line 108 of file network-interface.cpp.
Referenced by ndn::net::computePrefixLength().
void ndn::net::NetworkInterface::setEthernetAddress | ( | const ethernet::Address & | address | ) |
Definition at line 117 of file network-interface.cpp.
Referenced by ndn::net::computePrefixLength().
void ndn::net::NetworkInterface::setEthernetBroadcastAddress | ( | const ethernet::Address & | address | ) |
Definition at line 123 of file network-interface.cpp.
Referenced by ndn::net::computePrefixLength().
|
friend |
Definition at line 245 of file network-interface.hpp.
|
mutable |
Fires when interface state changes.
Definition at line 73 of file network-interface.hpp.
|
mutable |
Fires when interface mtu changes.
Definition at line 77 of file network-interface.hpp.
|
mutable |
Fires when a network-layer address is added to the interface.
Definition at line 81 of file network-interface.hpp.
|
mutable |
Fires when a network-layer address is removed from the interface.
Definition at line 85 of file network-interface.hpp.