SFML logo
  • Main Page
  • Data Structures
  • Files
  • File List

Http.h

00001 
00002 //
00003 // SFML - Simple and Fast Multimedia Library
00004 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
00005 //
00006 // This software is provided 'as-is', without any express or implied warranty.
00007 // In no event will the authors be held liable for any damages arising from the use of this software.
00008 //
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it freely,
00011 // subject to the following restrictions:
00012 //
00013 // 1. The origin of this software must not be misrepresented;
00014 //    you must not claim that you wrote the original software.
00015 //    If you use this software in a product, an acknowledgment
00016 //    in the product documentation would be appreciated but is not required.
00017 //
00018 // 2. Altered source versions must be plainly marked as such,
00019 //    and must not be misrepresented as being the original software.
00020 //
00021 // 3. This notice may not be removed or altered from any source distribution.
00022 //
00024 
00025 #ifndef SFML_HTTP_H
00026 #define SFML_HTTP_H
00027 
00029 // Headers
00031 #include <SFML/Config.h>
00032 #include <SFML/Network/Types.h>
00033 
00034 
00038 enum sfHttpMethod
00039 {
00040     sfHttpGet,  
00041     sfHttpPost, 
00042     sfHttpHead  
00043 };
00044 
00045 
00050 enum sfHttpStatus
00051 {
00052     // 2xx: success
00053     sfHttpOk        = 200, 
00054     sfHttpCreated   = 201, 
00055     sfHttpAccepted  = 202, 
00056     sfHttpNoContent = 204, 
00057 
00058     // 3xx: redirection
00059     sfHttpMultipleChoices  = 300, 
00060     sfHttpMovedPermanently = 301, 
00061     sfHttpMovedTemporarily = 302, 
00062     sfHttpNotModified      = 304, 
00063 
00064     // 4xx: client error
00065     sfHttpBadRequest   = 400, 
00066     sfHttpUnauthorized = 401, 
00067     sfHttpForbidden    = 403, 
00068     sfHttpNotFound     = 404, 
00069 
00070     // 5xx: server error
00071     sfHttpInternalServerError = 500, 
00072     sfHttpNotImplemented      = 501, 
00073     sfHttpBadGateway          = 502, 
00074     sfHttpServiceNotAvailable = 503, 
00075 
00076     // 10xx: SFML custom codes
00077     sfHttpInvalidResponse  = 1000, 
00078     sfHttpConnectionFailed = 1001  
00079 };
00080 
00081 
00088 CSFML_API sfHttpRequest* sfHttpRequest_Create();
00089 
00096 CSFML_API void sfHttpRequest_Destroy(sfHttpRequest* HttpRequest);
00097 
00106 CSFML_API void sfHttpRequest_SetField(sfHttpRequest* HttpRequest, const char* Field, const char* Value);
00107 
00116 CSFML_API void sfHttpRequest_SetMethod(sfHttpRequest* HttpRequest, sfHttpMethod Method);
00117 
00126 CSFML_API void sfHttpRequest_SetURI(sfHttpRequest* HttpRequest, const char* URI);
00127 
00137 CSFML_API void sfHttpRequest_SetHttpVersion(sfHttpRequest* HttpRequest, unsigned int Major, unsigned int Minor);
00138 
00148 CSFML_API void sfHttpRequest_SetBody(sfHttpRequest* HttpRequest, const char* Body);
00149 
00156 CSFML_API void sfHttpResponse_Destroy(sfHttpResponse* HttpResponse);
00157 
00167 CSFML_API const char* sfHttpResponse_GetField(sfHttpResponse* HttpResponse, const char* Field);
00168 
00177 CSFML_API sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* HttpResponse);
00178 
00187 CSFML_API unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* HttpResponse);
00188 
00197 CSFML_API unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* HttpResponse);
00198 
00211 CSFML_API const char* sfHttpResponse_GetBody(sfHttpResponse* HttpResponse);
00212 
00219 CSFML_API sfHttp* sfHttp_Create();
00220 
00227 CSFML_API void sfHttp_Destroy(sfHttp* Http);
00228 
00237 CSFML_API void sfHttp_SetHost(sfHttp* Http, const char* Host, unsigned short Port);
00238 
00254 CSFML_API sfHttpResponse* sfHttp_SendRequest(sfHttp* Http, sfHttpRequest* Request, float Timeout);
00255 
00256 
00257 #endif // SFML_HTTP_H

 ::  Copyright © 2007-2008 Laurent Gomila, all rights reserved  ::  Documentation generated by doxygen 1.5.2  ::