Commit Graph

11 Commits

Author SHA1 Message Date
Frediano Ziglio
e0b395fb68 Declare exported functions as C
Allows to be used by both C and C++ code.
So to leave part of the code in C and part move to C++.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:08 +01:00
Frediano Ziglio
642b1683ae websocket: Include proper type header
inttypes.h contains macro for format string while
stdint.h more specifically contains type definitions (like uint8_t).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-17 12:53:11 +01:00
Frediano Ziglio
705ae9c197 websocket: Make header self-independent
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-16 15:42:49 +01:00
Frediano Ziglio
3a8c0bc28d websocket: Add header guards
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-16 15:42:32 +01:00
Frediano Ziglio
9d6a438aae websocket: Handle text data
Allows to specify and get frame type.
Type and flags are returned calling websocket_read and returned
calling websocket_write or websocket_writev.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:19:10 +01:00
Frediano Ziglio
55df5fa841 websocket: Better encapsulation
Move websocket structure declarations to C file.
Make some functions static as now not used externally.
Introduce a websocket_free function for symmetry.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:40 +01:00
Frediano Ziglio
a5c05ad845 websocket: New interface to create RedsWebSocket
Less coupling. This is a preparation for next patch.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:38 +01:00
Frediano Ziglio
b5f3ed1502 websocket: Make websocket_ack_close static
It's used only in websocket.c.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:36 +01:00
Frediano Ziglio
bbfb472154 websocket: Make websocket function more ABI compatibles with RedStream
Use same argument types as red_stream_* functions.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:33 +01:00
Frediano Ziglio
98c183a6f6 websocket: Move RedsWebSocket to header
Intention is to make private in websockets.c and reduce
changes in red-stream.c

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:31 +01:00
Jeremy White
cd2a317096 Add support for clients connecting with the WebSocket protocol.
We do this by auto detecting the inbound http(s) 'GET' and probing
for a well formulated WebSocket binary connection, such as used
by the spice-html5 client.  If detected, we implement a set of
cover functions that abstract the read/write/writev functions,
in a fashion similar to the SASL implementation.

This includes a limited implementation of the WebSocket protocol,
sufficient for our purposes.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-06-26 14:18:27 +01:00