#pragma once #include #include #include #include #include #include #include #include namespace phosphor::network { class DelayedExecutor { public: virtual ~DelayedExecutor() = default; virtual void schedule() = 0; virtual void setCallback(fu2::unique_function&& cb) = 0; }; /** @class InterfaceInfo * @brief Information about interfaces from the kernel */ struct InterfaceInfo { unsigned short type; unsigned idx; unsigned flags; std::optional name = std::nullopt; std::optional mac = std::nullopt; std::optional mtu = std::nullopt; std::optional parent_idx = std::nullopt; std::optional kind = std::nullopt; std::optional vlan_id = std::nullopt; constexpr bool operator==(const InterfaceInfo& rhs) const noexcept { return idx == rhs.idx && flags == rhs.flags && name == rhs.name && mac == rhs.mac && mtu == rhs.mtu && parent_idx == rhs.parent_idx && kind == rhs.kind && vlan_id == rhs.vlan_id; } }; /** @class AddressInfo * @brief Information about a addresses from the kernel */ struct AddressInfo { unsigned ifidx; stdplus::SubnetAny ifaddr; uint8_t scope; uint32_t flags; constexpr bool operator==(const AddressInfo& rhs) const noexcept { return ifidx == rhs.ifidx && ifaddr == rhs.ifaddr && scope == rhs.scope && flags == rhs.flags; } }; /** @class NeighborInfo * @brief Information about a neighbor from the kernel */ struct NeighborInfo { unsigned ifidx; uint16_t state; std::optional addr; std::optional mac; constexpr bool operator==(const NeighborInfo& rhs) const noexcept { return ifidx == rhs.ifidx && state == rhs.state && addr == rhs.addr && mac == rhs.mac; } }; /** @brief Contains all of the object information about the interface */ struct AllIntfInfo { InterfaceInfo intf; std::optional defgw4 = std::nullopt; std::optional defgw6 = std::nullopt; std::unordered_map addrs = {}; std::unordered_map staticNeighs = {}; }; } // namespace phosphor::network