5#ifndef OPENTITAN_SW_DEVICE_LIB_UJSON_UJSON_H_ 
    6#define OPENTITAN_SW_DEVICE_LIB_UJSON_UJSON_H_ 
    9#include "sw/device/lib/base/status.h" 
   21  status_t (*
putbuf)(
void *, 
const char *, size_t);
 
 
   33#define UJSON_INIT(context_, getc_, putbuf_, flushbuf_) \ 
   35      .io_context = (void *)(context_),                 \ 
   36      .putbuf_ = (putbuf_),                             \ 
   37      .flushbuf_ = (flushbuf_),                         \ 
   40      .crc32 = UINT32_MAX,                              \ 
   52ujson_t ujson_init(
void *context, status_t (*getc)(
void *),
 
   53                   status_t (*putbuf)(
void *, 
const char *, 
size_t),
 
   54                   status_t (*flushbuf)(
void *));
 
   62status_t ujson_getc(ujson_t *uj);
 
   71status_t ujson_ungetc(ujson_t *uj, 
char ch);
 
   81status_t ujson_putbuf(ujson_t *uj, 
const char *buf, 
size_t len);
 
   94status_t ujson_flushbuf(ujson_t *uj);
 
  101void ujson_crc32_reset(ujson_t *uj);
 
  112uint32_t ujson_crc32_finish(ujson_t *uj);
 
  121bool ujson_streq(
const char *a, 
const char *b);
 
  133status_t ujson_consume(ujson_t *uj, 
char ch);
 
  146status_t ujson_consume_maybe(ujson_t *uj, 
char ch);
 
  162status_t ujson_parse_qs(ujson_t *uj, 
char *str, 
size_t len);
 
  172status_t ujson_parse_integer(ujson_t *uj, 
void *result, 
size_t rsz);
 
  177status_t ujson_deserialize_uint64_t(ujson_t *uj, uint64_t *value);
 
  178status_t ujson_deserialize_uint32_t(ujson_t *uj, uint32_t *value);
 
  179status_t ujson_deserialize_uint16_t(ujson_t *uj, uint16_t *value);
 
  180status_t ujson_deserialize_uint8_t(ujson_t *uj, uint8_t *value);
 
  181status_t ujson_deserialize_size_t(ujson_t *uj, 
size_t *value);
 
  182status_t ujson_deserialize_int64_t(ujson_t *uj, int64_t *value);
 
  183status_t ujson_deserialize_int32_t(ujson_t *uj, int32_t *value);
 
  184status_t ujson_deserialize_int16_t(ujson_t *uj, int16_t *value);
 
  185status_t ujson_deserialize_int8_t(ujson_t *uj, int8_t *value);
 
  194status_t ujson_deserialize_bool(ujson_t *uj, 
bool *value);
 
  203status_t ujson_deserialize_status_t(ujson_t *uj, status_t *value);
 
  212status_t ujson_serialize_string(ujson_t *uj, 
const char *buf);
 
  221status_t ujson_serialize_uint64_t(ujson_t *uj, 
const uint64_t *value);
 
  222status_t ujson_serialize_uint32_t(ujson_t *uj, 
const uint32_t *value);
 
  223status_t ujson_serialize_uint16_t(ujson_t *uj, 
const uint16_t *value);
 
  224status_t ujson_serialize_uint8_t(ujson_t *uj, 
const uint8_t *value);
 
  225status_t ujson_serialize_size_t(ujson_t *uj, 
const size_t *value);
 
  226status_t ujson_serialize_int64_t(ujson_t *uj, 
const int64_t *value);
 
  227status_t ujson_serialize_int32_t(ujson_t *uj, 
const int32_t *value);
 
  228status_t ujson_serialize_int16_t(ujson_t *uj, 
const int16_t *value);
 
  229status_t ujson_serialize_int8_t(ujson_t *uj, 
const int8_t *value);
 
  238status_t ujson_serialize_bool(ujson_t *uj, 
const bool *value);
 
  247status_t ujson_serialize_status_t(ujson_t *uj, 
const status_t *value);