summaryrefslogtreecommitdiff
path: root/src/network/room.h
diff options
context:
space:
mode:
authorGravatar Weiyi Wang2017-07-17 17:08:02 +0300
committerGravatar GitHub2017-07-17 17:08:02 +0300
commit924215a41fc3b1cfe16ae622a14a4bc856b5972e (patch)
treec0407aad38f63520e402ce713bf7a73fa6397f11 /src/network/room.h
parentMerge pull request #2829 from MerryMage/check_submodules_present (diff)
parentNetwork: Changed timeout for receiving packets to 100ms (diff)
downloadyuzu-924215a41fc3b1cfe16ae622a14a4bc856b5972e.tar.gz
yuzu-924215a41fc3b1cfe16ae622a14a4bc856b5972e.tar.xz
yuzu-924215a41fc3b1cfe16ae622a14a4bc856b5972e.zip
Merge pull request #2818 from B3n30/network
Enable data transfer over ENet
Diffstat (limited to 'src/network/room.h')
-rw-r--r--src/network/room.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/network/room.h b/src/network/room.h
index 70c64d5f1..54cccf0ae 100644
--- a/src/network/room.h
+++ b/src/network/room.h
@@ -4,13 +4,15 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <atomic> 7#include <array>
8#include <memory> 8#include <memory>
9#include <string> 9#include <string>
10#include "common/common_types.h" 10#include "common/common_types.h"
11 11
12namespace Network { 12namespace Network {
13 13
14constexpr u32 network_version = 1; ///< The version of this Room and RoomMember
15
14constexpr u16 DefaultRoomPort = 1234; 16constexpr u16 DefaultRoomPort = 1234;
15constexpr size_t NumChannels = 1; // Number of channels used for the connection 17constexpr size_t NumChannels = 1; // Number of channels used for the connection
16 18
@@ -19,6 +21,28 @@ struct RoomInformation {
19 u32 member_slots; ///< Maximum number of members in this room 21 u32 member_slots; ///< Maximum number of members in this room
20}; 22};
21 23
24using MacAddress = std::array<u8, 6>;
25/// A special MAC address that tells the room we're joining to assign us a MAC address
26/// automatically.
27const MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
28
29// 802.11 broadcast MAC address
30constexpr MacAddress BroadcastMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
31
32// The different types of messages that can be sent. The first byte of each packet defines the type
33enum RoomMessageTypes : u8 {
34 IdJoinRequest = 1,
35 IdJoinSuccess,
36 IdRoomInformation,
37 IdSetGameName,
38 IdWifiPacket,
39 IdChatMessage,
40 IdNameCollision,
41 IdMacCollision,
42 IdVersionMismatch,
43 IdCloseRoom
44};
45
22/// This is what a server [person creating a server] would use. 46/// This is what a server [person creating a server] would use.
23class Room final { 47class Room final {
24public: 48public: