From 04b1757467bcb4e287dd1c34d5a21f76705340d6 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Thu, 21 Apr 2016 12:28:51 +0200 Subject: refactoring websockects low-level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id0e2952fb61dba0415698642d9eb907f83e18d5b Signed-off-by: José Bollo --- src/websock.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/websock.h') 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); -- cgit 1.2.3-korg