cleaning copyrights
[src/app-framework-binder.git] / src / websock.h
index f06bc23..e024182 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 iot.bzh
+ * Copyright (C) 2016 "IoT.bzh"
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -41,24 +41,31 @@ 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);
-int websock_text(struct websock *ws, int last, const char *text, size_t length);
+int websock_text(struct websock *ws, int last, const void *text, size_t length);
+int websock_text_v(struct websock *ws, int last, const struct iovec *iovec, int count);
 int websock_binary(struct websock *ws, int last, const void *data, size_t length);
+int websock_binary_v(struct websock *ws, int last, const struct iovec *iovec, int count);
+int websock_continue(struct websock *ws, int last, const void *data, size_t length);
+int websock_continue_v(struct websock *ws, int last, const struct iovec *iovec, int count);
 
 ssize_t websock_read(struct websock *ws, void *buffer, size_t size);
 int websock_drop(struct websock *ws);