Network: Add NetCode enum and SocketError_Packet, fixes compilation

Former-commit-id: 2c56f086a7b8892377730e4f556f3953e9e7dc62
This commit is contained in:
Lynix 2016-02-04 12:48:04 +01:00
parent 0b71d1a2e2
commit 4e3244c999
2 changed files with 35 additions and 30 deletions

View File

@ -26,7 +26,6 @@ namespace Nz
inline ByteStream(ByteStream&& stream);
~ByteStream();
inline Endianness GetDataEndianness() const;
inline Nz::UInt64 GetSize() const;
inline Stream* GetStream() const;

View File

@ -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
};