aboutsummaryrefslogtreecommitdiffstats
path: root/src/websock.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-04-21 17:45:44 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-04-21 17:45:44 +0200
commit5eaa2c12a8b89f8a16f0759db88d65b56c82918c (patch)
tree5ff91305ba212269b3b546f7dc33168b13d452af /src/websock.h
parent45e4c16ed05d6b5fed969b08aa873d6c24b5f948 (diff)
websocket refactoring
Change-Id: Ia39ec6c01ce1fc6b3921b0433ab872d47ebdbbc4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/websock.h')
-rw-r--r--src/websock.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/websock.h b/src/websock.h
index f06bc23d..dbb3b022 100644
--- a/src/websock.h
+++ b/src/websock.h
@@ -41,19 +41,22 @@ struct websock_itf {
ssize_t (*writev) (void *, const struct iovec *, int);
ssize_t (*readv) (void *, const struct iovec *, int);
- void (*on_ping) (void *, size_t size); /* if not NULL, responsible of pong */
- void (*on_pong) (void *, size_t size);
+ void (*on_ping) (void *, size_t size); /* optional, if not NULL, responsible of pong */
+ void (*on_pong) (void *, size_t size); /* optional */
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);
void (*on_continue) (void *, int last, size_t size);
int (*on_extension) (void *, int last, int rsv1, int rsv2, int rsv3, int opcode, size_t size);
+
+ void (*on_error) (void *, uint16_t code, const void *data, size_t size); /* optional */
};
struct websock;
-int websock_close(struct websock *ws);
-int websock_close_code(struct websock *ws, uint16_t code, const void *data, size_t length);
+int websock_close_empty(struct websock *ws);
+int websock_close(struct websock *ws, uint16_t code, const void *data, size_t length);
+int websock_error(struct websock *ws, uint16_t code, 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);