From 589dc083a58425cadd8390ddd81854dcf054dd27 Mon Sep 17 00:00:00 2001 From: B3n30 Date: Sat, 8 Jul 2017 15:24:47 +0200 Subject: Network: Threads for Room and RoomMember --- src/network/room.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/network/room.h') diff --git a/src/network/room.h b/src/network/room.h index 70c64d5f1..0a6217c11 100644 --- a/src/network/room.h +++ b/src/network/room.h @@ -4,7 +4,6 @@ #pragma once -#include #include #include #include "common/common_types.h" @@ -19,6 +18,19 @@ struct RoomInformation { u32 member_slots; ///< Maximum number of members in this room }; +// The different types of messages that can be sent. The first byte of each packet defines the type +typedef uint8_t MessageID; +enum RoomMessageTypes { + IdJoinRequest = 1, + IdJoinSuccess, + IdRoomInformation, + IdSetGameName, + IdWifiPacket, + IdChatMessage, + IdNameCollision, + IdMacCollision +}; + /// This is what a server [person creating a server] would use. class Room final { public: -- cgit v1.2.3 From 2af9a7146d17e89840c2c9c4f9134c992d27361c Mon Sep 17 00:00:00 2001 From: B3n30 Date: Sat, 8 Jul 2017 16:47:24 +0200 Subject: Network: Handle join request in Room --- src/network/room.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/network/room.h') diff --git a/src/network/room.h b/src/network/room.h index 0a6217c11..ca663058f 100644 --- a/src/network/room.h +++ b/src/network/room.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include "common/common_types.h" @@ -18,6 +19,11 @@ struct RoomInformation { u32 member_slots; ///< Maximum number of members in this room }; +using MacAddress = std::array; +/// A special MAC address that tells the room we're joining to assign us a MAC address +/// automatically. +const MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + // The different types of messages that can be sent. The first byte of each packet defines the type typedef uint8_t MessageID; enum RoomMessageTypes { -- cgit v1.2.3 From 859be35d54fda177a237e0c24bc1eaca76f1936d Mon Sep 17 00:00:00 2001 From: B3n30 Date: Sun, 9 Jul 2017 15:06:02 +0200 Subject: Network: Send the game title --- src/network/room.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/network/room.h') diff --git a/src/network/room.h b/src/network/room.h index ca663058f..82e3dc62c 100644 --- a/src/network/room.h +++ b/src/network/room.h @@ -19,13 +19,16 @@ struct RoomInformation { u32 member_slots; ///< Maximum number of members in this room }; -using MacAddress = std::array; +using MacAddress = std::array; /// A special MAC address that tells the room we're joining to assign us a MAC address /// automatically. const MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +// 802.11 broadcast MAC address +constexpr MacAddress BroadcastMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + // The different types of messages that can be sent. The first byte of each packet defines the type -typedef uint8_t MessageID; +using MessageID = u8; enum RoomMessageTypes { IdJoinRequest = 1, IdJoinSuccess, -- cgit v1.2.3 From a0626221a52056669c0b6d19b37d4189c1671fb7 Mon Sep 17 00:00:00 2001 From: B3n30 Date: Fri, 14 Jul 2017 09:20:39 +0200 Subject: Network: Made send async in RoomMember --- src/network/room.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/network/room.h') diff --git a/src/network/room.h b/src/network/room.h index 82e3dc62c..ffa17599d 100644 --- a/src/network/room.h +++ b/src/network/room.h @@ -11,6 +11,8 @@ namespace Network { +constexpr u32 network_version = 1; ///< The version of this Room and RoomMember + constexpr u16 DefaultRoomPort = 1234; constexpr size_t NumChannels = 1; // Number of channels used for the connection @@ -37,7 +39,9 @@ enum RoomMessageTypes { IdWifiPacket, IdChatMessage, IdNameCollision, - IdMacCollision + IdMacCollision, + IdVersionMismatch, + IdCloseRoom }; /// This is what a server [person creating a server] would use. -- cgit v1.2.3 From 77df82f5d66683f4928c4ad37f1deb77b79bb7df Mon Sep 17 00:00:00 2001 From: B3n30 Date: Sat, 15 Jul 2017 21:24:11 +0200 Subject: Network: Changed timeout for receiving packets to 100ms --- src/network/room.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/network/room.h') diff --git a/src/network/room.h b/src/network/room.h index ffa17599d..54cccf0ae 100644 --- a/src/network/room.h +++ b/src/network/room.h @@ -30,8 +30,7 @@ const MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; constexpr MacAddress BroadcastMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // The different types of messages that can be sent. The first byte of each packet defines the type -using MessageID = u8; -enum RoomMessageTypes { +enum RoomMessageTypes : u8 { IdJoinRequest = 1, IdJoinSuccess, IdRoomInformation, -- cgit v1.2.3