web_socket_misc.c
Go to the documentation of this file.
void sha1Update(Sha1Context *context, const void *data, size_t length)
Update the SHA-1 context with a portion of the message being hashed.
Definition: apm32f4xx_crypto_hash.c:230
void base64Encode(const void *input, size_t inputLen, char_t *output, size_t *outputLen)
Base64 encoding algorithm.
Definition: base64.c:142
error_t base64Decode(const char_t *input, size_t inputLen, void *output, size_t *outputLen)
Base64 decoding algorithm.
Definition: base64.c:258
Base64 encoding scheme.
Debugging facilities.
void sha1Final(Sha1Context *context, uint8_t *digest)
Finish the SHA-1 message digest.
Definition: esp32_c3_crypto_hash.c:269
void sha1Init(Sha1Context *context)
Initialize SHA-1 message digest context.
Definition: esp32_c3_crypto_hash.c:186
TCP/IP stack core.
SHA-1 (Secure Hash Algorithm 1)
error_t strSafeCopy(char_t *dest, const char_t *src, size_t destSize)
Copy string.
Definition: str.c:164
char_t * strTrimWhitespace(char_t *s)
Removes all leading and trailing whitespace from a string.
Definition: str.c:78
String manipulation helper functions.
char_t serverKey[WEB_SOCKET_SERVER_KEY_SIZE+1]
Definition: web_socket.h:388
char_t clientKey[WEB_SOCKET_CLIENT_KEY_SIZE+1]
Definition: web_socket.h:387
WebSocket API (client and server)
@ WS_STATUS_CODE_INVALID_PAYLOAD_DATA
Definition: web_socket.h:285
@ WS_SUB_STATE_HANDSHAKE_LEADING_LINE
Definition: web_socket.h:248
@ WS_SUB_STATE_HANDSHAKE_HEADER_FIELD
Definition: web_socket.h:249
size_t webSocketAddAuthorizationField(WebSocket *webSocket, char_t *output)
Format Authorization header field.
Definition: web_socket_auth.c:171
error_t webSocketParseAuthenticateField(WebSocket *webSocket, char_t *value)
Parse WWW-Authenticate header field.
Definition: web_socket_auth.c:55
HTTP authentication for WebSockets.
WebSocket frame parsing and formatting.
error_t webSocketVerifyClientKey(WebSocket *webSocket)
Verify client's key.
Definition: web_socket_misc.c:1053
error_t webSocketGenerateClientKey(WebSocket *webSocket)
Generate client's key.
Definition: web_socket_misc.c:969
void webSocketChangeState(WebSocket *webSocket, WebSocketState newState)
Update WebSocket state.
Definition: web_socket_misc.c:88
error_t webSocketParseStatusLine(WebSocket *webSocket, char_t *line)
Parse the Status-Line of the server's handshake.
Definition: web_socket_misc.c:474
bool_t webSocketCheckStatusCode(uint16_t statusCode)
Check whether a status code is valid.
Definition: web_socket_misc.c:1144
error_t webSocketVerifyServerHandshake(WebSocket *webSocket)
Verify server's handshake.
Definition: web_socket_misc.c:906
error_t webSocketFormatServerHandshake(WebSocket *webSocket)
Format server's handshake.
Definition: web_socket_misc.c:729
error_t webSocketParseRequestLine(WebSocket *webSocket, char_t *line)
Parse the Request-Line of the client's handshake.
Definition: web_socket_misc.c:366
error_t webSocketParseHandshake(WebSocket *webSocket)
Parse client or server handshake.
Definition: web_socket_misc.c:107
error_t webSocketFormatErrorResponse(WebSocket *webSocket, uint_t statusCode, const char_t *message)
Format HTTP error response.
Definition: web_socket_misc.c:781
error_t webSocketVerifyServerKey(WebSocket *webSocket)
Verify server's key.
Definition: web_socket_misc.c:1094
error_t webSocketDecodePercentEncodedString(const char_t *input, char_t *output, size_t outputSize)
Decode a percent-encoded string.
Definition: web_socket_misc.c:1183
error_t webSocketFormatClientHandshake(WebSocket *webSocket, uint16_t serverPort)
Format client's handshake.
Definition: web_socket_misc.c:643
error_t webSocketGenerateServerKey(WebSocket *webSocket)
Generate server's key.
Definition: web_socket_misc.c:1013
void webSocketParseConnectionField(WebSocket *webSocket, char_t *value)
Parse Connection header field.
Definition: web_socket_misc.c:599
error_t webSocketVerifyClientHandshake(WebSocket *webSocket)
Verify client's handshake.
Definition: web_socket_misc.c:857
bool_t webSocketCheckUtf8Stream(WebSocketUtf8Context *context, const uint8_t *data, size_t length, size_t remaining)
Check whether a an UTF-8 stream is valid.
Definition: web_socket_misc.c:1245
error_t webSocketParseHeaderField(WebSocket *webSocket, char_t *line)
Parse a header field.
Definition: web_socket_misc.c:512
Helper functions for WebSockets.
error_t webSocketReceiveData(WebSocket *webSocket, void *data, size_t size, size_t *received, uint_t flags)
Receive data using the relevant transport protocol.
Definition: web_socket_transport.c:284
WebSocket transport layer.