24 #ifndef NDN_CXX_NET_NETWORK_INTERFACE_HPP
25 #define NDN_CXX_NET_NETWORK_INTERFACE_HPP
146 return m_etherAddress;
155 return m_etherBrdAddress;
161 const std::set<NetworkAddress>&
164 return m_netAddresses;
173 return (m_flags & IFF_LOOPBACK) != 0;
182 return (m_flags & IFF_POINTOPOINT) != 0;
191 return (m_flags & IFF_BROADCAST) != 0;
200 return (m_flags & IFF_MULTICAST) != 0;
209 return (m_flags & IFF_UP) != 0;
223 setName(
const std::string& name);
250 uint32_t m_flags = 0;
255 std::set<NetworkAddress> m_netAddresses;
Represents an Ethernet hardware address.
Stores one IP address supported by a network interface.
Represents one network interface attached to the host.
void setMtu(uint32_t mtu)
uint32_t getMtu() const
Returns the MTU (maximum transmission unit) of the interface.
const std::set< NetworkAddress > & getNetworkAddresses() const
Returns all network-layer addresses present on the interface.
bool canMulticast() const
Returns true if the interface supports multicast communication.
void setEthernetAddress(const ethernet::Address &address)
bool isPointToPoint() const
Returns true if the interface is a point-to-point interface.
bool isLoopback() const
Returns true if the interface is a loopback interface.
signal::Signal< NetworkInterface, uint32_t, uint32_t > onMtuChanged
Fires when the interface MTU changes.
void setType(InterfaceType type)
void setState(InterfaceState state)
bool removeNetworkAddress(const NetworkAddress &address)
uint32_t getFlags() const
Returns a bitset of platform-specific flags enabled on the interface.
void setEthernetBroadcastAddress(const ethernet::Address &address)
bool canBroadcast() const
Returns true if the interface supports broadcast communication.
signal::Signal< NetworkInterface, NetworkAddress > onAddressRemoved
Fires when a network-layer address is removed from the interface.
bool isUp() const
Returns true if the interface is administratively "up".
InterfaceState getState() const
Returns the current state of the interface.
std::string getName() const
Returns the name of the interface, unique on the system.
signal::Signal< NetworkInterface, NetworkAddress > onAddressAdded
Fires when a network-layer address is added to the interface.
ethernet::Address getEthernetAddress() const
Returns the link-layer (Ethernet) address of the interface.
void setFlags(uint32_t flags)
bool addNetworkAddress(const NetworkAddress &address)
ethernet::Address getEthernetBroadcastAddress() const
Returns the link-layer (Ethernet) broadcast address of the interface.
InterfaceType getType() const
Returns the hardware type of the interface.
void setName(const std::string &name)
signal::Signal< NetworkInterface, InterfaceState, InterfaceState > onStateChanged
Fires when the interface state changes.
int getIndex() const
Returns an opaque ID that uniquely identifies the interface on the system.
Provides a lightweight signal / event system.
std::ostream & operator<<(std::ostream &os, AddressScope scope)
InterfaceType
Indicates the hardware type of a network interface.
InterfaceState
Indicates the state of a network interface.
@ RUNNING
interface can be used to send and receive packets
@ UNKNOWN
interface is in an unknown state
@ DORMANT
interface has a carrier but it cannot send or receive normal user traffic yet
@ DOWN
interface is administratively down
@ NO_CARRIER
interface is administratively up but has no carrier