|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
Packit |
1fb8d4 |
* Network Transport Layer
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Copyright 2011 Vic Lee
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit |
1fb8d4 |
* you may not use this file except in compliance with the License.
|
|
Packit |
1fb8d4 |
* You may obtain a copy of the License at
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
1fb8d4 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
1fb8d4 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
1fb8d4 |
* See the License for the specific language governing permissions and
|
|
Packit |
1fb8d4 |
* limitations under the License.
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifndef FREERDP_LIB_CORE_TRANSPORT_H
|
|
Packit |
1fb8d4 |
#define FREERDP_LIB_CORE_TRANSPORT_H
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
typedef enum
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
TRANSPORT_LAYER_TCP,
|
|
Packit |
1fb8d4 |
TRANSPORT_LAYER_TLS,
|
|
Packit |
1fb8d4 |
TRANSPORT_LAYER_TSG,
|
|
Packit |
1fb8d4 |
TRANSPORT_LAYER_TSG_TLS,
|
|
Packit |
1fb8d4 |
TRANSPORT_LAYER_CLOSED
|
|
Packit |
1fb8d4 |
} TRANSPORT_LAYER;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
typedef struct rdp_transport rdpTransport;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include "tcp.h"
|
|
Packit |
1fb8d4 |
#include "nla.h"
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include "gateway/tsg.h"
|
|
Packit |
1fb8d4 |
#include "gateway/rdg.h"
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <winpr/sspi.h>
|
|
Packit |
1fb8d4 |
#include <winpr/wlog.h>
|
|
Packit |
1fb8d4 |
#include <winpr/synch.h>
|
|
Packit |
1fb8d4 |
#include <winpr/thread.h>
|
|
Packit |
1fb8d4 |
#include <winpr/stream.h>
|
|
Packit |
1fb8d4 |
#include <winpr/collections.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <freerdp/api.h>
|
|
Packit |
1fb8d4 |
#include <freerdp/crypto/tls.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <time.h>
|
|
Packit |
1fb8d4 |
#include <freerdp/types.h>
|
|
Packit |
1fb8d4 |
#include <freerdp/settings.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
typedef int (*TransportRecv)(rdpTransport* transport, wStream* stream,
|
|
Packit |
1fb8d4 |
void* extra);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
struct rdp_transport
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
TRANSPORT_LAYER layer;
|
|
Packit |
1fb8d4 |
BIO* frontBio;
|
|
Packit |
1fb8d4 |
rdpRdg* rdg;
|
|
Packit |
1fb8d4 |
rdpTsg* tsg;
|
|
Packit |
1fb8d4 |
rdpTls* tls;
|
|
Packit |
1fb8d4 |
rdpContext* context;
|
|
Packit |
1fb8d4 |
rdpNla* nla;
|
|
Packit |
1fb8d4 |
rdpSettings* settings;
|
|
Packit |
1fb8d4 |
void* ReceiveExtra;
|
|
Packit |
1fb8d4 |
wStream* ReceiveBuffer;
|
|
Packit |
1fb8d4 |
TransportRecv ReceiveCallback;
|
|
Packit |
1fb8d4 |
wStreamPool* ReceivePool;
|
|
Packit |
1fb8d4 |
HANDLE connectedEvent;
|
|
Packit |
1fb8d4 |
BOOL NlaMode;
|
|
Packit |
1fb8d4 |
BOOL blocking;
|
|
Packit |
1fb8d4 |
BOOL GatewayEnabled;
|
|
Packit |
1fb8d4 |
CRITICAL_SECTION ReadLock;
|
|
Packit |
1fb8d4 |
CRITICAL_SECTION WriteLock;
|
|
Packit |
1fb8d4 |
ULONG written;
|
|
Packit |
1fb8d4 |
HANDLE rereadEvent;
|
|
Packit |
1fb8d4 |
BOOL haveMoreBytesToRead;
|
|
Packit |
1fb8d4 |
wLog* log;
|
|
Packit |
1fb8d4 |
};
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL wStream* transport_send_stream_init(rdpTransport* transport,
|
|
Packit |
1fb8d4 |
int size);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_connect(rdpTransport* transport,
|
|
Packit |
1fb8d4 |
const char* hostname, UINT16 port, int timeout);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_attach(rdpTransport* transport, int sockfd);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_disconnect(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_connect_rdp(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_connect_tls(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_connect_nla(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_accept_rdp(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_accept_tls(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_accept_nla(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL int transport_read_pdu(rdpTransport* transport, wStream* s);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL int transport_write(rdpTransport* transport, wStream* s);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL void transport_get_fds(rdpTransport* transport, void** rfds,
|
|
Packit |
1fb8d4 |
int* rcount);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL int transport_check_fds(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL DWORD transport_get_event_handles(rdpTransport* transport,
|
|
Packit |
1fb8d4 |
HANDLE* events, DWORD nCount);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_set_blocking_mode(rdpTransport* transport,
|
|
Packit |
1fb8d4 |
BOOL blocking);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL void transport_set_gateway_enabled(rdpTransport* transport,
|
|
Packit |
1fb8d4 |
BOOL GatewayEnabled);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL void transport_set_nla_mode(rdpTransport* transport,
|
|
Packit |
1fb8d4 |
BOOL NlaMode);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL BOOL transport_is_write_blocked(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL int transport_drain_output_buffer(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL wStream* transport_receive_pool_take(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL int transport_receive_pool_return(rdpTransport* transport,
|
|
Packit |
1fb8d4 |
wStream* pdu);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL rdpTransport* transport_new(rdpContext* context);
|
|
Packit |
1fb8d4 |
FREERDP_LOCAL void transport_free(rdpTransport* transport);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#endif /* FREERDP_LIB_CORE_TRANSPORT_H */
|