cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

rdpdr.h (8131B)


      1/**
      2 * FreeRDP: A Remote Desktop Protocol Implementation
      3 * Device Redirection Virtual Channel Server Interface
      4 *
      5 * Copyright 2014 Dell Software <Mike.McDonald@software.dell.com>
      6 * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
      7 * Copyright 2015 Thincast Technologies GmbH
      8 * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
      9 *
     10 * Licensed under the Apache License, Version 2.0 (the "License");
     11 * you may not use this file except in compliance with the License.
     12 * You may obtain a copy of the License at
     13 *
     14 *     http://www.apache.org/licenses/LICENSE-2.0
     15 *
     16 * Unless required by applicable law or agreed to in writing, software
     17 * distributed under the License is distributed on an "AS IS" BASIS,
     18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     19 * See the License for the specific language governing permissions and
     20 * limitations under the License.
     21 */
     22
     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
     31/**
     32 * Server Interface
     33 */
     34
     35typedef struct _rdpdr_server_context RdpdrServerContext;
     36typedef struct _rdpdr_server_private RdpdrServerPrivate;
     37
     38struct _FILE_DIRECTORY_INFORMATION
     39{
     40	UINT32 NextEntryOffset;
     41	UINT32 FileIndex;
     42	UINT64 CreationTime;
     43	UINT64 LastAccessTime;
     44	UINT64 LastWriteTime;
     45	UINT64 ChangeTime;
     46	UINT64 EndOfFile;
     47	UINT64 AllocationSize;
     48	UINT32 FileAttributes;
     49	char FileName[512];
     50};
     51typedef struct _FILE_DIRECTORY_INFORMATION FILE_DIRECTORY_INFORMATION;
     52
     53typedef UINT (*psRdpdrStart)(RdpdrServerContext* context);
     54typedef UINT (*psRdpdrStop)(RdpdrServerContext* context);
     55
     56typedef UINT (*psRdpdrDriveCreateDirectory)(RdpdrServerContext* context, void* callbackData,
     57                                            UINT32 deviceId, const char* path);
     58typedef UINT (*psRdpdrDriveDeleteDirectory)(RdpdrServerContext* context, void* callbackData,
     59                                            UINT32 deviceId, const char* path);
     60typedef UINT (*psRdpdrDriveQueryDirectory)(RdpdrServerContext* context, void* callbackData,
     61                                           UINT32 deviceId, const char* path);
     62typedef UINT (*psRdpdrDriveOpenFile)(RdpdrServerContext* context, void* callbackData,
     63                                     UINT32 deviceId, const char* path, UINT32 desiredAccess,
     64                                     UINT32 createDisposition);
     65typedef UINT (*psRdpdrDriveReadFile)(RdpdrServerContext* context, void* callbackData,
     66                                     UINT32 deviceId, UINT32 fileId, UINT32 length, UINT32 offset);
     67typedef UINT (*psRdpdrDriveWriteFile)(RdpdrServerContext* context, void* callbackData,
     68                                      UINT32 deviceId, UINT32 fileId, const char* buffer,
     69                                      UINT32 length, UINT32 offset);
     70typedef UINT (*psRdpdrDriveCloseFile)(RdpdrServerContext* context, void* callbackData,
     71                                      UINT32 deviceId, UINT32 fileId);
     72typedef UINT (*psRdpdrDriveDeleteFile)(RdpdrServerContext* context, void* callbackData,
     73                                       UINT32 deviceId, const char* path);
     74typedef UINT (*psRdpdrDriveRenameFile)(RdpdrServerContext* context, void* callbackData,
     75                                       UINT32 deviceId, const char* oldPath, const char* newPath);
     76
     77typedef void (*psRdpdrOnDriveCreate)(RdpdrServerContext* context, UINT32 deviceId,
     78                                     const char* name);
     79typedef void (*psRdpdrOnDriveDelete)(RdpdrServerContext* context, UINT32 deviceId);
     80typedef void (*psRdpdrOnDriveCreateDirectoryComplete)(RdpdrServerContext* context,
     81                                                      void* callbackData, UINT32 ioStatus);
     82typedef void (*psRdpdrOnDriveDeleteDirectoryComplete)(RdpdrServerContext* context,
     83                                                      void* callbackData, UINT32 ioStatus);
     84typedef void (*psRdpdrOnDriveQueryDirectoryComplete)(RdpdrServerContext* context,
     85                                                     void* callbackData, UINT32 ioStatus,
     86                                                     FILE_DIRECTORY_INFORMATION* fdi);
     87typedef void (*psRdpdrOnDriveOpenFileComplete)(RdpdrServerContext* context, void* callbackData,
     88                                               UINT32 ioStatus, UINT32 deviceId, UINT32 fileId);
     89typedef void (*psRdpdrOnDriveReadFileComplete)(RdpdrServerContext* context, void* callbackData,
     90                                               UINT32 ioStatus, const char* buffer, UINT32 length);
     91typedef void (*psRdpdrOnDriveWriteFileComplete)(RdpdrServerContext* context, void* callbackData,
     92                                                UINT32 ioStatus, UINT32 bytesWritten);
     93typedef void (*psRdpdrOnDriveCloseFileComplete)(RdpdrServerContext* context, void* callbackData,
     94                                                UINT32 ioStatus);
     95typedef void (*psRdpdrOnDriveDeleteFileComplete)(RdpdrServerContext* context, void* callbackData,
     96                                                 UINT32 ioStatus);
     97typedef void (*psRdpdrOnDriveRenameFileComplete)(RdpdrServerContext* context, void* callbackData,
     98                                                 UINT32 ioStatus);
     99
    100typedef void (*psRdpdrOnPortCreate)(RdpdrServerContext* context, UINT32 deviceId, const char* name);
    101typedef void (*psRdpdrOnPortDelete)(RdpdrServerContext* context, UINT32 deviceId);
    102
    103typedef void (*psRdpdrOnPrinterCreate)(RdpdrServerContext* context, UINT32 deviceId,
    104                                       const char* name);
    105typedef void (*psRdpdrOnPrinterDelete)(RdpdrServerContext* context, UINT32 deviceId);
    106
    107typedef void (*psRdpdrOnSmartcardCreate)(RdpdrServerContext* context, UINT32 deviceId,
    108                                         const char* name);
    109typedef void (*psRdpdrOnSmartcardDelete)(RdpdrServerContext* context, UINT32 deviceId);
    110
    111struct _rdpdr_server_context
    112{
    113	HANDLE vcm;
    114
    115	psRdpdrStart Start;
    116	psRdpdrStop Stop;
    117
    118	RdpdrServerPrivate* priv;
    119
    120	/* Server self-defined pointer. */
    121	void* data;
    122
    123	/* Server supported redirections. Set by server. */
    124	BOOL supportsDrives;
    125	BOOL supportsPorts;
    126	BOOL supportsPrinters;
    127	BOOL supportsSmartcards;
    128
    129	/*** Drive APIs called by the server. ***/
    130	psRdpdrDriveCreateDirectory DriveCreateDirectory;
    131	psRdpdrDriveDeleteDirectory DriveDeleteDirectory;
    132	psRdpdrDriveQueryDirectory DriveQueryDirectory;
    133	psRdpdrDriveOpenFile DriveOpenFile;
    134	psRdpdrDriveReadFile DriveReadFile;
    135	psRdpdrDriveWriteFile DriveWriteFile;
    136	psRdpdrDriveCloseFile DriveCloseFile;
    137	psRdpdrDriveDeleteFile DriveDeleteFile;
    138	psRdpdrDriveRenameFile DriveRenameFile;
    139
    140	/*** Drive callbacks registered by the server. ***/
    141	psRdpdrOnDriveCreate OnDriveCreate;
    142	psRdpdrOnDriveDelete OnDriveDelete;
    143	psRdpdrOnDriveCreateDirectoryComplete OnDriveCreateDirectoryComplete;
    144	psRdpdrOnDriveDeleteDirectoryComplete OnDriveDeleteDirectoryComplete;
    145	psRdpdrOnDriveQueryDirectoryComplete OnDriveQueryDirectoryComplete;
    146	psRdpdrOnDriveOpenFileComplete OnDriveOpenFileComplete;
    147	psRdpdrOnDriveReadFileComplete OnDriveReadFileComplete;
    148	psRdpdrOnDriveWriteFileComplete OnDriveWriteFileComplete;
    149	psRdpdrOnDriveCloseFileComplete OnDriveCloseFileComplete;
    150	psRdpdrOnDriveDeleteFileComplete OnDriveDeleteFileComplete;
    151	psRdpdrOnDriveRenameFileComplete OnDriveRenameFileComplete;
    152
    153	/*** Port callbacks registered by the server. ***/
    154	psRdpdrOnPortCreate OnPortCreate;
    155	psRdpdrOnPortDelete OnPortDelete;
    156
    157	/*** Printer callbacks registered by the server. ***/
    158	psRdpdrOnPrinterCreate OnPrinterCreate;
    159	psRdpdrOnPrinterDelete OnPrinterDelete;
    160
    161	/*** Smartcard callbacks registered by the server. ***/
    162	psRdpdrOnSmartcardCreate OnSmartcardCreate;
    163	psRdpdrOnSmartcardDelete OnSmartcardDelete;
    164
    165	rdpContext* rdpcontext;
    166};
    167
    168#ifdef __cplusplus
    169extern "C"
    170{
    171#endif
    172
    173	FREERDP_API RdpdrServerContext* rdpdr_server_context_new(HANDLE vcm);
    174	FREERDP_API void rdpdr_server_context_free(RdpdrServerContext* context);
    175
    176#ifdef __cplusplus
    177}
    178#endif
    179
    180#endif /* FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H */