PixelLightAPI  .
Http.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Http.h                                         *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLCORE_HTTP_H__
00024 #define __PLCORE_HTTP_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/String/String.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLCore {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Definitions                                           ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    Client signature
00046 */
00047 enum EClientSignature {
00048     ClientPixelLight = 0,   /**< Identify as PixelLight HTTP client */
00049     ClientMozilla           /**< Identify as Mozilla client */
00050 };
00051 
00052 /**
00053 *  @brief
00054 *    HTTP protocol version
00055 */
00056 enum EHttpProtocol {
00057     Http10 = 0,             /**< HTTP 1.0 protocol version */
00058     Http11                  /**< HTTP 1.1 protocol version */
00059 };
00060 
00061 /**
00062 *  @brief
00063 *    HTTP message type
00064 */
00065 enum EHttpMessageType {
00066     HttpRequest = 0,        /**< HTTP request */
00067     HttpResponse            /**< HTTP response */
00068 };
00069 
00070 /**
00071 *  @brief
00072 *    HTTP request
00073 */
00074 enum EHttpRequest{
00075     HttpGet = 0,            /**< GET-request */
00076     HttpPost,               /**< POST-request */
00077     HttpHead,               /**< HEAD-request */
00078     HttpPut,                /**< PUT-request */
00079     HttpDelete,             /**< DELETE-request */
00080     HttpTrace,              /**< TRACE-request */
00081     HttpOptions,            /**< OPTIONS-request */
00082     HttpConnect             /**< CONNECT-request */
00083 };
00084 
00085 /**
00086 *  @brief
00087 *    HTTP connection type
00088 */
00089 enum EHttpConnection {
00090     ConnectionClose = 0,    /**< Close connection after transaction */
00091     ConnectionKeepAlive     /**< Keep connection open */
00092 };
00093 
00094 /**
00095 *  @brief
00096 *    HTTP authentication
00097 */
00098 enum EHttpAuth {
00099     NoAuth = 0,     /**< No authentication */
00100     BasicAuth       /**< Basic authentication */
00101 };
00102 
00103 /**
00104 *  @brief
00105 *    HTTP status codes
00106 */
00107 enum EHttpStatus {
00108     Http_000_Unknown                        =   0,  /**< Unknown status code (invalid) */
00109     Http_100_Continue                       = 100,  /**< 100 Continue */
00110     Http_101_SwitchingProtocols             = 101,  /**< 101 Switching Protocols */
00111     Http_200_OK                             = 200,  /**< 200 OK */
00112     Http_201_Created                        = 201,  /**< 201 Created */
00113     Http_202_Accepted                       = 202,  /**< 202 Accepted */
00114     Http_203_NonAuthoritativeInformation    = 203,  /**< 203 Non-Authoritative Information */
00115     Http_204_NoContent                      = 204,  /**< 204 No Content */
00116     Http_205_ResetContent                   = 205,  /**< 205 Reset Content */
00117     Http_206_PartialContent                 = 206,  /**< 206 Partial Content */
00118     Http_300_MultipleChoices                = 300,  /**< 300 Multiple Choices */
00119     Http_301_MovedPermanently               = 301,  /**< 301 Moved Permanently */
00120     Http_302_Found                          = 302,  /**< 302 Found */
00121     Http_303_SeeOther                       = 303,  /**< 303 See Other */
00122     Http_304_NotModified                    = 304,  /**< 304 Not Modified */
00123     Http_305_UseProxy                       = 305,  /**< 305 Use Proxy */
00124     Http_307_TemporaryRedirect              = 307,  /**< 307 Temporary Redirect */
00125     Http_400_BadRequest                     = 400,  /**< 400 Bad Request */
00126     Http_401_Unauthorized                   = 401,  /**< 401 Unauthorized */
00127     Http_403_Forbidden                      = 403,  /**< 403 Forbidden */
00128     Http_404_NotFound                       = 404,  /**< 404 Not Found */
00129     Http_405_MethodNotAllowed               = 405,  /**< 405 Method Not Allowed */
00130     Http_406_NotAcceptable                  = 406,  /**< 406 Not Acceptable */
00131     Http_407_ProxyAuthenticationRequired    = 407,  /**< 407 Proxy Authentication Required */
00132     Http_408_RequestTimeout                 = 408,  /**< 408 Request Timeout */
00133     Http_409_Conflict                       = 409,  /**< 409 Conflict */
00134     Http_410_Gone                           = 410,  /**< 410 Gone */
00135     Http_411_LengthRequired                 = 411,  /**< 411 Length Required */
00136     Http_412_PreconditionFailed             = 412,  /**< 412 Precondition Failed */
00137     Http_413_RequestEntityTooLarge          = 413,  /**< 413 Request Entity Too Large */
00138     Http_414_RequestURITooLong              = 414,  /**< 414 Request-URI Too Long */
00139     Http_415_UnsupportedMediaType           = 415,  /**< 415 Unsupported Media Type */
00140     Http_416_RequestedRangeNotSatisfiable   = 416,  /**< 416 Requested Range Not Satisfiable */
00141     Http_417_ExpectationFailed              = 417,  /**< 417 Expectation Failed */
00142     Http_500_InternalServerError            = 500,  /**< 500 Internal Server Error */
00143     Http_501_NotImplemented                 = 501,  /**< 501 Not Implemented */
00144     Http_502_BadGateway                     = 502,  /**< 502 Bad Gateway */
00145     Http_503_ServiceUnavailable             = 503,  /**< 503 Service Unavailable */
00146     Http_504_GatewayTimeout                 = 504,  /**< 504 Gateway Timeout */
00147     Http_505_HTTPVersionNotSupported        = 505   /**< 505 HTTP Version Not Supported */
00148 };
00149 
00150 
00151 //[-------------------------------------------------------]
00152 //[ Classes                                               ]
00153 //[-------------------------------------------------------]
00154 /**
00155 *  @brief
00156 *    HTTP helper class
00157 */
00158 class Http {
00159 
00160 
00161     //[-------------------------------------------------------]
00162     //[ Public static functions                               ]
00163     //[-------------------------------------------------------]
00164     public:
00165         /**
00166         *  @brief
00167         *    Get status string from status code
00168         *
00169         *  @param[in] nStatusCode
00170         *    HTTP status code
00171         *
00172         *  @return
00173         *    Status string
00174         *
00175         *  @remarks
00176         *    Example: GetStatusString(Http_404_NotFound) -> "404 Not Found"
00177         */
00178         static PLCORE_API String GetStatusString(EHttpStatus nStatusCode);
00179 
00180 
00181 };
00182 
00183 
00184 //[-------------------------------------------------------]
00185 //[ Namespace                                             ]
00186 //[-------------------------------------------------------]
00187 } // PLCore
00188 
00189 
00190 #endif // __PLCORE_HTTP_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:56
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported