Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Externalize custom channels #9525

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,10 @@ if(WITH_CHANNELS)
add_subdirectory(channels)
endif()

if(WITH_CUSTOM_CHANNELS)
add_subdirectory(custom-channels)
endif()

if(WITH_CLIENT_COMMON OR WITH_CLIENT)
add_subdirectory(client)
endif()
Expand Down
13 changes: 0 additions & 13 deletions channels/ainput/ChannelOptions.cmake

This file was deleted.

10 changes: 0 additions & 10 deletions channels/rdp2tcp/ChannelOptions.cmake

This file was deleted.

12 changes: 0 additions & 12 deletions channels/sshagent/ChannelOptions.cmake

This file was deleted.

19 changes: 1 addition & 18 deletions client/common/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <freerdp/channels/drdynvc.h>
#include <freerdp/channels/cliprdr.h>
#include <freerdp/channels/encomsp.h>
#include <freerdp/channels/rdp2tcp.h>
#include <freerdp/channels/remdesk.h>
#include <freerdp/channels/rdpsnd.h>
#include <freerdp/channels/disp.h>
Expand Down Expand Up @@ -531,7 +530,7 @@ BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
printf("Serial Port Redirection: /serial:COM1,/dev/ttyS0\n");
printf("Parallel Port Redirection: /parallel:<name>,<device>\n");
printf("Printer Redirection: /printer:<device>,<driver>,[default]\n");
printf("TCP redirection: /rdp2tcp:/usr/bin/rdp2tcp\n");
printf("TCP redirection: /vc:rdp2tcp:/usr/bin/rdp2tcp\n");
printf("\n");
printf("Audio Output Redirection: /sound:sys:oss,dev:1,format:1\n");
printf("Audio Output Redirection: /sound:sys:alsa\n");
Expand Down Expand Up @@ -990,10 +989,6 @@ static int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_A
{
settings->SupportEchoChannel = enable;
}
CommandLineSwitchCase(arg, "ssh-agent")
{
settings->SupportSSHAgentChannel = enable;
}
CommandLineSwitchCase(arg, "disp")
{
settings->SupportDisplayControl = enable;
Expand Down Expand Up @@ -4501,11 +4496,6 @@ static int freerdp_client_settings_parse_command_line_arguments_int(rdpSettings*
if (!freerdp_settings_set_string(settings, FreeRDP_ActionScript, arg->Value))
return COMMAND_LINE_ERROR_MEMORY;
}
CommandLineSwitchCase(arg, RDP2TCP_DVC_CHANNEL_NAME)
{
if (!freerdp_settings_set_string(settings, FreeRDP_RDP2TCPArgs, arg->Value))
return COMMAND_LINE_ERROR_MEMORY;
}
CommandLineSwitchCase(arg, "fipsmode")
{
settings->FIPSMode = enable;
Expand Down Expand Up @@ -5145,13 +5135,6 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
}
}

if (settings->RDP2TCPArgs)
{
if (!freerdp_client_load_static_channel_addin(channels, settings, RDP2TCP_DVC_CHANNEL_NAME,
settings->RDP2TCPArgs))
return FALSE;
}

/* step 4: do the static channels loading and init */
for (i = 0; i < settings->StaticChannelCount; i++)
{
Expand Down
4 changes: 0 additions & 4 deletions client/common/cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,6 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
"Pass the hash (restricted admin mode)" },
{ "pwidth", COMMAND_LINE_VALUE_REQUIRED, "<width>", NULL, NULL, -1, NULL,
"Physical width of display (in millimeters)" },
{ "rdp2tcp", COMMAND_LINE_VALUE_REQUIRED, "<executable path[:arg...]>", NULL, NULL, -1, NULL,
"TCP redirection" },
{ "reconnect-cookie", COMMAND_LINE_VALUE_REQUIRED, "<base64-cookie>", NULL, NULL, -1, NULL,
"Pass base64 reconnect cookie to the connection" },
{ "redirect-prefer", COMMAND_LINE_VALUE_REQUIRED, "<FQDN|IP|NETBIOS>,[...]", NULL, NULL, -1,
Expand Down Expand Up @@ -435,8 +433,6 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
"Span screen over multiple monitors" },
{ "spn-class", COMMAND_LINE_VALUE_REQUIRED, "<service-class>", NULL, NULL, -1, NULL,
"SPN authentication service class" },
{ "ssh-agent", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "ssh-agent",
"SSH Agent forwarding channel" },
{ "sspi-module", COMMAND_LINE_VALUE_REQUIRED, "<SSPI module path>", NULL, NULL, -1, NULL,
"SSPI shared library module file path" },
{ "winscard-module", COMMAND_LINE_VALUE_REQUIRED, "<WinSCard module path>", NULL, NULL, -1,
Expand Down
1 change: 1 addition & 0 deletions cmake/ConfigOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ CMAKE_DEPENDENT_OPTION(WITH_CLIENT_SDL "[experimental] Build SDL client " ON "WI
option(WITH_SERVER "Build server binaries" ON)

option(WITH_CHANNELS "Build virtual channel plugins" ON)
option(WITH_CUSTOM_CHANNELS "Build (loadable) custom virtual channel plugins" ON)

option(FREERDP_UNIFIED_BUILD "Build WinPR, uwac, RdTk and FreeRDP in one go" ON)

Expand Down
7 changes: 7 additions & 0 deletions custom-channels/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (NOT BUILD_SHARED_LIBS)
message(WARNING "disabling custom channels, not supported for static builds")
else()
add_subdirectory(ainput)
add_subdirectory(rdp2tcp)
add_subdirectory(sshagent)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

define_channel("ainput")
include(CMakeDependentOption)

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
endif()

if(WITH_SERVER_CHANNELS)
add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME})
option(CHANNEL_AINPUT "build ainput channel" ON)
CMAKE_DEPENDENT_OPTION(CHANNEL_AINPUT_CLIENT "build ainput client channel" ON
"CHANNEL_AINPUT" OFF)
CMAKE_DEPENDENT_OPTION(CHANNEL_AINPUT_SERVER "build ainput server channel" ON
"CHANNEL_AINPUT" OFF)
if (CHANNEL_AINPUT)
if (CHANNEL_AINPUT_CLIENT)
add_subdirectory(client)
endif()
if (CHANNEL_AINPUT_SERVER)
add_subdirectory(server)
endif()
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.

define_channel_server("ainput")
set(MODULE_NAME "ainput-client")

set(${MODULE_PREFIX}_SRCS
set(SRCS
ainput_main.c
ainput_main.h
)

set(${MODULE_PREFIX}_LIBS
freerdp
set(LIBS
freerdp-client
freerdp
winpr
)

include_directories(..)

add_library(${MODULE_NAME}
SHARED
${SRCS}
)
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})
install(TARGETS ${MODULE_NAME} COMPONENT channels EXPORT FreeRDPTargets
ARCHIVE DESTINATION ${FREERDP_PLUGIN_PATH}
LIBRARY DESTINATION ${FREERDP_PLUGIN_PATH}
RUNTIME DESTINATION ${FREERDP_PLUGIN_PATH}
)
add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry")
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static const IWTSVirtualChannelCallback ainput_functions = { ainput_on_data_rece
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT ainput_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(FREERDP_API UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, AINPUT_DVC_CHANNEL_NAME,
sizeof(AINPUT_PLUGIN), sizeof(GENERIC_CHANNEL_CALLBACK),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

define_channel_client("ainput")
set(MODULE_NAME "ainput-server")

set(${MODULE_PREFIX}_SRCS
set(SRCS
ainput_main.c
ainput_main.h
)

set(${MODULE_PREFIX}_LIBS
set(LIBS
freerdp
winpr
)

include_directories(..)

add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry")
add_library(${MODULE_NAME}
SHARED
${SRCS}
)
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})
install(TARGETS ${MODULE_NAME} COMPONENT channels EXPORT FreeRDPTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

define_channel("rdp2tcp")
include(CMakeDependentOption)

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
option(CHANNEL_RDP2TCP "build rdp2tcp channel" ON)
CMAKE_DEPENDENT_OPTION(CHANNEL_RDP2TCP_CLIENT "build rdp2tcp client channel" ON
"CHANNEL_RDP2TCP" OFF)
CMAKE_DEPENDENT_OPTION(CHANNEL_RDP2TCP_SERVER "build rdp2tcp server channel" OFF
"CHANNEL_RDP2TCP" OFF)
if (CHANNEL_RDP2TCP)
if (CHANNEL_RDP2TCP_CLIENT)
add_subdirectory(client)
endif()
if (CHANNEL_RDP2TCP_SERVER)
add_subdirectory(server)
endif()
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

define_channel_client("rdp2tcp")
set(MODULE_NAME "rdp2tcp-client")

set(${MODULE_PREFIX}_SRCS
rdp2tcp_main.c
set(SRCS
rdp2tcp_main.c
)

set(${MODULE_PREFIX}_LIBS
freerdp
set(LIBS
freerdp
winpr
)

include_directories(..)

add_library(${MODULE_NAME}
SHARED
${SRCS}
)
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})
install(TARGETS ${MODULE_NAME} COMPONENT channels EXPORT FreeRDPTargets
ARCHIVE DESTINATION ${FREERDP_PLUGIN_PATH}
LIBRARY DESTINATION ${FREERDP_PLUGIN_PATH}
RUNTIME DESTINATION ${FREERDP_PLUGIN_PATH}
)
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "VirtualChannelEntryEx")
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <freerdp/freerdp.h>
#include <freerdp/svc.h>
#include <freerdp/channels/rdp2tcp.h>
#include "rdp2tcp.h"

#include <freerdp/log.h>
#define TAG CLIENT_TAG(RDP2TCP_DVC_CHANNEL_NAME)
Expand Down Expand Up @@ -316,13 +316,8 @@ static VOID VCAPITYPE VirtualChannelInitEventEx(LPVOID lpUserParam, LPVOID pInit
}
}

#if 1
#define VirtualChannelEntryEx rdp2tcp_VirtualChannelEntryEx
#else
#define VirtualChannelEntryEx FREERDP_API VirtualChannelEntryEx
#endif
FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints,
PVOID pInitHandle))
FREERDP_ENTRY_POINT(FREERDP_API BOOL VCAPITYPE VirtualChannelEntryEx(
PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID pInitHandle))
{
CHANNEL_ENTRY_POINTS_FREERDP_EX* pEntryPointsEx;
CHANNEL_DEF channelDef;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

define_channel("sshagent")
include(CMakeDependentOption)

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
option(CHANNEL_SSHAGENT "build sshagent channel" ON)
CMAKE_DEPENDENT_OPTION(CHANNEL_SSHAGENT_CLIENT "build sshagent client channel" ON
"CHANNEL_SSHAGENT" OFF)
CMAKE_DEPENDENT_OPTION(CHANNEL_SSHAGENT_SERVER "build sshagent server channel" OFF
"CHANNEL_SSHAGENT" OFF)
if (CHANNEL_SSHAGENT)
if (CHANNEL_SSHAGENT_CLIENT)
add_subdirectory(client)
endif()
if (CHANNEL_SSHAGENT_SERVER)
add_subdirectory(server)
endif()
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.

define_channel_client("sshagent")
set(MODULE_NAME "sshagent-client")

set(${MODULE_PREFIX}_SRCS
set(SRCS
sshagent_main.c
sshagent_main.h
sshagent.h
)

set(${MODULE_PREFIX}_LIBS
set(LIBS
freerdp
winpr
)

include_directories(..)

add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry")
add_library(${MODULE_NAME}
SHARED
${SRCS}
)
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})
install(TARGETS ${MODULE_NAME} COMPONENT channels EXPORT FreeRDPTargets
ARCHIVE DESTINATION ${FREERDP_PLUGIN_PATH}
LIBRARY DESTINATION ${FREERDP_PLUGIN_PATH}
RUNTIME DESTINATION ${FREERDP_PLUGIN_PATH}
)
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ static UINT sshagent_plugin_terminated(IWTSPlugin* pPlugin)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT sshagent_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(FREERDP_API UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
UINT status = CHANNEL_RC_OK;
SSHAGENT_PLUGIN* sshagent;
Expand Down
3 changes: 0 additions & 3 deletions include/config/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@
#cmakedefine CHANNEL_SMARTCARD
#cmakedefine CHANNEL_SMARTCARD_CLIENT
#cmakedefine CHANNEL_SMARTCARD_SERVER
#cmakedefine CHANNEL_SSHAGENT
#cmakedefine CHANNEL_SSHAGENT_CLIENT
#cmakedefine CHANNEL_SSHAGENT_SERVER
#cmakedefine CHANNEL_TELEMETRY
#cmakedefine CHANNEL_TELEMETRY_CLIENT
#cmakedefine CHANNEL_TELEMETRY_SERVER
Expand Down