GlobalLobbyProcessor.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * GlobalLobbyProcessor.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../lib/network/NetworkInterface.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class JsonNode;
  14. VCMI_LIB_NAMESPACE_END
  15. class CVCMIServer;
  16. class GlobalLobbyProcessor : public INetworkClientListener
  17. {
  18. CVCMIServer & owner;
  19. NetworkConnectionPtr controlConnection;
  20. std::map<std::string, NetworkConnectionPtr> proxyConnections;
  21. void onDisconnected(const std::shared_ptr<INetworkConnection> & connection, const std::string & errorMessage) override;
  22. void onPacketReceived(const std::shared_ptr<INetworkConnection> & connection, const std::vector<std::byte> & message) override;
  23. void onConnectionFailed(const std::string & errorMessage) override;
  24. void onConnectionEstablished(const std::shared_ptr<INetworkConnection> &) override;
  25. void receiveOperationFailed(const JsonNode & json);
  26. void receiveServerLoginSuccess(const JsonNode & json);
  27. void receiveAccountJoinsRoom(const JsonNode & json);
  28. void establishNewConnection();
  29. void sendMessage(const NetworkConnectionPtr & targetConnection, const JsonNode & payload);
  30. JsonNode getHostModList() const;
  31. const std::string & getHostAccountID() const;
  32. const std::string & getHostAccountCookie() const;
  33. const std::string & getHostAccountDisplayName() const;
  34. public:
  35. void sendChangeRoomDescription(const std::string & description);
  36. void sendGameStarted();
  37. explicit GlobalLobbyProcessor(CVCMIServer & owner);
  38. };