Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kWebSocket.h
Go to the documentation of this file.
1 
10 #ifndef K_API_WEBSOCKET_H
11 #define K_API_WEBSOCKET_H
12 
13 #include <kApi/kApiDef.h>
14 #include <kApi/Io/kNetwork.h>
15 
22 typedef k32s kWebSocketDataType;
23 
25 #define kWEB_SOCKET_DATA_TYPE_NULL (0x0)
26 #define kWEB_SOCKET_DATA_TYPE_UTF8 (0x1)
27 #define kWEB_SOCKET_DATA_TYPE_BINARY (0x2)
28 
30 #include <kApi/Io/kWebSocket.x.h>
31 
121 //typedef kStream kWebSocket; --forward-declared in kApiDef.x.h
122 
131 kFx(kStatus) kWebSocket_Construct(kWebSocket* webSocket, kAlloc allocator);
132 
149 kFx(kStatus) kWebSocket_SetWriteBuffers(kWebSocket webSocket, kSSize socketSize, kSSize clientSize);
150 
164 kFx(kStatus) kWebSocket_SetReadBuffers(kWebSocket webSocket, kSSize socketSize, kSSize clientSize);
165 
178 kFx(kStatus) kWebSocket_Connect(kWebSocket webSocket, kIpAddress address, k32u port, const kChar* host, const kChar* uri, k64u timeout);
179 
191 kFx(kStatus) kWebSocket_Close(kWebSocket webSocket);
192 
210 
231 kFx(kStatus) kWebSocket_Send(kWebSocket webSocket);
232 
253 kFx(kStatus) kWebSocket_Receive(kWebSocket webSocket, k64u timeout);
254 
269 kFx(kStatus) kWebSocket_WriteMessage(kWebSocket webSocket, const void* buffer, kSize size);
270 
289 kFx(kStatus) kWebSocket_ReadMessage(kWebSocket webSocket, kMemory memory, k64u timeout);
290 
299 kFx(kStatus) kWebSocket_Cancel(kWebSocket webSocket);
300 
311 kFx(kStatus) kWebSocket_SendPing(kWebSocket webSocket);
312 
320 kFx(k64u) kWebSocket_LastPong(kWebSocket webSocket);
321 
330 
339 
340 #endif
kStatus kWebSocket_Cancel(kWebSocket webSocket)
Cancels any pending I/O operations.
Represents a 32-bit unsigned integer.
k64u kWebSocket_LastPong(kWebSocket webSocket)
Reports the time at which the most recent pong message arrived.
Represents an in-memory stream.
kStatus kWebSocket_SetWriteBuffers(kWebSocket webSocket, kSSize socketSize, kSSize clientSize)
Sets the size of write buffers.
Represents a 64-bit unsigned integer.
Represents a WebSocket.
kWebSocketDataType kWebSocket_SendType(kWebSocket webSocket)
Reports the message data type currently used for sending.
kStatus kWebSocket_WriteMessage(kWebSocket webSocket, const void *buffer, kSize size)
Writes a complete WebSocket message.
Represents Websocket message content type.
Represents an unsigned integer that can store a pointer address.
Abstract base class for memory allocator types.
kStatus kWebSocket_Send(kWebSocket webSocket)
Sends any buffered data and ends the current message.
kStatus kWebSocket_ReadMessage(kWebSocket webSocket, kMemory memory, k64u timeout)
Blocks until a whole message has been read (or until a timeout occurs).
Represents an IP address.
Definition: kNetwork.h:37
Represents a single unit (byte) in a UTF-8 character.
kStatus kWebSocket_SetSendType(kWebSocket webSocket, kWebSocketDataType type)
Sets the data transfer type used for send operations.
Represents a signed integer that can store a pointer address.
Core Zen type declarations.
Represents a 32-bit signed integer.
IP networking definitions.
Represents an error code.
kWebSocketDataType kWebSocket_ReceiveType(kWebSocket webSocket)
Reports the data type of the most recently received data message.
kStatus kWebSocket_Construct(kWebSocket *webSocket, kAlloc allocator)
Constructs a WebSocket that can be used to connect to a server.
kStatus kWebSocket_SendPing(kWebSocket webSocket)
Sends a ping message.
kStatus kWebSocket_Close(kWebSocket webSocket)
Closes the WebSocket connection.
kStatus kWebSocket_SetReadBuffers(kWebSocket webSocket, kSSize socketSize, kSSize clientSize)
Sets the size of the read buffers.
kStatus kWebSocket_Receive(kWebSocket webSocket, k64u timeout)
Blocks until a new message is available for reading.
kStatus kWebSocket_Connect(kWebSocket webSocket, kIpAddress address, k32u port, const kChar *host, const kChar *uri, k64u timeout)
Connects a WebSocket to an HTTP server.