1 #pragma once 2 3 #include "types.hpp" 4 5 #include <stdplus/fd/managed.hpp> 6 7 namespace phosphor 8 { 9 namespace network 10 { 11 namespace rtnetlink 12 { 13 14 constexpr auto BUFSIZE = 4096; 15 16 /** General rtnetlink server which waits for the POLLIN event 17 and calls the call back once it gets the event. 18 Usage would be create the server with the call back 19 and call the run method. 20 */ 21 22 class Server 23 { 24 25 public: 26 /** @brief Constructor 27 * 28 * @details Sets up the server to handle incoming RTNETLINK events 29 * 30 * @param[in] eventPtr - Unique ptr reference to sd_event. 31 * @param[in] socket - netlink socket. 32 */ 33 Server(EventPtr& eventPtr); 34 35 /** @brief Gets the socket associated with this netlink server */ 36 inline stdplus::Fd& getSock() 37 { 38 return sock; 39 } 40 41 private: 42 stdplus::ManagedFd sock; 43 }; 44 45 } // namespace rtnetlink 46 } // namespace network 47 } // namespace phosphor 48