/*
- * Copyright (C) 2016 "IoT.bzh"
+ * Copyright (C) 2016, 2017 "IoT.bzh"
* Author: José Bollo <jose.bollo@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
#include <fcntl.h>
#include "afb-wsj1.h"
-#include "afb-common.h"
/**************** WebSocket handshake ****************************/
"MHiEc+Qc8w/SJ3zMHEM8pA==", "FVCxLBmoil3gY0jSX3aNJ6kR/t4="
};
-static const char websocket_s[] = "websocket";
-static const char sec_websocket_key_s[] = "Sec-WebSocket-Key";
-static const char sec_websocket_version_s[] = "Sec-WebSocket-Version";
-static const char sec_websocket_accept_s[] = "Sec-WebSocket-Accept";
-static const char sec_websocket_protocol_s[] = "Sec-WebSocket-Protocol";
-
-static const char vseparators[] = " \t,";
-
/* get randomly a pair of key/accept value */
static void getkeypair(const char **key, const char **ack)
{
errno = EINVAL;
error:
return -1;
-
}
static const char *proto_json1[2] = { "x-afb-ws-json1", NULL };
-struct afb_wsj1 *afb_ws_client_connect_wsj1(const char *uri, struct afb_wsj1_itf *itf, void *closure)
+struct afb_wsj1 *afb_ws_client_connect_wsj1(struct sd_event *eloop, const char *uri, struct afb_wsj1_itf *itf, void *closure)
{
int rc, fd;
char *host, *service, xhost[32];
if (rc == 0) {
rc = negociate(fd, proto_json1, path, xhost);
if (rc == 0) {
- result = afb_wsj1_create(fd, itf, closure);
+ result = afb_wsj1_create(eloop, fd, itf, closure);
if (result != NULL) {
fcntl(fd, F_SETFL, O_NONBLOCK);
break;
}
#endif
-/*
- *
- * Returns the internal event loop coming from afb-common
- *
- * Returns the handle to the event loop
- */
-struct sd_event *afb_ws_client_get_event_loop()
-{
- return afb_common_get_event_loop();
-}
-