FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
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 ComputerBookmark;
19@class ConnectionParams;
20
21// notification handler for session disconnect
22extern NSString *TSXSessionDidDisconnectNotification;
23extern NSString *TSXSessionDidFailToConnectNotification;
24
25// protocol for session notifications
26@protocol RDPSessionDelegate <NSObject>
27@optional
28- (void)session:(RDPSession *)session didFailToConnect:(int)reason;
29- (void)sessionWillConnect:(RDPSession *)session;
30- (void)sessionDidConnect:(RDPSession *)session;
31- (void)sessionWillDisconnect:(RDPSession *)session;
32- (void)sessionDidDisconnect:(RDPSession *)session;
33- (void)sessionBitmapContextWillChange:(RDPSession *)session;
34- (void)sessionBitmapContextDidChange:(RDPSession *)session;
35- (void)session:(RDPSession *)session needsRedrawInRect:(CGRect)rect;
36- (CGSize)sizeForFitScreenForSession:(RDPSession *)session;
37
38- (void)session:(RDPSession *)session
39 requestsAuthenticationWithParams:(NSMutableDictionary *)params;
40- (void)session:(RDPSession *)session verifyCertificateWithParams:(NSMutableDictionary *)params;
41
42@end
43
44// rdp session
45@interface RDPSession : NSObject
46{
47 @private
48 freerdp *_freerdp;
49
50 ComputerBookmark *_bookmark;
51
52 ConnectionParams *_params;
53
54 NSObject<RDPSessionDelegate> *_delegate;
55
56 NSCondition *_ui_request_completed;
57
58 NSString *_name;
59
60 // flag if the session is suspended
61 BOOL _suspended;
62
63 // flag that specifies whether the RDP toolbar is visible
64 BOOL _toolbar_visible;
65}
66
67@property(readonly) ConnectionParams *params;
68@property(readonly) ComputerBookmark *bookmark;
69@property(assign) id<RDPSessionDelegate> delegate;
70@property(assign) BOOL toolbarVisible;
71@property(readonly) CGContextRef bitmapContext;
72@property(readonly) NSCondition *uiRequestCompleted;
73
74// initialize a new session with the given bookmark
75- (id)initWithBookmark:(ComputerBookmark *)bookmark;
76
77#pragma mark - session control functions
78
79// connect the session
80- (void)connect;
81
82// disconnect session
83- (void)disconnect;
84
85// suspends the session
86- (void)suspend;
87
88// resumes a previously suspended session
89- (void)resume;
90
91// returns YES if the session is started
92- (BOOL)isSuspended;
93
94// send input event to the server
95- (void)sendInputEvent:(NSDictionary *)event;
96
97// session needs a refresh of its view
98- (void)setNeedsDisplayInRectAsValue:(NSValue *)rect_value;
99
100// get a small session screenshot
101- (UIImage *)getScreenshotWithSize:(CGSize)size;
102
103// returns the session's current parameters
104- (rdpSettings *)getSessionParams;
105
106// returns the session's name (usually the label of the bookmark the session was created with)
107- (NSString *)sessionName;
108
109@end