aboutsummaryrefslogtreecommitdiffstats
path: root/src/websock.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-04-07 19:57:25 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-04-07 19:57:25 +0200
commit911df9d068b3e259dcab970ded4132a7397f565f (patch)
treeaa514a649d95c13fa6dffa048584ff35d7870464 /src/websock.h
parent5d088cbac7130e9ec8655218acb15dd22b20a7f8 (diff)
improves websockets
Change-Id: I5b941a043838d438c0acc31623ce9361fa742f35 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/websock.h')
-rw-r--r--src/websock.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/websock.h b/src/websock.h
index 235f9910..6376a37e 100644
--- a/src/websock.h
+++ b/src/websock.h
@@ -23,27 +23,28 @@
struct iovec;
-#define STATUS_CODE_UNSET 0
-#define STATUS_CODE_OK 1000
-#define STATUS_CODE_GOING_AWAY 1001
-#define STATUS_CODE_PROTOCOL_ERROR 1002
-#define STATUS_CODE_RESERVED 1004 /* Protocol 8: frame too large */
-#define STATUS_CODE_INVALID_UTF8 1007
-#define STATUS_CODE_POLICY_VIOLATION 1008
-#define STATUS_CODE_MESSAGE_TOO_LARGE 1009
-#define STATUS_CODE_INTERNAL_ERROR 1011
+#define WEBSOCKET_CODE_UNSET 0
+#define WEBSOCKET_CODE_OK 1000
+#define WEBSOCKET_CODE_GOING_AWAY 1001
+#define WEBSOCKET_CODE_PROTOCOL_ERROR 1002
+#define WEBSOCKET_CODE_RESERVED 1004 /* Protocol 8: frame too large */
+#define WEBSOCKET_CODE_INVALID_UTF8 1007
+#define WEBSOCKET_CODE_POLICY_VIOLATION 1008
+#define WEBSOCKET_CODE_MESSAGE_TOO_LARGE 1009
+#define WEBSOCKET_CODE_INTERNAL_ERROR 1011
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 *);
+ void (*on_ping) (void *); /* if not NULL, responsible of pong */
void (*on_pong) (void *);
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);
};
struct websock;
@@ -61,6 +62,6 @@ void websock_drop(struct websock *ws);
int websock_dispatch(struct websock *ws);
-struct websock *websock_create(const struct websock_itf *itf, void *closure);
+struct websock *websock_create_v13(const struct websock_itf *itf, void *closure);
void websock_destroy(struct websock *ws);