blockchain , sdchain cpp sdk and demo

Dependencies:   EthernetInterface mbed-rtos mbed uniqueCPUID

Fork of bcsdk by SDchain C Plus Plus Team

Client.h

Committer:
webmaster
Date:
2017-11-03
Revision:
10:aabd720e632c
Parent:
8:f2a567ee3a46
Child:
12:1b24ea479a59

File content as of revision 10:aabd720e632c:

/***********************************************************************
 * Module:  Client.h
 * Author:  Administrator
 * Modified: 2017��9��4�� 11:08:02
 * Purpose: Declaration of the class Client
 * Comment: Client���������Զ��
 *    APIִ��HTTP�������������
 *    ��Ϣ�� ͨ����Ӧ�ó��򽫾�����
 *    �����ķ�������Ŀͻ��˺���HSM
 *    ��������������ĵ����ͻ��ˡ�
 ***********************************************************************/

#if !defined(__Account_Client_h)
#define __Account_Client_h

#include "define.h"
#include <stdio.h>  
#include <iostream>  
#include <string>  


using namespace std;

class Client
{
public:
	Client();
	Client(string ip, short port);
	~Client();

	void setIp(string newIp){ this->m_strIP = newIp;};
	string getIp(){return this->m_strIP;};
	void setPort(short newPort){this->m_sPort = newPort;};
	short getPort(){return this->m_sPort;};
	int http_post(const string &strIn,string &strOut);

	bool build_post_raw(const string & url,const string & content, string & post_raw);
	bool build_post_raw(const string & url, const string & host, const string & token, const string & content, string & post_raw);
	int http_post(const string & url,const string & content,string & strOut);
	int http_post_raw(const string &strIn,string &strOut);
	
	int get_content_length(const string & strRaw);
	string get_content(const string & strRep);
	bool unbuild_post_raw(const string & strRep, int & content_length, string & url,string & content);

protected:
private:
   int urlIndex;
   //list<URL> urls;
   std::string accessToken;
   //socket httpClient;
   std::string json;
   std::string version;

   string m_strIP;
   short m_sPort;
   string m_url;
   string m_host;
   string m_token;


};

#endif