SecureDweet is a dweet.io library that works on HTTPS protocol using SecureHttpClient library. It'll be able to fetch or listen to Dweet APIs and JSON messages.
IHttpDataIn.h@0:b30bbf6fe90d, 2016-08-22 (annotated)
- Committer:
- faheem_chaudhary
- Date:
- Mon Aug 22 18:37:13 2016 +0000
- Revision:
- 0:b30bbf6fe90d
First-cut library code check-in. No guarantees to work.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
faheem_chaudhary | 0:b30bbf6fe90d | 1 | /* |
faheem_chaudhary | 0:b30bbf6fe90d | 2 | * IHttpDataIn.h |
faheem_chaudhary | 0:b30bbf6fe90d | 3 | * |
faheem_chaudhary | 0:b30bbf6fe90d | 4 | * Created on: Aug 15, 2016 |
faheem_chaudhary | 0:b30bbf6fe90d | 5 | * Author: Faheem Inayat |
faheem_chaudhary | 0:b30bbf6fe90d | 6 | * Created for: Renesas Electronics America HQ, Santa Clara, CA, USA |
faheem_chaudhary | 0:b30bbf6fe90d | 7 | * |
faheem_chaudhary | 0:b30bbf6fe90d | 8 | * Copyright (c) 2016 Renesas Electronics America (REA) and Faheem Inayat |
faheem_chaudhary | 0:b30bbf6fe90d | 9 | */ |
faheem_chaudhary | 0:b30bbf6fe90d | 10 | /* |
faheem_chaudhary | 0:b30bbf6fe90d | 11 | * MIT License |
faheem_chaudhary | 0:b30bbf6fe90d | 12 | * |
faheem_chaudhary | 0:b30bbf6fe90d | 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
faheem_chaudhary | 0:b30bbf6fe90d | 14 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
faheem_chaudhary | 0:b30bbf6fe90d | 15 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
faheem_chaudhary | 0:b30bbf6fe90d | 16 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
faheem_chaudhary | 0:b30bbf6fe90d | 17 | * furnished to do so, subject to the following conditions: |
faheem_chaudhary | 0:b30bbf6fe90d | 18 | * |
faheem_chaudhary | 0:b30bbf6fe90d | 19 | * The above copyright notice and this permission notice shall be included in all copies or |
faheem_chaudhary | 0:b30bbf6fe90d | 20 | * substantial portions of the Software. |
faheem_chaudhary | 0:b30bbf6fe90d | 21 | * |
faheem_chaudhary | 0:b30bbf6fe90d | 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
faheem_chaudhary | 0:b30bbf6fe90d | 23 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
faheem_chaudhary | 0:b30bbf6fe90d | 24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
faheem_chaudhary | 0:b30bbf6fe90d | 25 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
faheem_chaudhary | 0:b30bbf6fe90d | 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
faheem_chaudhary | 0:b30bbf6fe90d | 27 | */ |
faheem_chaudhary | 0:b30bbf6fe90d | 28 | #ifndef IHTTPDATAIN_H_ |
faheem_chaudhary | 0:b30bbf6fe90d | 29 | #define IHTTPDATAIN_H_ |
faheem_chaudhary | 0:b30bbf6fe90d | 30 | |
faheem_chaudhary | 0:b30bbf6fe90d | 31 | #include "stddef.h" |
faheem_chaudhary | 0:b30bbf6fe90d | 32 | |
faheem_chaudhary | 0:b30bbf6fe90d | 33 | ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) |
faheem_chaudhary | 0:b30bbf6fe90d | 34 | class IHttpDataIn |
faheem_chaudhary | 0:b30bbf6fe90d | 35 | { |
faheem_chaudhary | 0:b30bbf6fe90d | 36 | public: |
faheem_chaudhary | 0:b30bbf6fe90d | 37 | IHttpDataIn (); |
faheem_chaudhary | 0:b30bbf6fe90d | 38 | virtual ~IHttpDataIn (); |
faheem_chaudhary | 0:b30bbf6fe90d | 39 | |
faheem_chaudhary | 0:b30bbf6fe90d | 40 | /** Reset stream to its beginning |
faheem_chaudhary | 0:b30bbf6fe90d | 41 | * Called by the HTTPClient on each new request |
faheem_chaudhary | 0:b30bbf6fe90d | 42 | */ |
faheem_chaudhary | 0:b30bbf6fe90d | 43 | virtual void writeReset() = 0; |
faheem_chaudhary | 0:b30bbf6fe90d | 44 | |
faheem_chaudhary | 0:b30bbf6fe90d | 45 | /** Write a piece of data transmitted by the server |
faheem_chaudhary | 0:b30bbf6fe90d | 46 | * @param buf Pointer to the buffer from which to copy the data |
faheem_chaudhary | 0:b30bbf6fe90d | 47 | * @param len Length of the buffer |
faheem_chaudhary | 0:b30bbf6fe90d | 48 | */ |
faheem_chaudhary | 0:b30bbf6fe90d | 49 | virtual int write(const char* buf, size_t len) = 0; |
faheem_chaudhary | 0:b30bbf6fe90d | 50 | |
faheem_chaudhary | 0:b30bbf6fe90d | 51 | /** Set MIME type |
faheem_chaudhary | 0:b30bbf6fe90d | 52 | * @param type Internet media type from Content-Type header |
faheem_chaudhary | 0:b30bbf6fe90d | 53 | */ |
faheem_chaudhary | 0:b30bbf6fe90d | 54 | virtual void setDataType(const char* type) = 0; |
faheem_chaudhary | 0:b30bbf6fe90d | 55 | |
faheem_chaudhary | 0:b30bbf6fe90d | 56 | /** Determine whether the data is chunked |
faheem_chaudhary | 0:b30bbf6fe90d | 57 | * Recovered from Transfer-Encoding header |
faheem_chaudhary | 0:b30bbf6fe90d | 58 | */ |
faheem_chaudhary | 0:b30bbf6fe90d | 59 | virtual void setIsChunked(bool chunked) = 0; |
faheem_chaudhary | 0:b30bbf6fe90d | 60 | |
faheem_chaudhary | 0:b30bbf6fe90d | 61 | /** If the data is not chunked, set its size |
faheem_chaudhary | 0:b30bbf6fe90d | 62 | * From Content-Length header |
faheem_chaudhary | 0:b30bbf6fe90d | 63 | */ |
faheem_chaudhary | 0:b30bbf6fe90d | 64 | virtual void setDataLen(size_t len) = 0; |
faheem_chaudhary | 0:b30bbf6fe90d | 65 | }; |
faheem_chaudhary | 0:b30bbf6fe90d | 66 | |
faheem_chaudhary | 0:b30bbf6fe90d | 67 | #endif /* IHTTPDATAIN_H_ */ |
faheem_chaudhary | 0:b30bbf6fe90d | 68 |