typedef BOOL (*psPeerInitialize)(freerdp_peer* client);
typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* client, void** rfds, int* rcount);
+typedef HANDLE (*psPeerGetEventHandle)(freerdp_peer* client);
typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* client);
typedef BOOL (*psPeerClose)(freerdp_peer* client);
typedef void (*psPeerDisconnect)(freerdp_peer* client);
psPeerInitialize Initialize;
psPeerGetFileDescriptor GetFileDescriptor;
+ psPeerGetEventHandle GetEventHandle;
psPeerCheckFileDescriptor CheckFileDescriptor;
psPeerClose Close;
psPeerDisconnect Disconnect;
return TRUE;
}
+static HANDLE freerdp_peer_get_event_handle(freerdp_peer* client)
+{
+ return client->context->rdp->transport->TcpIn->event;
+}
+
static BOOL freerdp_peer_check_fds(freerdp_peer* client)
{
int status;
freerdp_tcp_set_no_delay(sockfd, TRUE);
- if (client != NULL)
+ if (client)
{
client->sockfd = sockfd;
client->ContextSize = sizeof(rdpContext);
client->Initialize = freerdp_peer_initialize;
client->GetFileDescriptor = freerdp_peer_get_fds;
+ client->GetEventHandle = freerdp_peer_get_event_handle;
client->CheckFileDescriptor = freerdp_peer_check_fds;
client->Close = freerdp_peer_close;
client->Disconnect = freerdp_peer_disconnect;
return TRUE;
}
+int tcp_attach(rdpTcp* tcp, int sockfd)
+{
+ tcp->sockfd = sockfd;
+ SetEventFileDescriptor(tcp->event, tcp->sockfd);
+ return 0;
+}
+
HANDLE tcp_get_event_handle(rdpTcp* tcp)
{
#ifndef _WIN32
int tcp_wait_write(rdpTcp* tcp);
BOOL tcp_set_blocking_mode(rdpTcp* tcp, BOOL blocking);
BOOL tcp_set_keep_alive_mode(rdpTcp* tcp);
+int tcp_attach(rdpTcp* tcp, int sockfd);
HANDLE tcp_get_event_handle(rdpTcp* tcp);
rdpTcp* tcp_new(rdpSettings* settings);
void transport_attach(rdpTransport* transport, int sockfd)
{
- transport->TcpIn->sockfd = sockfd;
-
+ tcp_attach(transport->TcpIn, sockfd);
transport->SplitInputOutput = FALSE;
transport->TcpOut = transport->TcpIn;
}