guacamole-spice-protocol/src/protocols/vnc/settings.h

238 lines
6.0 KiB
C
Raw Normal View History

/*
* 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_SETTINGS_H
#define __GUAC_VNC_SETTINGS_H
#include "config.h"
#include <stdbool.h>
/**
* The filename to use for the screen recording, if not specified.
*/
#define GUAC_VNC_DEFAULT_RECORDING_NAME "recording"
/**
* VNC-specific client data.
*/
typedef struct guac_vnc_settings {
/**
* The hostname of the VNC server (or repeater) to connect to.
*/
char* hostname;
/**
* The port of the VNC server (or repeater) to connect to.
*/
int port;
/**
* The password given in the arguments.
*/
char* password;
/**
* Space-separated list of encodings to use within the VNC session.
*/
char* encodings;
/**
* Whether the red and blue components of each color should be swapped.
* This is mainly used for VNC servers that do not properly handle
* colors.
*/
bool swap_red_blue;
/**
* The color depth to request, in bits.
*/
int color_depth;
/**
* Whether this connection is read-only, and user input should be dropped.
*/
bool read_only;
#ifdef ENABLE_VNC_REPEATER
/**
* The VNC host to connect to, if using a repeater.
*/
char* dest_host;
/**
* The VNC port to connect to, if using a repeater.
*/
int dest_port;
#endif
#ifdef ENABLE_VNC_LISTEN
/**
* Whether not actually connecting to a VNC server, but rather listening
* for a connection from the VNC server (reverse connection).
*/
bool reverse_connect;
/**
* The maximum amount of time to wait when listening for connections, in
* milliseconds.
*/
int listen_timeout;
#endif
/**
* Whether the cursor should be rendered on the server (remote) or on the
* client (local).
*/
bool remote_cursor;
#ifdef ENABLE_PULSE
/**
* Whether audio is enabled.
*/
bool audio_enabled;
/**
* The name of the PulseAudio server to connect to.
*/
char* pa_servername;
#endif
/**
* The number of connection attempts to make before giving up.
*/
int retries;
/**
* The encoding to use for clipboard data sent to the VNC server, or NULL
* to use the encoding required by the VNC standard.
*/
char* clipboard_encoding;
#ifdef ENABLE_COMMON_SSH
/**
* Whether SFTP should be enabled for the VNC connection.
*/
bool enable_sftp;
/**
* The hostname of the SSH server to connect to for SFTP.
*/
char* sftp_hostname;
/**
* The port of the SSH server to connect to for SFTP.
*/
char* sftp_port;
/**
* The username to provide when authenticating with the SSH server for
* SFTP.
*/
char* sftp_username;
/**
* The password to provide when authenticating with the SSH server for
* SFTP (if not using a private key).
*/
char* sftp_password;
/**
* The base64-encoded private key to use when authenticating with the SSH
* server for SFTP (if not using a password).
*/
char* sftp_private_key;
/**
* The passphrase to use to decrypt the provided base64-encoded private
* key.
*/
char* sftp_passphrase;
/**
* The default location for file uploads within the SSH server. This will
* apply only to uploads which do not use the filesystem guac_object (where
* the destination directory is otherwise ambiguous).
*/
char* sftp_directory;
#endif
/**
* The path in which the screen recording should be saved, if enabled. If
* no screen recording should be saved, this will be NULL.
*/
char* recording_path;
/**
* The filename to use for the screen recording, if enabled.
*/
char* recording_name;
/**
* Whether the screen recording path should be automatically created if it
* does not already exist.
*/
bool create_recording_path;
} guac_vnc_settings;
/**
* Parses all given args, storing them in a newly-allocated settings object. If
* the args fail to parse, NULL is returned.
*
* @param user
* The user who submitted the given arguments while joining the
* connection.
*
* @param argc
* The number of arguments within the argv array.
*
* @param argv
* The values of all arguments provided by the user.
*
* @return
* A newly-allocated settings object which must be freed with
* guac_vnc_settings_free() when no longer needed. If the arguments fail
* to parse, NULL is returned.
*/
guac_vnc_settings* guac_vnc_parse_args(guac_user* user,
int argc, const char** argv);
/**
* Frees the given guac_vnc_settings object, having been previously allocated
* via guac_vnc_parse_args().
*
* @param settings
* The settings object to free.
*/
void guac_vnc_settings_free(guac_vnc_settings* settings);
/**
* NULL-terminated array of accepted client args.
*/
extern const char* GUAC_VNC_CLIENT_ARGS[];
#endif