summaryrefslogtreecommitdiff
path: root/src/network/room.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/room.h')
-rw-r--r--src/network/room.h60
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 @@
1// Copyright 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <atomic>
8#include <memory>
9#include <string>
10#include "common/common_types.h"
11
12namespace Network {
13
14constexpr u16 DefaultRoomPort = 1234;
15constexpr size_t NumChannels = 1; // Number of channels used for the connection
16
17struct RoomInformation {
18 std::string name; ///< Name of the server
19 u32 member_slots; ///< Maximum number of members in this room
20};
21
22/// This is what a server [person creating a server] would use.
23class Room final {
24public:
25 enum class State : u8 {
26 Open, ///< The room is open and ready to accept connections.
27 Closed, ///< The room is not opened and can not accept connections.
28 };
29
30 Room();
31 ~Room();
32
33 /**
34 * Gets the current state of the room.
35 */
36 State GetState() const;
37
38 /**
39 * Gets the room information of the room.
40 */
41 const RoomInformation& GetRoomInformation() const;
42
43 /**
44 * Creates the socket for this room. Will bind to default address if
45 * server is empty string.
46 */
47 void Create(const std::string& name, const std::string& server = "",
48 u16 server_port = DefaultRoomPort);
49
50 /**
51 * Destroys the socket
52 */
53 void Destroy();
54
55private:
56 class RoomImpl;
57 std::unique_ptr<RoomImpl> room_impl;
58};
59
60} // namespace Network