20 #ifndef FREERDP_PEER_H
21 #define FREERDP_PEER_H
23 #include <freerdp/api.h>
24 #include <freerdp/types.h>
25 #include <freerdp/settings.h>
26 #include <freerdp/input.h>
27 #include <freerdp/update.h>
28 #include <freerdp/autodetect.h>
29 #include <freerdp/redirection.h>
31 #include <winpr/sspi.h>
32 #include <winpr/ntlm.h>
33 #include <winpr/winsock.h>
34 #include <winpr/secapi.h>
41 typedef BOOL (*psPeerContextNew)(freerdp_peer* peer, rdpContext* context);
42 typedef void (*psPeerContextFree)(freerdp_peer* peer, rdpContext* context);
44 typedef BOOL (*psPeerInitialize)(freerdp_peer* peer);
45 #if defined(WITH_FREERDP_DEPRECATED)
46 WINPR_DEPRECATED_VAR(
"Use psPeerGetEventHandle instead",
47 typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* peer,
void** rfds,
50 typedef HANDLE (*psPeerGetEventHandle)(freerdp_peer* peer);
51 typedef DWORD (*psPeerGetEventHandles)(freerdp_peer* peer, HANDLE* events, DWORD count);
52 typedef HANDLE (*psPeerGetReceiveEventHandle)(freerdp_peer* peer);
53 typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* peer);
54 typedef BOOL (*psPeerIsWriteBlocked)(freerdp_peer* peer);
55 typedef int (*psPeerDrainOutputBuffer)(freerdp_peer* peer);
56 typedef BOOL (*psPeerHasMoreToRead)(freerdp_peer* peer);
57 typedef BOOL (*psPeerClose)(freerdp_peer* peer);
58 typedef void (*psPeerDisconnect)(freerdp_peer* peer);
59 typedef BOOL (*psPeerRemoteCredentials)(freerdp_peer* peer,
KERB_TICKET_LOGON* logonCreds,
61 typedef BOOL (*psPeerCapabilities)(freerdp_peer* peer);
62 typedef BOOL (*psPeerPostConnect)(freerdp_peer* peer);
63 typedef BOOL (*psPeerActivate)(freerdp_peer* peer);
64 typedef BOOL (*psPeerLogon)(freerdp_peer* peer,
const SEC_WINNT_AUTH_IDENTITY* identity,
66 typedef BOOL (*psPeerSendServerRedirection)(freerdp_peer* peer,
67 const rdpRedirection* redirection);
68 typedef BOOL (*psPeerAdjustMonitorsLayout)(freerdp_peer* peer);
69 typedef BOOL (*psPeerClientCapabilities)(freerdp_peer* peer);
71 typedef BOOL (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId,
const BYTE* data,
73 typedef BOOL (*psPeerSendChannelPacket)(freerdp_peer* client, UINT16 channelId,
74 size_t totalSize, UINT32 flags,
const BYTE* data,
76 typedef BOOL (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId,
const BYTE* data,
77 size_t size, UINT32 flags,
size_t totalSize);
79 typedef HANDLE (*psPeerVirtualChannelOpen)(freerdp_peer* peer,
const char* name, UINT32 flags);
80 typedef BOOL (*psPeerVirtualChannelClose)(freerdp_peer* peer, HANDLE hChannel);
81 typedef int (*psPeerVirtualChannelRead)(freerdp_peer* peer, HANDLE hChannel, BYTE* buffer,
83 typedef int (*psPeerVirtualChannelWrite)(freerdp_peer* peer, HANDLE hChannel,
84 const BYTE* buffer, UINT32 length);
85 typedef void* (*psPeerVirtualChannelGetData)(freerdp_peer* peer, HANDLE hChannel);
86 typedef int (*psPeerVirtualChannelSetData)(freerdp_peer* peer, HANDLE hChannel,
void* data);
87 typedef BOOL (*psPeerSetState)(freerdp_peer* peer, CONNECTION_STATE state);
88 typedef BOOL (*psPeerReachedState)(freerdp_peer* peer, CONNECTION_STATE state);
93 LICENSE_CB_INTERNAL_ERROR,
95 LICENSE_CB_IN_PROGRESS,
98 } LicenseCallbackResult;
100 typedef LicenseCallbackResult (*psPeerLicenseCallback)(freerdp_peer* peer,
wStream* s);
104 ALIGN64 rdpContext* context;
107 ALIGN64
char hostname[50];
109 #if defined(WITH_FREERDP_DEPRECATED)
110 WINPR_DEPRECATED_VAR(
"Use rdpContext::update instead", ALIGN64 rdpUpdate* update;)
111 WINPR_DEPRECATED_VAR(
"Use rdpContext::settings instead", ALIGN64 rdpSettings* settings;)
112 WINPR_DEPRECATED_VAR(
"Use rdpContext::autodetect instead",
113 ALIGN64 rdpAutoDetect* autodetect;)
118 ALIGN64
void* ContextExtra;
119 ALIGN64
size_t ContextSize;
120 ALIGN64 psPeerContextNew ContextNew;
121 ALIGN64 psPeerContextFree ContextFree;
123 ALIGN64 psPeerInitialize Initialize;
124 #if defined(WITH_FREERDP_DEPRECATED)
125 WINPR_DEPRECATED_VAR(
"Use freerdp_peer::GetEventHandle instead",
126 ALIGN64 psPeerGetFileDescriptor GetFileDescriptor;)
130 ALIGN64 psPeerGetEventHandle GetEventHandle;
131 ALIGN64 psPeerGetReceiveEventHandle GetReceiveEventHandle;
132 ALIGN64 psPeerCheckFileDescriptor CheckFileDescriptor;
133 ALIGN64 psPeerClose Close;
134 ALIGN64 psPeerDisconnect Disconnect;
136 ALIGN64 psPeerCapabilities Capabilities;
137 ALIGN64 psPeerPostConnect PostConnect;
138 ALIGN64 psPeerActivate Activate;
139 ALIGN64 psPeerLogon Logon;
141 ALIGN64 psPeerSendServerRedirection SendServerRedirection;
143 ALIGN64 psPeerSendChannelData SendChannelData;
144 ALIGN64 psPeerReceiveChannelData ReceiveChannelData;
146 ALIGN64 psPeerVirtualChannelOpen VirtualChannelOpen;
147 ALIGN64 psPeerVirtualChannelClose VirtualChannelClose;
148 ALIGN64 psPeerVirtualChannelRead VirtualChannelRead;
149 ALIGN64 psPeerVirtualChannelWrite VirtualChannelWrite;
150 ALIGN64 psPeerVirtualChannelGetData VirtualChannelGetData;
151 ALIGN64 psPeerVirtualChannelSetData VirtualChannelSetData;
154 ALIGN64 UINT32 ack_frame_id;
156 ALIGN64 BOOL connected;
157 ALIGN64 BOOL activated;
158 ALIGN64 BOOL authenticated;
159 ALIGN64 SEC_WINNT_AUTH_IDENTITY identity;
161 ALIGN64 psPeerIsWriteBlocked IsWriteBlocked;
162 ALIGN64 psPeerDrainOutputBuffer DrainOutputBuffer;
163 ALIGN64 psPeerHasMoreToRead HasMoreToRead;
164 ALIGN64 psPeerGetEventHandles GetEventHandles;
165 ALIGN64 psPeerAdjustMonitorsLayout AdjustMonitorsLayout;
166 ALIGN64 psPeerClientCapabilities ClientCapabilities;
167 #if defined(WITH_FREERDP_DEPRECATED)
168 WINPR_DEPRECATED_VAR(
"Use freerdp_peer::SspiNtlmHashCallback instead",
169 ALIGN64 psPeerComputeNtlmHash ComputeNtlmHash;)
173 ALIGN64 psPeerLicenseCallback LicenseCallback;
175 ALIGN64 psPeerSendChannelPacket SendChannelPacket;
188 ALIGN64 psPeerReachedState ReachedState;
189 ALIGN64 psSspiNtlmHashCallback SspiNtlmHashCallback;
198 FREERDP_API
void freerdp_peer_context_free(freerdp_peer* client);
200 FREERDP_API BOOL freerdp_peer_context_new(freerdp_peer* client);
201 FREERDP_API BOOL freerdp_peer_context_new_ex(freerdp_peer* client,
const rdpSettings* settings);
203 FREERDP_API
const char* freerdp_peer_os_major_type_string(freerdp_peer* client);
204 FREERDP_API
const char* freerdp_peer_os_minor_type_string(freerdp_peer* client);
206 FREERDP_API
void freerdp_peer_free(freerdp_peer* client);
208 WINPR_ATTR_MALLOC(freerdp_peer_free, 1)
209 FREERDP_API freerdp_peer* freerdp_peer_new(
int sockfd);
211 FREERDP_API BOOL freerdp_peer_set_local_and_hostname(freerdp_peer* client,
212 const struct sockaddr_storage* peer_addr);
ALIGN64 psPeerSetState SetState
SetState Function pointer allowing to manually set the state of the internal state machine.
ALIGN64 psPeerRemoteCredentials RemoteCredentials
RemoteCredentials Function pointer that will be called when remote credentials guard are used by the ...