Skip to content

Commit

Permalink
support for rfc7692 message deflate
Browse files Browse the repository at this point in the history
  • Loading branch information
ariken74 committed Nov 1, 2024
1 parent 9106c43 commit 2165e1b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/tcp_transport/include/esp_transport_ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ int esp_transport_ws_send_raw(esp_transport_handle_t t, ws_transport_opcodes_t o
*/
bool esp_transport_ws_get_fin_flag(esp_transport_handle_t t);

/**
* @brief Returns websocket rsv1 flag for last received data
*
* @param t websocket transport handle
*
* @return
* - Rsv1 flag as a boolean
*/
bool esp_transport_ws_get_rsv1_flag(esp_transport_handle_t t);

/**
* @brief Returns the HTTP status code of the websocket handshake
*
Expand Down
7 changes: 7 additions & 0 deletions components/tcp_transport/transport_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ static int ws_read_header(esp_transport_handle_t t, char *buffer, int len, int t
}
ws->frame_state.header_received = true;
ws->frame_state.fin = (*data_ptr & 0x80) != 0;
ws->frame_state.rsv1 = (*data_ptr & 0x40) != 0;
ws->frame_state.opcode = (*data_ptr & 0x0F);
data_ptr ++;
mask = ((*data_ptr >> 7) & 0x01);
Expand Down Expand Up @@ -858,6 +859,12 @@ bool esp_transport_ws_get_fin_flag(esp_transport_handle_t t)
return ws->frame_state.fin;
}

bool esp_transport_ws_get_rsv1_flag(esp_transport_handle_t t)
{
transport_ws_t *ws = esp_transport_get_context_data(t);
return ws->frame_state.rsv1;
}

int esp_transport_ws_get_upgrade_request_status(esp_transport_handle_t t)
{
transport_ws_t *ws = esp_transport_get_context_data(t);
Expand Down

0 comments on commit 2165e1b

Please sign in to comment.