{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1732350479,
"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":"8c89ee7d8a2969283c39b62463b187b1",
"oid":{ "oid": "6328231f2aa628632344d96a58e25c3b194af506", "alias": [ "refs/heads/main"]},"blobname": "minimal-examples/server/hello_world/main.c", "blob": "/*\n * lws-minimal-secure-streams-server\n *\n * Written in 2010-2021 by Andy Green \u003candy@warmcat.com\u003e\n *\n * This file is made available under the Creative Commons CC0 1.0\n * Universal Public Domain Dedication.\n *\n * Simplest possible SS https server\n */\n\n#include \u003clibwebsockets.h\u003e\n#include \u003csignal.h\u003e\n\nextern const lws_ss_info_t ssi_myss_srv_t;\n\nstatic struct lws_context *cx;\nint test_result \u003d 0, multipart;\n\nstatic int\nsmd_cb(void *opaque, lws_smd_class_t c, lws_usec_t ts, void *buf, size_t len)\n{\n\tif (!(c \u0026 LWSSMDCL_SYSTEM_STATE) ||\n\t lws_json_simple_strcmp(buf, len, \u0022\u005c\u0022state\u005c\u0022:\u0022, \u0022OPERATIONAL\u0022) ||\n\t !lws_ss_create(cx, 0, \u0026ssi_myss_srv_t, NULL, NULL, NULL, NULL))\n\t\treturn 0;\n\n\tlwsl_err(\u0022%s: failed to create secure stream\u005cn\u0022, __func__);\n\tlws_default_loop_exit(cx);\n\n\treturn -1;\n}\n\nstatic void\nsigint_handler(int sig)\n{\n\tlws_default_loop_exit(cx);\n}\n\nint\nmain(int argc, const char **argv)\n{\n\tstruct lws_context_creation_info info;\n\n\tlws_context_info_defaults(\u0026info, \u0022example-policy.json\u0022);\n\tlws_cmdline_option_handle_builtin(argc, argv, \u0026info);\n\tsignal(SIGINT, sigint_handler);\n\n\tlwsl_user(\u0022LWS Secure Streams Server\u005cn\u0022);\n\n\tinfo.early_smd_cb\t\t\u003d smd_cb;\n\tinfo.early_smd_class_filter\t\u003d LWSSMDCL_SYSTEM_STATE;\n\n\tcx \u003d lws_create_context(\u0026info);\n\tif (!cx) {\n\t\tlwsl_err(\u0022lws init failed\u005cn\u0022);\n\t\treturn 1;\n\t}\n\n\tlws_context_default_loop_run_destroy(cx);\n\n\t/* process ret 0 if actual is as expected (0, or--expected-exit 123) */\n\n\treturn lws_cmdline_passfail(argc, argv, test_result);\n}\n","s":{"c":1732075778,"u": 485}}
],"g": 803,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "7d0a"}