| | |
| | |
| |
|
| | #pragma once |
| |
|
| | #include <array> |
| | #include <functional> |
| | #include <string> |
| | #include <vector> |
| | #include "common/common_types.h" |
| | #include "common/socket_types.h" |
| | #include "web_service/web_result.h" |
| |
|
| | namespace AnnounceMultiplayerRoom { |
| |
|
| | struct GameInfo { |
| | std::string name{""}; |
| | u64 id{0}; |
| | std::string version{""}; |
| | }; |
| |
|
| | struct Member { |
| | std::string username; |
| | std::string nickname; |
| | std::string display_name; |
| | std::string avatar_url; |
| | Network::IPv4Address fake_ip; |
| | GameInfo game; |
| | }; |
| |
|
| | struct RoomInformation { |
| | std::string name; |
| | std::string description; |
| | u32 member_slots; |
| | u16 port; |
| | GameInfo preferred_game; |
| | std::string host_username; |
| | bool enable_yuzu_mods; |
| | }; |
| |
|
| | struct Room { |
| | RoomInformation information; |
| |
|
| | std::string id; |
| | std::string verify_uid; |
| | std::string ip; |
| | u32 net_version; |
| | bool has_password; |
| |
|
| | std::vector<Member> members; |
| | }; |
| | using RoomList = std::vector<Room>; |
| |
|
| | |
| | |
| | |
| | |
| | class Backend { |
| | public: |
| | virtual ~Backend() = default; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | virtual void SetRoomInformation(const std::string& name, const std::string& description, |
| | const u16 port, const u32 max_player, const u32 net_version, |
| | const bool has_password, const GameInfo& preferred_game) = 0; |
| | |
| | |
| | |
| | |
| | virtual void AddPlayer(const Member& member) = 0; |
| |
|
| | |
| | |
| | |
| | |
| | virtual WebService::WebResult Update() = 0; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | virtual WebService::WebResult Register() = 0; |
| |
|
| | |
| | |
| | |
| | virtual void ClearPlayers() = 0; |
| |
|
| | |
| | |
| | |
| | |
| | virtual RoomList GetRoomList() = 0; |
| |
|
| | |
| | |
| | |
| | virtual void Delete() = 0; |
| | }; |
| |
|
| | |
| | |
| | |
| | |
| | class NullBackend : public Backend { |
| | public: |
| | ~NullBackend() = default; |
| | void SetRoomInformation(const std::string& , const std::string& , |
| | const u16 , const u32 , const u32 , |
| | const bool , |
| | const GameInfo& ) override {} |
| | void AddPlayer(const Member& ) override {} |
| | WebService::WebResult Update() override { |
| | return WebService::WebResult{WebService::WebResult::Code::NoWebservice, |
| | "WebService is missing", ""}; |
| | } |
| | WebService::WebResult Register() override { |
| | return WebService::WebResult{WebService::WebResult::Code::NoWebservice, |
| | "WebService is missing", ""}; |
| | } |
| | void ClearPlayers() override {} |
| | RoomList GetRoomList() override { |
| | return RoomList{}; |
| | } |
| |
|
| | void Delete() override {} |
| | }; |
| |
|
| | } |
| |
|