diff --git a/.gitignore b/.gitignore index 4ebb74f3d..a33e728ac 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ client/X11/xfreerdp client/test/freerdp-test client/DirectFB/dfreerdp server/test/tfreerdp-server +server/test/xfreerdp-server diff --git a/include/freerdp/common/color.h b/include/freerdp/common/color.h index 76bdb3e00..77c6b47cf 100644 --- a/include/freerdp/common/color.h +++ b/include/freerdp/common/color.h @@ -1,6 +1,6 @@ /** * FreeRDP: A Remote Desktop Protocol Client - * GDI Color Conversion Routines + * Color Conversion Routines * * Copyright 2010 Marc-Andre Moreau * diff --git a/libfreerdp-common/color.c b/libfreerdp-common/color.c index fe5a3c717..bb5af4d65 100644 --- a/libfreerdp-common/color.c +++ b/libfreerdp-common/color.c @@ -1,6 +1,6 @@ /** * FreeRDP: A Remote Desktop Protocol Client - * GDI Color Conversion Routines + * Color Conversion Routines * * Copyright 2010 Marc-Andre Moreau * diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 18c935acb..37cdbf3e2 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -20,8 +20,6 @@ # Servers if(NOT WIN32) - - # Build Test Server + add_subdirectory(X11) add_subdirectory(test) - endif() diff --git a/server/X11/CMakeLists.txt b/server/X11/CMakeLists.txt new file mode 100644 index 000000000..bca1a2572 --- /dev/null +++ b/server/X11/CMakeLists.txt @@ -0,0 +1,27 @@ +# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP X11 Server cmake build script +# +# Copyright 2011 O.S. Systems Software Ltda. +# Copyright 2011 Otavio Salvador +# Copyright 2011 Marc-Andre Moreau +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +add_executable(xfreerdp-server + xf_peer.c + xf_encode.c + xfreerdp.c) + +target_link_libraries(xfreerdp-server freerdp-core) +target_link_libraries(xfreerdp-server freerdp-utils) +target_link_libraries(xfreerdp-server freerdp-rfx) diff --git a/server/X11/rfx_test.pcap b/server/X11/rfx_test.pcap new file mode 100644 index 000000000..768c3960f Binary files /dev/null and b/server/X11/rfx_test.pcap differ diff --git a/server/X11/server.crt b/server/X11/server.crt new file mode 100644 index 000000000..7ce931c26 --- /dev/null +++ b/server/X11/server.crt @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICyzCCAbOgAwIBAgIJANbqtAWwlQZuMA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV +BAMTB0ZyZWVSRFAwHhcNMDkxMDI5MDA0MTQ5WhcNMDkxMTI4MDA0MTQ5WjASMRAw +DgYDVQQDEwdGcmVlUkRQMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA +q7mxFgRbS2FYJZX7BzpNd4T/n4nEVDBY6YaObLjGpaB1TptzXTcmfDrDslTGwcEY +hTFAC4ZvY6yOURExqbph4LSgvkoa6J722RjVPfshGa4mlh2SXvTiaV26VPPxddGb +o6fbs2u029lbtBlpIVbhx5RN9vstNkll26oSZ6wfEdBNHQJLd2SU4ItWHj8zjz1f +eGxjgChHihUlwcBYKDJsKFkzHZmLrMgB37KsGlXi/WV+eEsjgvz4yP7I3TL8+GsN +MjV8fRGVEKTbKSmgunO67d5u+IaqUQb0Ad1ha1jzDQ+a6hdymrulJSIhoOVfKkwi +ptTe43FgwxVRIygJP9HjHQIDAQABoyQwIjATBgNVHSUEDDAKBggrBgEFBQcDATAL +BgNVHQ8EBAMCBDAwDQYJKoZIhvcNAQEFBQADggEBAIOdEDhOX2kbl02znltd9hCr +nV4kRPKm979RKwBNkrEuwYSlcsjAHg5MZ5itH3wFOUo2s5pjt7/vMOAg+6rOBbIa +nqr22/gKBtOmuaJLG1yjxDC2vfez7f3B26pKgxa/krM8oxiFdT9n8QbdxdkN7/D9 +3RLU/aCfgrMzXxRus7eq3kR00jnSs6ggnAfE1E9gric3vFgr1wCzdcriRXmXDfUb +hRq+4VG+ZWk16TwCofV5GVU39XWCv5HNO2swAdjkNXgI5e3tQbV3wWLZLqqYzBco +iWulAXtoCGmE81+u1Ms7hLLzpXitLZSGPu1r+sDdkKPLCmOvkAaljDQ4nBz7fIA= +-----END CERTIFICATE----- diff --git a/server/X11/server.key b/server/X11/server.key new file mode 100644 index 000000000..5c2f2c803 --- /dev/null +++ b/server/X11/server.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEAq7mxFgRbS2FYJZX7BzpNd4T/n4nEVDBY6YaObLjGpaB1Tptz +XTcmfDrDslTGwcEYhTFAC4ZvY6yOURExqbph4LSgvkoa6J722RjVPfshGa4mlh2S +XvTiaV26VPPxddGbo6fbs2u029lbtBlpIVbhx5RN9vstNkll26oSZ6wfEdBNHQJL +d2SU4ItWHj8zjz1feGxjgChHihUlwcBYKDJsKFkzHZmLrMgB37KsGlXi/WV+eEsj +gvz4yP7I3TL8+GsNMjV8fRGVEKTbKSmgunO67d5u+IaqUQb0Ad1ha1jzDQ+a6hdy +mrulJSIhoOVfKkwiptTe43FgwxVRIygJP9HjHQIDAQABAoIBAAVv5K54xtc1JtBR +1lfdPbSqDlnjx8aOnVIPg5TnqMp3sR8jBt0NsPc/+RA9ZOmfjoIxFAEJaZ9zSDJC +5BqmnxC5R1mfCQkSd2haQ+4pdFvWyrv4Bblh8YU6hXrJGn0LfO0KlIcywtAvKpsi +LtTyZkWmaW2HeF/+pO32jYygw38R1wd8Tl6GwjOXwTF6lFACJXOT4YAzcfp3FKSB +AiKBIGuMzozoSND7KPFNRrhGhNumJpdS5A8Fb8D2c/ZMv6Cq5IbwOgTfKun+Bz+s +mFbnzeb1uWRqQbsVXOBBW/zHfuG3SU5qeZsaAyuu4DTy+LE1oAHF9uhBSHuT5C6i +vCJ8A8ECgYEA1iaOmiEJYBrs25iAc4SjCKqhY0mwR3wtu3I06vmgUoML5fhPMv36 +SvYQIqDyNw3p7TE6mZtw9+G+kK3PqhuJhogwSwg0a6o51RdKnhXH3/68oNWtKCLC +1AmR8q/Gd3FwAR3b49CuOIZ9uOiJrc/ejzKdFEJTDR1/TX1frWfZznECgYEAzUiz +XxFf7YrGel7JgmfRD2eZRYngOoteFlg5Tee42UjeAY2Pt2aiDLk+2TqQEdI9+Xg7 +LcFdBqcSNd8bh33xSzgNthIkX+lTDzx0SmKGfyxfFBJcY8nzsLvvnNt3YeuMeaJQ +CPszwoZ0jcD46jTCjbrKhaLyEWmUkDp1O71NTW0CgYAXKF49Xpsz8FVyvcAOPeaf +dkwzf3F3mX8ciRId4taqdY9g1AREgGCDoK5IAF2RBIkqZCtxFvUVaS0BWjpdq9Ko +YKvQQVfh2KueVoF0LOjLWTGutsydzXyCD3Lf6pAstHCnPkJcFWHxrOGFkGfrCtKH +a7K+0RlIDsuIZqllCBjukQKBgA31+MTpYJW+D1t5IMkumEgs6n6RLt+sZLyuSU9k +B+03CGogn3qAj1rAKmcJlYywuKhDpfqpoNL3/8QMJUokpYlRCZWtTC39pzltCheY +9b6mXNz3lrLupBUL4vLO9iKBq28GO90wgEelbz3ItuTuq6CJ6IYIG+BVRtY8M4bZ +i+1NAoGANXZjYnJYDnh8Je9SDxDSc5byzK7ddkQoId64RCIfNHqNKH63P81vjgnH +YBIPtagY75ZVVNxujCF7m8Rety+d8tEFwfQKDin2EVI7PD2rOJra385/izp7HuBR +vqxvLzG9Xv3cNOU2l7PttVw4Pa2i5E37atKi3V3Zp2kMW+KaKPQ= +-----END RSA PRIVATE KEY----- diff --git a/server/X11/xf_encode.c b/server/X11/xf_encode.c new file mode 100644 index 000000000..00d34bc7c --- /dev/null +++ b/server/X11/xf_encode.c @@ -0,0 +1,20 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * X11 RemoteFX Encoder + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "xf_encode.h" diff --git a/server/X11/xf_encode.h b/server/X11/xf_encode.h new file mode 100644 index 000000000..c4f89ced6 --- /dev/null +++ b/server/X11/xf_encode.h @@ -0,0 +1,25 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * X11 RemoteFX Encoder + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __XF_ENCODE_H +#define __XF_ENCODE_H + + + +#endif /* __XF_ENCODE_H */ diff --git a/server/X11/xf_peer.c b/server/X11/xf_peer.c new file mode 100644 index 000000000..d6085d878 --- /dev/null +++ b/server/X11/xf_peer.c @@ -0,0 +1,287 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * X11 Peer + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include + +extern char* xf_pcap_file; + +#include "xf_peer.h" + +void xf_peer_init(freerdp_peer* client) +{ + xfPeerInfo* info; + + info = xnew(xfPeerInfo); + + info->context = rfx_context_new(); + info->context->mode = RLGR3; + info->context->width = client->settings->width; + info->context->height = client->settings->height; + rfx_context_set_pixel_format(info->context, RFX_PIXEL_FORMAT_RGB); + + info->s = stream_new(65536); + + client->param1 = info; +} + +void xf_peer_uninit(freerdp_peer* client) +{ + xfPeerInfo* info = (xfPeerInfo*) client->param1; + + if (info) + { + stream_free(info->s); + rfx_context_free(info->context); + xfree(info); + } +} + +STREAM* xf_peer_stream_init(xfPeerInfo* info) +{ + stream_clear(info->s); + stream_set_pos(info->s, 0); + return info->s; +} + +void xf_peer_dump_rfx(freerdp_peer* client) +{ + STREAM* s; + uint32 seconds; + uint32 useconds; + rdpUpdate* update; + rdpPcap* pcap_rfx; + pcap_record record; + + s = stream_new(512); + update = client->update; + client->update->pcap_rfx = pcap_open(xf_pcap_file, False); + pcap_rfx = client->update->pcap_rfx; + + seconds = useconds = 0; + + while (pcap_has_next_record(pcap_rfx)) + { + pcap_get_next_record_header(pcap_rfx, &record); + + s->data = xrealloc(s->data, record.length); + record.data = s->data; + s->size = record.length; + + pcap_get_next_record_content(pcap_rfx, &record); + s->p = s->data + s->size; + + seconds = record.header.ts_sec - seconds; + useconds = record.header.ts_usec - useconds; + + if (seconds > 0) + freerdp_sleep(seconds); + + if (useconds > 0) + freerdp_usleep(useconds); + + update->SurfaceCommand(update, s); + } +} + +boolean xf_peer_post_connect(freerdp_peer* client) +{ + /** + * This callback is called when the entire connection sequence is done, i.e. we've received the + * Font List PDU from the client and sent out the Font Map PDU. + * The server may start sending graphics output and receiving keyboard/mouse input after this + * callback returns. + */ + printf("Client %s is activated", client->settings->hostname); + if (client->settings->autologon) + { + printf(" and wants to login automatically as %s\\%s", + client->settings->domain ? client->settings->domain : "", + client->settings->username); + + /* A real server may perform OS login here if NLA is not executed previously. */ + } + printf("\n"); + + printf("Client requested desktop: %dx%dx%d\n", + client->settings->width, client->settings->height, client->settings->color_depth); + + /* A real server should tag the peer as activated here and start sending updates in mainloop. */ + xf_peer_init(client); + + /* Return False here would stop the execution of the peer mainloop. */ + return True; +} + +boolean xf_peer_activate(freerdp_peer* client) +{ + xfPeerInfo* info = (xfPeerInfo*) client->param1; + + rfx_context_reset(info->context); + info->activated = True; + + if (xf_pcap_file != NULL) + { + client->update->dump_rfx = True; + xf_peer_dump_rfx(client); + } + + return True; +} + +void xf_peer_synchronize_event(rdpInput* input, uint32 flags) +{ + printf("Client sent a synchronize event (flags:0x%X)\n", flags); +} + +void xf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +{ + freerdp_peer* client = (freerdp_peer*) input->param1; + rdpUpdate* update = client->update; + xfPeerInfo* info = (xfPeerInfo*)client->param1; + + printf("Client sent a keyboard event (flags:0x%X code:0x%X)\n", flags, code); + + if ((flags & 0x4000) && code == 0x1F) /* 's' key */ + { + if (client->settings->width != 800) + { + client->settings->width = 800; + client->settings->height = 600; + } + else + { + client->settings->width = 640; + client->settings->height = 480; + } + update->DesktopResize(update); + info->activated = False; + } +} + +void xf_peer_unicode_keyboard_event(rdpInput* input, uint16 code) +{ + printf("Client sent a unicode keyboard event (code:0x%X)\n", code); +} + +void xf_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +{ + printf("Client sent a mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y); +} + +void xf_peer_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +{ + printf("Client sent an extended mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y); +} + +void* xf_peer_main_loop(void* arg) +{ + int i; + int fds; + int max_fds; + int rcount; + void* rfds[32]; + fd_set rfds_set; + freerdp_peer* client = (freerdp_peer*) arg; + + memset(rfds, 0, sizeof(rfds)); + + printf("We've got a client %s\n", client->settings->hostname); + + /* Initialize the real server settings here */ + client->settings->cert_file = xstrdup("server.crt"); + client->settings->privatekey_file = xstrdup("server.key"); + client->settings->nla_security = False; + client->settings->rfx_codec = True; + + client->PostConnect = xf_peer_post_connect; + client->Activate = xf_peer_activate; + + client->input->param1 = client; + client->input->SynchronizeEvent = xf_peer_synchronize_event; + client->input->KeyboardEvent = xf_peer_keyboard_event; + client->input->UnicodeKeyboardEvent = xf_peer_unicode_keyboard_event; + client->input->MouseEvent = xf_peer_mouse_event; + client->input->ExtendedMouseEvent = xf_peer_extended_mouse_event; + + client->Initialize(client); + + while (1) + { + rcount = 0; + + if (client->GetFileDescriptor(client, rfds, &rcount) != True) + { + printf("Failed to get FreeRDP file descriptor\n"); + break; + } + + max_fds = 0; + FD_ZERO(&rfds_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; + + if (select(max_fds + 1, &rfds_set, NULL, NULL, NULL) == -1) + { + /* these are not really errors */ + if (!((errno == EAGAIN) || + (errno == EWOULDBLOCK) || + (errno == EINPROGRESS) || + (errno == EINTR))) /* signal occurred */ + { + printf("select failed\n"); + break; + } + } + + if (client->CheckFileDescriptor(client) != True) + break; + } + + printf("Client %s disconnected.\n", client->settings->hostname); + + client->Disconnect(client); + xf_peer_uninit(client); + freerdp_peer_free(client); + + return NULL; +} + +void xf_peer_accepted(freerdp_listener* instance, freerdp_peer* client) +{ + pthread_t th; + pthread_create(&th, 0, xf_peer_main_loop, client); + pthread_detach(th); +} diff --git a/server/X11/xf_peer.h b/server/X11/xf_peer.h new file mode 100644 index 000000000..06aab2b3d --- /dev/null +++ b/server/X11/xf_peer.h @@ -0,0 +1,37 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * X11 Peer + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __XF_PEER_H +#define __XF_PEER_H + +#include +#include +#include + +struct xf_peer_info +{ + STREAM* s; + boolean activated; + RFX_CONTEXT* context; +}; +typedef struct xf_peer_info xfPeerInfo; + +void xf_peer_accepted(freerdp_listener* instance, freerdp_peer* client); + +#endif /* __XF_PEER_H */ diff --git a/server/X11/xfreerdp.c b/server/X11/xfreerdp.c new file mode 100644 index 000000000..94670c335 --- /dev/null +++ b/server/X11/xfreerdp.c @@ -0,0 +1,114 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP X11 Server + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include "xf_peer.h" +#include "xfreerdp.h" + +char* xf_pcap_file = NULL; + +void xf_server_main_loop(freerdp_listener* instance) +{ + int i; + int fds; + int max_fds; + int rcount; + void* rfds[32]; + fd_set rfds_set; + + memset(rfds, 0, sizeof(rfds)); + + while (1) + { + rcount = 0; + + if (instance->GetFileDescriptor(instance, rfds, &rcount) != True) + { + printf("Failed to get FreeRDP file descriptor\n"); + break; + } + + max_fds = 0; + FD_ZERO(&rfds_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; + + if (select(max_fds + 1, &rfds_set, NULL, NULL, NULL) == -1) + { + /* these are not really errors */ + if (!((errno == EAGAIN) || + (errno == EWOULDBLOCK) || + (errno == EINPROGRESS) || + (errno == EINTR))) /* signal occurred */ + { + printf("select failed\n"); + break; + } + } + + if (instance->CheckFileDescriptor(instance) != True) + { + printf("Failed to check FreeRDP file descriptor\n"); + break; + } + } + + instance->Close(instance); +} + +int main(int argc, char* argv[]) +{ + freerdp_listener* instance; + + /* Ignore SIGPIPE, otherwise an SSL_write failure could crash your server */ + signal(SIGPIPE, SIG_IGN); + + instance = freerdp_listener_new(); + + instance->PeerAccepted = xf_peer_accepted; + + if (argc > 1) + xf_pcap_file = argv[1]; + + /* Open the server socket and start listening. */ + if (instance->Open(instance, NULL, 3389)) + { + /* Entering the server main loop. In a real server the listener can be run in its own thread. */ + xf_server_main_loop(instance); + } + + freerdp_listener_free(instance); + + return 0; +} + diff --git a/server/X11/xfreerdp.h b/server/X11/xfreerdp.h new file mode 100644 index 000000000..73d5e1e32 --- /dev/null +++ b/server/X11/xfreerdp.h @@ -0,0 +1,25 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP X11 Server + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __XFREERDP_H +#define __XFREERDP_H + + + +#endif /* __XFREERDP_H */ diff --git a/server/test/tfreerdp.c b/server/test/tfreerdp.c index 4984a117e..5397a6531 100644 --- a/server/test/tfreerdp.c +++ b/server/test/tfreerdp.c @@ -238,7 +238,7 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y) info->icon_y = y; } -void test_peer_dump_rfx(freerdp_peer* client) +void xf_peer_dump_rfx(freerdp_peer* client) { STREAM* s; uint32 seconds; @@ -278,7 +278,7 @@ void test_peer_dump_rfx(freerdp_peer* client) } } -boolean test_peer_post_connect(freerdp_peer* client) +boolean xf_peer_post_connect(freerdp_peer* client) { /** * This callback is called when the entire connection sequence is done, i.e. we've received the @@ -308,7 +308,7 @@ boolean test_peer_post_connect(freerdp_peer* client) return True; } -boolean test_peer_activate(freerdp_peer* client) +boolean xf_peer_activate(freerdp_peer* client) { testPeerInfo* info = (testPeerInfo*)client->param1; @@ -318,7 +318,7 @@ boolean test_peer_activate(freerdp_peer* client) if (test_pcap_file != NULL) { client->update->dump_rfx = True; - test_peer_dump_rfx(client); + xf_peer_dump_rfx(client); } else { @@ -328,12 +328,12 @@ boolean test_peer_activate(freerdp_peer* client) return True; } -void test_peer_synchronize_event(rdpInput* input, uint32 flags) +void xf_peer_synchronize_event(rdpInput* input, uint32 flags) { printf("Client sent a synchronize event (flags:0x%X)\n", flags); } -void test_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void xf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) { freerdp_peer* client = (freerdp_peer*) input->param1; rdpUpdate* update = client->update; @@ -358,19 +358,19 @@ void test_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) } } -void test_peer_unicode_keyboard_event(rdpInput* input, uint16 code) +void xf_peer_unicode_keyboard_event(rdpInput* input, uint16 code) { printf("Client sent a unicode keyboard event (code:0x%X)\n", code); } -void test_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void xf_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) { printf("Client sent a mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y); test_peer_draw_icon(input->param1, x + 10, y); } -void test_peer_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void xf_peer_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) { printf("Client sent an extended mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y); } @@ -395,15 +395,15 @@ static void* test_peer_mainloop(void* arg) client->settings->nla_security = False; client->settings->rfx_codec = True; - client->PostConnect = test_peer_post_connect; - client->Activate = test_peer_activate; + client->PostConnect = xf_peer_post_connect; + client->Activate = xf_peer_activate; client->input->param1 = client; - client->input->SynchronizeEvent = test_peer_synchronize_event; - client->input->KeyboardEvent = test_peer_keyboard_event; - client->input->UnicodeKeyboardEvent = test_peer_unicode_keyboard_event; - client->input->MouseEvent = test_peer_mouse_event; - client->input->ExtendedMouseEvent = test_peer_extended_mouse_event; + client->input->SynchronizeEvent = xf_peer_synchronize_event; + client->input->KeyboardEvent = xf_peer_keyboard_event; + client->input->UnicodeKeyboardEvent = xf_peer_unicode_keyboard_event; + client->input->MouseEvent = xf_peer_mouse_event; + client->input->ExtendedMouseEvent = xf_peer_extended_mouse_event; client->Initialize(client);