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