Libnetwork: add password protected rooms, guid, and error fixes (#3068)

* Network: Add password protected roomsand GUID

* Limit chat message size
This commit is contained in:
B3n30 2017-11-19 19:52:37 +01:00 committed by GitHub
parent 4071da5012
commit c0a7afaa5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 139 additions and 33 deletions

View file

@ -16,7 +16,13 @@ namespace Network {
/// Information about the received WiFi packets.
/// Acts as our own 802.11 header.
struct WifiPacket {
enum class PacketType : u8 { Beacon, Data, Authentication, AssociationResponse };
enum class PacketType : u8 {
Beacon,
Data,
Authentication,
AssociationResponse,
Deauthentication
};
PacketType type; ///< The type of 802.11 frame.
std::vector<u8> data; ///< Raw 802.11 frame data, starting at the management frame header
/// for management frames.
@ -49,6 +55,7 @@ public:
NameCollision, ///< Somebody is already using this name
MacCollision, ///< Somebody is already using that mac-address
WrongVersion, ///< The room version is not the same as for this RoomMember
WrongPassword, ///< The password doesn't match the one from the Room
CouldNotConnect ///< The room is not responding to a connection attempt
};
@ -109,8 +116,8 @@ public:
* This may fail if the username is already taken.
*/
void Join(const std::string& nickname, const char* server_addr = "127.0.0.1",
const u16 serverPort = DefaultRoomPort, const u16 clientPort = 0,
const MacAddress& preferred_mac = NoPreferredMac);
const u16 server_port = DefaultRoomPort, const u16 client_port = 0,
const MacAddress& preferred_mac = NoPreferredMac, const std::string& password = "");
/**
* Sends a WiFi packet to the room.