libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-write.h
Go to the documentation of this file.
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
30#define LWS_WRITE_RAW LWS_WRITE_HTTP
31
32/*
33 * NOTE: These public enums are part of the abi. If you want to add one,
34 * add it at where specified so existing users are unaffected.
35 */
52
53 /* LWS_WRITE_CLOSE is handled by lws_close_reason() */
56
57 /* Same as write_http but we know this write ends the transaction */
59
60 /* HTTP2 */
61
75
76 /****** add new things just above ---^ ******/
77
78 /* flags */
79
87
90
95
100};
101
102/* used with LWS_CALLBACK_CHILD_WRITE_VIA_PARENT */
103
105 struct lws *wsi;
106 unsigned char *buf;
107 size_t len;
109};
110
111
213lws_write(struct lws *wsi, unsigned char *buf, size_t len,
214 enum lws_write_protocol protocol);
215
216/* helper for case where buffer may be const */
217#define lws_write_http(wsi, buf, len) \
218 lws_write(wsi, (unsigned char *)(buf), len, LWS_WRITE_HTTP)
219
232lws_write_ws_flags(int initial, int is_start, int is_end)
233{
234 enum lws_write_protocol r;
235
236 if (is_start)
237 r = (enum lws_write_protocol)initial;
238 else
240
241 if (!is_end)
242 r = (enum lws_write_protocol)((int)r | (int)LWS_WRITE_NO_FIN);
243
244 return r;
245}
246
262
#define LWS_INLINE
#define LWS_EXTERN
#define LWS_WARN_UNUSED_RESULT
#define LWS_VISIBLE
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_raw_transaction_completed(struct lws *wsi)
struct lws * wsi
Definition lws-write.h:105
unsigned char * buf
Definition lws-write.h:106
lws_write_protocol
Definition lws-write.h:36
@ LWS_WRITE_CONTINUATION
Definition lws-write.h:47
@ LWS_WRITE_NO_FIN
Definition lws-write.h:88
@ LWS_WRITE_CLIENT_IGNORE_XOR_MASK
Definition lws-write.h:96
@ LWS_WRITE_H2_STREAM_END
Definition lws-write.h:91
@ LWS_WRITE_PING
Definition lws-write.h:54
@ LWS_WRITE_QUIC_DATAGRAM
Definition lws-write.h:71
@ LWS_WRITE_TEXT
Definition lws-write.h:37
@ LWS_WRITE_PONG
Definition lws-write.h:55
@ LWS_WRITE_HTTP
Definition lws-write.h:50
@ LWS_WRITE_HTTP_FINAL
Definition lws-write.h:58
@ LWS_WRITE_BINARY
Definition lws-write.h:42
@ LWS_WRITE_BUFLIST
Definition lws-write.h:80
@ LWS_WRITE_HTTP_HEADERS_CONTINUATION
Definition lws-write.h:68
@ LWS_WRITE_HTTP_HEADERS
Definition lws-write.h:62
enum lws_write_protocol wp
Definition lws-write.h:108
LWS_VISIBLE LWS_EXTERN int lws_write(struct lws *wsi, unsigned char *buf, size_t len, enum lws_write_protocol protocol)