Hepu.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef __HEPU_H__
  2. #define __HEPU_H__
  3. #include <iostream>
  4. #include <time.h>
  5. #include <ctime>
  6. #include "Util/util.h"
  7. #include "Util/logger.h"
  8. #include "Util/NoticeCenter.h"
  9. #include "Poller/EventPoller.h"
  10. #include "Util/SqlPool.h"
  11. #include "Network/TcpClient.h"
  12. #include "Poller/Timer.h"
  13. //#include "TCPClient.hpp"
  14. #include <httplib.h>
  15. #include "Notices.h"
  16. #include "md5.h"
  17. #include "UtilBase.hpp"
  18. #include "HepuHB.h"
  19. #include "HepuHBRe.h"
  20. #include "HepuLogin.h"
  21. #include "HepuLoginRe.h"
  22. #include "HepuTarget.h"
  23. #include "HepuTargetRe.h"
  24. #include "HepuGetSalt.h"
  25. #include "HepuGetSaltRe.h"
  26. using namespace std;
  27. using namespace toolkit;
  28. namespace gsd{
  29. class Hepu: public enable_shared_from_this<Hepu>, public ModuleBase
  30. {
  31. private:
  32. string username_;
  33. string password_;
  34. string token_;
  35. string url_;
  36. string salt_;
  37. int port_;
  38. public:
  39. Hepu(){}
  40. ~Hepu(){}
  41. virtual bool Init(){
  42. return true;
  43. }
  44. virtual void Destroy(){
  45. }
  46. int32_t Init(string username, string url, int port);
  47. int32_t Init2();
  48. static std::shared_ptr<Hepu> CreateNew();
  49. int32_t LoginHepu();
  50. bool alive();
  51. int32_t getSalt(HepuGetSalt& hepuGetSaltMsg);
  52. int32_t getSalt();
  53. int32_t sendHepuHB(HepuHB& hepuHBMsg);
  54. int32_t sendHepuHB();
  55. int32_t sendHepuTarget(HepuTarget& hepuTargetMsg);
  56. void setUsr(string usr);
  57. void setPwd(string pwd);
  58. void setUrl(string url);
  59. void setPort(int port);
  60. };
  61. };
  62. #endif