Hepu.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 "UtilBase.hpp"
  17. #include "HepuHB.h"
  18. #include "HepuHBRe.h"
  19. #include "HepuLogin.h"
  20. #include "HepuLoginRe.h"
  21. #include "HepuTarget.h"
  22. #include "HepuTargetRe.h"
  23. using namespace std;
  24. using namespace toolkit;
  25. namespace gsd{
  26. class Hepu: public enable_shared_from_this<Hepu>, public ModuleBase
  27. {
  28. private:
  29. string username_;
  30. string password_;
  31. string token_;
  32. string url_;
  33. int port_;
  34. public:
  35. Hepu(){}
  36. ~Hepu(){}
  37. virtual bool Init(){
  38. return true;
  39. }
  40. virtual void Destroy(){
  41. }
  42. int32_t Init(string username, string url, int port);
  43. int32_t Init2();
  44. static std::shared_ptr<Hepu> CreateNew();
  45. int32_t LoginHepu();
  46. bool alive();
  47. int32_t sendHepuHB(HepuHB& HepuHBMsg);
  48. int32_t sendHepuHB();
  49. int32_t sendHepuTarget(HepuTarget& HepuTargetMsg);
  50. void setUsr(string usr);
  51. void setPwd(string pwd);
  52. void setUrl(string url);
  53. void setPort(int port);
  54. };
  55. };
  56. #endif