From a51d47a4bb97bdf12349270d013e824a88844939 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Tue, 26 Jan 2021 14:29:53 +0100 Subject: [PATCH] Add partial docs. --- Source/Engine/Platform/Base/NetworkBase.h | 85 ++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Platform/Base/NetworkBase.h b/Source/Engine/Platform/Base/NetworkBase.h index 0f0f89cb7..99a93ebf5 100644 --- a/Source/Engine/Platform/Base/NetworkBase.h +++ b/Source/Engine/Platform/Base/NetworkBase.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. +// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #pragma once @@ -74,17 +74,100 @@ struct FLAXENGINE_API NetworkSocketGroup class FLAXENGINE_API NetworkBase { public: + /// + /// Initialize the network module. + /// + /// Return true on error. Otherwise false. static bool Init(); + + /// + /// Deinitialize the network module. + /// static void Exit(); + + /// + /// Create a new native socket. + /// + /// The socket struct to fill in. + /// The protocol. + /// The ip version. + /// Return true on error. Otherwise false. static bool CreateSocket(NetworkSocket& socket, NetworkProtocolType proto, NetworkIPVersion ipv); + + /// + /// Close native socket. + /// + /// The socket. + /// Return true on error. Otherwise false. static bool DestroySocket(NetworkSocket& socket); + + /// + /// Set the specified socket option. + /// + /// The socket. + /// The option. + /// The value. + /// Return true on error. Otherwise false. static bool SetSocketOption(NetworkSocket& socket, NetworkSocketOption option, bool value); + + /// + /// Set the specified socket option. + /// + /// The socket. + /// The option. + /// The value. + /// Return true on error. Otherwise false. static bool SetSocketOption(NetworkSocket& socket, NetworkSocketOption option, int32 value); + + /// + /// Get the specified socket option. + /// + /// The socket. + /// The option. + /// The returned value. + /// Return true on error. Otherwise false. static bool GetSocketOption(NetworkSocket& socket, NetworkSocketOption option, bool* value); + + /// + /// Get the specified socket option. + /// + /// The socket. + /// The option. + /// The returned value. + /// Return true on error. Otherwise false. static bool GetSocketOption(NetworkSocket& socket, NetworkSocketOption option, int32* value); + + /// + /// Connect a socket to the specified end point. + /// + /// The socket. + /// The end point. + /// Return true on error. Otherwise false. static bool ConnectSocket(NetworkSocket& socket, NetworkEndPoint& endPoint); + + /// + /// Bind a socket to the specified end point. + /// + /// The socket. + /// The end point. + /// Return true on error. Otherwise false. static bool BindSocket(NetworkSocket& socket, NetworkEndPoint& endPoint); + + /// + /// Listen for incoming connection. + /// + /// The socket. + /// Pending connection queue size. + /// Return true on error. Otherwise false. static bool Listen(NetworkSocket& socket, uint16 queueSize); + + /// + /// Accept a pending connection. + /// + /// The socket. + /// The newly connected socket. + /// The end point of the new socket. + /// Return true on error. Otherwise false. static bool Accept(NetworkSocket& serverSock, NetworkSocket& newSock, NetworkEndPoint& newEndPoint); static bool IsReadable(NetworkSocket& socket); static bool IsWriteable(NetworkSocket& socket);