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