diff options
Diffstat (limited to 'libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network')
11 files changed, 1984 insertions, 0 deletions
diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Export.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Export.h new file mode 100755 index 0000000..f103e2d --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Export.h @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_EXPORT_H +#define SFML_NETWORK_EXPORT_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Config.h> + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(CSFML_NETWORK_EXPORTS) + + #define CSFML_NETWORK_API CSFML_API_EXPORT + +#else + + #define CSFML_NETWORK_API CSFML_API_IMPORT + +#endif + + +#endif // SFML_NETWORK_EXPORT_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Ftp.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Ftp.h new file mode 100755 index 0000000..0e33db1 --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Ftp.h @@ -0,0 +1,510 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FTP_H +#define SFML_FTP_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Network/Export.h> +#include <SFML/Network/IpAddress.h> +#include <SFML/Network/Types.h> +#include <stddef.h> + + +//////////////////////////////////////////////////////////// +/// \brief Enumeration of transfer modes +/// +//////////////////////////////////////////////////////////// +typedef enum +{ + sfFtpBinary, ///< Binary mode (file is transfered as a sequence of bytes) + sfFtpAscii, ///< Text mode using ASCII encoding + sfFtpEbcdic ///< Text mode using EBCDIC encoding +} sfFtpTransferMode; + + +//////////////////////////////////////////////////////////// +/// \brief Status codes possibly returned by a FTP response +/// +//////////////////////////////////////////////////////////// +typedef enum +{ + // 1xx: the requested action is being initiated, + // expect another reply before proceeding with a new command + sfFtpRestartMarkerReply = 110, ///< Restart marker reply + sfFtpServiceReadySoon = 120, ///< Service ready in N minutes + sfFtpDataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting + sfFtpOpeningDataConnection = 150, ///< File status ok, about to open data connection + + // 2xx: the requested action has been successfully completed + sfFtpOk = 200, ///< Command ok + sfFtpPointlessCommand = 202, ///< Command not implemented + sfFtpSystemStatus = 211, ///< System status, or system help reply + sfFtpDirectoryStatus = 212, ///< Directory status + sfFtpFileStatus = 213, ///< File status + sfFtpHelpMessage = 214, ///< Help message + sfFtpSystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document + sfFtpServiceReady = 220, ///< Service ready for new user + sfFtpClosingConnection = 221, ///< Service closing control connection + sfFtpDataConnectionOpened = 225, ///< Data connection open, no transfer in progress + sfFtpClosingDataConnection = 226, ///< Closing data connection, requested file action successful + sfFtpEnteringPassiveMode = 227, ///< Entering passive mode + sfFtpLoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate + sfFtpFileActionOk = 250, ///< Requested file action ok + sfFtpDirectoryOk = 257, ///< PATHNAME created + + // 3xx: the command has been accepted, but the requested action + // is dormant, pending receipt of further information + sfFtpNeedPassword = 331, ///< User name ok, need password + sfFtpNeedAccountToLogIn = 332, ///< Need account for login + sfFtpNeedInformation = 350, ///< Requested file action pending further information + + // 4xx: the command was not accepted and the requested action did not take place, + // but the error condition is temporary and the action may be requested again + sfFtpServiceUnavailable = 421, ///< Service not available, closing control connection + sfFtpDataConnectionUnavailable = 425, ///< Can't open data connection + sfFtpTransferAborted = 426, ///< Connection closed, transfer aborted + sfFtpFileActionAborted = 450, ///< Requested file action not taken + sfFtpLocalError = 451, ///< Requested action aborted, local error in processing + sfFtpInsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable + + // 5xx: the command was not accepted and + // the requested action did not take place + sfFtpCommandUnknown = 500, ///< Syntax error, command unrecognized + sfFtpParametersUnknown = 501, ///< Syntax error in parameters or arguments + sfFtpCommandNotImplemented = 502, ///< Command not implemented + sfFtpBadCommandSequence = 503, ///< Bad sequence of commands + sfFtpParameterNotImplemented = 504, ///< Command not implemented for that parameter + sfFtpNotLoggedIn = 530, ///< Not logged in + sfFtpNeedAccountToStore = 532, ///< Need account for storing files + sfFtpFileUnavailable = 550, ///< Requested action not taken, file unavailable + sfFtpPageTypeUnknown = 551, ///< Requested action aborted, page type unknown + sfFtpNotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation + sfFtpFilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed + + // 10xx: SFML custom codes + sfFtpInvalidResponse = 1000, ///< Response is not a valid FTP one + sfFtpConnectionFailed = 1001, ///< Connection with server failed + sfFtpConnectionClosed = 1002, ///< Connection with server closed + sfFtpInvalidFile = 1003 ///< Invalid file to upload / download +} sfFtpStatus; + + +//////////////////////////////////////////////////////////// +/// \brief Destroy a FTP listing response +/// +/// \param ftpListingResponse Ftp listing response to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfFtpListingResponse_destroy(sfFtpListingResponse* ftpListingResponse); + +//////////////////////////////////////////////////////////// +/// \brief Check if a FTP listing response status code means a success +/// +/// This function is defined for convenience, it is +/// equivalent to testing if the status code is < 400. +/// +/// \param ftpListingResponse Ftp listing response +/// +/// \return sfTrue if the status is a success, sfFalse if it is a failure +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the status code of a FTP listing response +/// +/// \param ftpListingResponse Ftp listing response +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpStatus sfFtpListingResponse_getStatus(const sfFtpListingResponse* ftpListingResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the full message contained in a FTP listing response +/// +/// \param ftpListingResponse Ftp listing response +/// +/// \return The response message +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const char* sfFtpListingResponse_getMessage(const sfFtpListingResponse* ftpListingResponse); + +//////////////////////////////////////////////////////////// +/// \brief Return the number of directory/file names contained in a FTP listing response +/// +/// \param ftpListingResponse Ftp listing response +/// +/// \return Total number of names available +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API size_t sfFtpListingResponse_getCount(const sfFtpListingResponse* ftpListingResponse); + +//////////////////////////////////////////////////////////// +/// \brief Return a directory/file name contained in a FTP listing response +/// +/// \param ftpListingResponse Ftp listing response +/// \param index Index of the name to get (in range [0 .. getCount]) +/// +/// \return The requested name +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const char* sfFtpListingResponse_getName(const sfFtpListingResponse* ftpListingResponse, size_t index); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a FTP directory response +/// +/// \param ftpDirectoryResponse Ftp directory response to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfFtpDirectoryResponse_destroy(sfFtpDirectoryResponse* ftpDirectoryResponse); + +//////////////////////////////////////////////////////////// +/// \brief Check if a FTP directory response status code means a success +/// +/// This function is defined for convenience, it is +/// equivalent to testing if the status code is < 400. +/// +/// \param ftpDirectoryResponse Ftp directory response +/// +/// \return sfTrue if the status is a success, sfFalse if it is a failure +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the status code of a FTP directory response +/// +/// \param ftpDirectoryResponse Ftp directory response +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpStatus sfFtpDirectoryResponse_getStatus(const sfFtpDirectoryResponse* ftpDirectoryResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the full message contained in a FTP directory response +/// +/// \param ftpDirectoryResponse Ftp directory response +/// +/// \return The response message +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getMessage(const sfFtpDirectoryResponse* ftpDirectoryResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the directory returned in a FTP directory response +/// +/// \param ftpDirectoryResponse Ftp directory response +/// +/// \return Directory name +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse); + + +//////////////////////////////////////////////////////////// +/// \brief Destroy a FTP response +/// +/// \param ftpResponse Ftp response to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfFtpResponse_destroy(sfFtpResponse* ftpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Check if a FTP response status code means a success +/// +/// This function is defined for convenience, it is +/// equivalent to testing if the status code is < 400. +/// +/// \param ftpResponse Ftp response object +/// +/// \return sfTrue if the status is a success, sfFalse if it is a failure +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the status code of a FTP response +/// +/// \param ftpResponse Ftp response object +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpStatus sfFtpResponse_getStatus(const sfFtpResponse* ftpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the full message contained in a FTP response +/// +/// \param ftpResponse Ftp response object +/// +/// \return The response message +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const char* sfFtpResponse_getMessage(const sfFtpResponse* ftpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Create a new Ftp object +/// +/// \return A new sfFtp object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtp* sfFtp_create(void); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a Ftp object +/// +/// \param ftp Ftp object to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfFtp_destroy(sfFtp* ftp); + +//////////////////////////////////////////////////////////// +/// \brief Connect to the specified FTP server +/// +/// The port should be 21, which is the standard +/// port used by the FTP protocol. You shouldn't use a different +/// value, unless you really know what you do. +/// This function tries to connect to the server so it may take +/// a while to complete, especially if the server is not +/// reachable. To avoid blocking your application for too long, +/// you can use a timeout. Using 0 means that the +/// system timeout will be used (which is usually pretty long). +/// +/// \param ftp Ftp object +/// \param server Name or address of the FTP server to connect to +/// \param port Port used for the connection +/// \param timeout Maximum time to wait +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfTime timeout); + +//////////////////////////////////////////////////////////// +/// \brief Log in using an anonymous account +/// +/// Logging in is mandatory after connecting to the server. +/// Users that are not logged in cannot perform any operation. +/// +/// \param ftp Ftp object +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp); + +//////////////////////////////////////////////////////////// +/// \brief Log in using a username and a password +/// +/// Logging in is mandatory after connecting to the server. +/// Users that are not logged in cannot perform any operation. +/// +/// \param ftp Ftp object +/// \param name User name +/// \param password Password +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* userName, const char* password); + +//////////////////////////////////////////////////////////// +/// \brief Close the connection with the server +/// +/// \param ftp Ftp object +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_disconnect(sfFtp* ftp); + +//////////////////////////////////////////////////////////// +/// \brief Send a null command to keep the connection alive +/// +/// This command is useful because the server may close the +/// connection automatically if no command is sent. +/// +/// \param ftp Ftp object +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_keepAlive(sfFtp* ftp); + +//////////////////////////////////////////////////////////// +/// \brief Get the current working directory +/// +/// The working directory is the root path for subsequent +/// operations involving directories and/or filenames. +/// +/// \param ftp Ftp object +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpDirectoryResponse* sfFtp_getWorkingDirectory(sfFtp* ftp); + +//////////////////////////////////////////////////////////// +/// \brief Get the contents of the given directory +/// +/// This function retrieves the sub-directories and files +/// contained in the given directory. It is not recursive. +/// The \a directory parameter is relative to the current +/// working directory. +/// +/// \param ftp Ftp object +/// \param directory Directory to list +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpListingResponse* sfFtp_getDirectoryListing(sfFtp* ftp, const char* directory); + +//////////////////////////////////////////////////////////// +/// \brief Change the current working directory +/// +/// The new directory must be relative to the current one. +/// +/// \param ftp Ftp object +/// \param directory New working directory +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_changeDirectory(sfFtp* ftp, const char* directory); + +//////////////////////////////////////////////////////////// +/// \brief Go to the parent directory of the current one +/// +/// \param ftp Ftp object +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_parentDirectory(sfFtp* ftp); + +//////////////////////////////////////////////////////////// +/// \brief Create a new directory +/// +/// The new directory is created as a child of the current +/// working directory. +/// +/// \param ftp Ftp object +/// \param name Name of the directory to create +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_createDirectory(sfFtp* ftp, const char* name); + +//////////////////////////////////////////////////////////// +/// \brief Remove an existing directory +/// +/// The directory to remove must be relative to the +/// current working directory. +/// Use this function with caution, the directory will +/// be removed permanently! +/// +/// \param ftp Ftp object +/// \param name Name of the directory to remove +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteDirectory(sfFtp* ftp, const char* name); + +//////////////////////////////////////////////////////////// +/// \brief Rename an existing file +/// +/// The filenames must be relative to the current working +/// directory. +/// +/// \param ftp Ftp object +/// \param file File to rename +/// \param newName New name of the file +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_renameFile(sfFtp* ftp, const char* file, const char* newName); + +//////////////////////////////////////////////////////////// +/// \brief Remove an existing file +/// +/// The file name must be relative to the current working +/// directory. +/// Use this function with caution, the file will be +/// removed permanently! +/// +/// \param ftp Ftp object +/// \param name File to remove +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name); + +//////////////////////////////////////////////////////////// +/// \brief Download a file from a FTP server +/// +/// The filename of the distant file is relative to the +/// current working directory of the server, and the local +/// destination path is relative to the current directory +/// of your application. +/// +/// \param ftp Ftp object +/// \param remoteFile Filename of the distant file to download +/// \param localPath Where to put to file on the local computer +/// \param mode Transfer mode +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* distantFile, const char* destPath, sfFtpTransferMode mode); + +//////////////////////////////////////////////////////////// +/// \brief Upload a file to a FTP server +/// +/// The name of the local file is relative to the current +/// working directory of your application, and the +/// remote path is relative to the current directory of the +/// FTP server. +/// +/// \param ftp Ftp object +/// \param localFile Path of the local file to upload +/// \param remotePath Where to put to file on the server +/// \param mode Transfer mode +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode); + + +#endif // SFML_FTP_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Http.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Http.h new file mode 100755 index 0000000..854f6bb --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Http.h @@ -0,0 +1,302 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_HTTP_H +#define SFML_HTTP_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Network/Export.h> +#include <SFML/Network/Types.h> +#include <SFML/System/Time.h> + + +//////////////////////////////////////////////////////////// +/// \brief Enumerate the available HTTP methods for a request +/// +//////////////////////////////////////////////////////////// +typedef enum +{ + sfHttpGet, ///< Request in get mode, standard method to retrieve a page + sfHttpPost, ///< Request in post mode, usually to send data to a page + sfHttpHead ///< Request a page's header only +} sfHttpMethod; + + +//////////////////////////////////////////////////////////// +/// \brief Enumerate all the valid status codes for a response +/// +//////////////////////////////////////////////////////////// +typedef enum +{ + // 2xx: success + sfHttpOk = 200, ///< Most common code returned when operation was successful + sfHttpCreated = 201, ///< The resource has successfully been created + sfHttpAccepted = 202, ///< The request has been accepted, but will be processed later by the server + sfHttpNoContent = 204, ///< Sent when the server didn't send any data in return + sfHttpResetContent = 205, ///< The server informs the client that it should clear the view (form) that caused the request to be sent + sfHttpPartialContent = 206, ///< The server has sent a part of the resource, as a response to a partial GET request + + // 3xx: redirection + sfHttpMultipleChoices = 300, ///< The requested page can be accessed from several locations + sfHttpMovedPermanently = 301, ///< The requested page has permanently moved to a new location + sfHttpMovedTemporarily = 302, ///< The requested page has temporarily moved to a new location + sfHttpNotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed + + // 4xx: client error + sfHttpBadRequest = 400, ///< The server couldn't understand the request (syntax error) + sfHttpUnauthorized = 401, ///< The requested page needs an authentification to be accessed + sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentification + sfHttpNotFound = 404, ///< The requested page doesn't exist + sfHttpRangeNotSatisfiable = 407, ///< The server can't satisfy the partial GET request (with a "Range" header field) + + // 5xx: server error + sfHttpInternalServerError = 500, ///< The server encountered an unexpected error + sfHttpNotImplemented = 501, ///< The server doesn't implement a requested feature + sfHttpBadGateway = 502, ///< The gateway server has received an error from the source server + sfHttpServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...) + sfHttpGatewayTimeout = 504, ///< The gateway server couldn't receive a response from the source server + sfHttpVersionNotSupported = 505, ///< The server doesn't support the requested HTTP version + + // 10xx: SFML custom codes + sfHttpInvalidResponse = 1000, ///< Response is not a valid HTTP one + sfHttpConnectionFailed = 1001 ///< Connection with server failed +} sfHttpStatus; + + +//////////////////////////////////////////////////////////// +/// \brief Create a new HTTP request +/// +/// \return A new sfHttpRequest object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfHttpRequest* sfHttpRequest_create(void); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a HTTP request +/// +/// \param httpRequest HTTP request to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttpRequest_destroy(sfHttpRequest* httpRequest); + +//////////////////////////////////////////////////////////// +/// \brief Set the value of a header field of a HTTP request +/// +/// The field is created if it doesn't exist. The name of +/// the field is case insensitive. +/// By default, a request doesn't contain any field (but the +/// mandatory fields are added later by the HTTP client when +/// sending the request). +/// +/// \param httpRequest HTTP request +/// \param field Name of the field to set +/// \param value Value of the field +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttpRequest_setField(sfHttpRequest* httpRequest, const char* field, const char* value); + +//////////////////////////////////////////////////////////// +/// \brief Set a HTTP request method +/// +/// See the sfHttpMethod enumeration for a complete list of all +/// the availale methods. +/// The method is sfHttpGet by default. +/// +/// \param httpRequest HTTP request +/// \param method Method to use for the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttpRequest_setMethod(sfHttpRequest* httpRequest, sfHttpMethod method); + +//////////////////////////////////////////////////////////// +/// \brief Set a HTTP request URI +/// +/// The URI is the resource (usually a web page or a file) +/// that you want to get or post. +/// The URI is "/" (the root page) by default. +/// +/// \param httpRequest HTTP request +/// \param uri URI to request, relative to the host +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttpRequest_setUri(sfHttpRequest* httpRequest, const char* uri); + +//////////////////////////////////////////////////////////// +/// \brief Set the HTTP version of a HTTP request +/// +/// The HTTP version is 1.0 by default. +/// +/// \param httpRequest HTTP request +/// \param major Major HTTP version number +/// \param minor Minor HTTP version number +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttpRequest_setHttpVersion(sfHttpRequest* httpRequest, unsigned int major, unsigned int minor); + +//////////////////////////////////////////////////////////// +/// \brief Set the body of a HTTP request +/// +/// The body of a request is optional and only makes sense +/// for POST requests. It is ignored for all other methods. +/// The body is empty by default. +/// +/// \param httpRequest HTTP request +/// \param body Content of the body +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttpRequest_setBody(sfHttpRequest* httpRequest, const char* body); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a HTTP response +/// +/// \param httpResponse HTTP response to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttpResponse_destroy(sfHttpResponse* httpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the value of a field of a HTTP response +/// +/// If the field \a field is not found in the response header, +/// the empty string is returned. This function uses +/// case-insensitive comparisons. +/// +/// \param httpResponse HTTP response +/// \param field Name of the field to get +/// +/// \return Value of the field, or empty string if not found +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const char* sfHttpResponse_getField(const sfHttpResponse* httpResponse, const char* field); + +//////////////////////////////////////////////////////////// +/// \brief Get the status code of a HTTP reponse +/// +/// The status code should be the first thing to be checked +/// after receiving a response, it defines whether it is a +/// success, a failure or anything else (see the sfHttpStatus +/// enumeration). +/// +/// \param httpResponse HTTP response +/// +/// \return Status code of the response +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfHttpStatus sfHttpResponse_getStatus(const sfHttpResponse* httpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the major HTTP version number of a HTTP response +/// +/// \param httpResponse HTTP response +/// +/// \return Major HTTP version number +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API unsigned int sfHttpResponse_getMajorVersion(const sfHttpResponse* httpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the minor HTTP version number of a HTTP response +/// +/// \param httpResponse HTTP response +/// +/// \return Minor HTTP version number +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API unsigned int sfHttpResponse_getMinorVersion(const sfHttpResponse* httpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Get the body of a HTTP response +/// +/// The body of a response may contain: +/// \li the requested page (for GET requests) +/// \li a response from the server (for POST requests) +/// \li nothing (for HEAD requests) +/// \li an error message (in case of an error) +/// +/// \param httpResponse HTTP response +/// +/// \return The response body +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const char* sfHttpResponse_getBody(const sfHttpResponse* httpResponse); + +//////////////////////////////////////////////////////////// +/// \brief Create a new Http object +/// +/// \return A new sfHttp object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfHttp* sfHttp_create(void); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a Http object +/// +/// \param http Http object to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttp_destroy(sfHttp* http); + +//////////////////////////////////////////////////////////// +/// \brief Set the target host of a HTTP object +/// +/// This function just stores the host address and port, it +/// doesn't actually connect to it until you send a request. +/// If the port is 0, it means that the HTTP client will use +/// the right port according to the protocol used +/// (80 for HTTP, 443 for HTTPS). You should +/// leave it like this unless you really need a port other +/// than the standard one, or use an unknown protocol. +/// +/// \param http Http object +/// \param host Web server to connect to +/// \param port Port to use for connection +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfHttp_setHost(sfHttp* http, const char* host, unsigned short port); + +//////////////////////////////////////////////////////////// +/// \brief Send a HTTP request and return the server's response. +/// +/// You must have a valid host before sending a request (see sfHttp_setHost). +/// Any missing mandatory header field in the request will be added +/// with an appropriate value. +/// Warning: this function waits for the server's response and may +/// not return instantly; use a thread if you don't want to block your +/// application, or use a timeout to limit the time to wait. A value +/// of 0 means that the client will use the system defaut timeout +/// (which is usually pretty long). +/// +/// \param http Http object +/// \param request Request to send +/// \param timeout Maximum time to wait +/// +/// \return Server's response +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfHttpResponse* sfHttp_sendRequest(sfHttp* http, const sfHttpRequest* request, sfTime timeout); + + +#endif // SFML_HTTP_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/IpAddress.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/IpAddress.h new file mode 100755 index 0000000..af3c3d0 --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/IpAddress.h @@ -0,0 +1,176 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IPADDRESS_H +#define SFML_IPADDRESS_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Network/Export.h> +#include <SFML/System/Time.h> + + +//////////////////////////////////////////////////////////// +/// \brief Encapsulate an IPv4 network address +/// +//////////////////////////////////////////////////////////// +typedef struct +{ + char address[16]; +} sfIpAddress; + + +//////////////////////////////////////////////////////////// +/// \brief Empty object that represents invalid addresses +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const sfIpAddress sfIpAddress_None; + +//////////////////////////////////////////////////////////// +/// \brief Local host IP address (127.0.0.1, or "localhost") +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const sfIpAddress sfIpAddress_LocalHost; + +//////////////////////////////////////////////////////////// +/// \brief UDP broadcast address (255.255.255.255) +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const sfIpAddress sfIpAddress_Broadcast; + +//////////////////////////////////////////////////////////// +/// \brief Create an address from a string +/// +/// Here \a address can be either a decimal address +/// (ex: "192.168.1.56") or a network name (ex: "localhost"). +/// +/// \param address IP address or network name +/// +/// \return Resulting address +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfIpAddress sfIpAddress_fromString(const char* address); + +//////////////////////////////////////////////////////////// +/// \brief Create an address from 4 bytes +/// +/// Calling sfIpAddress_fromBytes(a, b, c, d) is equivalent +/// to calling sfIpAddress_fromString("a.b.c.d"), but safer +/// as it doesn't have to parse a string to get the address +/// components. +/// +/// \param byte0 First byte of the address +/// \param byte1 Second byte of the address +/// \param byte2 Third byte of the address +/// \param byte3 Fourth byte of the address +/// +/// \return Resulting address +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3); + +//////////////////////////////////////////////////////////// +/// \brief Construct an address from a 32-bits integer +/// +/// This function uses the internal representation of +/// the address directly. It should be used for optimization +/// purposes, and only if you got that representation from +/// sfIpAddress_ToInteger. +/// +/// \param address 4 bytes of the address packed into a 32-bits integer +/// +/// \return Resulting address +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(sfUint32 address); + +//////////////////////////////////////////////////////////// +/// \brief Get a string representation of an address +/// +/// The returned string is the decimal representation of the +/// IP address (like "192.168.1.56"), even if it was constructed +/// from a host name. +/// +/// \param address Address object +/// +/// \return String representation of the address +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string); + +//////////////////////////////////////////////////////////// +/// \brief Get an integer representation of the address +/// +/// The returned number is the internal representation of the +/// address, and should be used for optimization purposes only +/// (like sending the address through a socket). +/// The integer produced by this function can then be converted +/// back to a sfIpAddress with sfIpAddress_FromInteger. +/// +/// \param address Address object +/// +/// \return 32-bits unsigned integer representation of the address +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfUint32 sfIpAddress_toInteger(sfIpAddress address); + +//////////////////////////////////////////////////////////// +/// \brief Get the computer's local address +/// +/// The local address is the address of the computer from the +/// LAN point of view, i.e. something like 192.168.1.56. It is +/// meaningful only for communications over the local network. +/// Unlike sfIpAddress_getPublicAddress, this function is fast +/// and may be used safely anywhere. +/// +/// \return Local IP address of the computer +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfIpAddress sfIpAddress_getLocalAddress(void); + +//////////////////////////////////////////////////////////// +/// \brief Get the computer's public address +/// +/// The public address is the address of the computer from the +/// internet point of view, i.e. something like 89.54.1.169. +/// It is necessary for communications over the world wide web. +/// The only way to get a public address is to ask it to a +/// distant website; as a consequence, this function depends on +/// both your network connection and the server, and may be +/// very slow. You should use it as few as possible. Because +/// this function depends on the network connection and on a distant +/// server, you may use a time limit if you don't want your program +/// to be possibly stuck waiting in case there is a problem; use +/// 0 to deactivate this limit. +/// +/// \param timeout Maximum time to wait +/// +/// \return Public IP address of the computer +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfIpAddress sfIpAddress_getPublicAddress(sfTime timeout); + + +#endif // SFML_IPADDRESS_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Packet.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Packet.h new file mode 100755 index 0000000..75fc95d --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Packet.h @@ -0,0 +1,177 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PACKET_H +#define SFML_PACKET_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Network/Export.h> +#include <SFML/Network/Types.h> +#include <stddef.h> + + +//////////////////////////////////////////////////////////// +/// \brief Create a new packet +/// +/// \return A new sfPacket object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfPacket* sfPacket_create(void); + +//////////////////////////////////////////////////////////// +/// \brief Create a new packet by copying an existing one +/// +/// \param packet Packet to copy +/// +/// \return A new sfPacket object which is a copy of \a packet +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfPacket* sfPacket_copy(const sfPacket* packet); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a packet +/// +/// \param packet Packet to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfPacket_destroy(sfPacket* packet); + +//////////////////////////////////////////////////////////// +/// \brief Append data to the end of a packet +/// +/// \param packet Packet object +/// \param data Pointer to the sequence of bytes to append +/// \param sizeInBytes Number of bytes to append +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfPacket_append(sfPacket* packet, const void* data, size_t sizeInBytes); + +//////////////////////////////////////////////////////////// +/// \brief Clear a packet +/// +/// After calling Clear, the packet is empty. +/// +/// \param packet Packet object +/// +/////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfPacket_clear(sfPacket* packet); + +//////////////////////////////////////////////////////////// +/// \brief Get a pointer to the data contained in a packet +/// +/// Warning: the returned pointer may become invalid after +/// you append data to the packet, therefore it should never +/// be stored. +/// The return pointer is NULL if the packet is empty. +/// +/// \param packet Packet object +/// +/// \return Pointer to the data +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API const void* sfPacket_getData(const sfPacket* packet); + +//////////////////////////////////////////////////////////// +/// \brief Get the size of the data contained in a packet +/// +/// This function returns the number of bytes pointed to by +/// what sfPacket_getData returns. +/// +/// \param packet Packet object +/// +/// \return Data size, in bytes +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API size_t sfPacket_getDataSize(const sfPacket* packet); + +//////////////////////////////////////////////////////////// +/// \brief Tell if the reading position has reached the +/// end of a packet +/// +/// This function is useful to know if there is some data +/// left to be read, without actually reading it. +/// +/// \param packet Packet object +/// +/// \return sfTrue if all data was read, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfPacket_endOfPacket(const sfPacket* packet); + +//////////////////////////////////////////////////////////// +/// \brief Test the validity of a packet, for reading +/// +/// This function allows to test the packet, to check if +/// a reading operation was successful. +/// +/// A packet will be in an invalid state if it has no more +/// data to read. +/// +/// \param packet Packet object +/// +/// \return sfTrue if last data extraction from packet was successful +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfPacket_canRead(const sfPacket* packet); + +//////////////////////////////////////////////////////////// +/// \brief Functions to extract data from a packet +/// +/// \param packet Packet object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfPacket_readBool(sfPacket* packet); +CSFML_NETWORK_API sfInt8 sfPacket_readInt8(sfPacket* packet); +CSFML_NETWORK_API sfUint8 sfPacket_readUint8(sfPacket* packet); +CSFML_NETWORK_API sfInt16 sfPacket_readInt16(sfPacket* packet); +CSFML_NETWORK_API sfUint16 sfPacket_readUint16(sfPacket* packet); +CSFML_NETWORK_API sfInt32 sfPacket_readInt32(sfPacket* packet); +CSFML_NETWORK_API sfUint32 sfPacket_readUint32(sfPacket* packet); +CSFML_NETWORK_API float sfPacket_readFloat(sfPacket* packet); +CSFML_NETWORK_API double sfPacket_readDouble(sfPacket* packet); +CSFML_NETWORK_API void sfPacket_readString(sfPacket* packet, char* string); +CSFML_NETWORK_API void sfPacket_readWideString(sfPacket* packet, wchar_t* string); + +//////////////////////////////////////////////////////////// +/// \brief Functions to insert data into a packet +/// +/// \param packet Packet object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfPacket_writeBool(sfPacket* packet, sfBool); +CSFML_NETWORK_API void sfPacket_writeInt8(sfPacket* packet, sfInt8); +CSFML_NETWORK_API void sfPacket_writeUint8(sfPacket* packet, sfUint8); +CSFML_NETWORK_API void sfPacket_writeInt16(sfPacket* packet, sfInt16); +CSFML_NETWORK_API void sfPacket_writeUint16(sfPacket* packet, sfUint16); +CSFML_NETWORK_API void sfPacket_writeInt32(sfPacket* packet, sfInt32); +CSFML_NETWORK_API void sfPacket_writeUint32(sfPacket* packet, sfUint32); +CSFML_NETWORK_API void sfPacket_writeFloat(sfPacket* packet, float); +CSFML_NETWORK_API void sfPacket_writeDouble(sfPacket* packet, double); +CSFML_NETWORK_API void sfPacket_writeString(sfPacket* packet, const char* string); +CSFML_NETWORK_API void sfPacket_writeWideString(sfPacket* packet, const wchar_t* string); + + +#endif // SFML_PACKET_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/SocketSelector.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/SocketSelector.h new file mode 100755 index 0000000..2480c98 --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/SocketSelector.h @@ -0,0 +1,141 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETSELECTOR_H +#define SFML_SOCKETSELECTOR_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Network/Export.h> +#include <SFML/Network/Types.h> +#include <SFML/System/Time.h> + + +//////////////////////////////////////////////////////////// +/// \brief Create a new selector +/// +/// \return A new sfSocketSelector object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_create(void); + +//////////////////////////////////////////////////////////// +/// \brief Create a new socket selector by copying an existing one +/// +/// \param selector Socket selector to copy +/// +/// \return A new sfSocketSelector object which is a copy of \a selector +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_copy(const sfSocketSelector* selector); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a socket selector +/// +/// \param selector Socket selector to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfSocketSelector_destroy(sfSocketSelector* selector); + +//////////////////////////////////////////////////////////// +/// \brief Add a new socket to a socket selector +/// +/// This function keeps a weak pointer to the socket, +/// so you have to make sure that the socket is not destroyed +/// while it is stored in the selector. +/// +/// \param selector Socket selector object +/// \param socket Pointer to the socket to add +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfSocketSelector_addTcpListener(sfSocketSelector* selector, sfTcpListener* socket); +CSFML_NETWORK_API void sfSocketSelector_addTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket); +CSFML_NETWORK_API void sfSocketSelector_addUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Remove a socket from a socket selector +/// +/// This function doesn't destroy the socket, it simply +/// removes the pointer that the selector has to it. +/// +/// \param selector Socket selector object +/// \param socket POointer to the socket to remove +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfSocketSelector_removeTcpListener(sfSocketSelector* selector, sfTcpListener* socket); +CSFML_NETWORK_API void sfSocketSelector_removeTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket); +CSFML_NETWORK_API void sfSocketSelector_removeUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Remove all the sockets stored in a selector +/// +/// This function doesn't destroy any instance, it simply +/// removes all the pointers that the selector has to +/// external sockets. +/// +/// \param selector Socket selector object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfSocketSelector_clear(sfSocketSelector* selector); + +//////////////////////////////////////////////////////////// +/// \brief Wait until one or more sockets are ready to receive +/// +/// This function returns as soon as at least one socket has +/// some data available to be received. To know which sockets are +/// ready, use the sfSocketSelector_isXxxReady functions. +/// If you use a timeout and no socket is ready before the timeout +/// is over, the function returns sfFalse. +/// +/// \param selector Socket selector object +/// \param timeout Maximum time to wait (use sfTimeZero for infinity) +/// +/// \return sfTrue if there are sockets ready, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfSocketSelector_wait(sfSocketSelector* selector, sfTime timeout); + +//////////////////////////////////////////////////////////// +/// \brief Test a socket to know if it is ready to receive data +/// +/// This function must be used after a call to +/// sfSocketSelector_wait, to know which sockets are ready to +/// receive data. If a socket is ready, a call to Receive will +/// never block because we know that there is data available to read. +/// Note that if this function returns sfTrue for a sfTcpListener, +/// this means that it is ready to accept a new connection. +/// +/// \param selector Socket selector object +/// \param socket Socket to test +/// +/// \return sfTrue if the socket is ready to read, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket); +CSFML_NETWORK_API sfBool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket); +CSFML_NETWORK_API sfBool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket); + + +#endif // SFML_SOCKETSELECTOR_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/SocketStatus.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/SocketStatus.h new file mode 100755 index 0000000..421e516 --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/SocketStatus.h @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETSTATUS_H +#define SFML_SOCKETSTATUS_H + + +//////////////////////////////////////////////////////////// +/// \brief Define the status that can be returned by the socket functions +/// +//////////////////////////////////////////////////////////// +typedef enum +{ + sfSocketDone, ///< The socket has sent / received the data + sfSocketNotReady, ///< The socket is not ready to send / receive data yet + sfSocketDisconnected, ///< The TCP socket has been disconnected + sfSocketError ///< An unexpected error happened + +} sfSocketStatus; + + +#endif // SFML_SOCKETSTATUS_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/TcpListener.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/TcpListener.h new file mode 100755 index 0000000..f0fdfca --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/TcpListener.h @@ -0,0 +1,128 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TCPLISTENER_H +#define SFML_TCPLISTENER_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Network/Export.h> +#include <SFML/Network/SocketStatus.h> +#include <SFML/Network/Types.h> + + +//////////////////////////////////////////////////////////// +/// \brief Create a new TCP listener +/// +/// \return A new sfTcpListener object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfTcpListener* sfTcpListener_create(void); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a TCP listener +/// +/// \param listener TCP listener to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfTcpListener_destroy(sfTcpListener* listener); + +//////////////////////////////////////////////////////////// +/// \brief Set the blocking state of a TCP listener +/// +/// In blocking mode, calls will not return until they have +/// completed their task. For example, a call to +/// sfTcpListener_accept in blocking mode won't return until +/// a new connection was actually received. +/// In non-blocking mode, calls will always return immediately, +/// using the return code to signal whether there was data +/// available or not. +/// By default, all sockets are blocking. +/// +/// \param listener TCP listener object +/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfTcpListener_setBlocking(sfTcpListener* listener, sfBool blocking); + +//////////////////////////////////////////////////////////// +/// \brief Tell whether a TCP listener is in blocking or non-blocking mode +/// +/// \param listener TCP listener object +/// +/// \return sfTrue if the socket is blocking, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfTcpListener_isBlocking(const sfTcpListener* listener); + +//////////////////////////////////////////////////////////// +/// \brief Get the port to which a TCP listener is bound locally +/// +/// If the socket is not listening to a port, this function +/// returns 0. +/// +/// \param listener TCP listener object +/// +/// \return Port to which the TCP listener is bound +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API unsigned short sfTcpListener_getLocalPort(const sfTcpListener* listener); + +//////////////////////////////////////////////////////////// +/// \brief Start listening for connections +/// +/// This functions makes the socket listen to the specified +/// port, waiting for new connections. +/// If the socket was previously listening to another port, +/// it will be stopped first and bound to the new port. +/// +/// \param listener TCP listener object +/// \param port Port to listen for new connections +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port); + +//////////////////////////////////////////////////////////// +/// \brief Accept a new connection +/// +/// If the socket is in blocking mode, this function will +/// not return until a connection is actually received. +/// +/// The \a connected argument points to a valid sfTcpSocket pointer +/// in case of success (the function returns sfSocketDone), it points +/// to a NULL pointer otherwise. +/// +/// \param listener TCP listener object +/// \param connected Socket that will hold the new connection +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfTcpListener_accept(sfTcpListener* listener, sfTcpSocket** connected); + + +#endif // SFML_TCPLISTENER_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/TcpSocket.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/TcpSocket.h new file mode 100755 index 0000000..2911c00 --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/TcpSocket.h @@ -0,0 +1,210 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TCPSOCKET_H +#define SFML_TCPSOCKET_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Network/Export.h> +#include <SFML/Network/IpAddress.h> +#include <SFML/Network/SocketStatus.h> +#include <SFML/Network/Types.h> +#include <SFML/System/Time.h> +#include <stddef.h> + + +//////////////////////////////////////////////////////////// +/// \brief Create a new TCP socket +/// +/// \return A new sfTcpSocket object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfTcpSocket* sfTcpSocket_create(void); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a TCP socket +/// +/// \param socket TCP socket to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfTcpSocket_destroy(sfTcpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Set the blocking state of a TCP listener +/// +/// In blocking mode, calls will not return until they have +/// completed their task. For example, a call to +/// sfTcpSocket_receive in blocking mode won't return until +/// new data was actually received. +/// In non-blocking mode, calls will always return immediately, +/// using the return code to signal whether there was data +/// available or not. +/// By default, all sockets are blocking. +/// +/// \param socket TCP socket object +/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfTcpSocket_setBlocking(sfTcpSocket* socket, sfBool blocking); + +//////////////////////////////////////////////////////////// +/// \brief Tell whether a TCP socket is in blocking or non-blocking mode +/// +/// \param socket TCP socket object +/// +/// \return sfTrue if the socket is blocking, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfTcpSocket_isBlocking(const sfTcpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Get the port to which a TCP socket is bound locally +/// +/// If the socket is not connected, this function returns 0. +/// +/// \param socket TCP socket object +/// +/// \return Port to which the socket is bound +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API unsigned short sfTcpSocket_getLocalPort(const sfTcpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Get the address of the connected peer of a TCP socket +/// +/// It the socket is not connected, this function returns +/// sfIpAddress_None. +/// +/// \param socket TCP socket object +/// +/// \return Address of the remote peer +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfIpAddress sfTcpSocket_getRemoteAddress(const sfTcpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Get the port of the connected peer to which +/// a TCP socket is connected +/// +/// If the socket is not connected, this function returns 0. +/// +/// \param socket TCP socket object +/// +/// \return Remote port to which the socket is connected +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API unsigned short sfTcpSocket_getRemotePort(const sfTcpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Connect a TCP socket to a remote peer +/// +/// In blocking mode, this function may take a while, especially +/// if the remote peer is not reachable. The last parameter allows +/// you to stop trying to connect after a given timeout. +/// If the socket was previously connected, it is first disconnected. +/// +/// \param socket TCP socket object +/// \param remoteAddress Address of the remote peer +/// \param remotePort Port of the remote peer +/// \param timeout Maximum time to wait +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress host, unsigned short port, sfTime timeout); + +//////////////////////////////////////////////////////////// +/// \brief Disconnect a TCP socket from its remote peer +/// +/// This function gracefully closes the connection. If the +/// socket is not connected, this function has no effect. +/// +/// \param socket TCP socket object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Send raw data to the remote peer of a TCP socket +/// +/// This function will fail if the socket is not connected. +/// +/// \param socket TCP socket object +/// \param data Pointer to the sequence of bytes to send +/// \param size Number of bytes to send +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const void* data, size_t size); + +//////////////////////////////////////////////////////////// +/// \brief Receive raw data from the remote peer of a TCP socket +/// +/// In blocking mode, this function will wait until some +/// bytes are actually received. +/// This function will fail if the socket is not connected. +/// +/// \param socket TCP socket object +/// \param data Pointer to the array to fill with the received bytes +/// \param size Maximum number of bytes that can be received +/// \param received This variable is filled with the actual number of bytes received +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived); + +//////////////////////////////////////////////////////////// +/// \brief Send a formatted packet of data to the remote peer of a TCP socket +/// +/// This function will fail if the socket is not connected. +/// +/// \param socket TCP socket object +/// \param packet Packet to send +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfTcpSocket_sendPacket(sfTcpSocket* socket, sfPacket* packet); + +//////////////////////////////////////////////////////////// +/// \brief Receive a formatted packet of data from the remote peer +/// +/// In blocking mode, this function will wait until the whole packet +/// has been received. +/// This function will fail if the socket is not connected. +/// +/// \param socket TCP socket object +/// \param packet Packet to fill with the received data +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receivePacket(sfTcpSocket* socket, sfPacket* packet); + + +#endif // SFML_TCPSOCKET_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Types.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Types.h new file mode 100755 index 0000000..60378a1 --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/Types.h @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_TYPES_H +#define SFML_NETWORK_TYPES_H + + +typedef struct sfFtpDirectoryResponse sfFtpDirectoryResponse; +typedef struct sfFtpListingResponse sfFtpListingResponse; +typedef struct sfFtpResponse sfFtpResponse; +typedef struct sfFtp sfFtp; +typedef struct sfHttpRequest sfHttpRequest; +typedef struct sfHttpResponse sfHttpResponse; +typedef struct sfHttp sfHttp; +typedef struct sfPacket sfPacket; +typedef struct sfSocketSelector sfSocketSelector; +typedef struct sfTcpListener sfTcpListener; +typedef struct sfTcpSocket sfTcpSocket; +typedef struct sfUdpSocket sfUdpSocket; + + +#endif // SFML_NETWORK_TYPES_H diff --git a/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/UdpSocket.h b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/UdpSocket.h new file mode 100755 index 0000000..527d153 --- /dev/null +++ b/libghack/CSFML-2.1-windows-32bits/CSFML-2.1/include/SFML/Network/UdpSocket.h @@ -0,0 +1,206 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_UDPSOCKET_H +#define SFML_UDPSOCKET_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <SFML/Network/Export.h> +#include <SFML/Network/IpAddress.h> +#include <SFML/Network/SocketStatus.h> +#include <SFML/Network/Types.h> +#include <stddef.h> + + +//////////////////////////////////////////////////////////// +/// \brief Create a new UDP socket +/// +/// \return A new sfUdpSocket object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfUdpSocket* sfUdpSocket_create(void); + +//////////////////////////////////////////////////////////// +/// \brief Destroy a UDP socket +/// +/// \param socket UDP socket to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfUdpSocket_destroy(sfUdpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Set the blocking state of a UDP listener +/// +/// In blocking mode, calls will not return until they have +/// completed their task. For example, a call to +/// sfUDPSocket_receive in blocking mode won't return until +/// new data was actually received. +/// In non-blocking mode, calls will always return immediately, +/// using the return code to signal whether there was data +/// available or not. +/// By default, all sockets are blocking. +/// +/// \param socket UDP socket object +/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfUdpSocket_setBlocking(sfUdpSocket* socket, sfBool blocking); + +//////////////////////////////////////////////////////////// +/// \brief Tell whether a UDP socket is in blocking or non-blocking mode +/// +/// \param socket UDP socket object +/// +/// \return sfTrue if the socket is blocking, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfBool sfUdpSocket_isBlocking(const sfUdpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Get the port to which a UDP socket is bound locally +/// +/// If the socket is not bound to a port, this function +/// returns 0. +/// +/// \param socket UDP socket object +/// +/// \return Port to which the socket is bound +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Bind a UDP socket to a specific port +/// +/// Binding the socket to a port is necessary for being +/// able to receive data on that port. +/// You can use the special value 0 to tell the +/// system to automatically pick an available port, and then +/// call sfUdpSocket_getLocalPort to retrieve the chosen port. +/// +/// \param socket UDP socket object +/// \param port Port to bind the socket to +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port); + +//////////////////////////////////////////////////////////// +/// \brief Unbind a UDP socket from the local port to which it is bound +/// +/// The port that the socket was previously using is immediately +/// available after this function is called. If the +/// socket is not bound to a port, this function has no effect. +/// +/// \param socket UDP socket object +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API void sfUdpSocket_unbind(sfUdpSocket* socket); + +//////////////////////////////////////////////////////////// +/// \brief Send raw data to a remote peer with a UDP socket +/// +/// Make sure that \a size is not greater than +/// sfUdpSocket_maxDatagramSize(), otherwise this function will +/// fail and no data will be sent. +/// +/// \param socket UDP socket object +/// \param data Pointer to the sequence of bytes to send +/// \param size Number of bytes to send +/// \param remoteAddress Address of the receiver +/// \param remotePort Port of the receiver to send the data to +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress address, unsigned short port); + +//////////////////////////////////////////////////////////// +/// \brief Receive raw data from a remote peer with a UDP socket +/// +/// In blocking mode, this function will wait until some +/// bytes are actually received. +/// Be careful to use a buffer which is large enough for +/// the data that you intend to receive, if it is too small +/// then an error will be returned and *all* the data will +/// be lost. +/// +/// \param socket UDP socket object +/// \param data Pointer to the array to fill with the received bytes +/// \param size Maximum number of bytes that can be received +/// \param received This variable is filled with the actual number of bytes received +/// \param remoteAddress Address of the peer that sent the data +/// \param remotePort Port of the peer that sent the data +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port); + +//////////////////////////////////////////////////////////// +/// \brief Send a formatted packet of data to a remote peer with a UDP socket +/// +/// Make sure that the packet size is not greater than +/// sfUdpSocket_maxDatagramSize(), otherwise this function will +/// fail and no data will be sent. +/// +/// \param socket UDP socket object +/// \param packet Packet to send +/// \param remoteAddress Address of the receiver +/// \param remotePort Port of the receiver to send the data to +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress address, unsigned short port); + +//////////////////////////////////////////////////////////// +/// \brief Receive a formatted packet of data from a remote peer with a UDP socket +/// +/// In blocking mode, this function will wait until the whole packet +/// has been received. +/// +/// \param packet Packet to fill with the received data +/// \param remoteAddress Address of the peer that sent the data +/// \param remotePort Port of the peer that sent the data +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port); + +//////////////////////////////////////////////////////////// +/// \brief Return the maximum number of bytes that can be +/// sent in a single UDP datagram +/// +/// \return The maximum size of a UDP datagram (message) +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API unsigned int sfUdpSocket_maxDatagramSize(); + + +#endif // SFML_UDPSOCKET_H |