2011-07-03 05:50:11 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-03 05:50:11 +04:00
|
|
|
* Network Transport Layer
|
|
|
|
*
|
|
|
|
* Copyright 2011 Vic Lee
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#ifndef FREERDP_LIB_CORE_TRANSPORT_H
|
|
|
|
#define FREERDP_LIB_CORE_TRANSPORT_H
|
2011-07-03 05:50:11 +04:00
|
|
|
|
2011-07-10 23:34:43 +04:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TRANSPORT_LAYER_TCP,
|
2011-08-25 09:30:17 +04:00
|
|
|
TRANSPORT_LAYER_TLS,
|
2023-09-22 23:13:54 +03:00
|
|
|
TRANSPORT_LAYER_NAMEDPIPE,
|
2012-03-26 20:20:38 +04:00
|
|
|
TRANSPORT_LAYER_TSG,
|
2013-10-11 14:12:50 +04:00
|
|
|
TRANSPORT_LAYER_TSG_TLS,
|
2011-08-25 09:30:17 +04:00
|
|
|
TRANSPORT_LAYER_CLOSED
|
2011-07-10 23:34:43 +04:00
|
|
|
} TRANSPORT_LAYER;
|
|
|
|
|
2011-07-03 23:34:15 +04:00
|
|
|
#include "tcp.h"
|
2012-11-15 06:19:17 +04:00
|
|
|
#include "nla.h"
|
2023-03-07 13:58:28 +03:00
|
|
|
#include "rdstls.h"
|
2012-05-05 03:48:53 +04:00
|
|
|
|
2012-12-13 08:18:20 +04:00
|
|
|
#include "gateway/tsg.h"
|
|
|
|
|
2012-05-05 03:48:53 +04:00
|
|
|
#include <winpr/sspi.h>
|
2013-10-09 07:43:57 +04:00
|
|
|
#include <winpr/wlog.h>
|
2013-03-27 21:03:41 +04:00
|
|
|
#include <winpr/synch.h>
|
|
|
|
#include <winpr/thread.h>
|
|
|
|
#include <winpr/stream.h>
|
2012-12-22 00:36:10 +04:00
|
|
|
#include <winpr/collections.h>
|
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
#include <freerdp/api.h>
|
2011-07-03 23:34:15 +04:00
|
|
|
|
2011-07-03 20:42:35 +04:00
|
|
|
#include <time.h>
|
2011-07-07 21:37:48 +04:00
|
|
|
#include <freerdp/types.h>
|
2011-07-06 07:18:00 +04:00
|
|
|
#include <freerdp/settings.h>
|
2020-09-02 14:37:04 +03:00
|
|
|
#include <freerdp/transport_io.h>
|
2013-03-22 00:45:25 +04:00
|
|
|
|
2022-11-11 14:26:28 +03:00
|
|
|
#include "state.h"
|
|
|
|
|
|
|
|
typedef state_run_t (*TransportRecv)(rdpTransport* transport, wStream* stream, void* extra);
|
2011-07-03 05:50:11 +04:00
|
|
|
|
2021-09-03 09:00:24 +03:00
|
|
|
FREERDP_LOCAL wStream* transport_send_stream_init(rdpTransport* transport, size_t size);
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_connect(rdpTransport* transport, const char* hostname, UINT16 port,
|
2020-06-17 09:41:21 +03:00
|
|
|
DWORD timeout);
|
2023-09-22 23:13:54 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_connect_childsession(rdpTransport* transport);
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_attach(rdpTransport* transport, int sockfd);
|
|
|
|
FREERDP_LOCAL BOOL transport_disconnect(rdpTransport* transport);
|
|
|
|
FREERDP_LOCAL BOOL transport_connect_rdp(rdpTransport* transport);
|
|
|
|
FREERDP_LOCAL BOOL transport_connect_tls(rdpTransport* transport);
|
2023-06-23 01:49:27 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_connect_nla(rdpTransport* transport, BOOL earlyUserAuth);
|
2023-03-07 13:58:28 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_connect_rdstls(rdpTransport* transport);
|
2023-03-08 04:06:47 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_connect_aad(rdpTransport* transport);
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_accept_rdp(rdpTransport* transport);
|
|
|
|
FREERDP_LOCAL BOOL transport_accept_tls(rdpTransport* transport);
|
|
|
|
FREERDP_LOCAL BOOL transport_accept_nla(rdpTransport* transport);
|
2023-03-07 13:58:28 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_accept_rdstls(rdpTransport* transport);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL int transport_read_pdu(rdpTransport* transport, wStream* s);
|
|
|
|
FREERDP_LOCAL int transport_write(rdpTransport* transport, wStream* s);
|
|
|
|
|
2024-01-02 19:00:14 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_get_public_key(rdpTransport* transport, const BYTE** data,
|
|
|
|
DWORD* length);
|
|
|
|
|
2021-08-24 16:04:58 +03:00
|
|
|
#if defined(WITH_FREERDP_DEPRECATED)
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount);
|
2021-08-24 16:04:58 +03:00
|
|
|
#endif
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL int transport_check_fds(rdpTransport* transport);
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL DWORD transport_get_event_handles(rdpTransport* transport, HANDLE* events,
|
|
|
|
DWORD nCount);
|
2021-09-06 12:01:36 +03:00
|
|
|
FREERDP_LOCAL HANDLE transport_get_front_bio(rdpTransport* transport);
|
2016-08-10 10:12:55 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking);
|
|
|
|
FREERDP_LOCAL void transport_set_gateway_enabled(rdpTransport* transport, BOOL GatewayEnabled);
|
|
|
|
FREERDP_LOCAL void transport_set_nla_mode(rdpTransport* transport, BOOL NlaMode);
|
2023-03-07 13:58:28 +03:00
|
|
|
FREERDP_LOCAL void transport_set_rdstls_mode(rdpTransport* transport, BOOL RdstlsMode);
|
2023-03-08 04:06:47 +03:00
|
|
|
FREERDP_LOCAL void transport_set_aad_mode(rdpTransport* transport, BOOL AadMode);
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_is_write_blocked(rdpTransport* transport);
|
|
|
|
FREERDP_LOCAL int transport_drain_output_buffer(rdpTransport* transport);
|
|
|
|
|
|
|
|
FREERDP_LOCAL wStream* transport_receive_pool_take(rdpTransport* transport);
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL int transport_receive_pool_return(rdpTransport* transport, wStream* pdu);
|
2016-08-10 10:12:55 +03:00
|
|
|
|
2022-11-15 17:04:13 +03:00
|
|
|
FREERDP_LOCAL BOOL transport_io_callback_set_event(rdpTransport* transport, BOOL set);
|
|
|
|
|
2020-09-02 14:37:04 +03:00
|
|
|
FREERDP_LOCAL const rdpTransportIo* transport_get_io_callbacks(rdpTransport* transport);
|
|
|
|
FREERDP_LOCAL BOOL transport_set_io_callbacks(rdpTransport* transport,
|
|
|
|
const rdpTransportIo* io_callbacks);
|
2021-09-06 12:01:36 +03:00
|
|
|
|
|
|
|
FREERDP_LOCAL BOOL transport_set_nla(rdpTransport* transport, rdpNla* nla);
|
|
|
|
FREERDP_LOCAL rdpNla* transport_get_nla(rdpTransport* transport);
|
|
|
|
|
|
|
|
FREERDP_LOCAL BOOL transport_set_tls(rdpTransport* transport, rdpTls* tls);
|
|
|
|
FREERDP_LOCAL rdpTls* transport_get_tls(rdpTransport* transport);
|
|
|
|
|
|
|
|
FREERDP_LOCAL BOOL transport_set_tsg(rdpTransport* transport, rdpTsg* tsg);
|
|
|
|
FREERDP_LOCAL rdpTsg* transport_get_tsg(rdpTransport* transport);
|
|
|
|
|
|
|
|
FREERDP_LOCAL wStream* transport_take_from_pool(rdpTransport* transport, size_t size);
|
|
|
|
|
|
|
|
FREERDP_LOCAL ULONG transport_get_bytes_sent(rdpTransport* transport, BOOL resetCount);
|
|
|
|
|
|
|
|
FREERDP_LOCAL BOOL transport_have_more_bytes_to_read(rdpTransport* transport);
|
|
|
|
|
|
|
|
FREERDP_LOCAL TRANSPORT_LAYER transport_get_layer(rdpTransport* transport);
|
|
|
|
FREERDP_LOCAL BOOL transport_set_layer(rdpTransport* transport, TRANSPORT_LAYER layer);
|
|
|
|
|
|
|
|
FREERDP_LOCAL BOOL transport_get_blocking(rdpTransport* transport);
|
|
|
|
FREERDP_LOCAL BOOL transport_set_blocking(rdpTransport* transport, BOOL blocking);
|
|
|
|
|
|
|
|
FREERDP_LOCAL BOOL transport_set_connected_event(rdpTransport* transport);
|
|
|
|
|
|
|
|
FREERDP_LOCAL BOOL transport_set_recv_callbacks(rdpTransport* transport, TransportRecv recv,
|
|
|
|
void* extra);
|
|
|
|
|
2021-09-08 16:47:03 +03:00
|
|
|
FREERDP_LOCAL int transport_tcp_connect(rdpTransport* transport, const char* hostname, int port,
|
|
|
|
DWORD timeout);
|
2021-09-06 12:01:36 +03:00
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL void transport_free(rdpTransport* transport);
|
2011-07-03 05:50:11 +04:00
|
|
|
|
2024-01-26 15:09:00 +03:00
|
|
|
WINPR_ATTR_MALLOC(transport_free, 1)
|
|
|
|
FREERDP_LOCAL rdpTransport* transport_new(rdpContext* context);
|
|
|
|
|
2023-06-23 01:49:27 +03:00
|
|
|
FREERDP_LOCAL void transport_set_early_user_auth_mode(rdpTransport* transport, BOOL EUAMode);
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#endif /* FREERDP_LIB_CORE_TRANSPORT_H */
|