diff options
Diffstat (limited to 'aepd/websocket-protocol.c')
-rw-r--r-- | aepd/websocket-protocol.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/aepd/websocket-protocol.c b/aepd/websocket-protocol.c index 073c211..597838b 100644 --- a/aepd/websocket-protocol.c +++ b/aepd/websocket-protocol.c @@ -45,10 +45,9 @@ static const struct serveable whitelist[] = { /* this protocol server (always the first one) just knows how to do HTTP */ -static int callback_http(struct libwebsocket_context *context, - struct libwebsocket *wsi, - enum libwebsocket_callback_reasons reason, void *user, - void *in, size_t len) +static int +callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, + void *in, size_t len) { int n; char buf[512]; @@ -56,14 +55,14 @@ static int callback_http(struct libwebsocket_context *context, switch (reason) { case LWS_CALLBACK_HTTP: - for (n = 0; n < (sizeof(whitelist) / sizeof(whitelist[0]) - 1); n++) + for (n = 0; n < (ARRAY_SIZE(whitelist) - 1); n++) if (in && strcmp(in, whitelist[n].urlpath) == 0) break; sprintf(buf, LOCAL_RESOURCE_PATH"%s", whitelist[n].urlpath); - if (libwebsockets_serve_http_file(context, wsi, buf, - whitelist[n].mimetype, NULL, 0)) + if (lws_serve_http_file(wsi, buf, whitelist[n].mimetype, + NULL, 0)) //fprintf(stderr, "Failed to send HTTP file\n"); break; break; @@ -80,7 +79,7 @@ static int callback_http(struct libwebsocket_context *context, /* linaro_aepd_protocol */ struct per_session_data__linaro_aepd { - struct libwebsocket *wsi; + struct lws *wsi; long ringbuffer_tail; double sam[MAX_PROBES * CHANNELS_PER_PROBE * 3]; int sam_valid; @@ -99,10 +98,8 @@ struct per_session_data__linaro_aepd { extern struct aep_context aep_context; static int -callback_linaro_aepd(struct libwebsocket_context *context, - struct libwebsocket *wsi, - enum libwebsocket_callback_reasons reason, - void *user, void *in, size_t len) +callback_linaro_aepd(struct lws *wsi, enum lws_callback_reasons reason, + void *user, void *in, size_t len) { int n, m; struct per_session_data__linaro_aepd *pss = user; @@ -367,14 +364,14 @@ send: */ if (p != &buf[LWS_SEND_BUFFER_PRE_PADDING]) { - n = libwebsocket_write(wsi, (unsigned char *) + n = lws_write(wsi, (unsigned char *) &buf[LWS_SEND_BUFFER_PRE_PADDING], p - &buf[LWS_SEND_BUFFER_PRE_PADDING], LWS_WRITE_TEXT); if (n < 0) { fprintf(stderr, "ERROR writing to socket"); return 1; } - libwebsocket_callback_on_writable(context, wsi); + lws_callback_on_writable(wsi); } break; @@ -436,7 +433,7 @@ send: pss->issue_timestamp = 1; pss->seen_rate = 1; pss->sam_valid = 0; - libwebsocket_callback_on_writable(context, wsi); + lws_callback_on_writable(wsi); } else fprintf(stderr, "sscanf failed\n"); break; @@ -452,7 +449,7 @@ send: /* list of supported protocols and callbacks */ -struct libwebsocket_protocols protocols[] = { +const struct lws_protocols protocols[] = { /* first protocol must always be HTTP handler */ { |