summaryrefslogtreecommitdiff
path: root/src/network/room.h
diff options
context:
space:
mode:
authorGravatar B3n302017-08-19 19:14:33 +0200
committerGravatar James Rowe2017-08-19 11:14:33 -0600
commit5d0a1e7efddf234234d54fe97395f6975f8d1a28 (patch)
treecef0c9114f39af64c2971509fb2d0197c73cc155 /src/network/room.h
parentMerge pull request #2881 from MerryMage/dsp-firm-check (diff)
downloadyuzu-5d0a1e7efddf234234d54fe97395f6975f8d1a28.tar.gz
yuzu-5d0a1e7efddf234234d54fe97395f6975f8d1a28.tar.xz
yuzu-5d0a1e7efddf234234d54fe97395f6975f8d1a28.zip
Added missing parts in libnetwork (#2838)
* Network: Set and send the game information over enet Added Callbacks for RoomMember and GetMemberList to Room in preparation for web_services.
Diffstat (limited to 'src/network/room.h')
-rw-r--r--src/network/room.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/network/room.h b/src/network/room.h
index 65b0d008a..8285a4d0c 100644
--- a/src/network/room.h
+++ b/src/network/room.h
@@ -7,6 +7,7 @@
7#include <array> 7#include <array>
8#include <memory> 8#include <memory>
9#include <string> 9#include <string>
10#include <vector>
10#include "common/common_types.h" 11#include "common/common_types.h"
11 12
12namespace Network { 13namespace Network {
@@ -21,6 +22,11 @@ struct RoomInformation {
21 u32 member_slots; ///< Maximum number of members in this room 22 u32 member_slots; ///< Maximum number of members in this room
22}; 23};
23 24
25struct GameInfo {
26 std::string name{""};
27 u64 id{0};
28};
29
24using MacAddress = std::array<u8, 6>; 30using MacAddress = std::array<u8, 6>;
25/// A special MAC address that tells the room we're joining to assign us a MAC address 31/// A special MAC address that tells the room we're joining to assign us a MAC address
26/// automatically. 32/// automatically.
@@ -34,7 +40,7 @@ enum RoomMessageTypes : u8 {
34 IdJoinRequest = 1, 40 IdJoinRequest = 1,
35 IdJoinSuccess, 41 IdJoinSuccess,
36 IdRoomInformation, 42 IdRoomInformation,
37 IdSetGameName, 43 IdSetGameInfo,
38 IdWifiPacket, 44 IdWifiPacket,
39 IdChatMessage, 45 IdChatMessage,
40 IdNameCollision, 46 IdNameCollision,
@@ -51,6 +57,12 @@ public:
51 Closed, ///< The room is not opened and can not accept connections. 57 Closed, ///< The room is not opened and can not accept connections.
52 }; 58 };
53 59
60 struct Member {
61 std::string nickname; ///< The nickname of the member.
62 GameInfo game_info; ///< The current game of the member
63 MacAddress mac_address; ///< The assigned mac address of the member.
64 };
65
54 Room(); 66 Room();
55 ~Room(); 67 ~Room();
56 68
@@ -65,6 +77,11 @@ public:
65 const RoomInformation& GetRoomInformation() const; 77 const RoomInformation& GetRoomInformation() const;
66 78
67 /** 79 /**
80 * Gets a list of the mbmers connected to the room.
81 */
82 std::vector<Member> GetRoomMemberList() const;
83
84 /**
68 * Creates the socket for this room. Will bind to default address if 85 * Creates the socket for this room. Will bind to default address if
69 * server is empty string. 86 * server is empty string.
70 */ 87 */