Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HTTPClient by
HTTPMap.h
00001 /* HTTPMap.h */ 00002 /* Copyright (C) 2012 mbed.org, MIT License 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00005 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00006 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00007 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in all copies or 00011 * substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00014 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00015 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00016 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00017 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00018 */ 00019 00020 00021 #ifndef HTTPMAP_H_ 00022 #define HTTPMAP_H_ 00023 00024 #include "../IHTTPData.h" 00025 00026 #define HTTPMAP_TABLE_SIZE 32 00027 00028 /** Map of key/value pairs 00029 * Used to transmit POST data using the application/x-www-form-urlencoded encoding 00030 */ 00031 class HTTPMap: public IHTTPDataOut 00032 { 00033 public: 00034 /** 00035 Instantiates HTTPMap 00036 It supports at most 32 key/values pairs 00037 */ 00038 HTTPMap(); 00039 00040 /** Put Key/Value pair 00041 The references to the parameters must remain valid as long as the clear() function is not called 00042 @param key The key to use 00043 @param value The corresponding value 00044 */ 00045 void put(const char* key, const char* value); 00046 00047 /** Clear table 00048 */ 00049 void clear(); 00050 00051 protected: 00052 //IHTTPDataIn 00053 virtual void readReset(); 00054 00055 virtual int read(char* buf, size_t len, size_t* pReadLen); 00056 00057 virtual int getDataType(char* type, size_t maxTypeLen); //Internet media type for Content-Type header 00058 00059 virtual bool getIsChunked(); //For Transfer-Encoding header 00060 00061 virtual size_t getDataLen(); //For Content-Length header 00062 00063 private: 00064 const char* m_keys[HTTPMAP_TABLE_SIZE]; 00065 const char* m_values[HTTPMAP_TABLE_SIZE]; 00066 00067 size_t m_pos; 00068 size_t m_count; 00069 }; 00070 00071 #endif /* HTTPMAP_H_ */
Generated on Tue Jul 12 2022 20:03:26 by
