inetwork/http.h
00001 /* 00002 Copyright (C) 2011 by Jelle Hellemans 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __INETWORK_HTTP_H__ 00020 #define __INETWORK_HTTP_H__ 00021 00022 #include <csutil/scf.h> 00023 #include <csutil/scf_implementation.h> 00024 00025 struct iDataBuffer; 00026 00027 00028 namespace CS { 00029 namespace Network { 00030 namespace HTTP { 00031 00032 enum ResponseState 00033 { 00034 OK = 0, 00035 CouldNotConnect = 1, 00036 CouldNotResolve = 2, 00037 Other = 2 00038 }; 00039 00043 struct iResponse : public virtual iBase 00044 { 00045 SCF_INTERFACE(iResponse, 0, 1, 0); 00046 00047 virtual int GetCode () = 0; 00048 00049 virtual const ResponseState& GetState () = 0; 00050 00051 virtual const char* GetError () = 0; 00052 00053 virtual csRef<iDataBuffer> GetHeader () = 0; 00054 00055 virtual csRef<iDataBuffer> GetData () = 0; 00056 }; 00057 00058 00062 struct iHTTPConnection : public virtual iBase 00063 { 00064 SCF_INTERFACE (iHTTPConnection, 0, 0, 1); 00065 00070 virtual csRef<iResponse> Get(const char* location, const char* params=0, iStringArray* headers=0) = 0; 00071 00076 virtual csRef<iResponse> Head(const char* location, const char* params=0) = 0; 00077 00082 virtual csRef<iResponse> Post(const char* location, const char* pdata=0, const char* format=0) = 0; 00083 00088 virtual csRef<iResponse> Put(const char* location, const char* pdata=0, const char* format=0) = 0; 00089 00094 virtual csRef<iResponse> Delete(const char* location) = 0; 00095 }; 00096 00097 enum ProxySetting 00098 { 00099 NoProxy = 0, 00100 SystemProxy = 1, 00101 CustomProxy = 2 00102 }; 00103 00104 00108 struct iHTTPConnectionFactory : public virtual iBase 00109 { 00110 SCF_INTERFACE (iHTTPConnectionFactory, 0, 0, 1); 00111 00118 virtual csRef<iHTTPConnection> Create (const char* uri) = 0; 00119 00123 virtual void UseProxy (ProxySetting setting) = 0; 00124 00129 virtual void SetCustomProxy(const char* uri, const char* user=0, const char* password=0) = 0; 00130 }; 00131 00132 } // namespace HTTP 00133 } // namespace Network 00134 } // namespace CS 00135 00136 #endif
Generated for Crystal Space 2.1 by doxygen 1.6.1
