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)sessionBitmapContextWillChange:(RDPSession *)session;
37- (void)sessionBitmapContextDidChange:(RDPSession *)session;
38- (void)session:(RDPSession *)session needsRedrawInRect:(CGRect)rect;
39- (void)session:(RDPSession *)session didSetRemoteCursor:(RDPCursor *)cursor;
40- (void)session:(RDPSession *)session didMoveRemoteCursor:(CGPoint)position;
41- (void)sessionDidHideRemoteCursor:(RDPSession *)session;
42- (void)sessionDidSetDefaultRemoteCursor:(RDPSession *)session;
43- (void)session:(RDPSession *)session didChangeRemoteClipboardText:(NSString *)text;
44- (CGSize)sizeForFitScreenForSession:(RDPSession *)session;
45
46- (void)session:(RDPSession *)session
47 requestsAuthenticationWithParams:(NSMutableDictionary *)params;
48- (void)session:(RDPSession *)session verifyCertificateWithParams:(NSMutableDictionary *)params;
49- (void)session:(RDPSession *)session requestsClipboardTextWithParams:(NSMutableDictionary *)params;
50
51@end
52
53// rdp session
54@interface RDPSession : NSObject
55{
56 @private
57 freerdp *_freerdp;
58
59 ComputerBookmark *_bookmark;
60
61 ConnectionParams *_params;
62
63 NSObject<RDPSessionDelegate> *_delegate;
64
65 NSCondition *_ui_request_completed;
66
67 NSString *_name;
68
69 // flag if the session is suspended
70 BOOL _suspended;
71
72 // flag that specifies whether the RDP toolbar is visible
73 BOOL _toolbar_visible;
74}
75
76@property(readonly) ConnectionParams *params;
77@property(readonly) ComputerBookmark *bookmark;
78@property(assign) id<RDPSessionDelegate> delegate;
79@property(assign) BOOL toolbarVisible;
80@property(readonly) CGContextRef bitmapContext;
81@property(readonly) NSCondition *uiRequestCompleted;
82
83// initialize a new session with the given bookmark
84- (id)initWithBookmark:(ComputerBookmark *)bookmark;
85
86#pragma mark - session control functions
87
88// connect the session
89- (void)connect;
90
91// disconnect session
92- (void)disconnect;
93
94// suspends the session
95- (void)suspend;
96
97// resumes a previously suspended session
98- (void)resume;
99
100// returns YES if the session is started
101- (BOOL)isSuspended;
102
103// send input event to the server
104- (void)sendInputEvent:(NSDictionary *)event;
105
106// tell the server whether the local clipboard has text
107- (void)sendClipboardHasText:(BOOL)hasText;
108
109// session needs a refresh of its view
110- (void)setNeedsDisplayInRectAsValue:(NSValue *)rect_value;
111
112// handle cursor updated event
113- (void)setRemoteCursor:(RDPCursor *)cursor;
114- (void)setRemoteCursorPositionValue:(NSValue *)positionValue;
115- (void)hideRemoteCursor;
116- (void)setDefaultRemoteCursor;
117
118// handle text copied on the server
119- (void)setRemoteClipboardText:(NSString *)text;
120
121// get a small session screenshot
122- (UIImage *)getScreenshotWithSize:(CGSize)size;
123
124// returns the session's current parameters
125- (rdpSettings *)getSessionParams;
126
127// returns the session's name (usually the label of the bookmark the session was created with)
128- (NSString *)sessionName;
129
130@end