keeping the old callback and adding the new one at the end of the struct, so that it can be potentially binary compatible.

This commit is contained in:
zihao.jiang 2016-10-29 00:28:10 +08:00
parent ddc326d6d3
commit b58ee586e7
2 changed files with 12 additions and 1 deletions

View File

@ -34,6 +34,7 @@ typedef void (*psPeerContextFree)(freerdp_peer* peer, rdpContext* context);
typedef BOOL (*psPeerInitialize)(freerdp_peer* peer);
typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* peer, void** rfds, int* rcount);
typedef HANDLE(*psPeerGetEventHandle)(freerdp_peer* peer);
typedef DWORD (*psPeerGetEventHandles)(freerdp_peer* peer, HANDLE* events, DWORD count);
typedef HANDLE(*psPeerGetReceiveEventHandle)(freerdp_peer* peer);
typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* peer);
@ -79,7 +80,7 @@ struct rdp_freerdp_peer
psPeerInitialize Initialize;
psPeerGetFileDescriptor GetFileDescriptor;
psPeerGetEventHandles GetEventHandles;
psPeerGetEventHandle GetEventHandle;
psPeerGetReceiveEventHandle GetReceiveEventHandle;
psPeerCheckFileDescriptor CheckFileDescriptor;
psPeerClose Close;
@ -111,6 +112,7 @@ struct rdp_freerdp_peer
psPeerIsWriteBlocked IsWriteBlocked;
psPeerDrainOutputBuffer DrainOutputBuffer;
psPeerHasMoreToRead HasMoreToRead;
psPeerGetEventHandles GetEventHandles;
};
#ifdef __cplusplus

View File

@ -248,6 +248,14 @@ static BOOL freerdp_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount)
return TRUE;
}
static HANDLE freerdp_peer_get_event_handle(freerdp_peer* client)
{
HANDLE hEvent = NULL;
rdpTransport* transport = client->context->rdp->transport;
BIO_get_event(transport->frontBio, &hEvent);
return hEvent;
}
static DWORD freerdp_peer_get_event_handles(freerdp_peer* client, HANDLE* events, DWORD count)
{
DWORD nCount = 0;
@ -807,6 +815,7 @@ freerdp_peer* freerdp_peer_new(int sockfd)
client->ContextSize = sizeof(rdpContext);
client->Initialize = freerdp_peer_initialize;
client->GetFileDescriptor = freerdp_peer_get_fds;
client->GetEventHandle = freerdp_peer_get_event_handle;
client->GetEventHandles = freerdp_peer_get_event_handles;
client->CheckFileDescriptor = freerdp_peer_check_fds;
client->Close = freerdp_peer_close;