00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Base Library 00005 * Module : HTTPDefines 00006 * Package : Zeus.ZeusBase.Net.Protocols 00007 * Author : Benjamin Hadorn 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 #ifndef HTTPDefinesHPP 00033 #define HTTPDefinesHPP 00034 00035 #include <zeusbase/System/ZObject.h> 00036 #include <zeusbase/System/Queue.hpp> 00037 00038 /***********************************************************************/ 00039 /* Used internally by the Scanner 00040 */ 00041 /***********************************************************************/ 00042 #define HTTP_TOKEN_DATA 0 00043 #define HTTP_TOKEN_NEWLINE 1 00044 #define HTTP_TOKEN_SPACE 2 00045 #define HTTP_TOKEN_TAB 3 00046 00047 #define HTTPSCAN_STATE_HEADER 0 00048 #define HTTPSCAN_STATE_BODY 1 00049 #define HTTPSCAN_STATE_END 2 00050 #define HTTPSCAN_STATE_ERROR 3 00051 00052 00053 #define HTTPPARSE_STATE_PROTOCOL 0 00054 #define HTTPPARSE_STATE_STATUSCODE 1 00055 #define HTTPPARSE_STATE_STATUSTEXT 2 00056 #define HTTPPARSE_STATE_HEADER_START 3 00057 #define HTTPPARSE_STATE_HEADER 4 00058 #define HTTPPARSE_STATE_HEADER_CONT 5 00059 #define HTTPPARSE_STATE_BODY 6 00060 #define HTTPPARSE_STATE_METHOD 7 00061 #define HTTPPARSE_STATE_RESSOURCE 8 00062 #define HTTPPARSE_STATE_ERROR 9 00063 00064 00065 BEGIN_NAMESPACE_Zeus 00066 00067 /***************************************************************************/ 00070 /***************************************************************************/ 00071 class THTTProtocol : public TZObject 00072 { 00073 public: 00074 00075 /**********************************************************************/ 00078 /**********************************************************************/ 00079 enum EResponseState 00080 { 00081 /*HTTP 1.0*/ 00082 etOK = 200, //OK 00083 etCreated = 201, //Created 00084 etAccepted = 202, //Accepted 00085 etNoContent =204, //No Content 00086 etMovedPermanently = 301, //Moved Permanently 00087 etMovedTemporarily = 302, //Moved Temporarily 00088 etNotModified = 304, //Not Modified 00089 etBadRequest = 400, //Bad Request 00090 etUnauthorized = 401, //Unauthorized 00091 etForbidden = 403, //Forbidden 00092 etNotFound = 404, //Not Found 00093 etInternalServerError = 500, //Internal Server Error 00094 etNotImplemented = 501, //Not Implemented 00095 etBadGateway = 502, //Bad Gateway 00096 etServiceUnavailable = 503, //Service Unavailable 00097 00098 /*HTTP 1.1*/ 00099 etSeeOther = 303 00100 }; 00101 00102 /**********************************************************************/ 00105 /**********************************************************************/ 00106 enum ERequestMethod 00107 { 00108 /*Base methods of HTTP 1.0*/ 00109 etGetMethod = 0, 00110 etPostMethod = 1, 00111 etHeadMethod = 2, 00112 00113 /*Additional features of HTTP 1.0*/ 00114 etPutMethod = 3, 00115 etDeleteMethod = 4, 00116 etLinkMethod = 5, 00117 etUnlinkMethod = 6 00118 }; 00119 00120 /***************************************************************************/ 00123 /***************************************************************************/ 00124 enum EHTTPVersion 00125 { 00126 etVersion_1_0 = 0, 00127 etVersion_1_1 = 1 00128 }; 00129 }; 00130 00131 END_NAMESPACE_Zeus 00132 00133 #endif