|
libwebsockets
Lightweight C library for HTML5 websockets
|
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_JO_SIGNED(type, name, qname) |
| #define | LSM_JO_UNSIGNED(type, name, qname) |
| #define | LSM_JO_BOOLEAN(type, name, qname) |
| #define | LSM_JO_CARRAY(type, name, qname) |
| #define | LSM_JO_STRING_PTR(type, name, qname) |
| #define | LSM_JO_LIST(ptype, pname, ctype, cname, lejp_cb, cmap, qname) |
| #define | LSM_JO_CHILD_PTR(ptype, pname, ctype, lejp_cb, cmap, qname) |
| #define | LSM_JO_SCHEMA(ctype, lejp_cb, map, schema_name) |
| #define | LSM_JO_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 } |
| struct lejp_collation |
Definition at line 50 of file lws-struct.h.
Collaboration diagram for lejp_collation:| Data Fields | ||
|---|---|---|
| struct lws_dll2 | chunks | |
| int | len | |
| char | buf[LEJP_STRING_CHUNK+1] | |
| struct lws_struct_map |
Definition at line 56 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 | |
| char | json_only | |
| struct lws_struct_args |
Definition at line 70 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 | |
| struct lws_struct_serialize_st |
Definition at line 360 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 | |
| struct lws_struct_serialize |
Definition at line 376 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 | |
| #define LSM_SIGNED | ( | type, | |
| name, | |||
| qname ) |
Definition at line 98 of file lws-struct.h.
| #define LSM_UNSIGNED | ( | type, | |
| name, | |||
| qname ) |
Definition at line 111 of file lws-struct.h.
| #define LSM_BOOLEAN | ( | type, | |
| name, | |||
| qname ) |
Definition at line 124 of file lws-struct.h.
| #define LSM_CARRAY | ( | type, | |
| name, | |||
| qname ) |
Definition at line 137 of file lws-struct.h.
| #define LSM_STRING_PTR | ( | type, | |
| name, | |||
| qname ) |
Definition at line 150 of file lws-struct.h.
| #define LSM_LIST | ( | ptype, | |
| pname, | |||
| ctype, | |||
| cname, | |||
| lejp_cb, | |||
| cmap, | |||
| qname ) |
Definition at line 163 of file lws-struct.h.
| #define LSM_CHILD_PTR | ( | ptype, | |
| pname, | |||
| ctype, | |||
| lejp_cb, | |||
| cmap, | |||
| qname ) |
Definition at line 176 of file lws-struct.h.
| #define LSM_SCHEMA | ( | ctype, | |
| lejp_cb, | |||
| map, | |||
| schema_name ) |
Definition at line 189 of file lws-struct.h.
| #define LSM_SCHEMA_DLL2 | ( | ctype, | |
| cdll2mem, | |||
| lejp_cb, | |||
| map, | |||
| schema_name ) |
Definition at line 202 of file lws-struct.h.
| #define LSM_JO_SIGNED | ( | type, | |
| name, | |||
| qname ) |
Definition at line 224 of file lws-struct.h.
| #define LSM_JO_UNSIGNED | ( | type, | |
| name, | |||
| qname ) |
Definition at line 237 of file lws-struct.h.
| #define LSM_JO_BOOLEAN | ( | type, | |
| name, | |||
| qname ) |
Definition at line 250 of file lws-struct.h.
| #define LSM_JO_CARRAY | ( | type, | |
| name, | |||
| qname ) |
Definition at line 263 of file lws-struct.h.
| #define LSM_JO_STRING_PTR | ( | type, | |
| name, | |||
| qname ) |
Definition at line 276 of file lws-struct.h.
| #define LSM_JO_LIST | ( | ptype, | |
| pname, | |||
| ctype, | |||
| cname, | |||
| lejp_cb, | |||
| cmap, | |||
| qname ) |
Definition at line 289 of file lws-struct.h.
| #define LSM_JO_CHILD_PTR | ( | ptype, | |
| pname, | |||
| ctype, | |||
| lejp_cb, | |||
| cmap, | |||
| qname ) |
Definition at line 302 of file lws-struct.h.
| #define LSM_JO_SCHEMA | ( | ctype, | |
| lejp_cb, | |||
| map, | |||
| schema_name ) |
Definition at line 315 of file lws-struct.h.
| #define LSM_JO_SCHEMA_DLL2 | ( | ctype, | |
| cdll2mem, | |||
| lejp_cb, | |||
| map, | |||
| schema_name ) |
Definition at line 328 of file lws-struct.h.
| #define LSM_BLOB_PTR | ( | type, | |
| blobptr_name, | |||
| qname ) |
Definition at line 347 of file lws-struct.h.
| 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) |
Definition at line 68 of file lws-struct.h.
| 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 |
Definition at line 476 of file lws-struct.h.
| 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 37 of file lws-struct.h.
| anonymous enum |
| Enumerator | |
|---|---|
| LSSERJ_FLAG_PRETTY | |
| LSSERJ_FLAG_OMIT_SCHEMA | |
Definition at line 371 of file lws-struct.h.
| Enumerator | |
|---|---|
| LSJS_RESULT_CONTINUE | |
| LSJS_RESULT_FINISH | |
| LSJS_RESULT_ERROR | |
Definition at line 386 of file lws-struct.h.
| LWS_VISIBLE LWS_EXTERN int lws_struct_json_init_parse | ( | struct lejp_ctx * | ctx, |
| lejp_callback | cb, | ||
| void * | user ) |
lws_struct_json_init_parse(): prepare to translate JSON to C struct
ctx: JSON parse context cb: the parsing callback user: an opaque user pointer
Returns 0 if OK else nonzero for error.
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN signed char lws_struct_schema_only_lejp_cb | ( | struct lejp_ctx * | ctx, |
| char | reason ) |
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN signed char lws_struct_default_lejp_cb | ( | struct lejp_ctx * | ctx, |
| char | reason ) |
References LWS_EXTERN, and LWS_VISIBLE.
| 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_create(): create a C struct -> JSON renderer
map: the map of members and types map_entries: the count of entries in the map flags: JSON parsing options ptoplevel: the start of the C struct to render
Returns an object that manages the stateful translation of a C struct to a JSON representation.
Returns a pointer to the object, or NULL on failure.
References LWS_EXTERN, and LWS_VISIBLE.
| 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_json_serialize(): output the next buffer of JSON
js: the management object buf: the output fragment buffer len: the max size of buf written: pointer to a size_t to be set to the valid about in buf on exit
This emits the next section of JSON for the object being represented by js. You must refer to the return from the function to understand what is in the buffer on exit, LSJS_RESULT_ERROR indicates the function failed and the buffer is invalid, LSJS_RESULT_CONTINUE indicates the buffer is valid, but is a fragment of the full representation and you should call this function again later to get another fragment, and LSJS_RESULT_FINISH indicates the buffer is valid and is the last part of the representation.
After seeing LSJS_RESULT_FINISH or LSJS_RESULT_ERROR you should clean up \js by calling lws_struct_json_serialize_destroy() on it
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_struct_json_serialize_destroy | ( | lws_struct_serialize_t ** | pjs | ) |
lws_struct_json_serialize_destroy(): destruct a C struct -> JSON renderer
pjs: pointer to the object to be destroyed
The object to be destroyed should have been returned originally from lws_struct_json_serialize_create()
| 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_open(): open an sqlite3 database
context: the lws_context sqlite3_path: the filepath to the database file create_if_missing: flag to control if the database is created or not if absent pdb: pointer to an sqlite3 * to be set to the database handle if successful
Returns 0 for success, *pdb is valid, else nonzero for failure
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_close | ( | sqlite3 ** | pdb | ) |
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_create_table | ( | sqlite3 * | pdb, |
| const lws_struct_map_t * | schema ) |
References LWS_EXTERN, and LWS_VISIBLE.
| 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_serialize(): store objects pointed to by owner in the db
pdb: the open sqlite3 db schema: the schema (and db table) to use owner: the list of objects to store to the db table manual_idx: the starting index for the objects
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_update | ( | sqlite3 * | pdb, |
| const char * | table, | ||
| const lws_struct_map_t * | map, | ||
| size_t | map_entries, | ||
| const void * | data, | ||
| const char * | where_col ) |
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN int lws_struct_sq3_upsert | ( | sqlite3 * | pdb, |
| const char * | table, | ||
| const lws_struct_map_t * | map, | ||
| size_t | map_entries, | ||
| const void * | data, | ||
| const char * | where_col ) |
References LWS_EXTERN, and LWS_VISIBLE.
| 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 ) |