From 4e3244c999166bc989349efde439fcfe1dc4ea91 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 4 Feb 2016 12:48:04 +0100 Subject: [PATCH] Network: Add NetCode enum and SocketError_Packet, fixes compilation Former-commit-id: 2c56f086a7b8892377730e4f556f3953e9e7dc62 --- include/Nazara/Core/ByteStream.hpp | 1 - include/Nazara/Network/Enums.hpp | 64 ++++++++++++++++-------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/include/Nazara/Core/ByteStream.hpp b/include/Nazara/Core/ByteStream.hpp index 3b23a9f70..e26382cf4 100644 --- a/include/Nazara/Core/ByteStream.hpp +++ b/include/Nazara/Core/ByteStream.hpp @@ -26,7 +26,6 @@ namespace Nz inline ByteStream(ByteStream&& stream); ~ByteStream(); - inline Endianness GetDataEndianness() const; inline Nz::UInt64 GetSize() const; inline Stream* GetStream() const; diff --git a/include/Nazara/Network/Enums.hpp b/include/Nazara/Network/Enums.hpp index 21c96dde4..6fbb5aff3 100644 --- a/include/Nazara/Network/Enums.hpp +++ b/include/Nazara/Network/Enums.hpp @@ -9,20 +9,9 @@ namespace Nz { - enum ResolveError + enum NetCode : UInt16 { - ResolveError_NoError, - - ResolveError_Internal, //< An internal error occured - ResolveError_ResourceError, //< The operating system lacks the resources to proceed (insufficient memory) - ResolveError_NonRecoverable, //< An nonrecoverable error occured - ResolveError_NotFound, //< No such host is known - ResolveError_NotInitialized, //< Nazara network has not been initialized - ResolveError_ProtocolNotSupported, //< A specified protocol is not supported by the server - ResolveError_TemporaryFailure, //< A temporary failure occured, try again - ResolveError_Unknown, //< The last operation failed with an unlisted error code - - ResolveError_Max = ResolveError_TemporaryFailure + NetCode_Invalid = 0x0000 }; enum NetProtocol @@ -35,25 +24,42 @@ namespace Nz NetProtocol_Max = NetProtocol_Unknown }; + enum ResolveError + { + ResolveError_NoError, + + ResolveError_Internal, //< An internal error occurred + ResolveError_ResourceError, //< The operating system lacks the resources to proceed (insufficient memory) + ResolveError_NonRecoverable, //< An nonrecoverable error occurred + ResolveError_NotFound, //< No such host is known + ResolveError_NotInitialized, //< Nazara network has not been initialized + ResolveError_ProtocolNotSupported, //< A specified protocol is not supported by the server + ResolveError_TemporaryFailure, //< A temporary failure occurred, try again + ResolveError_Unknown, //< The last operation failed with an unlisted error code + + ResolveError_Max = ResolveError_Unknown + }; + enum SocketError { SocketError_NoError, - SocketError_AddressNotAvailable, //< The address is already in use (when binding/listening) - SocketError_ConnectionClosed, //< The connection has been closed - SocketError_ConnectionRefused, //< The connection attempt was refused - SocketError_DatagramSize, //< The datagram size is over the system limit - SocketError_Internal, //< The error is coming from the engine - SocketError_NetworkError, //< The network system has failed (maybe network is down) - SocketError_NotInitialized, //< Nazara network has not been initialized - SocketError_NotSupported, //< The operation is not supported (e.g. creating a bluetooth socket on a system without any bluetooth adaptater) - SocketError_ResolveError, //< The hostname couldn't be resolved (more information in ResolveError code) - SocketError_ResourceError, //< The operating system lacks the resources to proceed (e.g. memory/socket descriptor) - SocketError_UnreachableHost, //< The host is not reachable - SocketError_TimedOut, //< The operation timed out - SocketError_Unknown, //< The last operation failed with an unlisted error code - - SocketError_Max = SocketError_Unknown + SocketError_AddressNotAvailable, //< The address is already in use (when binding/listening) + SocketError_ConnectionClosed, //< The connection has been closed + SocketError_ConnectionRefused, //< The connection attempt was refused + SocketError_DatagramSize, //< The datagram size is over the system limit + SocketError_Internal, //< The error is coming from the engine + SocketError_Packet, //< The packet encoding/decoding failed, probably because of corrupted data + SocketError_NetworkError, //< The network system has failed (maybe network is down) + SocketError_NotInitialized, //< Nazara network has not been initialized + SocketError_NotSupported, //< The operation is not supported (e.g. creating a bluetooth socket on a system without any bluetooth adaptater) + SocketError_ResolveError, //< The hostname couldn't be resolved (more information in ResolveError code) + SocketError_ResourceError, //< The operating system lacks the resources to proceed (e.g. memory/socket descriptor) + SocketError_TimedOut, //< The operation timed out + SocketError_Unknown, //< The last operation failed with an unlisted error code + SocketError_UnreachableHost, //< The host is not reachable + + SocketError_Max = SocketError_UnreachableHost }; enum SocketState @@ -62,7 +68,7 @@ namespace Nz SocketState_Connecting, //< The socket is currently connecting SocketState_Connected, //< The socket is currently connected SocketState_NotConnected, //< The socket is not connected (or has been disconnected) - SocketState_Resolving, //< The socket is currently resolving a hostname + SocketState_Resolving, //< The socket is currently resolving a host name SocketState_Max = SocketState_NotConnected };