Path: blob/master/Utilities/cmcurl/include/curl/websockets.h
3158 views
#ifndef CURLINC_WEBSOCKETS_H1#define CURLINC_WEBSOCKETS_H2/***************************************************************************3* _ _ ____ _4* Project ___| | | | _ \| |5* / __| | | | |_) | |6* | (__| |_| | _ <| |___7* \___|\___/|_| \_\_____|8*9* Copyright (C) Daniel Stenberg, <[email protected]>, et al.10*11* This software is licensed as described in the file COPYING, which12* you should have received as part of this distribution. The terms13* are also available at https://curl.se/docs/copyright.html.14*15* You may opt to use, copy, modify, merge, publish, distribute and/or sell16* copies of the Software, and permit persons to whom the Software is17* furnished to do so, under the terms of the COPYING file.18*19* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY20* KIND, either express or implied.21*22* SPDX-License-Identifier: curl23*24***************************************************************************/2526#ifdef __cplusplus27extern "C" {28#endif2930struct curl_ws_frame {31int age; /* zero */32int flags; /* See the CURLWS_* defines */33curl_off_t offset; /* the offset of this data into the frame */34curl_off_t bytesleft; /* number of pending bytes left of the payload */35size_t len; /* size of the current data chunk */36};3738/* flag bits */39#define CURLWS_TEXT (1<<0)40#define CURLWS_BINARY (1<<1)41#define CURLWS_CONT (1<<2)42#define CURLWS_CLOSE (1<<3)43#define CURLWS_PING (1<<4)44#define CURLWS_OFFSET (1<<5)4546/*47* NAME curl_ws_recv()48*49* DESCRIPTION50*51* Receives data from the websocket connection. Use after successful52* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.53*/54CURL_EXTERN CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,55size_t *recv,56const struct curl_ws_frame **metap);5758/* flags for curl_ws_send() */59#define CURLWS_PONG (1<<6)6061/*62* NAME curl_ws_send()63*64* DESCRIPTION65*66* Sends data over the websocket connection. Use after successful67* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.68*/69CURL_EXTERN CURLcode curl_ws_send(CURL *curl, const void *buffer,70size_t buflen, size_t *sent,71curl_off_t fragsize,72unsigned int flags);7374/* bits for the CURLOPT_WS_OPTIONS bitmask: */75#define CURLWS_RAW_MODE (1<<0)76#define CURLWS_NOAUTOPONG (1<<1)7778CURL_EXTERN const struct curl_ws_frame *curl_ws_meta(CURL *curl);7980#ifdef __cplusplus81}82#endif8384#endif /* CURLINC_WEBSOCKETS_H */858687