HTTP Client library
Dependents: weather_LCD_display News_LCD_display TwitterExample_1 GeoLocation_LCD_Display ... more
Diff: IHTTPData.h
- Revision:
- 7:d97a4fc01c86
- Parent:
- 6:3d3824893be1
--- a/IHTTPData.h Thu Apr 19 09:19:58 2012 +0000 +++ b/IHTTPData.h Thu Apr 19 09:52:54 2012 +0000 @@ -24,33 +24,62 @@ #ifndef IHTTPDATA_H #define IHTTPDATA_H -class IHTTPDataOut //This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) +///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) +class IHTTPDataOut { protected: friend class HTTPClient; + /** Read a piece of data to be transmitted + * @param buf Pointer to the buffer on which to copy the data + * @param len Length of the buffer + * @param pReadLen Pointer to the variable on which the actual copied data length will be stored + */ virtual int read(char* buf, size_t len, size_t* pReadLen) = 0; + /** Get MIME type + * @param type Internet media type from Content-Type header + */ virtual int getDataType(char* type, size_t maxTypeLen) = 0; //Internet media type for Content-Type header - virtual bool getIsChunked() = 0; //For Transfer-Encoding header + /** Determine whether the HTTP client should chunk the data + * Used for Transfer-Encoding header + */ + virtual bool getIsChunked() = 0; - virtual size_t getDataLen() = 0; //For Content-Length header + /** If the data is not chunked, get its size + * Used for Content-Length header + */ + virtual size_t getDataLen() = 0; }; -class IHTTPDataIn //This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) +///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) +class IHTTPDataIn { protected: friend class HTTPClient; + /** Write a piece of data transmitted by the server + * @param buf Pointer to the buffer from which to copy the data + * @param len Length of the buffer + */ virtual int write(const char* buf, size_t len) = 0; - virtual void setDataType(const char* type) = 0; //Internet media type from Content-Type header + /** Set MIME type + * @param type Internet media type from Content-Type header + */ + virtual void setDataType(const char* type) = 0; - virtual void setIsChunked(bool chunked) = 0; //From Transfer-Encoding header + /** Determine whether the data is chunked + * Recovered from Transfer-Encoding header + */ + virtual void setIsChunked(bool chunked) = 0; - virtual void setDataLen(size_t len) = 0; //From Content-Length header, or if the transfer is chunked, next chunk length + /** If the data is not chunked, set its size + * From Content-Length header + */ + virtual void setDataLen(size_t len) = 0; };