FreeRDP
server/rdpdr.h
1 
23 #ifndef FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H
24 #define FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H
25 
26 #include <freerdp/api.h>
27 #include <freerdp/types.h>
28 #include <freerdp/channels/wtsvc.h>
29 #include <freerdp/channels/rdpdr.h>
30 #include <freerdp/utils/rdpdr_utils.h>
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
41  typedef struct s_rdpdr_server_context RdpdrServerContext;
42  typedef struct s_rdpdr_server_private RdpdrServerPrivate;
43 
44  typedef struct
45  {
46  UINT16 Component;
47  UINT16 PacketId;
48  } RDPDR_HEADER;
49 
50 #ifndef __MINGW32__
51 typedef struct
52 {
53  UINT32 NextEntryOffset;
54  UINT32 FileIndex;
55  LARGE_INTEGER CreationTime;
56  LARGE_INTEGER LastAccessTime;
57  LARGE_INTEGER LastWriteTime;
58  LARGE_INTEGER ChangeTime;
59  LARGE_INTEGER EndOfFile;
60  LARGE_INTEGER AllocationSize;
61  UINT32 FileAttributes;
62  char FileName[512];
64 #endif
65 
66 typedef UINT (*psRdpdrStart)(RdpdrServerContext* context);
67 typedef UINT (*psRdpdrStop)(RdpdrServerContext* context);
68 
69 typedef UINT (*psRdpdrCapablityPDU)(RdpdrServerContext* context,
70  const RDPDR_CAPABILITY_HEADER* header, size_t size,
71  const BYTE* data);
72 typedef UINT (*psRdpdrReceivePDU)(RdpdrServerContext* context, const RDPDR_HEADER* header,
73  UINT error);
74 typedef UINT (*psRdpdrReceiveAnnounceResponse)(RdpdrServerContext* context, UINT16 VersionMajor,
75  UINT16 VersionMinor, UINT32 ClientId);
76 typedef UINT (*psRdpdrSendServerAnnounce)(RdpdrServerContext* context);
77 typedef UINT (*psRdpdrReceiveDeviceAnnounce)(RdpdrServerContext* context,
78  const RdpdrDevice* device);
79 typedef UINT (*psRdpdrReceiveDeviceRemove)(RdpdrServerContext* context, UINT32 deviceId,
80  const RdpdrDevice* device);
81 typedef UINT (*psRdpdrReceiveClientNameRequest)(RdpdrServerContext* context, size_t ComputerNameLen,
82  const char* name);
83 
84 typedef UINT (*psRdpdrDriveCreateDirectory)(RdpdrServerContext* context, void* callbackData,
85  UINT32 deviceId, const char* path);
86 typedef UINT (*psRdpdrDriveDeleteDirectory)(RdpdrServerContext* context, void* callbackData,
87  UINT32 deviceId, const char* path);
88 typedef UINT (*psRdpdrDriveQueryDirectory)(RdpdrServerContext* context, void* callbackData,
89  UINT32 deviceId, const char* path);
90 typedef UINT (*psRdpdrDriveOpenFile)(RdpdrServerContext* context, void* callbackData,
91  UINT32 deviceId, const char* path, UINT32 desiredAccess,
92  UINT32 createDisposition);
93 typedef UINT (*psRdpdrDriveReadFile)(RdpdrServerContext* context, void* callbackData,
94  UINT32 deviceId, UINT32 fileId, UINT32 length, UINT32 offset);
95 typedef UINT (*psRdpdrDriveWriteFile)(RdpdrServerContext* context, void* callbackData,
96  UINT32 deviceId, UINT32 fileId, const char* buffer,
97  UINT32 length, UINT32 offset);
98 typedef UINT (*psRdpdrDriveCloseFile)(RdpdrServerContext* context, void* callbackData,
99  UINT32 deviceId, UINT32 fileId);
100 typedef UINT (*psRdpdrDriveDeleteFile)(RdpdrServerContext* context, void* callbackData,
101  UINT32 deviceId, const char* path);
102 typedef UINT (*psRdpdrDriveRenameFile)(RdpdrServerContext* context, void* callbackData,
103  UINT32 deviceId, const char* oldPath, const char* newPath);
104 
105 typedef void (*psRdpdrOnDriveCreateDirectoryComplete)(RdpdrServerContext* context,
106  void* callbackData, UINT32 ioStatus);
107 typedef void (*psRdpdrOnDriveDeleteDirectoryComplete)(RdpdrServerContext* context,
108  void* callbackData, UINT32 ioStatus);
109 typedef void (*psRdpdrOnDriveQueryDirectoryComplete)(RdpdrServerContext* context,
110  void* callbackData, UINT32 ioStatus,
112 typedef void (*psRdpdrOnDriveOpenFileComplete)(RdpdrServerContext* context, void* callbackData,
113  UINT32 ioStatus, UINT32 deviceId, UINT32 fileId);
114 typedef void (*psRdpdrOnDriveReadFileComplete)(RdpdrServerContext* context, void* callbackData,
115  UINT32 ioStatus, const char* buffer, UINT32 length);
116 typedef void (*psRdpdrOnDriveWriteFileComplete)(RdpdrServerContext* context, void* callbackData,
117  UINT32 ioStatus, UINT32 bytesWritten);
118 typedef void (*psRdpdrOnDriveCloseFileComplete)(RdpdrServerContext* context, void* callbackData,
119  UINT32 ioStatus);
120 typedef void (*psRdpdrOnDriveDeleteFileComplete)(RdpdrServerContext* context, void* callbackData,
121  UINT32 ioStatus);
122 typedef void (*psRdpdrOnDriveRenameFileComplete)(RdpdrServerContext* context, void* callbackData,
123  UINT32 ioStatus);
124 
125 typedef UINT (*psRdpdrOnDeviceCreate)(RdpdrServerContext* context, const RdpdrDevice* device);
126 typedef UINT (*psRdpdrOnDeviceDelete)(RdpdrServerContext* context, UINT32 deviceId);
127 
129 {
130  HANDLE vcm;
131 
132  psRdpdrStart Start;
133  psRdpdrStop Stop;
134 
135  RdpdrServerPrivate* priv;
136 
137  /* Server self-defined pointer. */
138  void* data;
139 
147  UINT16 supported;
148 
149  /*** RDPDR message intercept callbacks */
150  psRdpdrCapablityPDU ReceiveCaps;
151  psRdpdrCapablityPDU SendCaps;
152  psRdpdrReceivePDU ReceivePDU;
153  psRdpdrSendServerAnnounce
155  psRdpdrReceiveAnnounceResponse
157  psRdpdrReceiveClientNameRequest
159  psRdpdrReceiveDeviceAnnounce
160  ReceiveDeviceAnnounce;
162  psRdpdrReceiveDeviceRemove ReceiveDeviceRemove;
165  /*** Drive APIs called by the server. ***/
166  psRdpdrDriveCreateDirectory DriveCreateDirectory;
167  psRdpdrDriveDeleteDirectory DriveDeleteDirectory;
168  psRdpdrDriveQueryDirectory DriveQueryDirectory;
169  psRdpdrDriveOpenFile DriveOpenFile;
170  psRdpdrDriveReadFile DriveReadFile;
171  psRdpdrDriveWriteFile DriveWriteFile;
172  psRdpdrDriveCloseFile DriveCloseFile;
173  psRdpdrDriveDeleteFile DriveDeleteFile;
174  psRdpdrDriveRenameFile DriveRenameFile;
175 
176  /*** Drive callbacks registered by the server. ***/
177  psRdpdrOnDeviceCreate OnDriveCreate;
179  psRdpdrOnDeviceDelete OnDriveDelete;
181  psRdpdrOnDriveCreateDirectoryComplete OnDriveCreateDirectoryComplete;
182  psRdpdrOnDriveDeleteDirectoryComplete OnDriveDeleteDirectoryComplete;
183  psRdpdrOnDriveQueryDirectoryComplete OnDriveQueryDirectoryComplete;
184  psRdpdrOnDriveOpenFileComplete OnDriveOpenFileComplete;
185  psRdpdrOnDriveReadFileComplete OnDriveReadFileComplete;
186  psRdpdrOnDriveWriteFileComplete OnDriveWriteFileComplete;
187  psRdpdrOnDriveCloseFileComplete OnDriveCloseFileComplete;
188  psRdpdrOnDriveDeleteFileComplete OnDriveDeleteFileComplete;
189  psRdpdrOnDriveRenameFileComplete OnDriveRenameFileComplete;
190 
191  /*** Serial Port callbacks registered by the server. ***/
192  psRdpdrOnDeviceCreate OnSerialPortCreate;
194  psRdpdrOnDeviceDelete OnSerialPortDelete;
197  /*** Parallel Port callbacks registered by the server. ***/
198  psRdpdrOnDeviceCreate OnParallelPortCreate;
200  psRdpdrOnDeviceDelete OnParallelPortDelete;
203  /*** Printer callbacks registered by the server. ***/
204  psRdpdrOnDeviceCreate OnPrinterCreate;
206  psRdpdrOnDeviceDelete OnPrinterDelete;
209  /*** Smartcard callbacks registered by the server. ***/
210  psRdpdrOnDeviceCreate OnSmartcardCreate;
212  psRdpdrOnDeviceDelete OnSmartcardDelete;
215  rdpContext* rdpcontext;
216 };
217 
218 FREERDP_API void rdpdr_server_context_free(RdpdrServerContext* context);
219 
220 WINPR_ATTR_MALLOC(rdpdr_server_context_free, 1)
221 FREERDP_API RdpdrServerContext* rdpdr_server_context_new(HANDLE vcm);
222 
223 #ifdef __cplusplus
224 }
225 #endif
226 
227 #endif /* FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H */
psRdpdrOnDeviceDelete OnParallelPortDelete
Definition: server/rdpdr.h:200
psRdpdrReceiveDeviceRemove ReceiveDeviceRemove
Definition: server/rdpdr.h:162
psRdpdrReceiveAnnounceResponse ReceiveAnnounceResponse
Definition: server/rdpdr.h:156
psRdpdrOnDeviceCreate OnSerialPortCreate
Definition: server/rdpdr.h:192
psRdpdrSendServerAnnounce SendServerAnnounce
Definition: server/rdpdr.h:154
psRdpdrOnDeviceDelete OnPrinterDelete
Definition: server/rdpdr.h:206
psRdpdrOnDeviceDelete OnDriveDelete
Definition: server/rdpdr.h:179
psRdpdrOnDeviceDelete OnSerialPortDelete
Definition: server/rdpdr.h:194
psRdpdrOnDeviceCreate OnDriveCreate
Definition: server/rdpdr.h:177
psRdpdrOnDeviceCreate OnParallelPortCreate
Definition: server/rdpdr.h:198
psRdpdrOnDeviceCreate OnPrinterCreate
Definition: server/rdpdr.h:204
psRdpdrReceiveClientNameRequest ReceiveClientNameRequest
Definition: server/rdpdr.h:158
psRdpdrOnDeviceCreate OnSmartcardCreate
Definition: server/rdpdr.h:210
psRdpdrOnDeviceDelete OnSmartcardDelete
Definition: server/rdpdr.h:212
psRdpdrCapablityPDU ReceiveCaps
Definition: server/rdpdr.h:150
psRdpdrCapablityPDU SendCaps
Definition: server/rdpdr.h:151
psRdpdrReceivePDU ReceivePDU
Definition: server/rdpdr.h:152