jpayne@69
|
1 #ifndef CURLINC_WEBSOCKETS_H
|
jpayne@69
|
2 #define CURLINC_WEBSOCKETS_H
|
jpayne@69
|
3 /***************************************************************************
|
jpayne@69
|
4 * _ _ ____ _
|
jpayne@69
|
5 * Project ___| | | | _ \| |
|
jpayne@69
|
6 * / __| | | | |_) | |
|
jpayne@69
|
7 * | (__| |_| | _ <| |___
|
jpayne@69
|
8 * \___|\___/|_| \_\_____|
|
jpayne@69
|
9 *
|
jpayne@69
|
10 * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
jpayne@69
|
11 *
|
jpayne@69
|
12 * This software is licensed as described in the file COPYING, which
|
jpayne@69
|
13 * you should have received as part of this distribution. The terms
|
jpayne@69
|
14 * are also available at https://curl.se/docs/copyright.html.
|
jpayne@69
|
15 *
|
jpayne@69
|
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
jpayne@69
|
17 * copies of the Software, and permit persons to whom the Software is
|
jpayne@69
|
18 * furnished to do so, under the terms of the COPYING file.
|
jpayne@69
|
19 *
|
jpayne@69
|
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
jpayne@69
|
21 * KIND, either express or implied.
|
jpayne@69
|
22 *
|
jpayne@69
|
23 * SPDX-License-Identifier: curl
|
jpayne@69
|
24 *
|
jpayne@69
|
25 ***************************************************************************/
|
jpayne@69
|
26
|
jpayne@69
|
27 #ifdef __cplusplus
|
jpayne@69
|
28 extern "C" {
|
jpayne@69
|
29 #endif
|
jpayne@69
|
30
|
jpayne@69
|
31 struct curl_ws_frame {
|
jpayne@69
|
32 int age; /* zero */
|
jpayne@69
|
33 int flags; /* See the CURLWS_* defines */
|
jpayne@69
|
34 curl_off_t offset; /* the offset of this data into the frame */
|
jpayne@69
|
35 curl_off_t bytesleft; /* number of pending bytes left of the payload */
|
jpayne@69
|
36 };
|
jpayne@69
|
37
|
jpayne@69
|
38 /* flag bits */
|
jpayne@69
|
39 #define CURLWS_TEXT (1<<0)
|
jpayne@69
|
40 #define CURLWS_BINARY (1<<1)
|
jpayne@69
|
41 #define CURLWS_CONT (1<<2)
|
jpayne@69
|
42 #define CURLWS_CLOSE (1<<3)
|
jpayne@69
|
43 #define CURLWS_PING (1<<4)
|
jpayne@69
|
44 #define CURLWS_OFFSET (1<<5)
|
jpayne@69
|
45
|
jpayne@69
|
46 /*
|
jpayne@69
|
47 * NAME curl_ws_recv()
|
jpayne@69
|
48 *
|
jpayne@69
|
49 * DESCRIPTION
|
jpayne@69
|
50 *
|
jpayne@69
|
51 * Receives data from the websocket connection. Use after successful
|
jpayne@69
|
52 * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
jpayne@69
|
53 */
|
jpayne@69
|
54 CURL_EXTERN CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
|
jpayne@69
|
55 size_t *recv,
|
jpayne@69
|
56 struct curl_ws_frame **metap);
|
jpayne@69
|
57
|
jpayne@69
|
58 /* sendflags for curl_ws_send() */
|
jpayne@69
|
59 #define CURLWS_PONG (1<<6)
|
jpayne@69
|
60
|
jpayne@69
|
61 /*
|
jpayne@69
|
62 * NAME curl_easy_send()
|
jpayne@69
|
63 *
|
jpayne@69
|
64 * DESCRIPTION
|
jpayne@69
|
65 *
|
jpayne@69
|
66 * Sends data over the websocket connection. Use after successful
|
jpayne@69
|
67 * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
jpayne@69
|
68 */
|
jpayne@69
|
69 CURL_EXTERN CURLcode curl_ws_send(CURL *curl, const void *buffer,
|
jpayne@69
|
70 size_t buflen, size_t *sent,
|
jpayne@69
|
71 curl_off_t framesize,
|
jpayne@69
|
72 unsigned int sendflags);
|
jpayne@69
|
73
|
jpayne@69
|
74 /* bits for the CURLOPT_WS_OPTIONS bitmask: */
|
jpayne@69
|
75 #define CURLWS_RAW_MODE (1<<0)
|
jpayne@69
|
76
|
jpayne@69
|
77 CURL_EXTERN struct curl_ws_frame *curl_ws_meta(CURL *curl);
|
jpayne@69
|
78
|
jpayne@69
|
79 #ifdef __cplusplus
|
jpayne@69
|
80 }
|
jpayne@69
|
81 #endif
|
jpayne@69
|
82
|
jpayne@69
|
83 #endif /* CURLINC_WEBSOCKETS_H */
|