FreeRDP
ios_freerdp.h
1 /*
2  RDP run-loop
3 
4  Copyright 2013 Thincast Technologies GmbH, Authors: Martin Fleisz, Dorian Johnson
5  Copyright 2023 Iordan Iordanov
6 
7  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
8  If a copy of the MPL was not distributed with this file, You can obtain one at
9  http://mozilla.org/MPL/2.0/.
10  */
11 
12 #import <CoreGraphics/CoreGraphics.h>
13 
14 #import <freerdp/freerdp.h>
15 #import <freerdp/channels/channels.h>
16 #import "TSXTypes.h"
17 #import <winpr/clipboard.h>
18 #import <freerdp/client/cliprdr.h>
19 
21 
22 typedef BOOL (*pServerCutText)(rdpContext *context, UINT8 *data, UINT32 size);
23 
24 // FreeRDP extended structs
25 typedef struct mf_info mfInfo;
26 
27 typedef struct mf_context
28 {
29  rdpContext _p;
30 
31  mfInfo *mfi;
32  rdpSettings *settings;
33 
34  BOOL clipboardSync;
35  wClipboard *clipboard;
36  UINT32 numServerFormats;
37  UINT32 requestedFormatId;
38  HANDLE clipboardRequestEvent;
39  CLIPRDR_FORMAT *serverFormats;
40  CliprdrClientContext *cliprdr;
41  UINT32 clipboardCapabilities;
42  pServerCutText ServerCutText;
43 } mfContext;
44 
45 struct mf_info
46 {
47  // RDP
48  freerdp *instance;
49  mfContext *context;
50  rdpContext *_context;
51 
52  // UI
53  RDPSession *session;
54 
55  // Graphics
56  CGContextRef bitmap_context;
57 
58  // Events
59  int event_pipe_producer;
60  int event_pipe_consumer;
61  HANDLE handle;
62 
63  // Tracking connection state
64  volatile TSXConnectionState connection_state;
65  volatile BOOL
66  unwanted; // set when controlling Session no longer wants the connection to continue
67 };
68 
69 #define MFI_FROM_INSTANCE(inst) (((mfContext *)((inst)->context))->mfi)
70 
71 enum MF_EXIT_CODE
72 {
73  MF_EXIT_SUCCESS = 0,
74 
75  MF_EXIT_CONN_FAILED = 128,
76  MF_EXIT_CONN_CANCELED = 129,
77  MF_EXIT_LOGON_TIMEOUT = 130,
78 
79  MF_EXIT_UNKNOWN = 255
80 };
81 
82 void ios_init_freerdp(void);
83 void ios_uninit_freerdp(void);
84 freerdp *ios_freerdp_new(void);
85 int ios_run_freerdp(freerdp *instance);
86 void ios_freerdp_free(freerdp *instance);
87 void ios_send_clipboard_data(void *context, const void *data, UINT32 size);