diff options
author | B3n30 <bene_thomas@web.de> | 2017-07-07 21:34:15 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2017-07-07 21:34:15 +0200 |
commit | 2e37ce01c9dcdc5932cf5fe47a1ade0e0d2b7cf8 (patch) | |
tree | b5298b3c528d9acc1f3fa48f19c9f9c19c97d036 /src/network/room.h | |
parent | Merge pull request #2814 from Kloen/macro-remove (diff) | |
download | yuzu-2e37ce01c9dcdc5932cf5fe47a1ade0e0d2b7cf8.tar yuzu-2e37ce01c9dcdc5932cf5fe47a1ade0e0d2b7cf8.tar.gz yuzu-2e37ce01c9dcdc5932cf5fe47a1ade0e0d2b7cf8.tar.bz2 yuzu-2e37ce01c9dcdc5932cf5fe47a1ade0e0d2b7cf8.tar.lz yuzu-2e37ce01c9dcdc5932cf5fe47a1ade0e0d2b7cf8.tar.xz yuzu-2e37ce01c9dcdc5932cf5fe47a1ade0e0d2b7cf8.tar.zst yuzu-2e37ce01c9dcdc5932cf5fe47a1ade0e0d2b7cf8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/network/room.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/network/room.h b/src/network/room.h new file mode 100644 index 000000000..70c64d5f1 --- /dev/null +++ b/src/network/room.h @@ -0,0 +1,60 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <atomic> +#include <memory> +#include <string> +#include "common/common_types.h" + +namespace Network { + +constexpr u16 DefaultRoomPort = 1234; +constexpr size_t NumChannels = 1; // Number of channels used for the connection + +struct RoomInformation { + std::string name; ///< Name of the server + u32 member_slots; ///< Maximum number of members in this room +}; + +/// This is what a server [person creating a server] would use. +class Room final { +public: + enum class State : u8 { + Open, ///< The room is open and ready to accept connections. + Closed, ///< The room is not opened and can not accept connections. + }; + + Room(); + ~Room(); + + /** + * Gets the current state of the room. + */ + State GetState() const; + + /** + * Gets the room information of the room. + */ + const RoomInformation& GetRoomInformation() const; + + /** + * Creates the socket for this room. Will bind to default address if + * server is empty string. + */ + void Create(const std::string& name, const std::string& server = "", + u16 server_port = DefaultRoomPort); + + /** + * Destroys the socket + */ + void Destroy(); + +private: + class RoomImpl; + std::unique_ptr<RoomImpl> room_impl; +}; + +} // namespace Network |