channels: refactoring of rdpdr cmake scripts
This commit is contained in:
parent
fbd2f360e9
commit
cb69657b81
32
channels/client/CMakeLists.txt
Normal file
32
channels/client/CMakeLists.txt
Normal file
@ -0,0 +1,32 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 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(MODULE_NAME "freerdp-channels-client")
|
||||
set(MODULE_PREFIX "FREERDP_CHANNELS_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
loader.c)
|
||||
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Client")
|
||||
|
20
channels/client/loader.c
Normal file
20
channels/client/loader.c
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Client Channel Loader
|
||||
*
|
||||
* Copyright 2012 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.
|
||||
*/
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
# 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>
|
||||
# Copyright 2012 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.
|
||||
@ -17,19 +15,22 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(PARALLEL_SRCS
|
||||
parallel_main.c
|
||||
)
|
||||
set(MODULE_NAME "parallel")
|
||||
set(MODULE_PREFIX "CHANNEL_PARALLEL_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
parallel_main.c)
|
||||
|
||||
include_directories(..)
|
||||
|
||||
add_library(parallel ${PARALLEL_SRCS})
|
||||
set_target_properties(parallel PROPERTIES PREFIX "")
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(parallel freerdp)
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
else()
|
||||
target_link_libraries(parallel freerdp-utils)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils winpr-interlocked)
|
||||
endif()
|
||||
|
||||
install(TARGETS parallel DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
@ -1,9 +1,7 @@
|
||||
# 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>
|
||||
# Copyright 2012 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.
|
||||
@ -17,13 +15,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(PRINTER_SRCS
|
||||
set(MODULE_NAME "printer")
|
||||
set(MODULE_PREFIX "CHANNEL_PRINTER_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
printer_main.c
|
||||
printer_main.h)
|
||||
|
||||
if(WITH_CUPS)
|
||||
set(PRINTER_SRCS
|
||||
${PRINTER_SRCS}
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
|
||||
printer_cups.c
|
||||
printer_cups.h)
|
||||
|
||||
@ -32,25 +32,25 @@ if(WITH_CUPS)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(PRINTER_SRCS
|
||||
${PRINTER_SRCS}
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
|
||||
printer_win.c
|
||||
printer_win.h)
|
||||
endif()
|
||||
|
||||
include_directories(..)
|
||||
|
||||
add_library(printer ${PRINTER_SRCS})
|
||||
set_target_properties(printer PROPERTIES PREFIX "")
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(printer freerdp winpr)
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr)
|
||||
else()
|
||||
target_link_libraries(printer freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
endif()
|
||||
|
||||
if(WITH_CUPS)
|
||||
target_link_libraries(printer ${CUPS_LIBRARIES})
|
||||
target_link_libraries(${MODULE_NAME} ${CUPS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
install(TARGETS printer DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
@ -1,9 +1,7 @@
|
||||
# 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>
|
||||
# Copyright 2012 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.
|
||||
@ -17,23 +15,25 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(SCARD_SRCS
|
||||
set(MODULE_NAME "smartcard")
|
||||
set(MODULE_PREFIX "CHANNEL_PRINTER_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
scard_main.c
|
||||
scard_operations.c
|
||||
)
|
||||
scard_operations.c)
|
||||
|
||||
include_directories(..)
|
||||
include_directories(${PCSC_INCLUDE_DIRS})
|
||||
|
||||
add_library(scard ${SCARD_SRCS})
|
||||
set_target_properties(scard PROPERTIES PREFIX "")
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(scard freerdp winpr)
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr)
|
||||
else()
|
||||
target_link_libraries(scard freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
endif()
|
||||
|
||||
target_link_libraries(scard ${PCSC_LIBRARIES})
|
||||
target_link_libraries(${MODULE_NAME} ${PCSC_LIBRARIES})
|
||||
|
||||
install(TARGETS scard DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
@ -702,9 +702,9 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
instance->context->argv = __argv;
|
||||
|
||||
#ifdef WITH_RDPDR
|
||||
REGISTER_SVC_PLUGIN_ENTRY(rdpdr) ;
|
||||
REGISTER_DEV_PLUGIN_ENTRY(disk) ;
|
||||
REGISTER_DEV_PLUGIN_ENTRY(printer) ;
|
||||
REGISTER_SVC_PLUGIN_ENTRY(rdpdr);
|
||||
REGISTER_DEV_PLUGIN_ENTRY(disk);
|
||||
REGISTER_DEV_PLUGIN_ENTRY(printer);
|
||||
#endif
|
||||
|
||||
if (!CreateThread(NULL, 0, kbd_thread_func, NULL, 0, NULL))
|
||||
|
@ -139,6 +139,7 @@ static rdpChannels* g_init_channels;
|
||||
|
||||
/* The list of all channel managers. */
|
||||
typedef struct rdp_channels_list rdpChannelsList;
|
||||
|
||||
struct rdp_channels_list
|
||||
{
|
||||
rdpChannels* channels;
|
||||
@ -296,7 +297,7 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF
|
||||
|
||||
if (ppInitHandle == NULL)
|
||||
{
|
||||
DEBUG_CHANNELS("error bad pphan");
|
||||
DEBUG_CHANNELS("error bad init handle");
|
||||
return CHANNEL_RC_BAD_INIT_HANDLE;
|
||||
}
|
||||
|
||||
@ -690,7 +691,6 @@ int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, c
|
||||
|
||||
lib = channels->libs_data + channels->num_libs_data;
|
||||
lib->entry = (PVIRTUALCHANNELENTRY) freerdp_load_plugin(name, CHANNEL_EXPORT_FUNC_NAME);
|
||||
//lib->entry = (PVIRTUALCHANNELENTRY) freerdp_load_channel_plugin(settings, name, CHANNEL_EXPORT_FUNC_NAME);
|
||||
|
||||
if (lib->entry == NULL)
|
||||
{
|
||||
|
@ -48,7 +48,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define MAX_STATIC_PLUGINS 50
|
||||
|
||||
struct static_plugin
|
||||
@ -62,94 +61,6 @@ typedef struct static_plugin staticPlugin;
|
||||
static staticPlugin g_static_plugins[MAX_STATIC_PLUGINS];
|
||||
static int g_static_plugins_count;
|
||||
|
||||
|
||||
/**
|
||||
* UNUSED
|
||||
* This function opens a handle on the specified library in order to load symbols from it.
|
||||
* It is just a wrapper over dlopen(), but provides some logs in case of error.
|
||||
*
|
||||
* The returned pointer can be used to load a symbol from the library, using the freerdp_get_library_symbol() call.
|
||||
* The returned pointer should be closed using the freerdp_close_library() call.
|
||||
*
|
||||
* @see freerdp_get_library_symbol
|
||||
* @see freerdp_close_library
|
||||
*
|
||||
* @param file [IN] - library name
|
||||
* @return Pointer to the loaded library. NULL if an error occurs.
|
||||
*/
|
||||
void* freerdp_open_library(const char* file)
|
||||
{
|
||||
void* library;
|
||||
|
||||
library = DLOPEN(file);
|
||||
|
||||
if (library == NULL)
|
||||
{
|
||||
printf("freerdp_load_library: failed to open %s: %s\n", file, DLERROR());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return library;
|
||||
}
|
||||
|
||||
/**
|
||||
* UNUSED
|
||||
* This function retrieves a pointer to the specified symbol from the given (loaded) library.
|
||||
* It is a wrapper over the dlsym() function, but provides some logs in case of error.
|
||||
*
|
||||
* @see freerdp_open_library
|
||||
* @see freerdp_close_library
|
||||
*
|
||||
* @param library [IN] - a valid pointer to the opened library.
|
||||
* This pointer should come from a successful call to freerdp_open_library()
|
||||
* @param name [IN] - name of the symbol that must be loaded
|
||||
*
|
||||
* @return A pointer to the loaded symbol. NULL if an error occured.
|
||||
*/
|
||||
void* freerdp_get_library_symbol(void* library, const char* name)
|
||||
{
|
||||
void* symbol;
|
||||
|
||||
symbol = DLSYM(library, name);
|
||||
|
||||
if (symbol == NULL)
|
||||
{
|
||||
printf("freerdp_get_library_symbol: failed to load %s: %s\n", name, DLERROR());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* UNUSED
|
||||
* This function closes a library handle that was previously opened by freerdp_open_library().
|
||||
* It is a wrapper over dlclose(), but provides logs in case of error.
|
||||
*
|
||||
* @see freerdp_open_library
|
||||
* @see freerdp_get_library_symbol
|
||||
*
|
||||
* @return true if the close succeeded. false otherwise.
|
||||
*/
|
||||
boolean freerdp_close_library(void* library)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = DLCLOSE(library);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (status != 0)
|
||||
#else
|
||||
if (status == 0)
|
||||
#endif
|
||||
{
|
||||
printf("freerdp_free_library: failed to close: %s\n", DLERROR());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will load the specified library, retrieve the specified symbol in it, and return a pointer to it.
|
||||
* It is used in freerdp_load_plugin() and freerdp_load_channel_plugin().
|
||||
@ -204,7 +115,9 @@ void* freerdp_load_plugin(const char* name, const char* entry_name)
|
||||
|
||||
/* first attempt to load a static plugin */
|
||||
entry = freerdp_load_static_plugin(name, entry_name);
|
||||
if (entry != NULL) return entry;
|
||||
|
||||
if (entry != NULL)
|
||||
return entry;
|
||||
|
||||
suffixed_name = freerdp_append_shared_library_suffix((char*) name);
|
||||
|
||||
@ -233,71 +146,6 @@ void* freerdp_load_plugin(const char* name, const char* entry_name)
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* UNUSED
|
||||
* This function was meant to be used to load channel plugins.
|
||||
* It was initially called from freerdp_channels_load_plugin() but now we use the freerdp_load_plugin() function
|
||||
* which is more generic.
|
||||
*
|
||||
*/
|
||||
void* freerdp_load_channel_plugin(rdpSettings* settings, const char* name, const char* entry_name)
|
||||
{
|
||||
char* path;
|
||||
void* entry;
|
||||
char* suffixed_name;
|
||||
|
||||
suffixed_name = freerdp_append_shared_library_suffix((char*) name);
|
||||
|
||||
if (!freerdp_path_contains_separator(suffixed_name))
|
||||
{
|
||||
/* no explicit path given, use default path */
|
||||
|
||||
if (!settings->development_mode)
|
||||
{
|
||||
path = freerdp_construct_path(FREERDP_PLUGIN_PATH, suffixed_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* dot;
|
||||
char* plugin_name;
|
||||
char* channels_path;
|
||||
char* channel_subpath;
|
||||
|
||||
dot = strrchr(suffixed_name, '.');
|
||||
plugin_name = xmalloc((dot - suffixed_name) + 1);
|
||||
strncpy(plugin_name, suffixed_name, (dot - suffixed_name));
|
||||
plugin_name[(dot - suffixed_name)] = '\0';
|
||||
|
||||
channels_path = freerdp_construct_path(settings->development_path, "channels");
|
||||
channel_subpath = freerdp_construct_path(channels_path, plugin_name);
|
||||
|
||||
path = freerdp_construct_path(channel_subpath, suffixed_name);
|
||||
|
||||
xfree(plugin_name);
|
||||
xfree(channels_path);
|
||||
xfree(channel_subpath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* explicit path given, use it instead of default path */
|
||||
path = xstrdup(suffixed_name);
|
||||
}
|
||||
|
||||
entry = freerdp_load_library_symbol(path, entry_name);
|
||||
|
||||
xfree(suffixed_name);
|
||||
xfree(path);
|
||||
|
||||
if (entry == NULL)
|
||||
{
|
||||
printf("freerdp_load_channel_plugin: failed to load %s/%s\n", name, entry_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to register a static plugin so that it can be loaded later on using freerdp_load_plugin.
|
||||
*
|
||||
@ -334,6 +182,7 @@ boolean freerdp_register_static_plugin(const char* name, const char* entry_name,
|
||||
*
|
||||
* @return Pointer to the entry function, NULL if no matching plugin could be found
|
||||
*/
|
||||
|
||||
void* freerdp_load_static_plugin(const char* name, const char* entry_name)
|
||||
{
|
||||
int i;
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
/* The list of all plugin instances. */
|
||||
typedef struct rdp_svc_plugin_list rdpSvcPluginList;
|
||||
|
||||
struct rdp_svc_plugin_list
|
||||
{
|
||||
rdpSvcPlugin* plugin;
|
||||
@ -160,7 +161,7 @@ static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, uint3
|
||||
/* According to MS-RDPBCGR 2.2.6.1, "All virtual channel traffic MUST be suspended.
|
||||
This flag is only valid in server-to-client virtual channel traffic. It MUST be
|
||||
ignored in client-to-server data." Thus it would be best practice to cease data
|
||||
transmission. However, simply returing here avoids a crash. */
|
||||
transmission. However, simply returning here avoids a crash. */
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user