feat: RdpBridge – standalone FreeRDP SDK with C ABI, CMake build, and CI/CD - #1
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Refactor existing CxRdpBridge into standalone RDP SDK
feat: RdpBridge – standalone FreeRDP SDK with C ABI, CMake build, and CI/CD
Jun 29, 2026
Fix Linux CI dependency resolution on Ubuntu 24.04 (FreeRDP package names)
There was a problem hiding this comment.
Pull request overview
This PR turns the project into a standalone FreeRDP-based native SDK (“RdpBridge”) with a stable C ABI, a CMake build suitable for downstream consumption, and CI workflows to build/package binaries on Linux and Windows.
Changes:
- Adds the core SDK implementation (
RdpBridge_*C ABI) with a worker-thread connection model, callbacks, input injection, and OpenSSL provider setup. - Introduces a public header (
include/rdp_bridge.h) plus a minimal C example. - Adds a top-level CMake build and a GitHub Actions workflow to build/package artifacts and publish releases on tags.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/RdpBridge/rdp_bridge.cpp | Implements the FreeRDP-backed session object, worker thread, callbacks, and C ABI entrypoints. |
| include/rdp_bridge.h | Defines the public C ABI types and functions with Doxygen comments. |
| CMakeLists.txt | Adds the shared library target, dependency discovery, install rules, and example option. |
| examples/minimal/main.c | Minimal lifecycle example program using the C ABI. |
| examples/minimal/CMakeLists.txt | Builds the minimal example, including a standalone find_package(RdpBridge CONFIG) path. |
| README.md | Documents features, build instructions, API usage, and layout. |
| .github/workflows/build.yml | CI builds Linux/Windows artifacts and publishes GitHub Releases on tags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+184
to
+192
| void notify_status(RdpSession* session, const char* message) | ||
| { | ||
| if (!session) | ||
| return; | ||
|
|
||
| std::lock_guard<std::mutex> lock(session->callback_mutex); | ||
| if (session->status_callback) | ||
| session->status_callback(session->user_data, message); | ||
| } |
Comment on lines
+500
to
+502
| std::lock_guard<std::mutex> lock(session->callback_mutex); | ||
| if (session->frame_callback) | ||
| session->frame_callback(session->user_data, width, height, stride, pixels); |
Comment on lines
+550
to
+554
| const bool wasConnected = session->connected.exchange(false); | ||
| notify_status(session, "RDP disconnected."); | ||
| std::lock_guard<std::mutex> lock(session->callback_mutex); | ||
| if (wasConnected && session->disconnect_callback) | ||
| session->disconnect_callback(session->user_data); |
Comment on lines
+178
to
+182
| void set_error(RdpSession* session, const std::string& message) | ||
| { | ||
| if (session) | ||
| session->last_error = message; | ||
| } |
Comment on lines
+863
to
+869
| RDP_BRIDGE_API const char* RdpBridge_get_last_error(void* handle) | ||
| { | ||
| auto* session = static_cast<RdpSession*>(handle); | ||
| if (!session) | ||
| return ""; | ||
| return session->last_error.c_str(); | ||
| } |
Comment on lines
+81
to
+85
| install(EXPORT RdpBridgeTargets | ||
| FILE RdpBridgeTargets.cmake | ||
| NAMESPACE RdpBridge:: | ||
| DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/RdpBridge | ||
| ) |
Comment on lines
+88
to
+93
| * @param handle Session handle. | ||
| * @param host Server hostname or IP address (UTF-8, must not be NULL). | ||
| * @param port TCP port (use 3389 for the default). | ||
| * @param username Login username (UTF-8, must not be NULL). | ||
| * @param password Login password (UTF-8, must not be NULL). | ||
| * @param width Initial desktop width in pixels. |
Comment on lines
+95
to
+97
| * @return 0 – connection thread started successfully. | ||
| * -1 – invalid handle. | ||
| * -2 – Winsock initialisation failed (Windows only). |
Comment on lines
+618
to
+619
| freerdp_settings_set_bool(settings, FreeRDP_IgnoreCertificate, TRUE); | ||
| freerdp_settings_set_bool(settings, FreeRDP_AutoAcceptCertificate, TRUE); |
| << " flags=0x" << std::hex << flags; | ||
| notify_status(session, message.str().c_str()); | ||
| } | ||
| return 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracts and refactors the FreeRDP-based RDP bridge from CxShell/CxRdpBridge into a standalone, production-grade SDK with a stable C ABI suitable for P/Invoke from C#/Avalonia and other languages.
Public API (
include/rdp_bridge.h)cxrdp_*→RdpBridge_*prefix for clean namespaceRdpBridge_FrameCallback(BGRA32),RdpBridge_StatusCallback,RdpBridge_DisconnectCallbackCore implementation (
src/RdpBridge/rdp_bridge.cpp)atomic_boolsession state; mutex-protected callbacksBeginPaint/EndPaint— zero-copy pointer delivery to callerossl-modulespath discoveryBGRA32_BYTES_PER_PIXELinstead of magic4Build (
CMakeLists.txt)find_packagefor FreeRDP 3, WinPR, OpenSSL; no vendored depsRdpBridge.dll(Windows, nolibprefix) /libRdpBridge.so(Linux)$ORIGIN/@loader_pathRPATH for portable deploymentCI/CD (
.github/workflows/build.yml)mainv*include/+ binaries →tar.gz/.zip→ GitHub Release viasoftprops/action-gh-releaseAll build jobs carry explicit
permissions: contents: read; the release job additionally hascontents: write. Ubuntu 24.04 is required —libfreerdp3-devis not packaged for 22.04.Example (
examples/minimal/main.c)Minimal C program exercising the full session lifecycle, with correct platform includes (
<windows.h>/<time.h>).Original prompt