FreeRDP
include/freerdp/peer.h
1 
20 #ifndef FREERDP_PEER_H
21 #define FREERDP_PEER_H
22 
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>
30 
31 #include <winpr/sspi.h>
32 #include <winpr/ntlm.h>
33 #include <winpr/winsock.h>
34 #include <winpr/secapi.h>
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41  typedef BOOL (*psPeerContextNew)(freerdp_peer* peer, rdpContext* context);
42  typedef void (*psPeerContextFree)(freerdp_peer* peer, rdpContext* context);
43 
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,
48  int* rcount);)
49 #endif
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,
65  BOOL automatic);
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);
70 
71  typedef BOOL (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
72  size_t size);
73  typedef BOOL (*psPeerSendChannelPacket)(freerdp_peer* client, UINT16 channelId,
74  size_t totalSize, UINT32 flags, const BYTE* data,
75  size_t chunkSize);
76  typedef BOOL (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
77  size_t size, UINT32 flags, size_t totalSize);
78 
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,
82  UINT32 length);
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);
89 
91  typedef enum
92  {
93  LICENSE_CB_INTERNAL_ERROR,
94  LICENSE_CB_ABORT,
95  LICENSE_CB_IN_PROGRESS,
97  LICENSE_CB_COMPLETED
98  } LicenseCallbackResult;
99 
100  typedef LicenseCallbackResult (*psPeerLicenseCallback)(freerdp_peer* peer, wStream* s);
101 
103  {
104  ALIGN64 rdpContext* context;
105 
106  ALIGN64 int sockfd;
107  ALIGN64 char hostname[50];
108 
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;)
114 #else
115  UINT64 reservedX[3];
116 #endif
117 
118  ALIGN64 void* ContextExtra;
119  ALIGN64 size_t ContextSize;
120  ALIGN64 psPeerContextNew ContextNew;
121  ALIGN64 psPeerContextFree ContextFree;
122 
123  ALIGN64 psPeerInitialize Initialize;
124 #if defined(WITH_FREERDP_DEPRECATED)
125  WINPR_DEPRECATED_VAR("Use freerdp_peer::GetEventHandle instead",
126  ALIGN64 psPeerGetFileDescriptor GetFileDescriptor;)
127 #else
128  UINT64 reserved;
129 #endif
130  ALIGN64 psPeerGetEventHandle GetEventHandle;
131  ALIGN64 psPeerGetReceiveEventHandle GetReceiveEventHandle;
132  ALIGN64 psPeerCheckFileDescriptor CheckFileDescriptor;
133  ALIGN64 psPeerClose Close;
134  ALIGN64 psPeerDisconnect Disconnect;
135 
136  ALIGN64 psPeerCapabilities Capabilities;
137  ALIGN64 psPeerPostConnect PostConnect;
138  ALIGN64 psPeerActivate Activate;
139  ALIGN64 psPeerLogon Logon;
140 
141  ALIGN64 psPeerSendServerRedirection SendServerRedirection;
142 
143  ALIGN64 psPeerSendChannelData SendChannelData;
144  ALIGN64 psPeerReceiveChannelData ReceiveChannelData;
145 
146  ALIGN64 psPeerVirtualChannelOpen VirtualChannelOpen;
147  ALIGN64 psPeerVirtualChannelClose VirtualChannelClose;
148  ALIGN64 psPeerVirtualChannelRead VirtualChannelRead;
149  ALIGN64 psPeerVirtualChannelWrite VirtualChannelWrite;
150  ALIGN64 psPeerVirtualChannelGetData VirtualChannelGetData;
151  ALIGN64 psPeerVirtualChannelSetData VirtualChannelSetData;
152 
153  ALIGN64 int pId;
154  ALIGN64 UINT32 ack_frame_id;
155  ALIGN64 BOOL local;
156  ALIGN64 BOOL connected;
157  ALIGN64 BOOL activated;
158  ALIGN64 BOOL authenticated;
159  ALIGN64 SEC_WINNT_AUTH_IDENTITY identity;
160 
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;)
170 #else
171  UINT64 reserved2;
172 #endif
173  ALIGN64 psPeerLicenseCallback LicenseCallback;
174 
175  ALIGN64 psPeerSendChannelPacket SendChannelPacket;
176 
187  ALIGN64 psPeerSetState SetState;
188  ALIGN64 psPeerReachedState ReachedState;
189  ALIGN64 psSspiNtlmHashCallback SspiNtlmHashCallback;
195  ALIGN64 psPeerRemoteCredentials RemoteCredentials;
196  };
197 
198  FREERDP_API void freerdp_peer_context_free(freerdp_peer* client);
199 
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);
202 
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);
205 
206  FREERDP_API void freerdp_peer_free(freerdp_peer* client);
207 
208  WINPR_ATTR_MALLOC(freerdp_peer_free, 1)
209  FREERDP_API freerdp_peer* freerdp_peer_new(int sockfd);
210 
211  FREERDP_API BOOL freerdp_peer_set_local_and_hostname(freerdp_peer* client,
212  const struct sockaddr_storage* peer_addr);
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif /* FREERDP_PEER_H */
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 ...