SLP Server
This contains the entry point for the SLP
and starts the SLP Server.
Change-Id: I5976c8168a1af2703143c9bead61583197949115
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/slp_server.hpp b/slp_server.hpp
new file mode 100644
index 0000000..0ab12c9
--- /dev/null
+++ b/slp_server.hpp
@@ -0,0 +1,46 @@
+#pragma once
+
+#include <iostream>
+#include <string>
+#include <sys/types.h>
+#include <systemd/sd-bus.h>
+#include <systemd/sd-daemon.h>
+#include <systemd/sd-event.h>
+
+#include "slp_meta.hpp"
+#include "slp.hpp"
+
+namespace slp
+{
+
+namespace udp
+{
+/** General udp server which waits for the POLLIN event
+ on the port and calls the call back once it gets the event.
+ usage would be create the server with the port and the call back
+ and call the run method.
+ */
+class Server
+{
+
+ public:
+
+ Server(): Server(slp::PORT, nullptr) {};
+
+ Server(uint16_t port, sd_event_io_handler_t cb):
+ port(port),
+ callme(cb) {};
+
+ Server(const Server&) = delete;
+ Server& operator=(const Server&) = delete;
+ Server(Server&&) = default;
+ Server& operator=(Server &&) = default;
+
+ uint16_t port;
+ sd_event_io_handler_t callme;
+
+ int run();
+
+};
+}//namespce udp
+}//namespace slp