Browse Source

restore iomanager.hpp

Missingmew 5 years ago
parent
commit
2eae30c132
1 changed files with 12 additions and 1 deletions
  1. 12 1
      cli/include/iomanager.hpp

+ 12 - 1
cli/include/iomanager.hpp

@@ -5,6 +5,7 @@
 
 #include <string>
 #include <boost/asio.hpp>
+#include <json/json.h>
 
 #define BLOCKSIZE 8
 
@@ -15,8 +16,18 @@ protected:
 	boost::asio::io_service ios;
 	tcp::socket *tcpsock;
 	boost::system::error_code errcode;
-	std::string *ipstring;
+	std::string ipstring;
 	int port;
+
+	std::string jsonerror;
+
+	Json::CharReaderBuilder rbuilder;
+	Json::CharReader* reader;
+	Json::StreamWriterBuilder wbuilder;
+
+	bool sendJson(Json::Value root);
+	bool receiveJson(boost::asio::streambuf &recvbuf);
+	bool parseJson(Json::Value *root, boost::asio::streambuf &recvbuf);
 public:
 	// Basic constructor
 	IoManager(char *ipcstring);