RobT's fork of HTTPClient library
Fork of HTTPClient_ToBeRemoved by
IHTTPData.h@7:d97a4fc01c86, 2012-04-19 (annotated)
- Committer:
- donatien
- Date:
- Thu Apr 19 09:52:54 2012 +0000
- Revision:
- 7:d97a4fc01c86
- Parent:
- 6:3d3824893be1
Documentation++
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 6:3d3824893be1 | 1 | /* IHTTPData.h */ |
donatien | 6:3d3824893be1 | 2 | /* |
donatien | 6:3d3824893be1 | 3 | Copyright (C) 2012 ARM Limited. |
donatien | 6:3d3824893be1 | 4 | |
donatien | 6:3d3824893be1 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
donatien | 6:3d3824893be1 | 6 | this software and associated documentation files (the "Software"), to deal in |
donatien | 6:3d3824893be1 | 7 | the Software without restriction, including without limitation the rights to |
donatien | 6:3d3824893be1 | 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
donatien | 6:3d3824893be1 | 9 | of the Software, and to permit persons to whom the Software is furnished to do |
donatien | 6:3d3824893be1 | 10 | so, subject to the following conditions: |
donatien | 6:3d3824893be1 | 11 | |
donatien | 6:3d3824893be1 | 12 | The above copyright notice and this permission notice shall be included in all |
donatien | 6:3d3824893be1 | 13 | copies or substantial portions of the Software. |
donatien | 6:3d3824893be1 | 14 | |
donatien | 6:3d3824893be1 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
donatien | 6:3d3824893be1 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
donatien | 6:3d3824893be1 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
donatien | 6:3d3824893be1 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
donatien | 6:3d3824893be1 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 6:3d3824893be1 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
donatien | 6:3d3824893be1 | 21 | SOFTWARE. |
donatien | 6:3d3824893be1 | 22 | */ |
donatien | 6:3d3824893be1 | 23 | |
donatien | 6:3d3824893be1 | 24 | #ifndef IHTTPDATA_H |
donatien | 6:3d3824893be1 | 25 | #define IHTTPDATA_H |
donatien | 6:3d3824893be1 | 26 | |
donatien | 7:d97a4fc01c86 | 27 | ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) |
donatien | 7:d97a4fc01c86 | 28 | class IHTTPDataOut |
donatien | 6:3d3824893be1 | 29 | { |
donatien | 6:3d3824893be1 | 30 | protected: |
donatien | 6:3d3824893be1 | 31 | friend class HTTPClient; |
donatien | 6:3d3824893be1 | 32 | |
donatien | 7:d97a4fc01c86 | 33 | /** Read a piece of data to be transmitted |
donatien | 7:d97a4fc01c86 | 34 | * @param buf Pointer to the buffer on which to copy the data |
donatien | 7:d97a4fc01c86 | 35 | * @param len Length of the buffer |
donatien | 7:d97a4fc01c86 | 36 | * @param pReadLen Pointer to the variable on which the actual copied data length will be stored |
donatien | 7:d97a4fc01c86 | 37 | */ |
donatien | 6:3d3824893be1 | 38 | virtual int read(char* buf, size_t len, size_t* pReadLen) = 0; |
donatien | 6:3d3824893be1 | 39 | |
donatien | 7:d97a4fc01c86 | 40 | /** Get MIME type |
donatien | 7:d97a4fc01c86 | 41 | * @param type Internet media type from Content-Type header |
donatien | 7:d97a4fc01c86 | 42 | */ |
donatien | 6:3d3824893be1 | 43 | virtual int getDataType(char* type, size_t maxTypeLen) = 0; //Internet media type for Content-Type header |
donatien | 6:3d3824893be1 | 44 | |
donatien | 7:d97a4fc01c86 | 45 | /** Determine whether the HTTP client should chunk the data |
donatien | 7:d97a4fc01c86 | 46 | * Used for Transfer-Encoding header |
donatien | 7:d97a4fc01c86 | 47 | */ |
donatien | 7:d97a4fc01c86 | 48 | virtual bool getIsChunked() = 0; |
donatien | 6:3d3824893be1 | 49 | |
donatien | 7:d97a4fc01c86 | 50 | /** If the data is not chunked, get its size |
donatien | 7:d97a4fc01c86 | 51 | * Used for Content-Length header |
donatien | 7:d97a4fc01c86 | 52 | */ |
donatien | 7:d97a4fc01c86 | 53 | virtual size_t getDataLen() = 0; |
donatien | 6:3d3824893be1 | 54 | |
donatien | 6:3d3824893be1 | 55 | }; |
donatien | 6:3d3824893be1 | 56 | |
donatien | 7:d97a4fc01c86 | 57 | ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) |
donatien | 7:d97a4fc01c86 | 58 | class IHTTPDataIn |
donatien | 6:3d3824893be1 | 59 | { |
donatien | 6:3d3824893be1 | 60 | protected: |
donatien | 6:3d3824893be1 | 61 | friend class HTTPClient; |
donatien | 6:3d3824893be1 | 62 | |
donatien | 7:d97a4fc01c86 | 63 | /** Write a piece of data transmitted by the server |
donatien | 7:d97a4fc01c86 | 64 | * @param buf Pointer to the buffer from which to copy the data |
donatien | 7:d97a4fc01c86 | 65 | * @param len Length of the buffer |
donatien | 7:d97a4fc01c86 | 66 | */ |
donatien | 6:3d3824893be1 | 67 | virtual int write(const char* buf, size_t len) = 0; |
donatien | 6:3d3824893be1 | 68 | |
donatien | 7:d97a4fc01c86 | 69 | /** Set MIME type |
donatien | 7:d97a4fc01c86 | 70 | * @param type Internet media type from Content-Type header |
donatien | 7:d97a4fc01c86 | 71 | */ |
donatien | 7:d97a4fc01c86 | 72 | virtual void setDataType(const char* type) = 0; |
donatien | 6:3d3824893be1 | 73 | |
donatien | 7:d97a4fc01c86 | 74 | /** Determine whether the data is chunked |
donatien | 7:d97a4fc01c86 | 75 | * Recovered from Transfer-Encoding header |
donatien | 7:d97a4fc01c86 | 76 | */ |
donatien | 7:d97a4fc01c86 | 77 | virtual void setIsChunked(bool chunked) = 0; |
donatien | 6:3d3824893be1 | 78 | |
donatien | 7:d97a4fc01c86 | 79 | /** If the data is not chunked, set its size |
donatien | 7:d97a4fc01c86 | 80 | * From Content-Length header |
donatien | 7:d97a4fc01c86 | 81 | */ |
donatien | 7:d97a4fc01c86 | 82 | virtual void setDataLen(size_t len) = 0; |
donatien | 6:3d3824893be1 | 83 | |
donatien | 6:3d3824893be1 | 84 | }; |
donatien | 6:3d3824893be1 | 85 | |
donatien | 6:3d3824893be1 | 86 | #endif |