-/**************** WebSocket handling ****************************/
-
-static ssize_t aws_writev(struct afb_websock *ws, const struct iovec *iov, int iovcnt);
-static ssize_t aws_readv(struct afb_websock *ws, const struct iovec *iov, int iovcnt);
-static void aws_disconnect(struct afb_websock *ws);
-static void aws_on_close(struct afb_websock *ws, uint16_t code, size_t size);
-static void aws_on_content(struct afb_websock *ws, int last, size_t size);
-static void aws_on_readable(struct afb_websock *ws);
-
-static struct websock_itf aws_itf = {
- .writev = (void*)aws_writev,
- .readv = (void*)aws_readv,
- .disconnect = (void*)aws_disconnect,
-
- .on_ping = NULL,
- .on_pong = NULL,
- .on_close = (void*)aws_on_close,
- .on_text = (void*)aws_on_content,
- .on_binary = (void*)aws_on_content,
- .on_continue = (void*)aws_on_content,
- .on_extension = NULL,
-};
-
-struct afb_wsreq
-{
- struct afb_websock *aws;
- struct afb_wsreq *next;
- struct json_object *id;
- struct json_object *name;
- struct json_object *token;
- struct json_object *request;
-};
-
-struct afb_websock
-{
- int fd;
- struct MHD_Connection *connection;
- struct websock *ws;
- struct upoll *up;
- struct AFB_clientCtx *context;
- struct json_tokener *tokener;
- struct afb_wsreq *requests;
-};
-
-static struct afb_arg wsreq_get(struct afb_wsreq *wsreq, const char *name);
-static void wsreq_iterate(struct afb_wsreq *wsreq, int (*iterator)(void *closure, struct afb_arg arg), void *closure);
-static void wsreq_fail(struct afb_wsreq *wsreq, const char *status, const char *info);
-static void wsreq_success(struct afb_wsreq *wsreq, struct json_object *obj, const char *info);
-static int wsreq_session_create(struct afb_wsreq *wsreq);
-static int wsreq_session_check(struct afb_wsreq *wsreq, int refresh);
-static void wsreq_session_close(struct afb_wsreq *wsreq);
-
-static const struct afb_req_itf wsreq_itf = {
- .get = (void*)wsreq_get,
- .iterate = (void*)wsreq_iterate,
- .fail = (void*)wsreq_fail,
- .success = (void*)wsreq_success,
- .session_create = (void*)wsreq_session_create,
- .session_check = (void*)wsreq_session_check,
- .session_close = (void*)wsreq_session_close