FreeRDP
Loading...
Searching...
No Matches
RDPSession.h
1/*
2 RDP Session object
3
4 Copyright 2013 Thincast Technologies GmbH, Authors: Martin Fleisz, Dorian Johnson
5
6 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7 If a copy of the MPL was not distributed with this file, You can obtain one at
8 http://mozilla.org/MPL/2.0/.
9 */
10
11#import <Foundation/Foundation.h>
12#import <UIKit/UIKit.h>
13
14#include <freerdp/freerdp.h>
15
16// forward declaration
17@class RDPSession;
18@class RDPCursor;
19@class ComputerBookmark;
20@class ConnectionParams;
21
22// notification handler for session disconnect
23extern NSString *TSXSessionDidDisconnectNotification;
24extern NSString *TSXSessionDidFailToConnectNotification;
25
26// protocol for session notifications
27@protocol RDPSessionDelegate <NSObject>
28@optional
29- (void)session:(RDPSession *)session didFailToConnect:(int)reason;
30- (void)sessionWillConnect:(RDPSession *)session;
31- (void)sessionDidConnect:(RDPSession *)session;
32- (void)sessionWillDisconnect:(RDPSession *)session;
33- (void)sessionDidDisconnect:(RDPSession *)session;
34- (void)sessionWillReconnect:(RDPSession *)session;
35- (void)sessionDidReconnect:(RDPSession *)session;
36- (void)sessionDidActivateDisplayControl:(RDPSession *)session;
37- (void)sessionBitmapContextWillChange:(RDPSession *)session;
38- (void)sessionBitmapContextDidChange:(RDPSession *)session;
39- (void)session:(RDPSession *)session needsRedrawInRect:(CGRect)rect;
40- (void)session:(RDPSession *)session didSetRemoteCursor:(RDPCursor *)cursor;
41- (void)session:(RDPSession *)session didMoveRemoteCursor:(CGPoint)position;
42- (void)sessionDidHideRemoteCursor:(RDPSession *)session;
43- (void)sessionDidSetDefaultRemoteCursor:(RDPSession *)session;
44- (void)session:(RDPSession *)session didChangeRemoteClipboardText:(NSString *)text;
45- (CGSize)sizeForFitScreenForSession:(RDPSession *)session;
46
47- (void)session:(RDPSession *)session
48 requestsAuthenticationWithParams:(NSMutableDictionary *)params;
49- (void)session:(RDPSession *)session verifyCertificateWithParams:(NSMutableDictionary *)params;
50- (void)session:(RDPSession *)session requestsClipboardTextWithParams:(NSMutableDictionary *)params;
51
52@end
53
54// rdp session
55@interface RDPSession : NSObject
56{
57 @private
58 freerdp *_freerdp;
59
60 ComputerBookmark *_bookmark;
61
62 ConnectionParams *_params;
63
64 NSObject<RDPSessionDelegate> *_delegate;
65
66 NSCondition *_ui_request_completed;
67
68 NSString *_name;
69
70 // flag if the session is suspended
71 BOOL _suspended;
72
73 // flag that specifies whether the RDP toolbar is visible
74 BOOL _toolbar_visible;
75}
76
77@property(readonly) ConnectionParams *params;
78@property(readonly) ComputerBookmark *bookmark;
79@property(assign) id<RDPSessionDelegate> delegate;
80@property(assign) BOOL toolbarVisible;
81@property(readonly) CGContextRef bitmapContext;
82@property(readonly) NSCondition *uiRequestCompleted;
83
84// initialize a new session with the given bookmark
85- (id)initWithBookmark:(ComputerBookmark *)bookmark;
86
87#pragma mark - session control functions
88
89// connect the session
90- (void)connect;
91
92// disconnect session
93- (void)disconnect;
94
95// suspends the session
96- (void)suspend;
97
98// resumes a previously suspended session
99- (void)resume;
100
101// returns YES if the session is started
102- (BOOL)isSuspended;
103
104// send input event to the server
105- (void)sendInputEvent:(NSDictionary *)event;
106
107// tell the server whether the local clipboard has text
108- (void)sendClipboardHasText:(BOOL)hasText;
109
110// ask the server to change the desktop size
111- (void)sendMonitorLayoutWithSize:(CGSize)size;
112
113// session needs a refresh of its view
114- (void)setNeedsDisplayInRectAsValue:(NSValue *)rect_value;
115
116// handle cursor updated event
117- (void)setRemoteCursor:(RDPCursor *)cursor;
118- (void)setRemoteCursorPositionValue:(NSValue *)positionValue;
119- (void)hideRemoteCursor;
120- (void)setDefaultRemoteCursor;
121
122// handle text copied on the server
123- (void)setRemoteClipboardText:(NSString *)text;
124
125// get a small session screenshot
126- (UIImage *)getScreenshotWithSize:(CGSize)size;
127
128// returns the session's current parameters
129- (rdpSettings *)getSessionParams;
130
131// returns the session's name (usually the label of the bookmark the session was created with)
132- (NSString *)sessionName;
133
134@end