]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/protocols/HTTPClient_HelloWorld/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 /** Read a piece of data to be transmitted
34 * @param buf Pointer to the buffer on which to copy the data
35 * @param len Length of the buffer
36 * @param pReadLen Pointer to the variable on which the actual copied data length will be stored
38 virtual int read(char* buf
, size_t len
, size_t* pReadLen
) = 0;
41 * @param type Internet media type from Content-Type header
43 virtual int getDataType(char* type
, size_t maxTypeLen
) = 0; //Internet media type for Content-Type header
45 /** Determine whether the HTTP client should chunk the data
46 * Used for Transfer-Encoding header
48 virtual bool getIsChunked() = 0;
50 /** If the data is not chunked, get its size
51 * Used for Content-Length header
53 virtual size_t getDataLen() = 0;
57 ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...)
61 friend class HTTPClient
;
63 /** Write a piece of data transmitted by the server
64 * @param buf Pointer to the buffer from which to copy the data
65 * @param len Length of the buffer
67 virtual int write(const char* buf
, size_t len
) = 0;
70 * @param type Internet media type from Content-Type header
72 virtual void setDataType(const char* type
) = 0;
74 /** Determine whether the data is chunked
75 * Recovered from Transfer-Encoding header
77 virtual void setIsChunked(bool chunked
) = 0;
79 /** If the data is not chunked, set its size
80 * From Content-Length header
82 virtual void setDataLen(size_t len
) = 0;