X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwebsock.h;h=5066333ded64a90e2cea419fc1fee96376ac3cc5;hb=65353dce81a629e042800bb7b86fcd869a76727e;hp=e024182eb09efa453a0073d7ec3ff0b64efead4b;hpb=8112056eecede587bf884f56629858c8b21bdbec;p=src%2Fapp-framework-binder.git diff --git a/src/websock.h b/src/websock.h index e024182e..5066333d 100644 --- a/src/websock.h +++ b/src/websock.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 "IoT.bzh" + * Copyright (C) 2015-2020 "IoT.bzh" * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,24 +54,28 @@ struct websock_itf { struct websock; -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); +extern int websock_close_empty(struct websock *ws); +extern int websock_close(struct websock *ws, uint16_t code, const void *data, size_t length); +extern 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 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); +extern int websock_ping(struct websock *ws, const void *data, size_t length); +extern int websock_pong(struct websock *ws, const void *data, size_t length); +extern int websock_text(struct websock *ws, int last, const void *text, size_t length); +extern int websock_text_v(struct websock *ws, int last, const struct iovec *iovec, int count); +extern int websock_binary(struct websock *ws, int last, const void *data, size_t length); +extern int websock_binary_v(struct websock *ws, int last, const struct iovec *iovec, int count); +extern int websock_continue(struct websock *ws, int last, const void *data, size_t length); +extern 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); +extern ssize_t websock_read(struct websock *ws, void *buffer, size_t size); +extern int websock_drop(struct websock *ws); -int websock_dispatch(struct websock *ws); +extern int websock_dispatch(struct websock *ws, int loop); -struct websock *websock_create_v13(const struct websock_itf *itf, void *closure); -void websock_destroy(struct websock *ws); +extern struct websock *websock_create_v13(const struct websock_itf *itf, void *closure); +extern void websock_destroy(struct websock *ws); +extern void websock_set_default_max_length(size_t maxlen); +extern void websock_set_max_length(struct websock *ws, size_t maxlen); + +extern const char *websocket_explain_error(uint16_t code);