libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-lecp.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2021 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
34
35#ifndef LECP_MAX_PARSING_STACK_DEPTH
36#define LECP_MAX_PARSING_STACK_DEPTH 5
37#endif
38#ifndef LECP_MAX_DEPTH
39#define LECP_MAX_DEPTH 12
40#endif
41#ifndef LECP_MAX_INDEX_DEPTH
42#define LECP_MAX_INDEX_DEPTH 8
43#endif
44#ifndef LECP_MAX_PATH
45#define LECP_MAX_PATH 128
46#endif
47#ifndef LECP_STRING_CHUNK
48/* must be >= 30 to assemble floats */
49#define LECP_STRING_CHUNK 254
50#endif
51
52/*
53 * These are tunable, but every index into the arrays they size is a uint8_t
54 * in struct lecp_ctx, so they are hard-capped: LECP_MAX_PATH, LECP_MAX_DEPTH,
55 * LECP_MAX_INDEX_DEPTH and LECP_MAX_PARSING_STACK_DEPTH must each be <= 255,
56 * and LECP_STRING_CHUNK <= 254. Raising one past its cap does not overflow
57 * the array, but the bounds checks stop firing and the parser silently
58 * corrupts what it collected.
59 */
60
61#if LECP_MAX_PATH > 255 || LECP_MAX_DEPTH > 255 || \
62 LECP_MAX_INDEX_DEPTH > 255 || LECP_MAX_PARSING_STACK_DEPTH > 255 || \
63 LECP_STRING_CHUNK > 254
64#error "LECP_ size knob is larger than its uint8_t index can represent"
65#endif
66
67#define LECP_FLAG_CB_IS_VALUE 64
68
69/*
70 * CBOR initial byte 3 x MSB bits are these
71 */
72
73enum {
81 LWS_CBOR_MAJTYP_FLOAT = 7 << 5, /* also BREAK */
82
84
85 /*
86 * For the low 5 bits of the opcode, 0-23 are literals, unless it's
87 * FLOAT.
88 *
89 * 24 = 1 byte; 25 = 2..., 26 = 4... and 27 = 8 bytes following literal.
90 */
95
97
99
100 /*
101 * Major type 7 discriminators in low 5 bits
102 * 0 - 23 is SIMPLE implicit value (like, eg, LWS_CBOR_SWK_TRUE)
103 */
108
109 LWS_CBOR_M7_SUBTYP_SIMPLE_X8 = 24, /* simple with additional byte */
114
115/* 28, 29, 30 are illegal.
116 *
117 * 31 is illegal for UINT, INT_NEG, and TAG;
118 * for BSTR, TSTR, ARRAY and MAP it means "indefinite length", ie,
119 * it's made up of an endless amount of determinite-length
120 * fragments terminated with a BREAK (FLOAT | 31) instead of the
121 * next determinite-length fragment. The second framing level
122 * means no need for escapes for BREAK in the data.
123 */
124
126
127/*
128 * Well-known tags
129 */
130
132 LWS_CBOR_WKTAG_DATETIME_EPOCH = 1, /* int or float */
133 LWS_CBOR_WKTAG_BIGNUM_UNSIGNED = 2, /* byte string */
134 LWS_CBOR_WKTAG_BIGNUM_NEGATIVE = 3, /* byte string */
136 LWS_CBOR_WKTAG_BIGFLOAT = 5, /* array */
137
141
143 LWS_CBOR_WKTAG_TO_B64 = 22, /* any */
144 LWS_CBOR_WKTAG_TO_B16 = 23, /* any */
145 LWS_CBOR_WKTAG_CBOR = 24, /* byte string */
146
147 LWS_CBOR_WKTAG_URI = 32, /* text string */
148 LWS_CBOR_WKTAG_B64U = 33, /* text string */
149 LWS_CBOR_WKTAG_B64 = 34, /* text string */
150 LWS_CBOR_WKTAG_MIME = 36, /* text string */
151
155
157};
158
203
211
212
213struct lecp_item {
214 union {
215 uint64_t u64;
216 int64_t i64;
217
218 uint64_t u32;
219
220 uint16_t hf;
221#if defined(LWS_WITH_CBOR_FLOAT)
222 float f;
223 double d;
224#else
225 uint32_t f;
226 uint64_t d;
227#endif
228 } u;
230};
231
232struct lecp_ctx;
233typedef signed char (*lecp_callback)(struct lecp_ctx *ctx, char reason);
234
236 char s; /* lejp_state stack*/
237 uint8_t p; /* path length */
238 char i; /* index array length */
239 char indet; /* indeterminite */
240 char intermediate; /* in middle of string */
241
243 uint64_t tag;
244 uint64_t collect_rem;
249};
250
252 void *user; /* private to the stack level */
254 const char * const *paths;
258};
259
260struct lecp_ctx {
261
262 /* sorted by type for most compact alignment
263 *
264 * pointers
265 */
266 void *user;
268
269 /* arrays */
270
273 uint16_t i[LECP_MAX_INDEX_DEPTH]; /* index array */
276 uint8_t cbor[64]; /* literal cbor capture */
277
279
280
281 /* size_t */
282
283 size_t path_stride; /* 0 means default ptr size, else
284 * stride... allows paths to be
285 * provided composed inside a
286 * larger user struct instead of a
287 * duplicated array */
288 size_t used_in; /* bytes of input consumed */
289
290 /* short */
291
293
294 /* char */
295
299 uint8_t sp; /* stack head */
300 uint8_t ipos; /* index stack depth */
305 uint8_t pst_sp; /* parsing stack head */
310 char present; /* temp for cb reason to use */
311
312 uint8_t be; /* big endian */
313
314 /* at end so we can memset the rest of it */
315
317};
318
321 LWS_LECPCTX_RET_AGAIN, /* call again to continue writing buffer */
322 LWS_LECPCTX_RET_FAIL /* something broken, eg, format string */
323};
324
339
340typedef struct lws_lec_pctx {
345 uint8_t *start; /* the beginning of the out buf */
346 uint8_t *buf; /* cur pos in output buf */
347 uint8_t *end; /* the end of the output buf */
348
350 uint64_t ongoing_len;
351 uint64_t ongoing_done;
352
354
355 size_t used; /* number of bytes valid from start */
356
357 int opaque[4]; /* ignored by lws, caller may use */
358
360 unsigned int fmt_pos;
368
370lws_lec_int(lws_lec_pctx_t *ctx, uint8_t opcode, uint8_t indet, uint64_t num);
371
374
375/*
376 * lws_lec_init() - prepare a cbor writing context
377 *
378 * \param ctx: the cbor writing context to prepare
379 * \param buf: the output buffer start
380 * \param len: the amount of the output buffer we can use
381 *
382 * Prepares a cbor writing context so that les_lec_printf can be used to
383 * write into it.
384 */
386lws_lec_init(lws_lec_pctx_t *ctx, uint8_t *buf, size_t len);
387
388/*
389 * lws_lec_setbuf() - update the output buffer for an initialized cbor writing ctx
390 *
391 * \param ctx: the cbor writing context to prepare
392 * \param buf: the output buffer start
393 * \param len: the amount of the output buffer we can use
394 *
395 * Leaves the cbor writing context state as it is, but resets the output buffer
396 * it writes into as given in \p buf and \p len
397 */
399lws_lec_setbuf(lws_lec_pctx_t *ctx, uint8_t *buf, size_t len);
400
401/*
402 * lws_lec_vsprintf() - write into a cbor writing context
403 *
404 * \param ctx: the cbor writing context to prepare
405 * \param format: a printf style argument map
406 * \param args: the va args
407 *
408 * CBOR-aware vsprintf which pauses output when it fills the output buffer. You
409 * can call it again with the same args and same lws_lex_pctx to resume filling
410 *
411 * Returns either LWS_LECPCTX_RET_FINISHED if we have nothing left over that we
412 * want to put in the buffer, or LWS_LECPCTX_RET_AGAIN if the function should
413 * be called again with the same arguments (perhaps into a different output
414 * buffer) to continue emitting output from where it left off.
415 *
416 * If LWS_LECPCTX_RET_AGAIN is returned, lws_lec_setbuf() must be used on the
417 * context to reset or change the output buffer before calling again.
418 *
419 * The number of bytes placed in the output buffer is available in ctx->used.
420 *
421 * \p format is a printf-type format string that is specialized for CBOR
422 * generation. It understands the following specifiers
423 *
424 * |`123`||unsigned literal number|
425 * |`-123`||signed literal number|
426 * |`%u`|`unsigned int`|number|
427 * |`%lu`|`unsigned long int`|number|
428 * |`%llu`|`unsigned long long int`|number|
429 * |`%d`|`signed int`|number|
430 * |`%ld`|`signed long int`|number|
431 * |`%lld`|`signed long long int`|number|
432 * |`%f`|`double`|floating point number|
433 * |`123(...)`||literal tag and scope|
434 * |`%t(...)`|`unsigned int`|tag and scope|
435 * |`%lt(...)`|`unsigned long int`|tag and scope|
436 * |`%llt(...)`|`unsigned long long int`|tag and scope|
437 * |`[...]`||Array (fixed len if `]` in same format string)|
438 * |`{...}`||Map (fixed len if `}` in same format string)|
439 * |`<t...>`||Container for indeterminite text string frags|
440 * |`<b...>`||Container for indeterminite binary string frags|
441 * |`'string'`||Literal text of known length|
442 * |`%s`|`const char *`|NUL-terminated string|
443 * |`%.*s`|`int`, `const char *`|length-specified string|
444 * |`%.*b`|`int`, `const uint8_t *`|length-specified binary|
445 * |`:`||separator between Map items (a:b)|
446 * |`,`||separator between Map pairs or array items|
447 *
448 * See READMEs/README.cbor-lecp.md for more details.
449 */
451lws_lec_vsprintf(lws_lec_pctx_t *ctx, const char *format, va_list args);
452
453/*
454 * lws_lec_printf() - write into a cbor writing context
455 *
456 * \param ctx: the cbor writing context to prepare
457 * \param format: a printf style argument map
458 * \param ...: format args
459 *
460 * See lws_lec_vsprintf() for format details. This is the most common way
461 * to format the CBOR output.
462 *
463 * See READMEs/README.cbor-lecp.md for more details.
464 */
466lws_lec_printf(lws_lec_pctx_t *ctx, const char *format, ...);
467
480lecp_construct(struct lecp_ctx *ctx, lecp_callback cb, void *user,
481 const char * const *paths, unsigned char paths_count);
482
490
505lecp_parse(struct lecp_ctx *ctx, const uint8_t *cbor, size_t len);
506
509
510LWS_VISIBLE LWS_EXTERN const char *
512
528lecp_parse_report_raw(struct lecp_ctx *ctx, int on);
529
541
543lecp_parse_subtree(struct lecp_ctx *ctx, const uint8_t *in, size_t len);
544
545/*
546 * Helpers for half-float
547 */
548
551
554
unsigned short uint16_t
unsigned int uint32_t
#define LWS_EXTERN
unsigned char uint8_t
#define LWS_VISIBLE
LWS_VISIBLE LWS_EXTERN void lws_lec_int(lws_lec_pctx_t *ctx, uint8_t opcode, uint8_t indet, uint64_t num)
lecp_callbacks
Definition lws-lecp.h:159
@ LECPCB_VAL_BLOB_CHUNK
Definition lws-lecp.h:195
@ LECPCB_VAL_BLOB_END
Definition lws-lecp.h:196
@ LECPCB_VAL_NUM_INT
Definition lws-lecp.h:171
@ LECPCB_TAG_START
Definition lws-lecp.h:183
@ LECPCB_VAL_FLOAT32
Definition lws-lecp.h:189
@ LECPCB_CONSTRUCTED
Definition lws-lecp.h:160
@ LECPCB_COMPLETE
Definition lws-lecp.h:163
@ LECPCB_ARRAY_ITEM_START
Definition lws-lecp.h:198
@ LECPCB_VAL_STR_CHUNK
Definition lws-lecp.h:174
@ LECPCB_VAL_TRUE
Definition lws-lecp.h:168
@ LECPCB_VAL_RESERVED
Definition lws-lecp.h:172
@ LECPCB_VAL_BLOB_START
Definition lws-lecp.h:194
@ LECPCB_OBJECT_START
Definition lws-lecp.h:180
@ LECPCB_VAL_STR_START
Definition lws-lecp.h:173
@ LECPCB_VAL_STR_END
Definition lws-lecp.h:175
@ LECPCB_ARRAY_START
Definition lws-lecp.h:177
@ LECPCB_VAL_NUM_UINT
Definition lws-lecp.h:186
@ LECPCB_VAL_FLOAT16
Definition lws-lecp.h:188
@ LECPCB_DESTRUCTED
Definition lws-lecp.h:161
@ LECPCB_VAL_UNDEFINED
Definition lws-lecp.h:187
@ LECPCB_ARRAY_ITEM_END
Definition lws-lecp.h:199
@ LECPCB_VAL_FLOAT64
Definition lws-lecp.h:190
@ LECPCB_FAILED
Definition lws-lecp.h:164
@ LECPCB_LITERAL_CBOR
Definition lws-lecp.h:201
@ LECPCB_PAIR_NAME
Definition lws-lecp.h:166
@ LECPCB_OBJECT_END
Definition lws-lecp.h:181
@ LECPCB_VAL_FALSE
Definition lws-lecp.h:169
@ LECPCB_ARRAY_END
Definition lws-lecp.h:178
@ LECPCB_VAL_NULL
Definition lws-lecp.h:170
@ LECPCB_VAL_SIMPLE
Definition lws-lecp.h:192
@ LECPCB_TAG_END
Definition lws-lecp.h:184
struct lws_lec_pctx lws_lec_pctx_t
const char *const * paths
Definition lws-lecp.h:254
uint32_t ordinal
Definition lws-lecp.h:245
uint8_t p
Definition lws-lecp.h:237
LWS_VISIBLE LWS_EXTERN enum lws_lec_pctx_ret lws_lec_vsprintf(lws_lec_pctx_t *ctx, const char *format, va_list args)
char path[LECP_MAX_PATH]
Definition lws-lecp.h:275
uint8_t pst_sp
Definition lws-lecp.h:305
LWS_VISIBLE LWS_EXTERN void lws_lec_init(lws_lec_pctx_t *ctx, uint8_t *buf, size_t len)
LWS_VISIBLE LWS_EXTERN int lecp_parse_map_is_key(struct lecp_ctx *ctx)
LWS_VISIBLE LWS_EXTERN void lecp_construct(struct lecp_ctx *ctx, lecp_callback cb, void *user, const char *const *paths, unsigned char paths_count)
uint8_t ipos
Definition lws-lecp.h:300
uint8_t npos
Definition lws-lecp.h:296
struct lecp_item item
Definition lws-lecp.h:353
char intermediate
Definition lws-lecp.h:240
uint64_t collect_rem
Definition lws-lecp.h:244
#define LECP_MAX_DEPTH
Definition lws-lecp.h:39
char pop_iss
Definition lws-lecp.h:242
uint8_t * collect_tgt
Definition lws-lecp.h:267
uint64_t u64
uint8_t vaa[16]
Definition lws-lecp.h:342
#define LECP_STRING_CHUNK
Definition lws-lecp.h:49
unsigned int fmt_pos
Definition lws-lecp.h:360
struct _lecp_parsing_stack pst[LECP_MAX_PARSING_STACK_DEPTH]
Definition lws-lecp.h:271
size_t used
Definition lws-lecp.h:355
signed char(* lecp_callback)(struct lecp_ctx *ctx, char reason)
Definition lws-lecp.h:233
size_t path_stride
Definition lws-lecp.h:283
uint64_t ongoing_done
Definition lws-lecp.h:351
uint8_t dotstar
Definition lws-lecp.h:366
LWS_VISIBLE LWS_EXTERN void lecp_parse_report_raw(struct lecp_ctx *ctx, int on)
lws_lec_pctx_ret
Definition lws-lecp.h:319
@ LWS_LECPCTX_RET_AGAIN
Definition lws-lecp.h:321
@ LWS_LECPCTX_RET_FAIL
Definition lws-lecp.h:322
@ LWS_LECPCTX_RET_FINISHED
Definition lws-lecp.h:320
uint8_t _long
Definition lws-lecp.h:364
uint8_t outer_array
Definition lws-lecp.h:306
size_t used_in
Definition lws-lecp.h:288
struct _lecp_stack st[LECP_MAX_DEPTH]
Definition lws-lecp.h:272
LWS_VISIBLE LWS_EXTERN void lws_lec_setbuf(lws_lec_pctx_t *ctx, uint8_t *buf, size_t len)
struct lecp_item item
Definition lws-lecp.h:278
LWS_VISIBLE LWS_EXTERN int lecp_parse_subtree(struct lecp_ctx *ctx, const uint8_t *in, size_t len)
LWS_VISIBLE LWS_EXTERN void lws_halfp2singles(uint32_t *xp, uint16_t h)
uint8_t wildcount
Definition lws-lecp.h:304
uint8_t cbor_len
Definition lws-lecp.h:308
const uint8_t * ongoing_src
Definition lws-lecp.h:349
uint64_t d
@ LWS_CBOR_WKTAG_COSE_SIGN
Definition lws-lecp.h:154
@ LWS_CBOR_MAJTYP_BSTR
Definition lws-lecp.h:76
@ LWS_CBOR_MAJTYP_MASK
Definition lws-lecp.h:83
@ LWS_CBOR_1
Definition lws-lecp.h:91
@ LWS_CBOR_SWK_FALSE
Definition lws-lecp.h:104
@ LWS_CBOR_WKTAG_COSE_MAC0
Definition lws-lecp.h:139
@ LWS_CBOR_2
Definition lws-lecp.h:92
@ LWS_CBOR_RESERVED
Definition lws-lecp.h:96
@ LWS_CBOR_WKTAG_MIME
Definition lws-lecp.h:150
@ LWS_CBOR_SWK_UNDEFINED
Definition lws-lecp.h:107
@ LWS_CBOR_MAJTYP_TAG
Definition lws-lecp.h:80
@ LWS_CBOR_M7_SUBTYP_SIMPLE_X8
Definition lws-lecp.h:109
@ LWS_CBOR_WKTAG_BIGNUM_NEGATIVE
Definition lws-lecp.h:134
@ LWS_CBOR_INDETERMINITE
Definition lws-lecp.h:125
@ LWS_CBOR_M7_SUBTYP_FLOAT32
Definition lws-lecp.h:111
@ LWS_CBOR_MAJTYP_UINT
Definition lws-lecp.h:74
@ LWS_CBOR_8
Definition lws-lecp.h:94
@ LWS_CBOR_SWK_TRUE
Definition lws-lecp.h:105
@ LWS_CBOR_WKTAG_SELFDESCCBOR
Definition lws-lecp.h:156
@ LWS_CBOR_M7_SUBTYP_FLOAT16
Definition lws-lecp.h:110
@ LWS_CBOR_MAJTYP_ARRAY
Definition lws-lecp.h:78
@ LWS_CBOR_WKTAG_COSE_MAC
Definition lws-lecp.h:153
@ LWS_CBOR_WKTAG_DATETIME_STD
Definition lws-lecp.h:131
@ LWS_CBOR_WKTAG_CBOR
Definition lws-lecp.h:145
@ LWS_CBOR_MAJTYP_TSTR
Definition lws-lecp.h:77
@ LWS_CBOR_WKTAG_TO_B64
Definition lws-lecp.h:143
@ LWS_CBOR_WKTAG_COSE_ENC0
Definition lws-lecp.h:138
@ LWS_CBOR_WKTAG_B64
Definition lws-lecp.h:149
@ LWS_CBOR_WKTAG_TO_B64U
Definition lws-lecp.h:142
@ LWS_CBOR_WKTAG_DECIMAL_FRAC
Definition lws-lecp.h:135
@ LWS_CBOR_MAJTYP_INT_NEG
Definition lws-lecp.h:75
@ LWS_CBOR_WKTAG_DATETIME_EPOCH
Definition lws-lecp.h:132
@ LWS_CBOR_MAJTYP_MAP
Definition lws-lecp.h:79
@ LWS_CBOR_SWK_NULL
Definition lws-lecp.h:106
@ LWS_CBOR_4
Definition lws-lecp.h:93
@ LWS_CBOR_WKTAG_BIGNUM_UNSIGNED
Definition lws-lecp.h:133
@ LWS_CBOR_WKTAG_COSE_SIGN1
Definition lws-lecp.h:140
@ LWS_CBOR_WKTAG_TO_B16
Definition lws-lecp.h:144
@ LWS_CBOR_MAJTYP_FLOAT
Definition lws-lecp.h:81
@ LWS_CBOR_SUBMASK
Definition lws-lecp.h:98
@ LWS_CBOR_WKTAG_B64U
Definition lws-lecp.h:148
@ LWS_CBOR_WKTAG_BIGFLOAT
Definition lws-lecp.h:136
@ LWS_CBOR_M7_SUBTYP_FLOAT64
Definition lws-lecp.h:112
@ LWS_CBOR_WKTAG_COSE_ENC
Definition lws-lecp.h:152
@ LWS_CBOR_WKTAG_URI
Definition lws-lecp.h:147
@ LWS_CBOR_M7_BREAK
Definition lws-lecp.h:113
lecp_callback cb
Definition lws-lecp.h:253
uint32_t f
uint8_t sp
Definition lws-lecp.h:361
uint8_t path_match
Definition lws-lecp.h:302
uint16_t wild[LECP_MAX_INDEX_DEPTH]
Definition lws-lecp.h:274
uint8_t f
Definition lws-lecp.h:298
uint8_t vaa_pos
Definition lws-lecp.h:365
LWS_VISIBLE LWS_EXTERN const char * lecp_error_to_string(int e)
int opaque[4]
Definition lws-lecp.h:357
uint8_t literal_cbor_report
Definition lws-lecp.h:309
void * user
Definition lws-lecp.h:266
uint64_t u32
uint64_t ongoing_len
Definition lws-lecp.h:350
uint8_t send_new_array_item
Definition lws-lecp.h:247
uint8_t scratch[24]
Definition lws-lecp.h:344
uint8_t * buf
Definition lws-lecp.h:346
uint8_t sp
Definition lws-lecp.h:299
LWS_VISIBLE LWS_EXTERN enum lws_lec_pctx_ret lws_lec_printf(lws_lec_pctx_t *ctx, const char *format,...)
uint8_t opcode
Definition lws-lecp.h:246
char present
Definition lws-lecp.h:310
uint8_t cbor[64]
Definition lws-lecp.h:276
uint8_t path_match_len
Definition lws-lecp.h:303
LWS_VISIBLE LWS_EXTERN int lws_lec_scratch(lws_lec_pctx_t *ctx)
uint16_t i[LECP_MAX_INDEX_DEPTH]
Definition lws-lecp.h:273
uint8_t dcount
Definition lws-lecp.h:297
#define LECP_MAX_PATH
Definition lws-lecp.h:45
LWS_VISIBLE LWS_EXTERN void lecp_change_callback(struct lecp_ctx *ctx, lecp_callback cb)
uint8_t * end
Definition lws-lecp.h:347
enum cbp_state state
Definition lws-lecp.h:359
uint8_t scratch_len
Definition lws-lecp.h:362
LWS_VISIBLE LWS_EXTERN void lecp_destruct(struct lecp_ctx *ctx)
uint8_t cbor_pos
Definition lws-lecp.h:307
uint8_t * start
Definition lws-lecp.h:345
char buf[LECP_STRING_CHUNK+1]
Definition lws-lecp.h:316
cbp_state
Definition lws-lecp.h:325
@ CBPS_PC2
Definition lws-lecp.h:328
@ CBPS_CONTYPE
Definition lws-lecp.h:337
@ CBPS_STRING_BODY
Definition lws-lecp.h:331
@ CBPS_NUM_LIT
Definition lws-lecp.h:333
@ CBPS_STRING_LIT
Definition lws-lecp.h:335
@ CBPS_PC3
Definition lws-lecp.h:329
@ CBPS_PC1
Definition lws-lecp.h:327
@ CBPS_IDLE
Definition lws-lecp.h:326
#define LECP_FLAG_CB_IS_VALUE
Definition lws-lecp.h:67
uint8_t indet[16]
Definition lws-lecp.h:343
int64_t i64
uint8_t barrier
Definition lws-lecp.h:248
#define LECP_MAX_PARSING_STACK_DEPTH
Definition lws-lecp.h:36
uint16_t uni
Definition lws-lecp.h:292
uint8_t stack[16]
Definition lws-lecp.h:341
uint8_t count_paths
Definition lws-lecp.h:301
uint8_t be
Definition lws-lecp.h:312
uint64_t tag
Definition lws-lecp.h:243
LWS_VISIBLE LWS_EXTERN int lecp_parse(struct lecp_ctx *ctx, const uint8_t *cbor, size_t len)
uint8_t escflag
Definition lws-lecp.h:363
lecp_reasons
Definition lws-lecp.h:204
@ LECP_REJECT_UNKNOWN
Definition lws-lecp.h:207
@ LECP_CONTINUE
Definition lws-lecp.h:205
@ LECP_REJECT_BAD_CODING
Definition lws-lecp.h:206
@ LECP_STACK_OVERFLOW
Definition lws-lecp.h:209
@ LECP_REJECT_CALLBACK
Definition lws-lecp.h:208
LWS_VISIBLE LWS_EXTERN void lws_singles2halfp(uint16_t *hp, uint32_t x)
uint16_t hf
#define LECP_MAX_INDEX_DEPTH
Definition lws-lecp.h:42
uint8_t opcode
Definition lws-lecp.h:229
union lecp_item::@104245220244360170271146045203027326017165072164 u