| #pragma once |
| #include <sdeventplus/event.hpp> |
| #include <sdeventplus/source/io.hpp> |
| #include <stdplus/fd/managed.hpp> |
| |
| namespace phosphor |
| { |
| namespace network |
| { |
| namespace netlink |
| { |
| |
| constexpr auto BUFSIZE = 4096; |
| |
| /** General rtnetlink server which waits for the POLLIN event |
| and calls the call back once it gets the event. |
| Usage would be create the server with the call back |
| and call the run method. |
| */ |
| class Server |
| { |
| |
| public: |
| /** @brief Constructor |
| * |
| * @details Sets up the server to handle incoming RTNETLINK events |
| * |
| * @param[in] eventPtr - Unique ptr reference to sd_event. |
| * @param[in] socket - netlink socket. |
| */ |
| Server(sdeventplus::Event& event); |
| |
| /** @brief Gets the socket associated with this netlink server */ |
| inline stdplus::Fd& getSock() |
| { |
| return sock; |
| } |
| |
| private: |
| stdplus::ManagedFd sock; |
| sdeventplus::source::IO io; |
| }; |
| |
| } // namespace netlink |
| } // namespace network |
| } // namespace phosphor |