Add Zephyr examples

This commit is contained in:
Alex Alashkin committed 2022-04-13 11:10:22 +03:00
1 parent 6e3e77a1a0
commit 17e0fb1c15
21 files changed
+757 -19

No files matched your search

+2 -3
View File
@@ -2,20 +2,19 @@
// All rights reserved
#include "mongoose.h"
#include "certs.h"
static const char *s_debug_level = "3";
static const char *s_web_dir = "/";
static const char *s_http_addr = "http://0.0.0.0:8000";
static const char *s_https_addr = "https://0.0.0.0:8443";
static const char *s_cert = "cert.pem";
static const char *s_key = "key.pem";
static time_t s_boot_timestamp = 0;
static struct mg_connection *s_sntp_conn = NULL;
// Event handler for the listening HTTP/HTTPS connection.
static void wcb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (ev == MG_EV_ACCEPT && fn_data != NULL) {
struct mg_tls_opts opts = {.cert = s_cert, .certkey = s_key};
struct mg_tls_opts opts = {.cert = s_ssl_cert, .certkey = s_ssl_key};
mg_tls_init(c, &opts);
} else if (ev == MG_EV_HTTP_MSG) {
struct mg_http_message *hm = ev_data;