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_service_info.hpp b/slp_service_info.hpp
new file mode 100644
index 0000000..29fe1c4
--- /dev/null
+++ b/slp_service_info.hpp
@@ -0,0 +1,52 @@
+#pragma once
+#include <iostream>
+#include <fstream>
+#include <sstream>
+namespace slp
+{
+struct ConfigData
+{
+ std::string name;
+ std::string type;
+ std::string port;
+
+ friend std::istream& operator>>(std::istream& str, ConfigData& data)
+ {
+ std::string line;
+ constexpr auto DELIMITER = " ";
+ size_t delimtrPos = 0;
+ size_t delimtrPrevPos = 0;
+ std::array<std::string, 3>tokens;
+ std::getline(str, line);
+ size_t count = 0;
+
+ delimtrPos = line.find(DELIMITER, delimtrPrevPos);
+ while (delimtrPos != std::string::npos)
+ {
+ tokens[count] = line.substr(delimtrPrevPos, (delimtrPos - delimtrPrevPos));
+ delimtrPrevPos = delimtrPos + 1;
+
+ delimtrPos = line.find(DELIMITER, delimtrPrevPos);
+ if (delimtrPos == std::string::npos && delimtrPrevPos < line.length())
+ {
+ delimtrPos = line.length();
+ }
+
+ count++;
+ }
+
+ if (count > 2)
+ {
+ data.name = tokens[0];
+ data.type = tokens[1];
+ data.port = tokens[2];
+ }
+ else
+ {
+ str.setstate(std::ios::failbit);
+ }
+ return str;
+ }
+
+};
+}