mirror of https://github.com/FreeRDP/FreeRDP
Add rdpdbg test plugin.
This commit is contained in:
parent
e88d209d0c
commit
9bdb09f876
|
@ -0,0 +1,21 @@
|
|||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2011 O.S. Systems Software Ltda.
|
||||
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
|
||||
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
#
|
||||
# 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_subdirectory(rdpdbg)
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2011 O.S. Systems Software Ltda.
|
||||
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
|
||||
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
#
|
||||
# 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.
|
||||
|
||||
set(RDPDBG_SRCS
|
||||
rdpdbg_main.c
|
||||
)
|
||||
|
||||
add_library(rdpdbg SHARED ${RDPDBG_SRCS})
|
||||
set_target_properties(rdpdbg PROPERTIES PREFIX "")
|
||||
|
||||
target_link_libraries(rdpdbg freerdp-utils)
|
||||
|
||||
install(TARGETS rdpdbg DESTINATION lib/freerdp)
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* Debugging Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2011 Vic Lee
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
typedef struct rdpdbg_plugin rdpdbgPlugin;
|
||||
struct rdpdbg_plugin
|
||||
{
|
||||
rdpSvcPlugin plugin;
|
||||
};
|
||||
|
||||
static void rdpdbg_process_connect(rdpSvcPlugin* plugin)
|
||||
{
|
||||
printf("rdpdbg_process_connect\n");
|
||||
}
|
||||
|
||||
static void rdpdbg_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
|
||||
{
|
||||
STREAM* data_out;
|
||||
|
||||
printf("rdpdbg_process_receive: size %d\n", stream_get_size(data_in));
|
||||
stream_free(data_in);
|
||||
|
||||
data_out = stream_new(8);
|
||||
stream_write(data_out, "senddata", 8);
|
||||
svc_plugin_send(plugin, data_out);
|
||||
}
|
||||
|
||||
static void rdpdbg_process_terminate(rdpSvcPlugin* plugin)
|
||||
{
|
||||
printf("rdpdbg_process_terminate\n");
|
||||
xfree(plugin);
|
||||
}
|
||||
|
||||
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
rdpdbgPlugin* rdpdbg;
|
||||
|
||||
rdpdbg = (rdpdbgPlugin*)xmalloc(sizeof(rdpdbgPlugin));
|
||||
memset(rdpdbg, 0, sizeof(rdpdbgPlugin));
|
||||
|
||||
rdpdbg->plugin.channel_entry_points = *pEntryPoints;
|
||||
rdpdbg->plugin.channel_def.options = CHANNEL_OPTION_INITIALIZED |
|
||||
CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP |
|
||||
CHANNEL_OPTION_SHOW_PROTOCOL;
|
||||
strcpy(rdpdbg->plugin.channel_def.name, "rdpdbg");
|
||||
|
||||
rdpdbg->plugin.connect_callback = rdpdbg_process_connect;
|
||||
rdpdbg->plugin.receive_callback = rdpdbg_process_receive;
|
||||
rdpdbg->plugin.terminate_callback = rdpdbg_process_terminate;
|
||||
|
||||
svc_plugin_init((rdpSvcPlugin*)rdpdbg);
|
||||
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue