Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"en-US,en;q\u003d0.5", "gen_ut":1660501403, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"3e1f37396031a43932ef5f2acabcc677", "oid":{ "oid": "e3ed2ba6901c385b44acace6a4e91fac2b165f40", "alias": [ "refs/heads/main"]},"blobname": "include/libwebsockets/lws-struct.h", "blob": "/*\n * libwebsockets - small server side websockets and web server implementation\n *\n * Copyright (C) 2010 - 2020 Andy Green \u003candy@warmcat.com\u003e\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \u0022Software\u0022), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \u0022AS IS\u0022, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n#if defined(LWS_WITH_STRUCT_SQLITE3)\n#include \u003csqlite3.h\u003e\n#endif\n\ntypedef enum {\n\tLSMT_SIGNED,\n\tLSMT_UNSIGNED,\n\tLSMT_BOOLEAN,\n\tLSMT_STRING_CHAR_ARRAY,\n\tLSMT_STRING_PTR,\n\tLSMT_LIST,\n\tLSMT_CHILD_PTR,\n\tLSMT_SCHEMA,\n\tLSMT_BLOB_PTR,\n\n} lws_struct_map_type_eum;\n\ntypedef struct lejp_collation {\n\tstruct lws_dll2 chunks;\n\tint len;\n\tchar buf[LEJP_STRING_CHUNK + 1];\n} lejp_collation_t;\n\ntypedef struct lws_struct_map {\n\tconst char *colname;\n\tconst struct lws_struct_map *child_map;\n\tlejp_callback lejp_cb;\n\tsize_t ofs;\t\t\t/* child dll2; points to dll2_owner */\n\tsize_t aux;\n\tsize_t ofs_clist;\n\tsize_t child_map_size;\n\tlws_struct_map_type_eum type;\n} lws_struct_map_t;\n\ntypedef int (*lws_struct_args_cb)(void *obj, void *cb_arg);\n\ntypedef struct lws_struct_args {\n\tconst lws_struct_map_t *map_st[LEJP_MAX_PARSING_STACK_DEPTH];\n\tlws_struct_args_cb cb;\n\tstruct lwsac *ac;\n\tvoid *cb_arg;\n\tvoid *dest;\n\n\tsize_t dest_len;\n\tsize_t toplevel_dll2_ofs;\n\tsize_t map_entries_st[LEJP_MAX_PARSING_STACK_DEPTH];\n\tsize_t ac_block_size;\n\tint subtype;\n\n\tint top_schema_index;\n\n\t/*\n\t * temp ac used to collate unknown possibly huge strings before final\n\t * allocation and copy\n\t */\n\tstruct lwsac *ac_chunks;\n\tstruct lws_dll2_owner chunks_owner;\n\tsize_t chunks_length;\n} lws_struct_args_t;\n\n#define LSM_SIGNED(type, name, qname) \u005c\n\t{ \u005c\n\t qname, \u005c\n\t NULL, \u005c\n\t NULL, \u005c\n\t offsetof(type, name), \u005c\n\t sizeof ((type *)0)-\u003ename, \u005c\n\t 0, \u005c\n\t 0, \u005c\n\t LSMT_SIGNED \u005c\n\t}\n\n#define LSM_UNSIGNED(type, name, qname) \u005c\n\t{ \u005c\n\t qname, \u005c\n\t NULL, \u005c\n\t NULL, \u005c\n\t offsetof(type, name), \u005c\n\t sizeof ((type *)0)-\u003ename, \u005c\n\t 0, \u005c\n\t 0, \u005c\n\t LSMT_UNSIGNED \u005c\n\t}\n\n#define LSM_BOOLEAN(type, name, qname) \u005c\n\t{ \u005c\n\t qname, \u005c\n\t NULL, \u005c\n\t NULL, \u005c\n\t offsetof(type, name), \u005c\n\t sizeof ((type *)0)-\u003ename, \u005c\n\t 0, \u005c\n\t 0, \u005c\n\t LSMT_BOOLEAN \u005c\n\t}\n\n#define LSM_CARRAY(type, name, qname) \u005c\n\t{ \u005c\n\t qname, \u005c\n\t NULL, \u005c\n\t NULL, \u005c\n\t offsetof(type, name), \u005c\n\t sizeof (((type *)0)-\u003ename), \u005c\n\t 0, \u005c\n\t 0, \u005c\n\t LSMT_STRING_CHAR_ARRAY \u005c\n\t}\n\n#define LSM_STRING_PTR(type, name, qname) \u005c\n\t{ \u005c\n\t qname, \u005c\n\t NULL, \u005c\n\t NULL, \u005c\n\t offsetof(type, name), \u005c\n\t sizeof (((type *)0)-\u003ename), \u005c\n\t 0, \u005c\n\t 0, \u005c\n\t LSMT_STRING_PTR \u005c\n\t}\n\n#define LSM_LIST(ptype, pname, ctype, cname, lejp_cb, cmap, qname) \u005c\n\t{ \u005c\n\t qname, \u005c\n\t cmap, \u005c\n\t lejp_cb, \u005c\n\t offsetof(ptype, pname), \u005c\n\t sizeof (ctype), \u005c\n\t offsetof(ctype, cname), \u005c\n\t LWS_ARRAY_SIZE(cmap), \u005c\n\t LSMT_LIST \u005c\n\t}\n\n#define LSM_CHILD_PTR(ptype, pname, ctype, lejp_cb, cmap, qname) \u005c\n\t{ \u005c\n\t qname, \u005c\n\t cmap, \u005c\n\t lejp_cb, \u005c\n\t offsetof(ptype, pname), \u005c\n\t sizeof (ctype), \u005c\n\t 0, \u005c\n\t LWS_ARRAY_SIZE(cmap), \u005c\n\t LSMT_CHILD_PTR \u005c\n\t}\n\n#define LSM_SCHEMA(ctype, lejp_cb, map, schema_name) \u005c\n\t{ \u005c\n\t schema_name, \u005c\n\t map, \u005c\n\t lejp_cb, \u005c\n\t 0, \u005c\n\t sizeof (ctype), \u005c\n\t 0, \u005c\n\t LWS_ARRAY_SIZE(map), \u005c\n\t LSMT_SCHEMA \u005c\n\t}\n\n#define LSM_SCHEMA_DLL2(ctype, cdll2mem, lejp_cb, map, schema_name) \u005c\n\t{ \u005c\n\t schema_name, \u005c\n\t map, \u005c\n\t lejp_cb, \u005c\n\t offsetof(ctype, cdll2mem), \u005c\n\t sizeof (ctype), \u005c\n\t 0, \u005c\n\t LWS_ARRAY_SIZE(map), \u005c\n\t LSMT_SCHEMA \u005c\n\t}\n\n/*\n * This is just used to create the table schema, it is not part of serialization\n * and deserialization. Blobs should be accessed separately.\n */\n\n#define LSM_BLOB_PTR(type, blobptr_name, qname) \u005c\n\t{ \u005c\n\t qname, /* JSON item, or sqlite3 column name */ \u005c\n\t NULL, \u005c\n\t NULL, \u005c\n\t offsetof(type, blobptr_name), /* member that points to blob */ \u005c\n\t sizeof (((type *)0)-\u003eblobptr_name), /* size of blob pointer */ \u005c\n\t 0,\t\t /* member holding blob len */ \u005c\n\t 0, /* size of blob length member */ \u005c\n\t LSMT_BLOB_PTR \u005c\n\t}\n\ntypedef struct lws_struct_serialize_st {\n\tconst struct lws_dll2 *dllpos;\n\tconst lws_struct_map_t *map;\n\tconst char *obj;\n\tsize_t map_entries;\n\tsize_t map_entry;\n\tsize_t size;\n\tchar subsequent;\n\tchar idt;\n} lws_struct_serialize_st_t;\n\nenum {\n\tLSSERJ_FLAG_PRETTY\t\u003d (1 \u003c\u003c 0),\n\tLSSERJ_FLAG_OMIT_SCHEMA \u003d (1 \u003c\u003c 1)\n};\n\ntypedef struct lws_struct_serialize {\n\tlws_struct_serialize_st_t st[LEJP_MAX_PARSING_STACK_DEPTH];\n\n\tsize_t offset;\n\tsize_t remaining;\n\n\tint sp;\n\tint flags;\n} lws_struct_serialize_t;\n\ntypedef enum {\n\tLSJS_RESULT_CONTINUE,\n\tLSJS_RESULT_FINISH,\n\tLSJS_RESULT_ERROR\n} lws_struct_json_serialize_result_t;\n\nLWS_VISIBLE LWS_EXTERN int\nlws_struct_json_init_parse(struct lejp_ctx *ctx, lejp_callback cb,\n\t\t\t void *user);\n\nLWS_VISIBLE LWS_EXTERN signed char\nlws_struct_schema_only_lejp_cb(struct lejp_ctx *ctx, char reason);\n\nLWS_VISIBLE LWS_EXTERN signed char\nlws_struct_default_lejp_cb(struct lejp_ctx *ctx, char reason);\n\nLWS_VISIBLE LWS_EXTERN lws_struct_serialize_t *\nlws_struct_json_serialize_create(const lws_struct_map_t *map,\n\t\t\t\t size_t map_entries, int flags,\n\t\t\t\t const void *ptoplevel);\n\nLWS_VISIBLE LWS_EXTERN void\nlws_struct_json_serialize_destroy(lws_struct_serialize_t **pjs);\n\nLWS_VISIBLE LWS_EXTERN lws_struct_json_serialize_result_t\nlws_struct_json_serialize(lws_struct_serialize_t *js, uint8_t *buf,\n\t\t\t size_t len, size_t *written);\n\ntypedef struct sqlite3 sqlite3;\n\nLWS_VISIBLE LWS_EXTERN int\nlws_struct_sq3_serialize(sqlite3 *pdb, const lws_struct_map_t *schema,\n\t\t\t lws_dll2_owner_t *owner, uint32_t manual_idx);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_struct_sq3_deserialize(sqlite3 *pdb, const char *filter, const char *order,\n\t\t\t const lws_struct_map_t *schema, lws_dll2_owner_t *o,\n\t\t\t struct lwsac **ac, int start, int limit);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_struct_sq3_create_table(sqlite3 *pdb, const lws_struct_map_t *schema);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_struct_sq3_open(struct lws_context *context, const char *sqlite3_path,\n\t\t char create_if_missing, sqlite3 **pdb);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_struct_sq3_close(sqlite3 **pdb);\n\n","s":{"c":1660270171,"u": 417}} ],"g": 981,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "7d0a"}