mikroSDK Reference Manual
web_socket_misc.h
Go to the documentation of this file.
1
31#ifndef _WEB_SOCKET_MISC_H
32#define _WEB_SOCKET_MISC_H
33
34//Dependencies
35#include "core/net.h"
37
38//C++ guard
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43
48typedef struct
49{
50 uint_t value;
51 const char_t message[28];
53
54
55//WebSocket related functions
56void webSocketChangeState(WebSocket *webSocket, WebSocketState newState);
57
58error_t webSocketParseHandshake(WebSocket *webSocket);
59error_t webSocketParseRequestLine(WebSocket *webSocket, char_t *line);
60error_t webSocketParseStatusLine(WebSocket *webSocket, char_t *line);
61error_t webSocketParseHeaderField(WebSocket *webSocket, char_t *line);
62
63void webSocketParseConnectionField(WebSocket *webSocket, char_t *value);
64
65error_t webSocketFormatClientHandshake(WebSocket *webSocket, uint16_t serverPort);
66error_t webSocketFormatServerHandshake(WebSocket *webSocket);
67
68error_t webSocketFormatErrorResponse(WebSocket *webSocket,
69 uint_t statusCode, const char_t *message);
70
71error_t webSocketVerifyClientHandshake(WebSocket *webSocket);
72error_t webSocketVerifyServerHandshake(WebSocket *webSocket);
73
74error_t webSocketGenerateClientKey(WebSocket *webSocket);
75error_t webSocketGenerateServerKey(WebSocket *webSocket);
76
77error_t webSocketVerifyClientKey(WebSocket *webSocket);
78error_t webSocketVerifyServerKey(WebSocket *webSocket);
79
80bool_t webSocketCheckStatusCode(uint16_t statusCode);
81
82error_t webSocketDecodePercentEncodedString(const char_t *input,
83 char_t *output, size_t outputSize);
84
85bool_t webSocketCheckUtf8Stream(WebSocketUtf8Context *context,
86 const uint8_t *data, size_t length, size_t remaining);
87
88//C++ guard
89#ifdef __cplusplus
90}
91#endif
92
93#endif
error_t
Error codes.
Definition error.h:43
TCP/IP stack core.
HTTP status code.
Definition web_socket_misc.h:49
UTF-8 decoding context.
Definition web_socket.h:415
WebSocket API (client and server)
WebSocketState
WebSocket states.
Definition web_socket.h:225