blob: a00e6b7536b733fbec99459e3b7b4698a0d400a9 [file] [log] [blame]
Ratan Gupta0f9dc1b2017-09-03 17:57:50 +05301#pragma once
2
3#include "types.hpp"
Vishwanatha Subbanna18891c62017-10-17 15:22:46 +05304#include "util.hpp"
Ratan Gupta0f9dc1b2017-09-03 17:57:50 +05305
6#include <systemd/sd-event.h>
7
8namespace phosphor
9{
10namespace network
11{
12namespace rtnetlink
13{
14
15constexpr 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
23class Server
24{
25
26 public:
27
28 /** @brief Constructor
29 *
Vishwanatha Subbanna18891c62017-10-17 15:22:46 +053030 * @details Sets up the server to handle incoming RTNETLINK events
31 *
32 * @param[in] eventPtr - Unique ptr reference to sd_event.
Ratan Gupta0f9dc1b2017-09-03 17:57:50 +053033 */
Vishwanatha Subbanna18891c62017-10-17 15:22:46 +053034 Server(EventPtr& eventPtr);
Ratan Gupta0f9dc1b2017-09-03 17:57:50 +053035
Vishwanatha Subbanna18891c62017-10-17 15:22:46 +053036 Server() = delete;
37 ~Server() = default;
Ratan Gupta0f9dc1b2017-09-03 17:57:50 +053038 Server(const Server&) = delete;
39 Server& operator=(const Server&) = delete;
40 Server(Server&&) = default;
41 Server& operator=(Server &&) = default;
Ratan Gupta0f9dc1b2017-09-03 17:57:50 +053042};
43
44} //namespace rtnetlink
45} //namespce network
46} //namespace phosphor