]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/http/common/HTTPClient/IHTTPData.h
2 /* Copyright (C) 2012 mbed.org, MIT License
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in all copies or
11 * substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...)
31 friend class HTTPClient
;
33 /** Reset stream to its beginning
34 * Called by the HTTPClient on each new request
36 virtual void readReset() = 0;
38 /** Read a piece of data to be transmitted
39 * @param buf Pointer to the buffer on which to copy the data
40 * @param len Length of the buffer
41 * @param pReadLen Pointer to the variable on which the actual copied data length will be stored
43 virtual int read(char* buf
, size_t len
, size_t* pReadLen
) = 0;
46 * @param type Internet media type from Content-Type header
48 virtual int getDataType(char* type
, size_t maxTypeLen
) = 0; //Internet media type for Content-Type header
50 /** Determine whether the HTTP client should chunk the data
51 * Used for Transfer-Encoding header
53 virtual bool getIsChunked() = 0;
55 /** If the data is not chunked, get its size
56 * Used for Content-Length header
58 virtual size_t getDataLen() = 0;
62 ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...)
66 friend class HTTPClient
;
68 /** Reset stream to its beginning
69 * Called by the HTTPClient on each new request
71 virtual void writeReset() = 0;
73 /** Write a piece of data transmitted by the server
74 * @param buf Pointer to the buffer from which to copy the data
75 * @param len Length of the buffer
77 virtual int write(const char* buf
, size_t len
) = 0;
80 * @param type Internet media type from Content-Type header
82 virtual void setDataType(const char* type
) = 0;
84 /** Determine whether the data is chunked
85 * Recovered from Transfer-Encoding header
87 virtual void setIsChunked(bool chunked
) = 0;
89 /** If the data is not chunked, set its size
90 * From Content-Length header
92 virtual void setDataLen(size_t len
) = 0;