libwebsockets
Lightweight C library for HTML5 websockets
lws-struct.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lejp_collation
 
struct  lws_struct_map
 
struct  lws_struct_args
 
struct  lws_struct_serialize_st
 
struct  lws_struct_serialize
 

Macros

#define LSM_SIGNED(type, name, qname)
 
#define LSM_UNSIGNED(type, name, qname)
 
#define LSM_BOOLEAN(type, name, qname)
 
#define LSM_CARRAY(type, name, qname)
 
#define LSM_STRING_PTR(type, name, qname)
 
#define LSM_LIST(ptype, pname, ctype, cname, lejp_cb, cmap, qname)
 
#define LSM_CHILD_PTR(ptype, pname, ctype, lejp_cb, cmap, qname)
 
#define LSM_SCHEMA(ctype, lejp_cb, map, schema_name)
 
#define LSM_SCHEMA_DLL2(ctype, cdll2mem, lejp_cb, map, schema_name)
 
#define LSM_BLOB_PTR(type, blobptr_name, qname)
 

Typedefs

typedef struct lejp_collation lejp_collation_t
 
typedef struct lws_struct_map lws_struct_map_t
 
typedef int(* lws_struct_args_cb) (void *obj, void *cb_arg)
 
typedef struct lws_struct_args lws_struct_args_t
 
typedef struct lws_struct_serialize_st lws_struct_serialize_st_t
 
typedef struct lws_struct_serialize lws_struct_serialize_t
 
typedef struct sqlite3 sqlite3
 

Enumerations

enum  lws_struct_map_type_eum {
  LSMT_SIGNED , LSMT_UNSIGNED , LSMT_BOOLEAN , LSMT_STRING_CHAR_ARRAY ,
  LSMT_STRING_PTR , LSMT_LIST , LSMT_CHILD_PTR , LSMT_SCHEMA ,
  LSMT_BLOB_PTR
}
 
enum  { LSSERJ_FLAG_PRETTY = (1 << 0) , LSSERJ_FLAG_OMIT_SCHEMA = (1 << 1) }
 
enum  lws_struct_json_serialize_result_t { LSJS_RESULT_CONTINUE , LSJS_RESULT_FINISH , LSJS_RESULT_ERROR }
 

Functions

LWS_VISIBLE LWS_EXTERN int lws_struct_json_init_parse (struct lejp_ctx *ctx, lejp_callback cb, void *user)
 
LWS_VISIBLE LWS_EXTERN signed char lws_struct_schema_only_lejp_cb (struct lejp_ctx *ctx, char reason)
 
LWS_VISIBLE LWS_EXTERN signed char lws_struct_default_lejp_cb (struct lejp_ctx *ctx, char reason)
 
LWS_VISIBLE LWS_EXTERN lws_struct_serialize_tlws_struct_json_serialize_create (const lws_struct_map_t *map, size_t map_entries, int flags, const void *ptoplevel)
 
LWS_VISIBLE LWS_EXTERN void lws_struct_json_serialize_destroy (lws_struct_serialize_t **pjs)
 
LWS_VISIBLE LWS_EXTERN lws_struct_json_serialize_result_t lws_struct_json_serialize (lws_struct_serialize_t *js, uint8_t *buf, size_t len, size_t *written)
 
LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_serialize (sqlite3 *pdb, const lws_struct_map_t *schema, lws_dll2_owner_t *owner, uint32_t manual_idx)
 
LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_deserialize (sqlite3 *pdb, const char *filter, const char *order, const lws_struct_map_t *schema, lws_dll2_owner_t *o, struct lwsac **ac, int start, int limit)
 
LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_create_table (sqlite3 *pdb, const lws_struct_map_t *schema)
 
LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_open (struct lws_context *context, const char *sqlite3_path, char create_if_missing, sqlite3 **pdb)
 
LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_close (sqlite3 **pdb)
 

Data Structure Documentation

◆ lejp_collation

struct lejp_collation

Definition at line 42 of file lws-struct.h.

+ Collaboration diagram for lejp_collation:
Data Fields
struct lws_dll2 chunks
int len
char buf[LEJP_STRING_CHUNK+1]

◆ lws_struct_map

struct lws_struct_map

Definition at line 48 of file lws-struct.h.

+ Collaboration diagram for lws_struct_map:
Data Fields
const char * colname
const struct lws_struct_map * child_map
lejp_callback lejp_cb
size_t ofs
size_t aux
size_t ofs_clist
size_t child_map_size
lws_struct_map_type_eum type

◆ lws_struct_args

struct lws_struct_args

Definition at line 61 of file lws-struct.h.

+ Collaboration diagram for lws_struct_args:
Data Fields
const lws_struct_map_t * map_st[LEJP_MAX_PARSING_STACK_DEPTH]
lws_struct_args_cb cb
struct lwsac * ac
void * cb_arg
void * dest
size_t dest_len
size_t toplevel_dll2_ofs
size_t map_entries_st[LEJP_MAX_PARSING_STACK_DEPTH]
size_t ac_block_size
int subtype
int top_schema_index
struct lwsac * ac_chunks
struct lws_dll2_owner chunks_owner
size_t chunks_length

◆ lws_struct_serialize_st

struct lws_struct_serialize_st

Definition at line 210 of file lws-struct.h.

+ Collaboration diagram for lws_struct_serialize_st:
Data Fields
const struct lws_dll2 * dllpos
const lws_struct_map_t * map
const char * obj
size_t map_entries
size_t map_entry
size_t size
char subsequent
char idt

◆ lws_struct_serialize

struct lws_struct_serialize

Definition at line 226 of file lws-struct.h.

+ Collaboration diagram for lws_struct_serialize:
Data Fields
lws_struct_serialize_st_t st[LEJP_MAX_PARSING_STACK_DEPTH]
size_t offset
size_t remaining
int sp
int flags

Macro Definition Documentation

◆ LSM_SIGNED

#define LSM_SIGNED (   type,
  name,
  qname 
)
Value:
{ \
qname, \
NULL, \
NULL, \
offsetof(type, name), \
sizeof ((type *)0)->name, \
0, \
0, \
LSMT_SIGNED \
}

Definition at line 85 of file lws-struct.h.

◆ LSM_UNSIGNED

#define LSM_UNSIGNED (   type,
  name,
  qname 
)
Value:
{ \
qname, \
NULL, \
NULL, \
offsetof(type, name), \
sizeof ((type *)0)->name, \
0, \
0, \
LSMT_UNSIGNED \
}

Definition at line 97 of file lws-struct.h.

◆ LSM_BOOLEAN

#define LSM_BOOLEAN (   type,
  name,
  qname 
)
Value:
{ \
qname, \
NULL, \
NULL, \
offsetof(type, name), \
sizeof ((type *)0)->name, \
0, \
0, \
LSMT_BOOLEAN \
}

Definition at line 109 of file lws-struct.h.

◆ LSM_CARRAY

#define LSM_CARRAY (   type,
  name,
  qname 
)
Value:
{ \
qname, \
NULL, \
NULL, \
offsetof(type, name), \
sizeof (((type *)0)->name), \
0, \
0, \
LSMT_STRING_CHAR_ARRAY \
}

Definition at line 121 of file lws-struct.h.

◆ LSM_STRING_PTR

#define LSM_STRING_PTR (   type,
  name,
  qname 
)
Value:
{ \
qname, \
NULL, \
NULL, \
offsetof(type, name), \
sizeof (((type *)0)->name), \
0, \
0, \
LSMT_STRING_PTR \
}

Definition at line 133 of file lws-struct.h.

◆ LSM_LIST

#define LSM_LIST (   ptype,
  pname,
  ctype,
  cname,
  lejp_cb,
  cmap,
  qname 
)
Value:
{ \
qname, \
cmap, \
lejp_cb, \
offsetof(ptype, pname), \
sizeof (ctype), \
offsetof(ctype, cname), \
LWS_ARRAY_SIZE(cmap), \
LSMT_LIST \
}

Definition at line 145 of file lws-struct.h.

◆ LSM_CHILD_PTR

#define LSM_CHILD_PTR (   ptype,
  pname,
  ctype,
  lejp_cb,
  cmap,
  qname 
)
Value:
{ \
qname, \
cmap, \
lejp_cb, \
offsetof(ptype, pname), \
sizeof (ctype), \
0, \
LWS_ARRAY_SIZE(cmap), \
LSMT_CHILD_PTR \
}

Definition at line 157 of file lws-struct.h.

◆ LSM_SCHEMA

#define LSM_SCHEMA (   ctype,
  lejp_cb,
  map,
  schema_name 
)
Value:
{ \
schema_name, \
map, \
lejp_cb, \
0, \
sizeof (ctype), \
0, \
LWS_ARRAY_SIZE(map), \
LSMT_SCHEMA \
}

Definition at line 169 of file lws-struct.h.

◆ LSM_SCHEMA_DLL2

#define LSM_SCHEMA_DLL2 (   ctype,
  cdll2mem,
  lejp_cb,
  map,
  schema_name 
)
Value:
{ \
schema_name, \
map, \
lejp_cb, \
offsetof(ctype, cdll2mem), \
sizeof (ctype), \
0, \
LWS_ARRAY_SIZE(map), \
LSMT_SCHEMA \
}

Definition at line 181 of file lws-struct.h.

◆ LSM_BLOB_PTR

#define LSM_BLOB_PTR (   type,
  blobptr_name,
  qname 
)
Value:
{ \
qname, /* JSON item, or sqlite3 column name */ \
NULL, \
NULL, \
offsetof(type, blobptr_name), /* member that points to blob */ \
sizeof (((type *)0)->blobptr_name), /* size of blob pointer */ \
0, /* member holding blob len */ \
0, /* size of blob length member */ \
LSMT_BLOB_PTR \
}

Definition at line 198 of file lws-struct.h.

Typedef Documentation

◆ lejp_collation_t

◆ lws_struct_map_t

◆ lws_struct_args_cb

typedef int(* lws_struct_args_cb) (void *obj, void *cb_arg)

Definition at line 59 of file lws-struct.h.

◆ lws_struct_args_t

◆ lws_struct_serialize_st_t

◆ lws_struct_serialize_t

◆ sqlite3

typedef struct sqlite3 sqlite3

Definition at line 261 of file lws-struct.h.

Enumeration Type Documentation

◆ lws_struct_map_type_eum

Enumerator
LSMT_SIGNED 
LSMT_UNSIGNED 
LSMT_BOOLEAN 
LSMT_STRING_CHAR_ARRAY 
LSMT_STRING_PTR 
LSMT_LIST 
LSMT_CHILD_PTR 
LSMT_SCHEMA 
LSMT_BLOB_PTR 

Definition at line 29 of file lws-struct.h.

29  {
35  LSMT_LIST,
39 
lws_struct_map_type_eum
Definition: lws-struct.h:29
@ LSMT_SIGNED
Definition: lws-struct.h:30
@ LSMT_CHILD_PTR
Definition: lws-struct.h:36
@ LSMT_BLOB_PTR
Definition: lws-struct.h:38
@ LSMT_STRING_CHAR_ARRAY
Definition: lws-struct.h:33
@ LSMT_LIST
Definition: lws-struct.h:35
@ LSMT_BOOLEAN
Definition: lws-struct.h:32
@ LSMT_STRING_PTR
Definition: lws-struct.h:34
@ LSMT_UNSIGNED
Definition: lws-struct.h:31
@ LSMT_SCHEMA
Definition: lws-struct.h:37

◆ anonymous enum

anonymous enum
Enumerator
LSSERJ_FLAG_PRETTY 
LSSERJ_FLAG_OMIT_SCHEMA 

Definition at line 221 of file lws-struct.h.

221  {
222  LSSERJ_FLAG_PRETTY = (1 << 0),
223  LSSERJ_FLAG_OMIT_SCHEMA = (1 << 1)
224 };
@ LSSERJ_FLAG_OMIT_SCHEMA
Definition: lws-struct.h:223
@ LSSERJ_FLAG_PRETTY
Definition: lws-struct.h:222

◆ lws_struct_json_serialize_result_t

Enumerator
LSJS_RESULT_CONTINUE 
LSJS_RESULT_FINISH 
LSJS_RESULT_ERROR 

Definition at line 236 of file lws-struct.h.

236  {
lws_struct_json_serialize_result_t
Definition: lws-struct.h:236
@ LSJS_RESULT_CONTINUE
Definition: lws-struct.h:237
@ LSJS_RESULT_FINISH
Definition: lws-struct.h:238
@ LSJS_RESULT_ERROR
Definition: lws-struct.h:239

Function Documentation

◆ lws_struct_json_init_parse()

LWS_VISIBLE LWS_EXTERN int lws_struct_json_init_parse ( struct lejp_ctx ctx,
lejp_callback  cb,
void *  user 
)

◆ lws_struct_schema_only_lejp_cb()

LWS_VISIBLE LWS_EXTERN signed char lws_struct_schema_only_lejp_cb ( struct lejp_ctx ctx,
char  reason 
)

◆ lws_struct_default_lejp_cb()

LWS_VISIBLE LWS_EXTERN signed char lws_struct_default_lejp_cb ( struct lejp_ctx ctx,
char  reason 
)

◆ lws_struct_json_serialize_create()

LWS_VISIBLE LWS_EXTERN lws_struct_serialize_t* lws_struct_json_serialize_create ( const lws_struct_map_t map,
size_t  map_entries,
int  flags,
const void *  ptoplevel 
)

◆ lws_struct_json_serialize_destroy()

LWS_VISIBLE LWS_EXTERN void lws_struct_json_serialize_destroy ( lws_struct_serialize_t **  pjs)

◆ lws_struct_json_serialize()

LWS_VISIBLE LWS_EXTERN lws_struct_json_serialize_result_t lws_struct_json_serialize ( lws_struct_serialize_t js,
uint8_t *  buf,
size_t  len,
size_t *  written 
)

◆ lws_struct_sq3_serialize()

LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_serialize ( sqlite3 pdb,
const lws_struct_map_t schema,
lws_dll2_owner_t owner,
uint32_t  manual_idx 
)

◆ lws_struct_sq3_deserialize()

LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_deserialize ( sqlite3 pdb,
const char *  filter,
const char *  order,
const lws_struct_map_t schema,
lws_dll2_owner_t o,
struct lwsac **  ac,
int  start,
int  limit 
)

◆ lws_struct_sq3_create_table()

LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_create_table ( sqlite3 pdb,
const lws_struct_map_t schema 
)

◆ lws_struct_sq3_open()

LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_open ( struct lws_context *  context,
const char *  sqlite3_path,
char  create_if_missing,
sqlite3 **  pdb 
)

◆ lws_struct_sq3_close()

LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_close ( sqlite3 **  pdb)