diff options
author | 2016-04-21 17:45:44 +0200 | |
---|---|---|
committer | 2016-04-21 17:45:44 +0200 | |
commit | 5eaa2c12a8b89f8a16f0759db88d65b56c82918c (patch) | |
tree | 5ff91305ba212269b3b546f7dc33168b13d452af /src/afb-ws.h | |
parent | 45e4c16ed05d6b5fed969b08aa873d6c24b5f948 (diff) |
websocket refactoring
Change-Id: Ia39ec6c01ce1fc6b3921b0433ab872d47ebdbbc4
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-ws.h')
-rw-r--r-- | src/afb-ws.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/afb-ws.h b/src/afb-ws.h index 1faec65c..1ef61ad8 100644 --- a/src/afb-ws.h +++ b/src/afb-ws.h @@ -21,13 +21,18 @@ struct afb_ws; struct afb_ws_itf { - void (*on_close) (void *, uint16_t code, char *, size_t size); + void (*on_close) (void *, uint16_t code, char *, size_t size); /* optional, if not set hangup is called */ void (*on_text) (void *, char *, size_t size); void (*on_binary) (void *, char *, size_t size); + void (*on_error) (void *, uint16_t code, const void *, size_t size); /* optional, if not set hangup is called */ + void (*on_hangup) (void *); /* optional, it is safe too call afb_ws_destroy within the callback */ }; extern struct afb_ws *afb_ws_create(int fd, const struct afb_ws_itf *itf, void *closure); -extern void afb_ws_close(struct afb_ws *ws, uint16_t code); -extern void afb_ws_text(struct afb_ws *ws, const char *text, size_t length); -extern void afb_ws_binary(struct afb_ws *ws, const void *data, size_t length); +extern void afb_ws_destroy(struct afb_ws *ws); +extern void afb_ws_hangup(struct afb_ws *ws); +extern int afb_ws_close(struct afb_ws *ws, uint16_t code, const char *reason); +extern int afb_ws_error(struct afb_ws *ws, uint16_t code, const char *reason); +extern int afb_ws_text(struct afb_ws *ws, const char *text, size_t length); +extern int afb_ws_binary(struct afb_ws *ws, const void *data, size_t length); |