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 interface_manager.hpp:154
interface class.
Definition interface.hpp:50
bool isLoopback() const
is interface a loopback interface.
Definition interface.cpp:285
bool supportsMulticast() const
is interface supporting multicast.
Definition interface.cpp:367
int enable(bool enabled=true, bool sync=false) const
enable interface.
Definition interface.cpp:258
uint32_t master() const
get master index if bridged.
Definition interface.cpp:62
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:303
bool supportsIpv6() const
is interface supporting IPv6.
Definition interface.cpp:395
bool isRunning() const
is interface running.
Definition interface.cpp:276
uint32_t index() const noexcept
get interface index.
Definition interface.cpp:53
bool supportsBroadcast() const
is interface supporting broadcast.
Definition interface.cpp:358
int removeAddress(const IpAddress &ipAddress, uint32_t prefix, const IpAddress &broadcast={}, bool sync=false) const
remove address from interface.
Definition interface.cpp:148
std::vector< Address > AddressList
Definition interface.hpp:72
MacAddress mac() const
get interface mac address.
Definition interface.cpp:120
~Interface()=default
destroy instance.
bool supportsIpv4() const
is interface supporting IPv4.
Definition interface.cpp:376
bool isEnabled() const
is interface enabled.
Definition interface.cpp:267
std::string kind() const
get interface kind.
Definition interface.cpp:101
bool hasLocalAddress() const
check if interface has link local address stored.
Definition interface.cpp:195
std::shared_ptr< Interface > Ptr
Definition interface.hpp:60
int removeFromBridge(bool sync=false) const
remove interface from bridge.
Definition interface.cpp:239
int addAddress(const IpAddress &ipAddress, uint32_t prefix, const IpAddress &broadcast={}, bool sync=false) const
add address to interface.
Definition interface.cpp:130
bool hasAddress(const IpAddress &ipAddress) const
check if interface has address stored.
Definition interface.cpp:176
uint32_t flags() const
get interface flags.
Definition interface.cpp:248
std::string name() const
get interface name.
Definition interface.cpp:72
bool isGre() const
is interface a gre interface.
Definition interface.cpp:339
bool isVlan() const
is interface a vlan interface.
Definition interface.cpp:321
AddressList addressList() const
get interface ip addresses.
Definition interface.cpp:166
int addToBridge(uint32_t masterIndex, bool sync=false) const
add interface to bridge.
Definition interface.cpp:214
bool isVeth() const
is interface a veth interface.
Definition interface.cpp:330
uint32_t mtu() const
get interface mtu.
Definition interface.cpp:91
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:312
bool isTun() const
is interface a tun interface.
Definition interface.cpp:349
bool isPointToPoint() const
is interface a point to point interface.
Definition interface.cpp:294
Interface()=delete
create instance.
IPv6, IPv4 address class.
Definition ip_address.hpp:51
MAC address class.
Definition mac_address.hpp:46
Definition acceptor.hpp:32
std::vector< Interface::Ptr > InterfaceList
list of interfaces.
Definition interface.hpp:394
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:186
bool operator<(const BasicDatagramSocket< Protocol > &a, const BasicDatagramSocket< Protocol > &b) noexcept
compare if socket handle is inferior.
Definition datagram_socket.hpp:394
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 tcp_acceptor_test.cpp:35