mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-23 18:03:30 +08:00
some compile fixes
This commit is contained in:
parent
0da860ad1f
commit
1c15073508
@ -41,7 +41,9 @@ struct mf_info
|
||||
CGContextRef bitmap_context;
|
||||
|
||||
// Events
|
||||
int event_pipe_producer, event_pipe_consumer;
|
||||
int event_pipe_producer;
|
||||
int event_pipe_consumer;
|
||||
HANDLE handle;
|
||||
|
||||
// Tracking connection state
|
||||
volatile TSXConnectionState connection_state;
|
||||
|
@ -8,6 +8,8 @@
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <winpr/assert.h>
|
||||
|
||||
#import <freerdp/gdi/gdi.h>
|
||||
#import <freerdp/channels/channels.h>
|
||||
#import <freerdp/client/channels.h>
|
||||
@ -90,10 +92,11 @@ static BOOL ios_pre_connect(freerdp *instance)
|
||||
int rc;
|
||||
rdpSettings *settings;
|
||||
|
||||
if (!instance || !instance->settings)
|
||||
if (!instance || !instance->context)
|
||||
return FALSE;
|
||||
|
||||
settings = instance->settings;
|
||||
settings = instance->context->settings;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
settings->AutoLogonEnabled = settings->Password && (strlen(settings->Password) > 0);
|
||||
|
||||
@ -124,7 +127,7 @@ static BOOL ios_pre_connect(freerdp *instance)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!freerdp_client_load_addins(instance->context->channels, instance->settings))
|
||||
if (!freerdp_client_load_addins(instance->context->channels, settings))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to load addins [%l08X]", GetLastError());
|
||||
return FALSE;
|
||||
@ -216,9 +219,9 @@ static BOOL ios_post_connect(freerdp *instance)
|
||||
return FALSE;
|
||||
|
||||
ios_allocate_display_buffer(mfi);
|
||||
instance->update->BeginPaint = ios_ui_begin_paint;
|
||||
instance->update->EndPaint = ios_ui_end_paint;
|
||||
instance->update->DesktopResize = ios_ui_resize_window;
|
||||
instance->context->update->BeginPaint = ios_ui_begin_paint;
|
||||
instance->context->update->EndPaint = ios_ui_end_paint;
|
||||
instance->context->update->DesktopResize = ios_ui_resize_window;
|
||||
[mfi->session performSelectorOnMainThread:@selector(sessionDidConnect)
|
||||
withObject:nil
|
||||
waitUntilDone:YES];
|
||||
@ -252,102 +255,46 @@ int ios_run_freerdp(freerdp *instance)
|
||||
mfi->connection_state = TSXConnectionConnected;
|
||||
// Connection main loop
|
||||
NSAutoreleasePool *pool;
|
||||
int i;
|
||||
int fds;
|
||||
int max_fds;
|
||||
int rcount;
|
||||
int wcount;
|
||||
void *rfds[32];
|
||||
void *wfds[32];
|
||||
fd_set rfds_set;
|
||||
fd_set wfds_set;
|
||||
struct timeval timeout;
|
||||
int select_status;
|
||||
memset(rfds, 0, sizeof(rfds));
|
||||
memset(wfds, 0, sizeof(wfds));
|
||||
|
||||
while (!freerdp_shall_disconnect_context(instance->context))
|
||||
{
|
||||
rcount = wcount = 0;
|
||||
DWORD status;
|
||||
DWORD nCount = 0;
|
||||
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)
|
||||
nCount = freerdp_get_event_handles(instance->context, handles, ARRAYSIZE(handles));
|
||||
if (nCount == 0)
|
||||
{
|
||||
NSLog(@"%s: inst->rdp_get_fds failed", __func__);
|
||||
NSLog(@"%s: freerdp_get_event_handles failed", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE)
|
||||
handles[nCount++] = ios_events_get_handle(mfi);
|
||||
|
||||
status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);
|
||||
|
||||
if (WAIT_FAILED == status)
|
||||
{
|
||||
NSLog(@"%s: freerdp_chanman_get_fds failed", __func__);
|
||||
NSLog(@"%s: WaitForMultipleObjects failed!", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ios_events_get_fds(mfi, rfds, &rcount, wfds, &wcount) != TRUE)
|
||||
{
|
||||
NSLog(@"%s: ios_events_get_fds", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
max_fds = 0;
|
||||
FD_ZERO(&rfds_set);
|
||||
FD_ZERO(&wfds_set);
|
||||
|
||||
for (i = 0; i < rcount; i++)
|
||||
{
|
||||
fds = (int)(long)(rfds[i]);
|
||||
|
||||
if (fds > max_fds)
|
||||
max_fds = fds;
|
||||
|
||||
FD_SET(fds, &rfds_set);
|
||||
}
|
||||
|
||||
if (max_fds == 0)
|
||||
break;
|
||||
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
select_status = select(max_fds + 1, &rfds_set, NULL, NULL, &timeout);
|
||||
|
||||
// timeout?
|
||||
if (select_status == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (select_status == -1)
|
||||
{
|
||||
/* these are not really errors */
|
||||
if (!((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINPROGRESS) ||
|
||||
(errno == EINTR))) /* signal occurred */
|
||||
{
|
||||
NSLog(@"%s: select failed!", __func__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the libfreerdp fds
|
||||
if (freerdp_check_fds(instance) != true)
|
||||
if (!freerdp_check_event_handles(instance->context))
|
||||
{
|
||||
NSLog(@"%s: inst->rdp_check_fds failed.", __func__);
|
||||
NSLog(@"%s: freerdp_check_event_handles failed.", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
// Check input event fds
|
||||
if (ios_events_check_fds(mfi, &rfds_set) != TRUE)
|
||||
if (ios_events_check_handle(mfi) != TRUE)
|
||||
{
|
||||
// This event will fail when the app asks for a disconnect.
|
||||
// NSLog(@"%s: ios_events_check_fds failed: terminating connection.", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
// Check channel fds
|
||||
if (freerdp_channels_check_fds(channels, instance) != TRUE)
|
||||
{
|
||||
NSLog(@"%s: freerdp_chanman_check_fds failed", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
[pool release];
|
||||
pool = nil;
|
||||
}
|
||||
@ -379,7 +326,6 @@ static BOOL ios_client_new(freerdp *instance, rdpContext *context)
|
||||
|
||||
ctx->mfi->context = (mfContext *)context;
|
||||
ctx->mfi->_context = context;
|
||||
ctx->mfi->context->settings = instance->settings;
|
||||
ctx->mfi->instance = instance;
|
||||
|
||||
if (!ios_events_create_pipe(ctx->mfi))
|
||||
@ -390,8 +336,8 @@ static BOOL ios_client_new(freerdp *instance, rdpContext *context)
|
||||
instance->PostDisconnect = ios_post_disconnect;
|
||||
instance->Authenticate = ios_ui_authenticate;
|
||||
instance->GatewayAuthenticate = ios_ui_gw_authenticate;
|
||||
instance->VerifyCertificate = ios_ui_verify_certificate;
|
||||
instance->VerifyChangedCertificate = ios_ui_verify_changed_certificate;
|
||||
instance->VerifyCertificateEx = ios_ui_verify_certificate_ex;
|
||||
instance->VerifyChangedCertificateEx = ios_ui_verify_changed_certificate_ex;
|
||||
instance->LogonErrorInfo = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -18,9 +18,9 @@
|
||||
BOOL ios_events_send(mfInfo *mfi, NSDictionary *event_description);
|
||||
|
||||
// For connection runloop: use to poll for queued input events
|
||||
BOOL ios_events_get_fds(mfInfo *mfi, void **read_fds, int *read_count, void **write_fds,
|
||||
int *write_count);
|
||||
BOOL ios_events_check_fds(mfInfo *mfi, fd_set *rfds);
|
||||
HANDLE ios_events_get_handle(mfInfo *mfi);
|
||||
BOOL ios_events_check_handle(mfInfo *mfi);
|
||||
|
||||
BOOL ios_events_create_pipe(mfInfo *mfi);
|
||||
void ios_events_free_pipe(mfInfo *mfi);
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <winpr/assert.h>
|
||||
|
||||
#include "ios_freerdp_events.h"
|
||||
|
||||
#pragma mark -
|
||||
@ -19,6 +21,8 @@ BOOL ios_events_send(mfInfo *mfi, NSDictionary *event_description)
|
||||
{
|
||||
NSData *encoded_description = [NSKeyedArchiver archivedDataWithRootObject:event_description];
|
||||
|
||||
WINPR_ASSERT(mfi);
|
||||
|
||||
if ([encoded_description length] > 32000 || (mfi->event_pipe_producer == -1))
|
||||
return FALSE;
|
||||
|
||||
@ -49,24 +53,32 @@ static BOOL ios_events_handle_event(mfInfo *mfi, NSDictionary *event_description
|
||||
{
|
||||
NSString *event_type = [event_description objectForKey:@"type"];
|
||||
BOOL should_continue = TRUE;
|
||||
rdpInput *input;
|
||||
|
||||
WINPR_ASSERT(mfi);
|
||||
|
||||
freerdp *instance = mfi->instance;
|
||||
WINPR_ASSERT(instance);
|
||||
WINPR_ASSERT(instance->context);
|
||||
|
||||
input = instance->context->input;
|
||||
WINPR_ASSERT(input);
|
||||
|
||||
if ([event_type isEqualToString:@"mouse"])
|
||||
{
|
||||
instance->input->MouseEvent(
|
||||
instance->input, [[event_description objectForKey:@"flags"] unsignedShortValue],
|
||||
[[event_description objectForKey:@"coord_x"] unsignedShortValue],
|
||||
[[event_description objectForKey:@"coord_y"] unsignedShortValue]);
|
||||
input->MouseEvent(input, [[event_description objectForKey:@"flags"] unsignedShortValue],
|
||||
[[event_description objectForKey:@"coord_x"] unsignedShortValue],
|
||||
[[event_description objectForKey:@"coord_y"] unsignedShortValue]);
|
||||
}
|
||||
else if ([event_type isEqualToString:@"keyboard"])
|
||||
{
|
||||
if ([[event_description objectForKey:@"subtype"] isEqualToString:@"scancode"])
|
||||
freerdp_input_send_keyboard_event(
|
||||
instance->input, [[event_description objectForKey:@"flags"] unsignedShortValue],
|
||||
input, [[event_description objectForKey:@"flags"] unsignedShortValue],
|
||||
[[event_description objectForKey:@"scancode"] unsignedShortValue]);
|
||||
else if ([[event_description objectForKey:@"subtype"] isEqualToString:@"unicode"])
|
||||
freerdp_input_send_unicode_keyboard_event(
|
||||
instance->input, [[event_description objectForKey:@"flags"] unsignedShortValue],
|
||||
input, [[event_description objectForKey:@"flags"] unsignedShortValue],
|
||||
[[event_description objectForKey:@"unicode_char"] unsignedShortValue]);
|
||||
else
|
||||
NSLog(@"%s: doesn't know how to send keyboard input with subtype %@", __func__,
|
||||
@ -80,9 +92,14 @@ static BOOL ios_events_handle_event(mfInfo *mfi, NSDictionary *event_description
|
||||
return should_continue;
|
||||
}
|
||||
|
||||
BOOL ios_events_check_fds(mfInfo *mfi, fd_set *rfds)
|
||||
BOOL ios_events_check_handle(mfInfo *mfi)
|
||||
{
|
||||
if ((mfi->event_pipe_consumer == -1) || !FD_ISSET(mfi->event_pipe_consumer, rfds))
|
||||
WINPR_ASSERT(mfi);
|
||||
|
||||
if (WaitForSingleObject(mfi->handle, 0) != WAIT_OBJECT_0)
|
||||
return TRUE;
|
||||
|
||||
if (mfi->event_pipe_consumer == -1)
|
||||
return TRUE;
|
||||
|
||||
uint32_t archived_data_length = 0;
|
||||
@ -119,12 +136,10 @@ BOOL ios_events_check_fds(mfInfo *mfi, fd_set *rfds)
|
||||
return ios_events_handle_event(mfi, unarchived_object_data);
|
||||
}
|
||||
|
||||
BOOL ios_events_get_fds(mfInfo *mfi, void **read_fds, int *read_count, void **write_fds,
|
||||
int *write_count)
|
||||
HANDLE ios_events_get_handle(mfInfo *mfi)
|
||||
{
|
||||
read_fds[*read_count] = (void *)(long)(mfi->event_pipe_consumer);
|
||||
(*read_count)++;
|
||||
return TRUE;
|
||||
WINPR_ASSERT(mfi);
|
||||
return mfi->handle;
|
||||
}
|
||||
|
||||
// Sets up the event pipe
|
||||
@ -132,6 +147,8 @@ BOOL ios_events_create_pipe(mfInfo *mfi)
|
||||
{
|
||||
int pipe_fds[2];
|
||||
|
||||
WINPR_ASSERT(mfi);
|
||||
|
||||
if (pipe(pipe_fds) == -1)
|
||||
{
|
||||
NSLog(@"%s: pipe failed.", __func__);
|
||||
@ -140,14 +157,18 @@ BOOL ios_events_create_pipe(mfInfo *mfi)
|
||||
|
||||
mfi->event_pipe_consumer = pipe_fds[0];
|
||||
mfi->event_pipe_producer = pipe_fds[1];
|
||||
mfi->handle = CreateFileDescriptorEvent(NULL, FALSE, FALSE, mfi->event_pipe_consumer,
|
||||
WINPR_FD_READ | WINPR_FD_WRITE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ios_events_free_pipe(mfInfo *mfi)
|
||||
{
|
||||
WINPR_ASSERT(mfi);
|
||||
int consumer_fd = mfi->event_pipe_consumer, producer_fd = mfi->event_pipe_producer;
|
||||
|
||||
mfi->event_pipe_consumer = mfi->event_pipe_producer = -1;
|
||||
close(producer_fd);
|
||||
close(consumer_fd);
|
||||
CloseHandle(mfi->handle);
|
||||
}
|
||||
|
@ -16,11 +16,14 @@ BOOL ios_ui_resize_window(rdpContext* context);
|
||||
|
||||
BOOL ios_ui_authenticate(freerdp* instance, char** username, char** password, char** domain);
|
||||
BOOL ios_ui_gw_authenticate(freerdp* instance, char** username, char** password, char** domain);
|
||||
DWORD ios_ui_verify_certificate(freerdp* instance, const char* common_name, const char* subject,
|
||||
const char* issuer, const char* fingerprint, BOOL host_mismatch);
|
||||
DWORD ios_ui_verify_changed_certificate(freerdp* instance, const char* common_name,
|
||||
const char* subject, const char* issuer,
|
||||
const char* new_fingerprint, const char* old_subject,
|
||||
const char* old_issuer, const char* old_fingerprint);
|
||||
DWORD ios_ui_verify_certificate_ex(freerdp* instance, const char* host, UINT16 port,
|
||||
const char* common_name, const char* subject, const char* issuer,
|
||||
const char* fingerprint, DWORD flags);
|
||||
|
||||
DWORD ios_ui_verify_changed_certificate_ex(freerdp* instance, const char* host, UINT16 port,
|
||||
const char* common_name, const char* subject,
|
||||
const char* issuer, const char* fingerprint,
|
||||
const char* old_subject, const char* old_issuer,
|
||||
const char* old_fingerprint, DWORD flags);
|
||||
|
||||
void ios_allocate_display_buffer(mfInfo* mfi);
|
||||
|
@ -30,8 +30,8 @@ static BOOL ios_ui_authenticate_raw(freerdp *instance, char **username, char **p
|
||||
@"password",
|
||||
(*domain) ? [NSString stringWithUTF8String:*domain] : @"",
|
||||
@"domain",
|
||||
[NSString
|
||||
stringWithUTF8String:instance->settings->ServerHostname],
|
||||
[NSString stringWithUTF8String:instance->context->settings->
|
||||
ServerHostname],
|
||||
@"hostname", // used for the auth prompt message; not changed
|
||||
nil];
|
||||
// request auth UI
|
||||
@ -79,8 +79,9 @@ BOOL ios_ui_gw_authenticate(freerdp *instance, char **username, char **password,
|
||||
return ios_ui_authenticate_raw(instance, username, password, domain, "gateway");
|
||||
}
|
||||
|
||||
DWORD ios_ui_verify_certificate(freerdp *instance, const char *common_name, const char *subject,
|
||||
const char *issuer, const char *fingerprint, BOOL host_mismatch)
|
||||
DWORD ios_ui_verify_certificate_ex(freerdp *instance, const char *host, UINT16 port,
|
||||
const char *common_name, const char *subject, const char *issuer,
|
||||
const char *fingerprint, DWORD flags)
|
||||
{
|
||||
// check whether we accept all certificates
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"security.accept_certificates"] == YES)
|
||||
@ -112,13 +113,14 @@ DWORD ios_ui_verify_certificate(freerdp *instance, const char *common_name, cons
|
||||
return 1;
|
||||
}
|
||||
|
||||
DWORD ios_ui_verify_changed_certificate(freerdp *instance, const char *common_name,
|
||||
const char *subject, const char *issuer,
|
||||
const char *new_fingerprint, const char *old_subject,
|
||||
const char *old_issuer, const char *old_fingerprint)
|
||||
DWORD ios_ui_verify_changed_certificate_ex(freerdp *instance, const char *host, UINT16 port,
|
||||
const char *common_name, const char *subject,
|
||||
const char *issuer, const char *fingerprint,
|
||||
const char *old_subject, const char *old_issuer,
|
||||
const char *old_fingerprint, DWORD flags)
|
||||
{
|
||||
return ios_ui_verify_certificate(instance, common_name, subject, issuer, new_fingerprint,
|
||||
FALSE);
|
||||
return ios_ui_verify_certificate_ex(instance, host, port, common_name, subject, issuer,
|
||||
fingerprint, flags);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
@ -260,7 +260,8 @@ static void freeArguments(int argc, char **argv)
|
||||
if (!addArgument(&argc, &argv, "/kbd:%d", 0x409))
|
||||
goto out_free;
|
||||
|
||||
status = freerdp_client_settings_parse_command_line(_freerdp->settings, argc, argv, FALSE);
|
||||
status =
|
||||
freerdp_client_settings_parse_command_line(_freerdp->context->settings, argc, argv, FALSE);
|
||||
|
||||
if (0 != status)
|
||||
goto out_free;
|
||||
@ -296,7 +297,7 @@ out_free:
|
||||
- (void)connect
|
||||
{
|
||||
// Set Screen Size to automatic if widht or height are still 0
|
||||
rdpSettings *settings = _freerdp->settings;
|
||||
rdpSettings *settings = _freerdp->context->settings;
|
||||
|
||||
if (settings->DesktopWidth == 0 || settings->DesktopHeight == 0)
|
||||
{
|
||||
@ -413,7 +414,7 @@ out_free:
|
||||
|
||||
- (rdpSettings *)getSessionParams
|
||||
{
|
||||
return _freerdp->settings;
|
||||
return _freerdp->context->settings;
|
||||
}
|
||||
|
||||
- (NSString *)sessionName
|
||||
|
@ -21,7 +21,7 @@ MIN_SDK_VERSION="10.0"
|
||||
INSTALLDIR="external"
|
||||
|
||||
# Architectures to build
|
||||
ARCHS="i386 x86_64 armv7 armv7s arm64"
|
||||
ARCHS="arm64"
|
||||
|
||||
# Use default SDK version if not set
|
||||
if [ -z ${SDK_VERSION} ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user