Internal API for WebSockets Support (RFC8323)
More...
Internal API for WebSockets Support (RFC8323)
◆ COAP_MAX_FS
| #define COAP_MAX_FS (2 + 8 + 4) |
◆ WS_B0_FIN_BIT
| #define WS_B0_FIN_BIT 0x80 |
◆ WS_B0_OP_MASK
| #define WS_B0_OP_MASK 0x0f |
◆ WS_B0_RSV_MASK
| #define WS_B0_RSV_MASK 0x70 |
◆ WS_B1_LEN_MASK
| #define WS_B1_LEN_MASK 0x7f |
◆ WS_B1_MASK_BIT
| #define WS_B1_MASK_BIT 0x80 |
◆ coap_ws_state_t
WebSockets session state.
◆ coap_ws_opcode_t
| Enumerator |
|---|
| WS_OP_CONT | |
| WS_OP_TEXT | |
| WS_OP_BINARY | |
| WS_OP_CLOSE | |
| WS_OP_PING | |
| WS_OP_PONG | |
Definition at line 91 of file coap_ws_internal.h.
◆ coap_ws_close()
Layer function interface for WebSockets close for a session.
- Parameters
-
| session | Session to do the WebSockets close on. |
◆ coap_ws_establish()
Layer function interface for layer below WebSockets accept/connect being established.
This function initiates the WebSockets layer.
If this layer is properly established on invocation, then the next layer must get called by calling session->lfunc[COAP_LAYER_WS].establish(session) (or done at any point when WebSockets is established).
- Parameters
-
| session | Session that the lower layer accept/connect was done on. |
◆ coap_ws_read()
| ssize_t coap_ws_read |
( |
coap_session_t * |
session, |
|
|
uint8_t * |
data, |
|
|
size_t |
datalen |
|
) |
| |
Function interface for websockets data receiving.
This function returns the number of bytes that have been read, or a value less than zero on error. The number of bytes read may be less than datalen because of congestion control.
- Parameters
-
| session | Session to receive data on. |
| data | The data to receive. |
| datalen | The maximum length of data. |
- Returns
- The number of bytes read on success, or a value less than zero on error.
◆ coap_ws_write()
| ssize_t coap_ws_write |
( |
coap_session_t * |
session, |
|
|
const uint8_t * |
data, |
|
|
size_t |
datalen |
|
) |
| |
Function interface for websockets data transmission.
This function returns the number of bytes that have been transmitted, or a value less than zero on error. The number of bytes written may be less than datalen because of congestion control.
- Parameters
-
| session | Session to send data on. |
| data | The data to send. |
| datalen | The actual length of data. |
- Returns
- The number of bytes written on success, or a value less than zero on error.