/* * Copyright (C) 2014 Glyptodon LLC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef GUAC_VNC_VNC_H #define GUAC_VNC_VNC_H #include "config.h" #include "guac_clipboard.h" #include "guac_display.h" #include "guac_iconv.h" #include "guac_surface.h" #include "settings.h" #include #include #include #ifdef ENABLE_PULSE #include #include #endif #ifdef ENABLE_COMMON_SSH #include "guac_sftp.h" #include "guac_ssh.h" #include "guac_ssh_user.h" #endif #include /** * VNC-specific client data. */ typedef struct guac_vnc_client { /** * The VNC client thread. */ pthread_t client_thread; /** * The underlying VNC client. */ rfbClient* rfb_client; /** * The original framebuffer malloc procedure provided by the initialized * rfbClient. */ MallocFrameBufferProc rfb_MallocFrameBuffer; /** * Whether copyrect was used to produce the latest update received * by the VNC server. */ int copy_rect_used; /** * Client settings, parsed from args. */ guac_vnc_settings* settings; /** * The current display state. */ guac_common_display* display; /** * Internal clipboard. */ guac_common_clipboard* clipboard; #ifdef ENABLE_PULSE /** * Audio output, if any. */ guac_audio_stream* audio; /** * PulseAudio event loop. */ pa_threaded_mainloop* pa_mainloop; #endif #ifdef ENABLE_COMMON_SSH /** * The user and credentials used to authenticate for SFTP. */ guac_common_ssh_user* sftp_user; /** * The SSH session used for SFTP. */ guac_common_ssh_session* sftp_session; /** * An SFTP-based filesystem. */ guac_common_ssh_sftp_filesystem* sftp_filesystem; #endif /** * Clipboard encoding-specific reader. */ guac_iconv_read* clipboard_reader; /** * Clipboard encoding-specific writer. */ guac_iconv_write* clipboard_writer; } guac_vnc_client; /** * Allocates a new rfbClient instance given the parameters stored within the * client, returning NULL on failure. * * @param client * The guac_client associated with the settings of the desired VNC * connection. * * @return * A new rfbClient instance allocated and connected according to the * parameters stored within the given client, or NULL if connecting to the * VNC server fails. */ rfbClient* guac_vnc_get_client(guac_client* client); /** * VNC client thread. This thread initiates the VNC connection and ultimately * runs throughout the duration of the client, existing as a single instance, * shared by all users. * * @param data * The guac_client instance associated with the requested VNC connection. * * @return * Always NULL. */ void* guac_vnc_client_thread(void* data); /** * Key which can be used with the rfbClientGetClientData function to return * the associated guac_client. */ extern char* GUAC_VNC_CLIENT_KEY; #endif