2
0

Session.h 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include <stdint.h> // for uint8_t
  3. #include <memory> // for shared_ptr, unique_ptr
  4. #include <string> // for string
  5. #include <vector> // for vector
  6. namespace cspot {
  7. class AuthChallenges;
  8. class LoginBlob;
  9. class PlainConnection;
  10. class ShannonConnection;
  11. } // namespace cspot
  12. #define LOGIN_REQUEST_COMMAND 0xAB
  13. #define AUTH_SUCCESSFUL_COMMAND 0xAC
  14. #define AUTH_DECLINED_COMMAND 0xAD
  15. namespace cspot {
  16. class Session {
  17. protected:
  18. std::unique_ptr<cspot::AuthChallenges> challenges;
  19. std::shared_ptr<cspot::PlainConnection> conn;
  20. std::shared_ptr<LoginBlob> authBlob;
  21. std::string deviceId = "142137fd329622137a14901634264e6f332e2411";
  22. public:
  23. Session();
  24. ~Session();
  25. std::shared_ptr<cspot::ShannonConnection> shanConn;
  26. void connect(std::unique_ptr<cspot::PlainConnection> connection);
  27. void connectWithRandomAp();
  28. void close();
  29. virtual bool triggerTimeout() = 0;
  30. std::vector<uint8_t> authenticate(std::shared_ptr<LoginBlob> blob);
  31. };
  32. } // namespace cspot