25#ifndef JOIN_FABRIC_INTERFACE_HPP
26#define JOIN_FABRIC_INTERFACE_HPP
44 class InterfaceManager;
60 using Ptr = std::shared_ptr<Interface>;
88 uint32_t
index () const noexcept;
108 int mtu (uint32_t mtuBytes,
bool sync = false) const;
114 uint32_t
mtu () const;
128 int mac (const
MacAddress& macAddress,
bool sync = false) const;
145 bool sync =
false)
const;
164 bool sync =
false)
const;
185 bool hasAddress (
const IpAddress& ipAddress)
const;
199 int addToBridge (uint32_t masterIndex,
bool sync =
false)
const;
207 int addToBridge (
const std::string& masterName,
bool sync =
false)
const;
220 uint32_t
flags ()
const;
228 int enable (
bool enabled =
true,
bool sync =
false)
const;
322 uint32_t _master = 0;
343 mutable Mutex _mutex;
371 return lhs->_index == rhs->_index;
390 return lhs->_index < rhs->_index;
interface manager class.
Definition interfacemanager.hpp:154
interface class.
Definition interface.hpp:50
bool isLoopback() const
is interface a loopback interface.
Definition interface.cpp:288
bool supportsMulticast() const
is interface supporting multicast.
Definition interface.cpp:370
int enable(bool enabled=true, bool sync=false) const
enable interface.
Definition interface.cpp:261
uint32_t master() const
get master index if bridged.
Definition interface.cpp:65
friend bool operator==(const Interface::Ptr &lhs, const Interface::Ptr &rhs) noexcept
compare if two interfaces are equal.
Definition interface.hpp:361
bool isDummy() const
is interface a dummy interface.
Definition interface.cpp:306
bool supportsIpv6() const
is interface supporting IPv6.
Definition interface.cpp:398
bool isRunning() const
is interface running.
Definition interface.cpp:279
uint32_t index() const noexcept
get interface index.
Definition interface.cpp:56
bool supportsBroadcast() const
is interface supporting broadcast.
Definition interface.cpp:361
int removeAddress(const IpAddress &ipAddress, uint32_t prefix, const IpAddress &broadcast={}, bool sync=false) const
remove address from interface.
Definition interface.cpp:151
std::vector< Address > AddressList
Definition interface.hpp:72
MacAddress mac() const
get interface mac address.
Definition interface.cpp:123
~Interface()=default
destroy instance.
bool supportsIpv4() const
is interface supporting IPv4.
Definition interface.cpp:379
bool isEnabled() const
is interface enabled.
Definition interface.cpp:270
std::string kind() const
get interface kind.
Definition interface.cpp:104
bool hasLocalAddress() const
check if interface has link local address stored.
Definition interface.cpp:198
std::shared_ptr< Interface > Ptr
Definition interface.hpp:60
int removeFromBridge(bool sync=false) const
remove interface from bridge.
Definition interface.cpp:242
int addAddress(const IpAddress &ipAddress, uint32_t prefix, const IpAddress &broadcast={}, bool sync=false) const
add address to interface.
Definition interface.cpp:133
bool hasAddress(const IpAddress &ipAddress) const
check if interface has address stored.
Definition interface.cpp:179
uint32_t flags() const
get interface flags.
Definition interface.cpp:251
std::string name() const
get interface name.
Definition interface.cpp:75
bool isGre() const
is interface a gre interface.
Definition interface.cpp:342
bool isVlan() const
is interface a vlan interface.
Definition interface.cpp:324
AddressList addressList() const
get interface ip addresses.
Definition interface.cpp:169
int addToBridge(uint32_t masterIndex, bool sync=false) const
add interface to bridge.
Definition interface.cpp:217
bool isVeth() const
is interface a veth interface.
Definition interface.cpp:333
uint32_t mtu() const
get interface mtu.
Definition interface.cpp:94
friend bool operator<(const Interface::Ptr &lhs, const Interface::Ptr &rhs) noexcept
compare if interface is inferior.
Definition interface.hpp:380
friend class InterfaceManager
Definition interface.hpp:352
bool isBridge() const
is interface a bridge interface.
Definition interface.cpp:315
bool isTun() const
is interface a tun interface.
Definition interface.cpp:352
bool isPointToPoint() const
is interface a point to point interface.
Definition interface.cpp:297
Interface()=delete
create instance.
IPv6, IPv4 address class.
Definition ipaddress.hpp:51
MAC address class.
Definition macaddress.hpp:46
Definition acceptor.hpp:32
std::vector< Interface::Ptr > InterfaceList
list of interfaces.
Definition interface.hpp:394
bool operator<(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is lower.
Definition endpoint.hpp:207
bool operator==(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:183
IP address entry associated with an interface.
Definition interface.hpp:66
uint32_t prefix
Definition interface.hpp:68
IpAddress broadcast
Definition interface.hpp:69
IpAddress ip
Definition interface.hpp:67
IpAddress address
Definition tcpacceptor_test.cpp:35