1
9
10
11
20
21
22
23
24
25
28
29
30
31
32
33
34
35
36
37
38
39
46
47
48
55
56
57
64
65
66
67
73
74
75
80
81
82
88
89
90
96
/* ... */
#pragma once
#define KEEP_ALIVE_CONFIG_DEFAULT() \
{ \
.max_clients = 10, \
.task_stack_size = 2048, \
.task_prio = tskIDLE_PRIORITY+1, \
.keep_alive_period_ms = 5000, \
.not_alive_after_ms = 10000, \
}{...}
...
struct wss_keep_alive_storage;
typedef struct wss_keep_alive_storage* wss_keep_alive_t;
typedef bool (*wss_check_client_alive_cb_t)(wss_keep_alive_t h, int fd);
typedef bool (*wss_client_not_alive_cb_t)(wss_keep_alive_t h, int fd);
/* ... */
typedef struct {
size_t max_clients;
size_t task_stack_size;
size_t task_prio;
size_t keep_alive_period_ms;
size_t not_alive_after_ms;
wss_check_client_alive_cb_t check_client_alive_cb;
wss_client_not_alive_cb_t client_not_alive_cb;
void *user_ctx;
}{ ... } wss_keep_alive_config_t;
/* ... */
esp_err_t wss_keep_alive_add_client(wss_keep_alive_t h, int fd);
/* ... */
esp_err_t wss_keep_alive_remove_client(wss_keep_alive_t h, int fd);
/* ... */
esp_err_t wss_keep_alive_client_is_active(wss_keep_alive_t h, int fd);
/* ... */
wss_keep_alive_t wss_keep_alive_start(wss_keep_alive_config_t *config);
/* ... */
void wss_keep_alive_stop(wss_keep_alive_t h);
/* ... */
void wss_keep_alive_set_user_ctx(wss_keep_alive_t h, void *ctx);
/* ... */
void* wss_keep_alive_get_user_ctx(wss_keep_alive_t h);