diff options
| author | 2017-07-17 17:08:02 +0300 | |
|---|---|---|
| committer | 2017-07-17 17:08:02 +0300 | |
| commit | 924215a41fc3b1cfe16ae622a14a4bc856b5972e (patch) | |
| tree | c0407aad38f63520e402ce713bf7a73fa6397f11 /src/network/room.h | |
| parent | Merge pull request #2829 from MerryMage/check_submodules_present (diff) | |
| parent | Network: Changed timeout for receiving packets to 100ms (diff) | |
| download | yuzu-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.h | 26 |
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 | ||
| 12 | namespace Network { | 12 | namespace Network { |
| 13 | 13 | ||
| 14 | constexpr u32 network_version = 1; ///< The version of this Room and RoomMember | ||
| 15 | |||
| 14 | constexpr u16 DefaultRoomPort = 1234; | 16 | constexpr u16 DefaultRoomPort = 1234; |
| 15 | constexpr size_t NumChannels = 1; // Number of channels used for the connection | 17 | constexpr 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 | ||
| 24 | using 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. | ||
| 27 | const MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; | ||
| 28 | |||
| 29 | // 802.11 broadcast MAC address | ||
| 30 | constexpr 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 | ||
| 33 | enum 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. |
| 23 | class Room final { | 47 | class Room final { |
| 24 | public: | 48 | public: |