this is fork and i will modify for STM32

Fork of AWS-test by Pierre-Marie Ancèle

Committer:
bcjun@aname.co.kr
Date:
Fri Aug 04 15:34:19 2017 +0900
Revision:
3:1ef624d94403
Parent:
0:cd5404401c2f
add esp82660-driver for NUCLEO_F401RE target.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
peyo 0:cd5404401c2f 1 /*
peyo 0:cd5404401c2f 2 * Copyright (c) 2010 Serge A. Zaitsev
peyo 0:cd5404401c2f 3 *
peyo 0:cd5404401c2f 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
peyo 0:cd5404401c2f 5 * of this software and associated documentation files (the "Software"), to deal
peyo 0:cd5404401c2f 6 * in the Software without restriction, including without limitation the rights
peyo 0:cd5404401c2f 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
peyo 0:cd5404401c2f 8 * copies of the Software, and to permit persons to whom the Software is
peyo 0:cd5404401c2f 9 * furnished to do so, subject to the following conditions:
peyo 0:cd5404401c2f 10 *
peyo 0:cd5404401c2f 11 * The above copyright notice and this permission notice shall be included in
peyo 0:cd5404401c2f 12 * all copies or substantial portions of the Software.
peyo 0:cd5404401c2f 13 *
peyo 0:cd5404401c2f 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
peyo 0:cd5404401c2f 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
peyo 0:cd5404401c2f 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
peyo 0:cd5404401c2f 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
peyo 0:cd5404401c2f 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
peyo 0:cd5404401c2f 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
peyo 0:cd5404401c2f 20 * THE SOFTWARE.
peyo 0:cd5404401c2f 21 */
peyo 0:cd5404401c2f 22
peyo 0:cd5404401c2f 23 /**
peyo 0:cd5404401c2f 24 * @file jsmn.h
peyo 0:cd5404401c2f 25 * @brief Definition of the JSMN (Jasmine) JSON parser.
peyo 0:cd5404401c2f 26 *
peyo 0:cd5404401c2f 27 * For more information on JSMN:
peyo 0:cd5404401c2f 28 * @see http://zserge.com/jsmn.html
peyo 0:cd5404401c2f 29 */
peyo 0:cd5404401c2f 30
peyo 0:cd5404401c2f 31 #ifndef __JSMN_H_
peyo 0:cd5404401c2f 32 #define __JSMN_H_
peyo 0:cd5404401c2f 33
peyo 0:cd5404401c2f 34 #include <stddef.h>
peyo 0:cd5404401c2f 35
peyo 0:cd5404401c2f 36 #ifdef __cplusplus
peyo 0:cd5404401c2f 37 extern "C" {
peyo 0:cd5404401c2f 38 #endif
peyo 0:cd5404401c2f 39
peyo 0:cd5404401c2f 40 /**
peyo 0:cd5404401c2f 41 * JSON type identifier. Basic types are:
peyo 0:cd5404401c2f 42 * o Object
peyo 0:cd5404401c2f 43 * o Array
peyo 0:cd5404401c2f 44 * o String
peyo 0:cd5404401c2f 45 * o Other primitive: number, boolean (true/false) or null
peyo 0:cd5404401c2f 46 */
peyo 0:cd5404401c2f 47 typedef enum {
peyo 0:cd5404401c2f 48 JSMN_UNDEFINED = 0,
peyo 0:cd5404401c2f 49 JSMN_OBJECT = 1,
peyo 0:cd5404401c2f 50 JSMN_ARRAY = 2,
peyo 0:cd5404401c2f 51 JSMN_STRING = 3,
peyo 0:cd5404401c2f 52 JSMN_PRIMITIVE = 4
peyo 0:cd5404401c2f 53 } jsmntype_t;
peyo 0:cd5404401c2f 54
peyo 0:cd5404401c2f 55 enum jsmnerr {
peyo 0:cd5404401c2f 56 /* Not enough tokens were provided */
peyo 0:cd5404401c2f 57 JSMN_ERROR_NOMEM = -1,
peyo 0:cd5404401c2f 58 /* Invalid character inside JSON string */
peyo 0:cd5404401c2f 59 JSMN_ERROR_INVAL = -2,
peyo 0:cd5404401c2f 60 /* The string is not a full JSON packet, more bytes expected */
peyo 0:cd5404401c2f 61 JSMN_ERROR_PART = -3
peyo 0:cd5404401c2f 62 };
peyo 0:cd5404401c2f 63
peyo 0:cd5404401c2f 64 /**
peyo 0:cd5404401c2f 65 * JSON token description.
peyo 0:cd5404401c2f 66 * @param type type (object, array, string etc.)
peyo 0:cd5404401c2f 67 * @param start start position in JSON data string
peyo 0:cd5404401c2f 68 * @param end end position in JSON data string
peyo 0:cd5404401c2f 69 */
peyo 0:cd5404401c2f 70 typedef struct {
peyo 0:cd5404401c2f 71 jsmntype_t type;
peyo 0:cd5404401c2f 72 int start;
peyo 0:cd5404401c2f 73 int end;
peyo 0:cd5404401c2f 74 int size;
peyo 0:cd5404401c2f 75 #ifdef JSMN_PARENT_LINKS
peyo 0:cd5404401c2f 76 int parent;
peyo 0:cd5404401c2f 77 #endif
peyo 0:cd5404401c2f 78 } jsmntok_t;
peyo 0:cd5404401c2f 79
peyo 0:cd5404401c2f 80 /**
peyo 0:cd5404401c2f 81 * JSON parser. Contains an array of token blocks available. Also stores
peyo 0:cd5404401c2f 82 * the string being parsed now and current position in that string
peyo 0:cd5404401c2f 83 */
peyo 0:cd5404401c2f 84 typedef struct {
peyo 0:cd5404401c2f 85 unsigned int pos; /* offset in the JSON string */
peyo 0:cd5404401c2f 86 unsigned int toknext; /* next token to allocate */
peyo 0:cd5404401c2f 87 int toksuper; /* superior token node, e.g parent object or array */
peyo 0:cd5404401c2f 88 } jsmn_parser;
peyo 0:cd5404401c2f 89
peyo 0:cd5404401c2f 90 /**
peyo 0:cd5404401c2f 91 * Create JSON parser over an array of tokens
peyo 0:cd5404401c2f 92 */
peyo 0:cd5404401c2f 93 void jsmn_init(jsmn_parser *parser);
peyo 0:cd5404401c2f 94
peyo 0:cd5404401c2f 95 /**
peyo 0:cd5404401c2f 96 * Run JSON parser. It parses a JSON data string into and array of tokens, each describing
peyo 0:cd5404401c2f 97 * a single JSON object.
peyo 0:cd5404401c2f 98 */
peyo 0:cd5404401c2f 99 int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
peyo 0:cd5404401c2f 100 jsmntok_t *tokens, unsigned int num_tokens);
peyo 0:cd5404401c2f 101
peyo 0:cd5404401c2f 102 #ifdef __cplusplus
peyo 0:cd5404401c2f 103 }
peyo 0:cd5404401c2f 104 #endif
peyo 0:cd5404401c2f 105
peyo 0:cd5404401c2f 106 #endif /* __JSMN_H_ */