1 /* 2 * coap_ws.h -- WebSockets Transport Layer Support for libcoap 3 * 4 * Copyright (C) 2023 Olaf Bergmann <bergmann@tzi.org> 5 * Copyright (C) 2023 Jon Shallow <supjps-libcoap@jpshallow.com> 6 * 7 * SPDX-License-Identifier: BSD-2-Clause 8 * 9 * This file is part of the CoAP library libcoap. Please see README for terms 10 * of use. 11 */ 12 13 /** 14 * @file coap_ws.h 15 * @brief CoAP WebSockets support 16 */ 17 18 #ifndef COAP_WS_H_ 19 #define COAP_WS_H_ 20 21 /** 22 * @ingroup application_api 23 * @defgroup ws WebSockets Support 24 * API for interfacing with WebSockets (RFC8323) 25 * @{ 26 */ 27 28 /** 29 * Check whether WebSockets is available. 30 * 31 * @return @c 1 if support for WebSockets is available, or @c 0 otherwise. 32 */ 33 int coap_ws_is_supported(void); 34 35 /** 36 * Check whether Secure WebSockets is available. 37 * 38 * @return @c 1 if support for Secure WebSockets is available, or @c 0 otherwise. 39 */ 40 int coap_wss_is_supported(void); 41 42 /** 43 * Set the host for the HTTP Host: Header in the WebSockets Request. 44 * 45 * @return @c 1 if successful, else @c 0 if failure of some sort. 46 */ 47 int coap_ws_set_host_request(coap_session_t *session, coap_str_const_t *ws_host); 48 49 /** @} */ 50 51 #endif /* COAP_WS_H */ 52