diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-02-22 13:58:52 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-04-08 08:09:07 -0600 |
commit | fd0d7d0907fcb8783c4bd2fbbd8c8812f3ba1494 (patch) | |
tree | 003f3d8f144c92cb4073a348fd4191c96eced18d /include/backend | |
parent | 9faea17c738d9bfcdd241de7bae0bbe7590c77bf (diff) |
Add FreeRDP backend for remote desktop support
Diffstat (limited to 'include/backend')
-rw-r--r-- | include/backend/rdp.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/include/backend/rdp.h b/include/backend/rdp.h new file mode 100644 index 00000000..f8faa8fd --- /dev/null +++ b/include/backend/rdp.h @@ -0,0 +1,98 @@ +#ifndef BACKEND_RDP_H +#define BACKEND_RDP_H +#include <freerdp/codec/color.h> +#include <freerdp/codec/nsc.h> +#include <freerdp/codec/rfx.h> +#include <freerdp/freerdp.h> +#include <freerdp/input.h> +#include <freerdp/listener.h> +#include <freerdp/locale/keyboard.h> +#include <freerdp/update.h> +#include <pixman.h> +#include <wlr/backend/interface.h> +#include <wlr/backend/rdp.h> +#include <wlr/types/wlr_input_device.h> +#include <wlr/types/wlr_keyboard.h> +#include <wlr/types/wlr_output.h> +#include <wlr/types/wlr_pointer.h> +#include <xkbcommon/xkbcommon.h> + +#define MAX_FREERDP_FDS 64 + +struct wlr_rdp_peer_context; + +struct wlr_rdp_output { + struct wlr_output wlr_output; + struct wlr_rdp_backend *backend; + struct wlr_rdp_peer_context *context; + + void *egl_surface; + pixman_image_t *shadow_surface; + struct wl_event_source *frame_timer; + int frame_delay; // ms +}; + +struct wlr_rdp_input_device { + struct wlr_input_device wlr_input_device; +}; + +struct wlr_rdp_keyboard { + struct wlr_keyboard keyboard; + struct xkb_keymap *keymap; +}; + +enum wlr_rdp_peer_flags { + RDP_PEER_ACTIVATED = 1 << 0, + RDP_PEER_OUTPUT_ENABLED = 1 << 1, +}; + +struct wlr_rdp_peer_context { + rdpContext _p; + + struct wlr_rdp_backend *backend; + struct wl_event_source *events[MAX_FREERDP_FDS]; + freerdp_peer *peer; + uint32_t flags; + RFX_CONTEXT *rfx_context; + wStream *encode_stream; + RFX_RECT *rfx_rects; + NSC_CONTEXT *nsc_context; + + struct wlr_rdp_output *output; + struct wlr_rdp_input_device *pointer; + struct wlr_rdp_input_device *keyboard; + + struct wl_list link; +}; + +struct wlr_rdp_backend { + struct wlr_backend backend; + struct wlr_egl egl; + struct wlr_renderer *renderer; + struct wl_display *display; + struct wl_listener display_destroy; + + const char *tls_cert_path; + const char *tls_key_path; + char *address; + int port; + + freerdp_listener *listener; + struct wl_event_source *listener_events[MAX_FREERDP_FDS]; + + struct wl_list clients; +}; + +struct wlr_rdp_backend *rdp_backend_from_backend( + struct wlr_backend *wlr_backend); +bool rdp_configure_listener(struct wlr_rdp_backend *backend); +int rdp_peer_init(freerdp_peer *client, struct wlr_rdp_backend *backend); +struct wlr_rdp_output *wlr_rdp_output_create(struct wlr_rdp_backend *backend, + struct wlr_rdp_peer_context *context, unsigned int width, + unsigned int height); +struct wlr_rdp_input_device *wlr_rdp_pointer_create( + struct wlr_rdp_backend *backend, struct wlr_rdp_peer_context *context); +struct wlr_rdp_input_device *wlr_rdp_keyboard_create( + struct wlr_rdp_backend *backend, rdpSettings *settings); + +#endif |