Oct122012mbedLab
Fork of HTTPClient by
LPC1768/services/http/client/HTTPData.h@0:62fac7f06c8d, 2010-12-09 (annotated)
- Committer:
- mamezu
- Date:
- Thu Dec 09 01:36:34 2010 +0000
- Revision:
- 0:62fac7f06c8d
- Child:
- 1:b77740c0a846
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mamezu | 0:62fac7f06c8d | 1 | |
mamezu | 0:62fac7f06c8d | 2 | /* |
mamezu | 0:62fac7f06c8d | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
mamezu | 0:62fac7f06c8d | 4 | |
mamezu | 0:62fac7f06c8d | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
mamezu | 0:62fac7f06c8d | 6 | of this software and associated documentation files (the "Software"), to deal |
mamezu | 0:62fac7f06c8d | 7 | in the Software without restriction, including without limitation the rights |
mamezu | 0:62fac7f06c8d | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
mamezu | 0:62fac7f06c8d | 9 | copies of the Software, and to permit persons to whom the Software is |
mamezu | 0:62fac7f06c8d | 10 | furnished to do so, subject to the following conditions: |
mamezu | 0:62fac7f06c8d | 11 | |
mamezu | 0:62fac7f06c8d | 12 | The above copyright notice and this permission notice shall be included in |
mamezu | 0:62fac7f06c8d | 13 | all copies or substantial portions of the Software. |
mamezu | 0:62fac7f06c8d | 14 | |
mamezu | 0:62fac7f06c8d | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
mamezu | 0:62fac7f06c8d | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
mamezu | 0:62fac7f06c8d | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
mamezu | 0:62fac7f06c8d | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
mamezu | 0:62fac7f06c8d | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
mamezu | 0:62fac7f06c8d | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
mamezu | 0:62fac7f06c8d | 21 | THE SOFTWARE. |
mamezu | 0:62fac7f06c8d | 22 | */ |
mamezu | 0:62fac7f06c8d | 23 | |
mamezu | 0:62fac7f06c8d | 24 | #ifndef HTTP_DATA_H |
mamezu | 0:62fac7f06c8d | 25 | #define HTTP_DATA_H |
mamezu | 0:62fac7f06c8d | 26 | |
mamezu | 0:62fac7f06c8d | 27 | #include "core/net.h" |
mamezu | 0:62fac7f06c8d | 28 | |
mamezu | 0:62fac7f06c8d | 29 | #include <string> |
mamezu | 0:62fac7f06c8d | 30 | using std::string; |
mamezu | 0:62fac7f06c8d | 31 | |
mamezu | 0:62fac7f06c8d | 32 | class HTTPData //This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) |
mamezu | 0:62fac7f06c8d | 33 | { |
mamezu | 0:62fac7f06c8d | 34 | public: |
mamezu | 0:62fac7f06c8d | 35 | HTTPData(); |
mamezu | 0:62fac7f06c8d | 36 | virtual ~HTTPData(); |
mamezu | 0:62fac7f06c8d | 37 | |
mamezu | 0:62fac7f06c8d | 38 | virtual void clear() = 0; |
mamezu | 0:62fac7f06c8d | 39 | |
mamezu | 0:62fac7f06c8d | 40 | protected: |
mamezu | 0:62fac7f06c8d | 41 | friend class HTTPClient; |
mamezu | 0:62fac7f06c8d | 42 | virtual int read(char* buf, int len) = 0; |
mamezu | 0:62fac7f06c8d | 43 | virtual int write(const char* buf, int len) = 0; |
mamezu | 0:62fac7f06c8d | 44 | |
mamezu | 0:62fac7f06c8d | 45 | virtual string getDataType() = 0; //Internet media type for Content-Type header |
mamezu | 0:62fac7f06c8d | 46 | virtual void setDataType(const string& type) = 0; //Internet media type from Content-Type header |
mamezu | 0:62fac7f06c8d | 47 | |
mamezu | 0:62fac7f06c8d | 48 | virtual bool getIsChunked() = 0; //For Transfer-Encoding header |
mamezu | 0:62fac7f06c8d | 49 | virtual void setIsChunked(bool chunked) = 0; //From Transfer-Encoding header |
mamezu | 0:62fac7f06c8d | 50 | |
mamezu | 0:62fac7f06c8d | 51 | virtual int getDataLen() = 0; //For Content-Length header |
mamezu | 0:62fac7f06c8d | 52 | virtual void setDataLen(int len) = 0; //From Content-Length header, or if the transfer is chunked, next chunk length |
mamezu | 0:62fac7f06c8d | 53 | |
mamezu | 0:62fac7f06c8d | 54 | private: |
mamezu | 0:62fac7f06c8d | 55 | |
mamezu | 0:62fac7f06c8d | 56 | }; |
mamezu | 0:62fac7f06c8d | 57 | |
mamezu | 0:62fac7f06c8d | 58 | #endif |