Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:12

0001 #ifndef CURLINC_WEBSOCKETS_H
0002 #define CURLINC_WEBSOCKETS_H
0003 /***************************************************************************
0004  *                                  _   _ ____  _
0005  *  Project                     ___| | | |  _ \| |
0006  *                             / __| | | | |_) | |
0007  *                            | (__| |_| |  _ <| |___
0008  *                             \___|\___/|_| \_\_____|
0009  *
0010  * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
0011  *
0012  * This software is licensed as described in the file COPYING, which
0013  * you should have received as part of this distribution. The terms
0014  * are also available at https://curl.se/docs/copyright.html.
0015  *
0016  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
0017  * copies of the Software, and permit persons to whom the Software is
0018  * furnished to do so, under the terms of the COPYING file.
0019  *
0020  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
0021  * KIND, either express or implied.
0022  *
0023  * SPDX-License-Identifier: curl
0024  *
0025  ***************************************************************************/
0026 
0027 #ifdef  __cplusplus
0028 extern "C" {
0029 #endif
0030 
0031 struct curl_ws_frame {
0032   int age;              /* zero */
0033   int flags;            /* See the CURLWS_* defines */
0034   curl_off_t offset;    /* the offset of this data into the frame */
0035   curl_off_t bytesleft; /* number of pending bytes left of the payload */
0036   size_t len;           /* size of the current data chunk */
0037 };
0038 
0039 /* flag bits */
0040 #define CURLWS_TEXT       (1<<0)
0041 #define CURLWS_BINARY     (1<<1)
0042 #define CURLWS_CONT       (1<<2)
0043 #define CURLWS_CLOSE      (1<<3)
0044 #define CURLWS_PING       (1<<4)
0045 #define CURLWS_OFFSET     (1<<5)
0046 
0047 /*
0048  * NAME curl_ws_recv()
0049  *
0050  * DESCRIPTION
0051  *
0052  * Receives data from the websocket connection. Use after successful
0053  * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
0054  */
0055 CURL_EXTERN CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
0056                                   size_t *recv,
0057                                   const struct curl_ws_frame **metap);
0058 
0059 /* flags for curl_ws_send() */
0060 #define CURLWS_PONG       (1<<6)
0061 
0062 /*
0063  * NAME curl_ws_send()
0064  *
0065  * DESCRIPTION
0066  *
0067  * Sends data over the websocket connection. Use after successful
0068  * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
0069  */
0070 CURL_EXTERN CURLcode curl_ws_send(CURL *curl, const void *buffer,
0071                                   size_t buflen, size_t *sent,
0072                                   curl_off_t fragsize,
0073                                   unsigned int flags);
0074 
0075 /* bits for the CURLOPT_WS_OPTIONS bitmask: */
0076 #define CURLWS_RAW_MODE (1<<0)
0077 
0078 CURL_EXTERN const struct curl_ws_frame *curl_ws_meta(CURL *curl);
0079 
0080 #ifdef  __cplusplus
0081 }
0082 #endif
0083 
0084 #endif /* CURLINC_WEBSOCKETS_H */