Hepu.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. #include "HepuTarget2.h"
  27. #include "HepuTarget2Re.h"
  28. using namespace std;
  29. using namespace toolkit;
  30. namespace gsd{
  31. class Hepu: public enable_shared_from_this<Hepu>, public ModuleBase
  32. {
  33. private:
  34. string username_;
  35. string password_;
  36. string token_;
  37. string url_;
  38. string salt_;
  39. int port_;
  40. public:
  41. Hepu(){}
  42. ~Hepu(){}
  43. virtual bool Init(){
  44. return true;
  45. }
  46. virtual void Destroy(){
  47. }
  48. int32_t Init(string username, string url, int port);
  49. int32_t Init2();
  50. static std::shared_ptr<Hepu> CreateNew();
  51. int32_t LoginHepu();
  52. bool alive();
  53. int32_t getSalt(HepuGetSalt& hepuGetSaltMsg);
  54. int32_t getSalt();
  55. int32_t sendHepuHB(HepuHB& hepuHBMsg);
  56. int32_t sendHepuHB();
  57. int32_t sendHepuTarget(HepuTarget& hepuTargetMsg);
  58. int32_t sendHepuTarget2(HepuTarget2& hepuTargetMsg);
  59. void setUsr(string usr);
  60. void setPwd(string pwd);
  61. void setUrl(string url);
  62. void setPort(int port);
  63. };
  64. };
  65. #endif