/** Allocator function for a rdp context. * The function will allocate a rdpRdp structure using rdp_new(), then copy * its contents to the appropriate fields in the rdp_freerdp structure given in parameters. * It will also initialize the 'context' field in the rdp_freerdp structure as needed. * If the caller has set the ContextNew callback in the 'instance' parameter, it will be called at the end of the function. * * @param instance - Pointer to the rdp_freerdp structure that will be initialized with the new context. */ void freerdp_context_new(freerdp* instance) { rdpRdp* rdp; rdp = rdp_new(instance); // FIXME - we're not checking where rdp_new returns NULL, and have no way to report an error to the caller instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; instance->context = (rdpContext*) malloc(instance->context_size); ZeroMemory(instance->context, instance->context_size); instance->context->graphics = graphics_new(instance->context); instance->context->instance = instance; instance->context->rdp = rdp; instance->context->input = instance->input; instance->context->update = instance->update; instance->context->settings = instance->settings; instance->update->context = instance->context; instance->update->pointer->context = instance->context; instance->update->primary->context = instance->context; instance->update->secondary->context = instance->context; instance->update->altsec->context = instance->context; instance->input->context = instance->context; update_register_client_callbacks(rdp->update); IFCALL(instance->ContextNew, instance, instance->context); }
freerdp_peer* freerdp_peer_new(int sockfd) { freerdp_peer* client; rdpPeer* peer; client = xnew(freerdp_peer); client->Initialize = freerdp_peer_initialize; client->GetFileDescriptor = freerdp_peer_get_fds; client->CheckFileDescriptor = freerdp_peer_check_fds; client->Disconnect = freerdp_peer_disconnect; peer = xnew(rdpPeer); peer->client = client; peer->rdp = rdp_new(NULL); client->peer = (void*) peer; client->settings = peer->rdp->settings; client->input = peer->rdp->input; client->update = peer->rdp->update; update_register_server_callbacks(client->update); transport_attach(peer->rdp->transport, sockfd); peer->rdp->transport->recv_callback = peer_recv_callback; peer->rdp->transport->recv_extra = peer; transport_set_blocking_mode(peer->rdp->transport, False); return client; }
freerdp* freerdp_new() { freerdp* instance; instance = xzalloc(sizeof(freerdp)); if (instance != NULL) { rdpRdp* rdp = rdp_new(instance); instance->rdp = (void*) rdp; instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; instance->Connect = freerdp_connect; instance->GetFileDescriptor = freerdp_get_fds; instance->CheckFileDescriptor = freerdp_check_fds; instance->SendChannelData = freerdp_send_channel_data; instance->Disconnect = freerdp_disconnect; input_register_client_callbacks(rdp->input); } return instance; }
void freerdp_peer_context_new(freerdp_peer* client) { rdpRdp* rdp; rdp = rdp_new(NULL); client->input = rdp->input; client->update = rdp->update; client->settings = rdp->settings; client->context = (rdpContext*) malloc(client->context_size); ZeroMemory(client->context, client->context_size); client->context->rdp = rdp; client->context->peer = client; client->update->context = client->context; client->input->context = client->context; update_register_server_callbacks(client->update); transport_attach(rdp->transport, client->sockfd); rdp->transport->ReceiveCallback = peer_recv_callback; rdp->transport->ReceiveExtra = client; transport_set_blocking_mode(rdp->transport, FALSE); IFCALL(client->ContextNew, client, client->context); }
/** Allocator function for a rdp context. * The function will allocate a rdpRdp structure using rdp_new(), then copy * its contents to the appropriate fields in the rdp_freerdp structure given in parameters. * It will also initialize the 'context' field in the rdp_freerdp structure as needed. * If the caller has set the ContextNew callback in the 'instance' parameter, it will be called at the end of the function. * * @param instance - Pointer to the rdp_freerdp structure that will be initialized with the new context. */ int freerdp_context_new(freerdp* instance) { rdpRdp* rdp; rdpContext* context; instance->context = (rdpContext*) malloc(instance->ContextSize); ZeroMemory(instance->context, instance->ContextSize); context = instance->context; context->instance = instance; context->ServerMode = FALSE; context->settings = instance->settings; context->pubSub = PubSub_New(TRUE); PubSub_AddEventTypes(context->pubSub, FreeRDP_Events, sizeof(FreeRDP_Events) / sizeof(wEventType)); context->metrics = metrics_new(context); rdp = rdp_new(context); instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; context->graphics = graphics_new(context); context->rdp = rdp; context->input = instance->input; context->update = instance->update; context->settings = instance->settings; instance->update->context = instance->context; instance->update->pointer->context = instance->context; instance->update->primary->context = instance->context; instance->update->secondary->context = instance->context; instance->update->altsec->context = instance->context; instance->input->context = context; update_register_client_callbacks(rdp->update); IFCALL(instance->ContextNew, instance, instance->context); return 0; }
void freerdp_peer_context_new(freerdp_peer* client) { rdpRdp* rdp; client->context = (rdpContext*) calloc(1, client->ContextSize); client->context->ServerMode = TRUE; client->context->metrics = metrics_new(client->context); rdp = rdp_new(client->context); client->input = rdp->input; client->update = rdp->update; client->settings = rdp->settings; client->autodetect = rdp->autodetect; client->context->rdp = rdp; client->context->peer = client; client->context->input = client->input; client->context->update = client->update; client->context->settings = client->settings; client->context->autodetect = client->autodetect; client->update->context = client->context; client->input->context = client->context; client->autodetect->context = client->context; update_register_server_callbacks(client->update); autodetect_register_server_callbacks(client->autodetect); transport_attach(rdp->transport, client->sockfd); rdp->transport->ReceiveCallback = peer_recv_callback; rdp->transport->ReceiveExtra = client; transport_set_blocking_mode(rdp->transport, FALSE); client->IsWriteBlocked = freerdp_peer_is_write_blocked; client->DrainOutputBuffer = freerdp_peer_drain_output_buffer; IFCALL(client->ContextNew, client, client->context); }
void freerdp_context_new(freerdp* instance) { rdpRdp* rdp; rdp = rdp_new(instance); instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; instance->context = (rdpContext*) xzalloc(instance->context_size); instance->context->graphics = graphics_new(instance->context); instance->context->instance = instance; instance->context->rdp = rdp; instance->update->context = instance->context; instance->input->context = instance->context; input_register_client_callbacks(rdp->input); IFCALL(instance->ContextNew, instance, instance->context); }
void test_update_recv_orders(void) { rdpRdp* rdp; STREAM _s, *s; rdpUpdate* update; s = &_s; rdp = rdp_new(NULL); update = update_new(rdp); update->context = malloc(sizeof(rdpContext)); update->context->rdp = rdp; opaque_rect_count = 0; polyline_count = 0; patblt_count = 0; update->primary->OpaqueRect = test_opaque_rect; update->primary->Polyline = test_polyline; update->primary->PatBlt = test_patblt; s->p = s->data = orders_update_1; s->size = sizeof(orders_update_1); update_recv(update, s); CU_ASSERT(opaque_rect_count == 5); CU_ASSERT(polyline_count == 2); update->primary->order_info.orderType = ORDER_TYPE_PATBLT; s->p = s->data = orders_update_2; s->size = sizeof(orders_update_2); update_recv(update, s); CU_ASSERT(patblt_count == 3); free(update->context); }
rdpInst * freerdp_new(rdpSet * settings) { rdpInst * inst; inst = (rdpInst *) xmalloc(sizeof(rdpInst)); inst->version = FREERDP_INTERFACE_VERSION; inst->size = sizeof(rdpInst); inst->settings = settings; inst->rdp_connect = l_rdp_connect; inst->rdp_get_fds = l_rdp_get_fds; inst->rdp_check_fds = l_rdp_check_fds; inst->rdp_send_input_scancode = l_rdp_send_input_scancode; inst->rdp_send_input_unicode = l_rdp_send_input_unicode; inst->rdp_send_input_mouse = l_rdp_send_input_mouse; inst->rdp_sync_input = l_rdp_sync_input; inst->rdp_channel_data = l_rdp_channel_data; inst->rdp_disconnect = l_rdp_disconnect; inst->rdp_send_frame_ack = l_rdp_send_frame_ack; inst->rdp = (void *) rdp_new(settings, inst); return inst; }
void freerdp_context_new(freerdp* instance) { rdpRdp* rdp; uint32 size = sizeof(rdpContext); rdp = rdp_new(instance); instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; IFCALL(instance->ContextSize, instance, &size); instance->context = (rdpContext*) xzalloc(size); instance->context->instance = instance; instance->context->rdp = rdp; instance->update->context = instance->context; instance->input->context = instance->context; input_register_client_callbacks(rdp->input); IFCALL(instance->ContextNew, instance, instance->context); }
int glide64InitiateGFX (GFX_INFO Gfx_Info) { char name[21] = "DEFAULT"; rdp_new(); // Assume scale of 1 for debug purposes rdp.scale_x = 1.0f; rdp.scale_y = 1.0f; memset (&settings, 0, sizeof(SETTINGS)); ReadSettings (); ReadSpecialSettings (name); math_init (); TexCacheInit (); CRC_BuildTable(); CountCombine(); if (fb_depth_render_enabled) ZLUT_init(); return true; }
void freerdp_context_new(freerdp* instance) { rdpRdp* rdp; rdp = rdp_new(instance); instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; instance->context = (rdpContext*) xzalloc(instance->context_size); instance->context->graphics = graphics_new(instance->context); instance->context->instance = instance; instance->context->rdp = rdp; instance->update->context = instance->context; instance->update->pointer->context = instance->context; instance->update->primary->context = instance->context; instance->update->secondary->context = instance->context; instance->update->altsec->context = instance->context; instance->input->context = instance->context; IFCALL(instance->ContextNew, instance, instance->context); }
BOOL freerdp_peer_context_new(freerdp_peer* client) { rdpRdp* rdp; rdpContext* context; BOOL ret = TRUE; if (!client) return FALSE; if (!(context = (rdpContext*) calloc(1, client->ContextSize))) goto fail_context; client->context = context; context->peer = client; context->ServerMode = TRUE; context->settings = client->settings; if (!(context->metrics = metrics_new(context))) goto fail_metrics; if (!(rdp = rdp_new(context))) goto fail_rdp; client->input = rdp->input; client->update = rdp->update; client->settings = rdp->settings; client->autodetect = rdp->autodetect; context->rdp = rdp; context->input = client->input; context->update = client->update; context->settings = client->settings; context->autodetect = client->autodetect; client->update->context = context; client->input->context = context; client->autodetect->context = context; update_register_server_callbacks(client->update); autodetect_register_server_callbacks(client->autodetect); if (!(context->errorDescription = calloc(1, 500))) { WLog_ERR(TAG, "calloc failed!"); goto fail_error_description; } if (!transport_attach(rdp->transport, client->sockfd)) goto fail_transport_attach; rdp->transport->ReceiveCallback = peer_recv_callback; rdp->transport->ReceiveExtra = client; transport_set_blocking_mode(rdp->transport, FALSE); client->IsWriteBlocked = freerdp_peer_is_write_blocked; client->DrainOutputBuffer = freerdp_peer_drain_output_buffer; client->HasMoreToRead = freerdp_peer_has_more_to_read; IFCALLRET(client->ContextNew, ret, client, client->context); if (ret) return TRUE; WLog_ERR(TAG, "ContextNew callback failed"); fail_transport_attach: free(context->errorDescription); fail_error_description: rdp_free(client->context->rdp); fail_rdp: metrics_free(context->metrics); fail_metrics: free(client->context); fail_context: client->context = NULL; WLog_ERR(TAG, "Failed to create new peer context"); return FALSE; }
int init_license_suite(void) { rdp = rdp_new(NULL); license = rdp->license; return 0; }
/** Allocator function for a rdp context. * The function will allocate a rdpRdp structure using rdp_new(), then copy * its contents to the appropriate fields in the rdp_freerdp structure given in parameters. * It will also initialize the 'context' field in the rdp_freerdp structure as needed. * If the caller has set the ContextNew callback in the 'instance' parameter, it will be called at the end of the function. * * @param instance - Pointer to the rdp_freerdp structure that will be initialized with the new context. */ BOOL freerdp_context_new(freerdp* instance) { rdpRdp* rdp; rdpContext* context; BOOL ret = TRUE; instance->context = (rdpContext*) calloc(1, instance->ContextSize); if (!instance->context) return FALSE; context = instance->context; context->instance = instance; context->ServerMode = FALSE; context->settings = instance->settings; context->pubSub = PubSub_New(TRUE); if(!context->pubSub) goto out_error_pubsub; PubSub_AddEventTypes(context->pubSub, FreeRDP_Events, sizeof(FreeRDP_Events) / sizeof(wEventType)); context->metrics = metrics_new(context); if (!context->metrics) goto out_error_metrics_new; rdp = rdp_new(context); if (!rdp) goto out_error_rdp_new; instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; instance->autodetect = rdp->autodetect; context->graphics = graphics_new(context); if(!context->graphics) goto out_error_graphics_new; context->rdp = rdp; context->input = instance->input; context->update = instance->update; context->settings = instance->settings; context->autodetect = instance->autodetect; instance->update->context = instance->context; instance->update->pointer->context = instance->context; instance->update->primary->context = instance->context; instance->update->secondary->context = instance->context; instance->update->altsec->context = instance->context; instance->input->context = context; instance->autodetect->context = context; if (!(context->errorDescription = calloc(1, 500))) { WLog_ERR(TAG, "calloc failed!"); goto out_error_description; } if (!(context->channelErrorEvent = CreateEvent(NULL, TRUE, FALSE, NULL))) { WLog_ERR(TAG, "CreateEvent failed!"); goto out_error_create_event; } update_register_client_callbacks(rdp->update); instance->context->abortEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (!instance->context->abortEvent) goto out_error_abort_event; IFCALLRET(instance->ContextNew, ret, instance, instance->context); if (ret) return TRUE; CloseHandle(context->abortEvent); out_error_abort_event: CloseHandle(context->channelErrorEvent); out_error_create_event: free(context->errorDescription); out_error_description: graphics_free(context->graphics); out_error_graphics_new: rdp_free(rdp); out_error_rdp_new: metrics_free(context->metrics); out_error_metrics_new: PubSub_Free(context->pubSub); out_error_pubsub: free(instance->context); return FALSE; }
/** Allocator function for a rdp context. * The function will allocate a rdpRdp structure using rdp_new(), then copy * its contents to the appropriate fields in the rdp_freerdp structure given in parameters. * It will also initialize the 'context' field in the rdp_freerdp structure as needed. * If the caller has set the ContextNew callback in the 'instance' parameter, it will be called at the end of the function. * * @param instance - Pointer to the rdp_freerdp structure that will be initialized with the new context. */ BOOL freerdp_context_new(freerdp* instance) { rdpRdp* rdp; rdpContext* context; BOOL ret = TRUE; DWORD flags = WINPR_SSL_INIT_DEFAULT; instance->context = (rdpContext*) calloc(1, instance->ContextSize); if (!instance->context) return FALSE; context = instance->context; context->instance = instance; context->ServerMode = FALSE; context->settings = instance->settings; context->pubSub = PubSub_New(TRUE); if (!context->pubSub) goto fail; PubSub_AddEventTypes(context->pubSub, FreeRDP_Events, sizeof(FreeRDP_Events) / sizeof(wEventType)); context->metrics = metrics_new(context); if (!context->metrics) goto fail; rdp = rdp_new(context); if (!rdp) goto fail; instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; instance->autodetect = rdp->autodetect; context->graphics = graphics_new(context); if (!context->graphics) goto fail; context->rdp = rdp; context->input = instance->input; context->update = instance->update; context->settings = instance->settings; context->autodetect = instance->autodetect; instance->update->context = instance->context; instance->update->pointer->context = instance->context; instance->update->primary->context = instance->context; instance->update->secondary->context = instance->context; instance->update->altsec->context = instance->context; instance->input->context = context; instance->autodetect->context = context; if (!(context->errorDescription = calloc(1, 500))) { WLog_ERR(TAG, "calloc failed!"); goto fail; } if (!(context->channelErrorEvent = CreateEvent(NULL, TRUE, FALSE, NULL))) { WLog_ERR(TAG, "CreateEvent failed!"); goto fail; } update_register_client_callbacks(rdp->update); instance->context->abortEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (!instance->context->abortEvent) goto fail; if (!(context->channels = freerdp_channels_new(instance))) goto fail; IFCALLRET(instance->ContextNew, ret, instance, instance->context); if (ret) return TRUE; fail: freerdp_context_free(instance); return FALSE; }
/** Allocator function for a rdp context. * The function will allocate a rdpRdp structure using rdp_new(), then copy * its contents to the appropriate fields in the rdp_freerdp structure given in parameters. * It will also initialize the 'context' field in the rdp_freerdp structure as needed. * If the caller has set the ContextNew callback in the 'instance' parameter, it will be called at the end of the function. * * @param instance - Pointer to the rdp_freerdp structure that will be initialized with the new context. */ BOOL freerdp_context_new(freerdp* instance) { rdpRdp* rdp; rdpContext* context; BOOL ret = TRUE; instance->context = (rdpContext*) calloc(1, instance->ContextSize); if (!instance->context) return FALSE; context = instance->context; context->instance = instance; context->ServerMode = FALSE; context->settings = instance->settings; context->pubSub = PubSub_New(TRUE); if(!context->pubSub) goto out_error_pubsub; PubSub_AddEventTypes(context->pubSub, FreeRDP_Events, sizeof(FreeRDP_Events) / sizeof(wEventType)); context->metrics = metrics_new(context); if (!context->metrics) goto out_error_metrics_new; rdp = rdp_new(context); if (!rdp) goto out_error_rdp_new; instance->input = rdp->input; instance->update = rdp->update; instance->settings = rdp->settings; instance->autodetect = rdp->autodetect; context->graphics = graphics_new(context); if(!context->graphics) goto out_error_graphics_new; context->rdp = rdp; context->input = instance->input; context->update = instance->update; context->settings = instance->settings; context->autodetect = instance->autodetect; instance->update->context = instance->context; instance->update->pointer->context = instance->context; instance->update->primary->context = instance->context; instance->update->secondary->context = instance->context; instance->update->altsec->context = instance->context; instance->input->context = context; instance->autodetect->context = context; update_register_client_callbacks(rdp->update); IFCALLRET(instance->ContextNew, ret, instance, instance->context); if (ret) return TRUE; out_error_graphics_new: rdp_free(rdp); out_error_rdp_new: metrics_free(context->metrics); out_error_metrics_new: PubSub_Free(context->pubSub); out_error_pubsub: free(instance->context); return FALSE; }