|
libcoap 4.3.5b
|
Internal API for WebSockets Support (RFC8323). More...
Data Structures | |
| struct | coap_ws_state_t |
| WebSockets session state. More... | |
Macros | |
| #define | COAP_MAX_FS (2 + 8 + 4) |
| #define | WS_B0_FIN_BIT 0x80 |
| #define | WS_B0_RSV_MASK 0x70 |
| #define | WS_B0_OP_MASK 0x0f |
| #define | WS_B1_MASK_BIT 0x80 |
| #define | WS_B1_LEN_MASK 0x7f |
Typedefs | |
| typedef struct coap_ws_state_t | coap_ws_state_t |
| WebSockets session state. | |
Enumerations | |
| enum | coap_ws_opcode_t { WS_OP_CONT = 0x0 , WS_OP_TEXT , WS_OP_BINARY , WS_OP_CLOSE = 0x8 , WS_OP_PING , WS_OP_PONG } |
Functions | |
| ssize_t | coap_ws_write (coap_session_t *session, const uint8_t *data, size_t datalen) |
| Function interface for websockets data transmission. | |
| ssize_t | coap_ws_read (coap_session_t *session, uint8_t *data, size_t datalen) |
| Function interface for websockets data receiving. | |
| void | coap_ws_establish (coap_session_t *session) |
| Layer function interface for layer below WebSockets accept/connect being established. | |
| void | coap_ws_close (coap_session_t *session) |
| Layer function interface for WebSockets close for a session. | |
Internal API for WebSockets Support (RFC8323).
| #define COAP_MAX_FS (2 + 8 + 4) |
Definition at line 32 of file coap_ws_internal.h.
| #define WS_B0_FIN_BIT 0x80 |
Definition at line 84 of file coap_ws_internal.h.
| #define WS_B0_OP_MASK 0x0f |
Definition at line 86 of file coap_ws_internal.h.
| #define WS_B0_RSV_MASK 0x70 |
Definition at line 85 of file coap_ws_internal.h.
| #define WS_B1_LEN_MASK 0x7f |
Definition at line 89 of file coap_ws_internal.h.
| #define WS_B1_MASK_BIT 0x80 |
Definition at line 88 of file coap_ws_internal.h.
| typedef struct coap_ws_state_t coap_ws_state_t |
WebSockets session state.
| enum 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.
| void coap_ws_close | ( | coap_session_t * | session | ) |
Layer function interface for WebSockets close for a session.
| Sessions | Session to do the WebSockets close on. |
| void coap_ws_establish | ( | coap_session_t * | session | ) |
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).
| Sessions | Session that the lower layer accept/connect was done on. |
| 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.
| Sessions | Session to receive data on. |
| data | The data to receive. |
| datalen | The maximum length of data. |
| 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.
| Sessions | Session to send data on. |
| data | The data to send. |
| datalen | The actual length of data. |