Renesas / SecureDweet
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IHttpDataIn.h Source File

IHttpDataIn.h

00001 /*
00002  * IHttpDataIn.h
00003  *
00004  *  Created on: Aug 15, 2016
00005  *      Author: Faheem Inayat
00006  * Created for: Renesas Electronics America HQ, Santa Clara, CA, USA
00007  * 
00008  * Copyright (c) 2016 Renesas Electronics America (REA) and Faheem Inayat
00009  */
00010 /*
00011  * MIT License
00012  *
00013  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00014  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00015  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00016  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00017  * furnished to do so, subject to the following conditions:
00018  *
00019  * The above copyright notice and this permission notice shall be included in all copies or
00020  * substantial portions of the Software.
00021  *
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00023  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00024  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00025  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00026  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00027  */
00028 #ifndef IHTTPDATAIN_H_
00029     #define IHTTPDATAIN_H_
00030 
00031 #include "stddef.h"
00032 
00033 ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...)
00034 class IHttpDataIn
00035 {
00036     public:
00037         IHttpDataIn ();
00038         virtual ~IHttpDataIn ();
00039 
00040         /** Reset stream to its beginning
00041          * Called by the HTTPClient on each new request
00042          */
00043         virtual void writeReset() = 0;
00044 
00045         /** Write a piece of data transmitted by the server
00046          * @param buf Pointer to the buffer from which to copy the data
00047          * @param len Length of the buffer
00048          */
00049         virtual int write(const char* buf, size_t len) = 0;
00050 
00051         /** Set MIME type
00052          * @param type Internet media type from Content-Type header
00053          */
00054         virtual void setDataType(const char* type) = 0;
00055 
00056         /** Determine whether the data is chunked
00057          *  Recovered from Transfer-Encoding header
00058          */
00059         virtual void setIsChunked(bool chunked) = 0;
00060 
00061         /** If the data is not chunked, set its size
00062          * From Content-Length header
00063          */
00064         virtual void setDataLen(size_t len) = 0;
00065 };
00066 
00067 #endif /* IHTTPDATAIN_H_ */
00068