1 | /* |
2 | * libwebsockets - small server side websockets and web server implementation |
3 | * |
4 | * Copyright (C) 2010 - 2019 Andy Green <andy@warmcat.com> |
5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | * of this software and associated documentation files (the "Software"), to |
8 | * deal in the Software without restriction, including without limitation the |
9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | * sell copies of the Software, and to permit persons to whom the Software is |
11 | * furnished to do so, subject to the following conditions: |
12 | * |
13 | * The above copyright notice and this permission notice shall be included in |
14 | * all copies or substantial portions of the Software. |
15 | * |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
22 | * IN THE SOFTWARE. |
23 | */ |
24 | |
25 | /** \defgroup wsstatus Websocket status APIs |
26 | * ##Websocket connection status APIs |
27 | * |
28 | * These provide information about ws connection or message status |
29 | */ |
30 | ///@{ |
31 | /** |
32 | * lws_send_pipe_choked() - tests if socket is writable or not |
33 | * \param wsi: lws connection |
34 | * |
35 | * Allows you to check if you can write more on the socket |
36 | */ |
37 | LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT |
38 | lws_send_pipe_choked(struct lws *wsi); |
39 | |
40 | /** |
41 | * lws_is_final_fragment() - tests if last part of ws message |
42 | * |
43 | * \param wsi: lws connection |
44 | */ |
45 | LWS_VISIBLE LWS_EXTERN int |
46 | lws_is_final_fragment(struct lws *wsi); |
47 | |
48 | /** |
49 | * lws_is_first_fragment() - tests if first part of ws message |
50 | * |
51 | * \param wsi: lws connection |
52 | */ |
53 | LWS_VISIBLE LWS_EXTERN int |
54 | lws_is_first_fragment(struct lws *wsi); |
55 | |
56 | /** |
57 | * lws_get_reserved_bits() - access reserved bits of ws frame |
58 | * \param wsi: lws connection |
59 | */ |
60 | LWS_VISIBLE LWS_EXTERN unsigned char |
61 | lws_get_reserved_bits(struct lws *wsi); |
62 | |
63 | /** |
64 | * lws_partial_buffered() - find out if lws buffered the last write |
65 | * \param wsi: websocket connection to check |
66 | * |
67 | * Returns 1 if you cannot use lws_write because the last |
68 | * write on this connection is still buffered, and can't be cleared without |
69 | * returning to the service loop and waiting for the connection to be |
70 | * writeable again. |
71 | * |
72 | * If you will try to do >1 lws_write call inside a single |
73 | * WRITEABLE callback, you must check this after every write and bail if |
74 | * set, ask for a new writeable callback and continue writing from there. |
75 | * |
76 | * This is never set at the start of a writeable callback, but any write |
77 | * may set it. |
78 | */ |
79 | LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT |
80 | lws_partial_buffered(struct lws *wsi); |
81 | |
82 | /** |
83 | * lws_frame_is_binary(): true if the current frame was sent in binary mode |
84 | * |
85 | * \param wsi: the connection we are inquiring about |
86 | * |
87 | * This is intended to be called from the LWS_CALLBACK_RECEIVE callback if |
88 | * it's interested to see if the frame it's dealing with was sent in binary |
89 | * mode. |
90 | */ |
91 | LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT |
92 | lws_frame_is_binary(struct lws *wsi); |
93 | ///@} |
94 | |