From de23df891940464080297cd9b17324d8ee4601d7 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 19 May 2019 17:53:23 +0200 Subject: Implement basic peer connection handling --- builtins.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'builtins.c') diff --git a/builtins.c b/builtins.c index 2e3d285..b75dcd0 100644 --- a/builtins.c +++ b/builtins.c @@ -1,11 +1,36 @@ static ws_peer_info default_peer = { - 0 + .transport = peer_tcp_client, + .host = "localhost", + .port = "5900" }; +//TODO backend configuration ws_peer_info backend_defaultpeer_query(char* endpoint, size_t protocols, char** protocol, size_t headers, ws_http_header* header, websocket* ws){ //return a copy of the default peer - ws_peer_info peer = { - 0 - }; + ws_peer_info peer = default_peer; + peer.host = (default_peer.host) ? strdup(default_peer.host) : NULL; + peer.port = (default_peer.port) ? strdup(default_peer.port) : NULL; + + //TODO backend protocol discovery + peer.protocol = protocols; return peer; } + +int64_t framing_auto(uint8_t* data, size_t length, size_t last_read, ws_operation* opcode, void** framing_data, char* config){ + //TODO implement auto framer + return length; +} + +int64_t framing_binary(uint8_t* data, size_t length, size_t last_read, ws_operation* opcode, void** framing_data, char* config){ + return length; +} + +int64_t framing_separator(uint8_t* data, size_t length, size_t last_read, ws_operation* opcode, void** framing_data, char* config){ + //TODO implement separator framer + return length; +} + +int64_t framing_newline(uint8_t* data, size_t length, size_t last_read, ws_operation* opcode, void** framing_data, char* config){ + //TODO implement separator framer + return length; +} -- cgit v1.2.3