aboutsummaryrefslogtreecommitdiffstats
path: root/src/websock.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-04-21 12:28:51 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-04-21 12:28:51 +0200
commit04b1757467bcb4e287dd1c34d5a21f76705340d6 (patch)
tree11cd5e1fbfb56a6ccae4fcb1f5dbb4ad9b544a8a /src/websock.h
parent94ad734842c1359a012f9850b851063637d3e061 (diff)
refactoring websockects low-level
Change-Id: Id0e2952fb61dba0415698642d9eb907f83e18d5b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/websock.h')
-rw-r--r--src/websock.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/websock.h b/src/websock.h
index 7785a0c0..f06bc23d 100644
--- a/src/websock.h
+++ b/src/websock.h
@@ -40,10 +40,9 @@ struct iovec;
struct websock_itf {
ssize_t (*writev) (void *, const struct iovec *, int);
ssize_t (*readv) (void *, const struct iovec *, int);
- void (*disconnect) (void *);
- void (*on_ping) (void *); /* if not NULL, responsible of pong */
- void (*on_pong) (void *);
+ void (*on_ping) (void *, size_t size); /* if not NULL, responsible of pong */
+ void (*on_pong) (void *, size_t size);
void (*on_close) (void *, uint16_t code, size_t size);
void (*on_text) (void *, int last, size_t size);
void (*on_binary) (void *, int last, size_t size);
@@ -53,16 +52,16 @@ struct websock_itf {
struct websock;
-void websock_close(struct websock *ws);
-void websock_close_code(struct websock *ws, uint16_t code);
+int websock_close(struct websock *ws);
+int websock_close_code(struct websock *ws, uint16_t code, const void *data, size_t length);
-void websock_ping(struct websock *ws);
-void websock_pong(struct websock *ws);
-void websock_text(struct websock *ws, const char *text, size_t length);
-void websock_binary(struct websock *ws, const void *data, size_t length);
+int websock_ping(struct websock *ws, const void *data, size_t length);
+int websock_pong(struct websock *ws, const void *data, size_t length);
+int websock_text(struct websock *ws, int last, const char *text, size_t length);
+int websock_binary(struct websock *ws, int last, const void *data, size_t length);
ssize_t websock_read(struct websock *ws, void *buffer, size_t size);
-void websock_drop(struct websock *ws);
+int websock_drop(struct websock *ws);
int websock_dispatch(struct websock *ws);