Integrating the ublox LISA C200 modem
Fork of SprintUSBModemHTTPClientTest by
HTTPClient/data/HTTPMap.h@5:3f93dd1d4cb3, 2013-09-26 (annotated)
- Committer:
- sam_grove
- Date:
- Thu Sep 26 00:44:20 2013 -0500
- Revision:
- 5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 5:3f93dd1d4cb3 | 1 | /* HTTPMap.h */ |
sam_grove | 5:3f93dd1d4cb3 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
sam_grove | 5:3f93dd1d4cb3 | 3 | * |
sam_grove | 5:3f93dd1d4cb3 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
sam_grove | 5:3f93dd1d4cb3 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
sam_grove | 5:3f93dd1d4cb3 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
sam_grove | 5:3f93dd1d4cb3 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
sam_grove | 5:3f93dd1d4cb3 | 8 | * furnished to do so, subject to the following conditions: |
sam_grove | 5:3f93dd1d4cb3 | 9 | * |
sam_grove | 5:3f93dd1d4cb3 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
sam_grove | 5:3f93dd1d4cb3 | 11 | * substantial portions of the Software. |
sam_grove | 5:3f93dd1d4cb3 | 12 | * |
sam_grove | 5:3f93dd1d4cb3 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
sam_grove | 5:3f93dd1d4cb3 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
sam_grove | 5:3f93dd1d4cb3 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
sam_grove | 5:3f93dd1d4cb3 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
sam_grove | 5:3f93dd1d4cb3 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
sam_grove | 5:3f93dd1d4cb3 | 18 | */ |
sam_grove | 5:3f93dd1d4cb3 | 19 | |
sam_grove | 5:3f93dd1d4cb3 | 20 | |
sam_grove | 5:3f93dd1d4cb3 | 21 | #ifndef HTTPMAP_H_ |
sam_grove | 5:3f93dd1d4cb3 | 22 | #define HTTPMAP_H_ |
sam_grove | 5:3f93dd1d4cb3 | 23 | |
sam_grove | 5:3f93dd1d4cb3 | 24 | #include "../IHTTPData.h" |
sam_grove | 5:3f93dd1d4cb3 | 25 | |
sam_grove | 5:3f93dd1d4cb3 | 26 | #define HTTPMAP_TABLE_SIZE 32 |
sam_grove | 5:3f93dd1d4cb3 | 27 | |
sam_grove | 5:3f93dd1d4cb3 | 28 | /** Map of key/value pairs |
sam_grove | 5:3f93dd1d4cb3 | 29 | * Used to transmit POST data using the application/x-www-form-urlencoded encoding |
sam_grove | 5:3f93dd1d4cb3 | 30 | */ |
sam_grove | 5:3f93dd1d4cb3 | 31 | class HTTPMap: public IHTTPDataOut |
sam_grove | 5:3f93dd1d4cb3 | 32 | { |
sam_grove | 5:3f93dd1d4cb3 | 33 | public: |
sam_grove | 5:3f93dd1d4cb3 | 34 | /** |
sam_grove | 5:3f93dd1d4cb3 | 35 | Instantiates HTTPMap |
sam_grove | 5:3f93dd1d4cb3 | 36 | It supports at most 32 key/values pairs |
sam_grove | 5:3f93dd1d4cb3 | 37 | */ |
sam_grove | 5:3f93dd1d4cb3 | 38 | HTTPMap(); |
sam_grove | 5:3f93dd1d4cb3 | 39 | |
sam_grove | 5:3f93dd1d4cb3 | 40 | /** Put Key/Value pair |
sam_grove | 5:3f93dd1d4cb3 | 41 | The references to the parameters must remain valid as long as the clear() function is not called |
sam_grove | 5:3f93dd1d4cb3 | 42 | @param key The key to use |
sam_grove | 5:3f93dd1d4cb3 | 43 | @param value The corresponding value |
sam_grove | 5:3f93dd1d4cb3 | 44 | */ |
sam_grove | 5:3f93dd1d4cb3 | 45 | void put(const char* key, const char* value); |
sam_grove | 5:3f93dd1d4cb3 | 46 | |
sam_grove | 5:3f93dd1d4cb3 | 47 | /** Clear table |
sam_grove | 5:3f93dd1d4cb3 | 48 | */ |
sam_grove | 5:3f93dd1d4cb3 | 49 | void clear(); |
sam_grove | 5:3f93dd1d4cb3 | 50 | |
sam_grove | 5:3f93dd1d4cb3 | 51 | protected: |
sam_grove | 5:3f93dd1d4cb3 | 52 | //IHTTPDataIn |
sam_grove | 5:3f93dd1d4cb3 | 53 | virtual void readReset(); |
sam_grove | 5:3f93dd1d4cb3 | 54 | |
sam_grove | 5:3f93dd1d4cb3 | 55 | virtual int read(char* buf, size_t len, size_t* pReadLen); |
sam_grove | 5:3f93dd1d4cb3 | 56 | |
sam_grove | 5:3f93dd1d4cb3 | 57 | virtual int getDataType(char* type, size_t maxTypeLen); //Internet media type for Content-Type header |
sam_grove | 5:3f93dd1d4cb3 | 58 | |
sam_grove | 5:3f93dd1d4cb3 | 59 | virtual bool getIsChunked(); //For Transfer-Encoding header |
sam_grove | 5:3f93dd1d4cb3 | 60 | |
sam_grove | 5:3f93dd1d4cb3 | 61 | virtual size_t getDataLen(); //For Content-Length header |
sam_grove | 5:3f93dd1d4cb3 | 62 | |
sam_grove | 5:3f93dd1d4cb3 | 63 | private: |
sam_grove | 5:3f93dd1d4cb3 | 64 | const char* m_keys[HTTPMAP_TABLE_SIZE]; |
sam_grove | 5:3f93dd1d4cb3 | 65 | const char* m_values[HTTPMAP_TABLE_SIZE]; |
sam_grove | 5:3f93dd1d4cb3 | 66 | |
sam_grove | 5:3f93dd1d4cb3 | 67 | size_t m_pos; |
sam_grove | 5:3f93dd1d4cb3 | 68 | size_t m_count; |
sam_grove | 5:3f93dd1d4cb3 | 69 | }; |
sam_grove | 5:3f93dd1d4cb3 | 70 | |
sam_grove | 5:3f93dd1d4cb3 | 71 | #endif /* HTTPMAP_H_ */ |