Embed:
(wiki syntax)
Show/hide line numbers
IHTTPData.h
00001 /* IHTTPData.h */ 00002 /* 00003 Copyright (C) 2012 ARM Limited. 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a copy of 00006 this software and associated documentation files (the "Software"), to deal in 00007 the Software without restriction, including without limitation the rights to 00008 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 00009 of the Software, and to permit persons to whom the Software is furnished to do 00010 so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in all 00013 copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00021 SOFTWARE. 00022 */ 00023 00024 #ifndef IHTTPDATA_H 00025 #define IHTTPDATA_H 00026 00027 ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) 00028 class IHTTPDataOut 00029 { 00030 protected: 00031 friend class HTTPClient; 00032 00033 /** Read a piece of data to be transmitted 00034 * @param buf Pointer to the buffer on which to copy the data 00035 * @param len Length of the buffer 00036 * @param pReadLen Pointer to the variable on which the actual copied data length will be stored 00037 */ 00038 virtual int read(char* buf, size_t len, size_t* pReadLen) = 0; 00039 00040 /** Get MIME type 00041 * @param type Internet media type from Content-Type header 00042 */ 00043 virtual int getDataType(char* type, size_t maxTypeLen) = 0; //Internet media type for Content-Type header 00044 00045 /** Determine whether the HTTP client should chunk the data 00046 * Used for Transfer-Encoding header 00047 */ 00048 virtual bool getIsChunked() = 0; 00049 00050 /** If the data is not chunked, get its size 00051 * Used for Content-Length header 00052 */ 00053 virtual size_t getDataLen() = 0; 00054 00055 }; 00056 00057 ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) 00058 class IHTTPDataIn 00059 { 00060 protected: 00061 friend class HTTPClient; 00062 00063 /** Write a piece of data transmitted by the server 00064 * @param buf Pointer to the buffer from which to copy the data 00065 * @param len Length of the buffer 00066 */ 00067 virtual int write(const char* buf, size_t len) = 0; 00068 00069 /** Set MIME type 00070 * @param type Internet media type from Content-Type header 00071 */ 00072 virtual void setDataType(const char* type) = 0; 00073 00074 /** Determine whether the data is chunked 00075 * Recovered from Transfer-Encoding header 00076 */ 00077 virtual void setIsChunked(bool chunked) = 0; 00078 00079 /** If the data is not chunked, set its size 00080 * From Content-Length header 00081 */ 00082 virtual void setDataLen(size_t len) = 0; 00083 00084 }; 00085 00086 #endif
Generated on Wed Jul 13 2022 00:58:15 by 1.7.2