cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

settings.h (8124B)


      1/*
      2 * Licensed to the Apache Software Foundation (ASF) under one
      3 * or more contributor license agreements.  See the NOTICE file
      4 * distributed with this work for additional information
      5 * regarding copyright ownership.  The ASF licenses this file
      6 * to you under the Apache License, Version 2.0 (the
      7 * "License"); you may not use this file except in compliance
      8 * with the License.  You may obtain a copy of the License at
      9 *
     10 *   http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing,
     13 * software distributed under the License is distributed on an
     14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     15 * KIND, either express or implied.  See the License for the
     16 * specific language governing permissions and limitations
     17 * under the License.
     18 */
     19
     20#ifndef GUAC_KUBERNETES_SETTINGS_H
     21#define GUAC_KUBERNETES_SETTINGS_H
     22
     23#include <guacamole/user.h>
     24
     25#include <stdbool.h>
     26
     27/**
     28 * The port to connect to when initiating any Kubernetes connection, if no
     29 * other port is specified.
     30 */
     31#define GUAC_KUBERNETES_DEFAULT_PORT 8080
     32
     33/**
     34 * The name of the Kubernetes namespace that should be used by default if no
     35 * specific Kubernetes namespace is provided.
     36 */
     37#define GUAC_KUBERNETES_DEFAULT_NAMESPACE "default"
     38
     39/**
     40 * The filename to use for the typescript, if not specified.
     41 */
     42#define GUAC_KUBERNETES_DEFAULT_TYPESCRIPT_NAME "typescript" 
     43
     44/**
     45 * The filename to use for the screen recording, if not specified.
     46 */
     47#define GUAC_KUBERNETES_DEFAULT_RECORDING_NAME "recording"
     48
     49/**
     50 * Settings for the Kubernetes connection. The values for this structure are
     51 * parsed from the arguments given during the Guacamole protocol handshake
     52 * using the guac_kubernetes_parse_args() function.
     53 */
     54typedef struct guac_kubernetes_settings {
     55
     56    /**
     57     * The hostname of the Kubernetes server to connect to.
     58     */
     59    char* hostname;
     60
     61    /**
     62     * The port of the Kubernetes server to connect to.
     63     */
     64    int port;
     65
     66    /**
     67     * The name of the Kubernetes namespace of the pod containing the container
     68     * being attached to.
     69     */
     70    char* kubernetes_namespace;
     71
     72    /**
     73     * The name of the Kubernetes pod containing with the container being
     74     * attached to.
     75     */
     76    char* kubernetes_pod;
     77
     78    /**
     79     * The name of the container to attach to, or NULL to arbitrarily attach to
     80     * the first container in the pod.
     81     */
     82    char* kubernetes_container;
     83
     84    /**
     85     * The command to generate api endpoint for call exec. 
     86     * If omitted call attach will be used.
     87     */
     88    char* exec_command;
     89
     90    /**
     91     * Whether SSL/TLS should be used.
     92     */
     93    bool use_ssl;
     94
     95    /**
     96     * The certificate to use if performing SSL/TLS client authentication to
     97     * authenticate with the Kubernetes server, in PEM format. If omitted, SSL
     98     * client authentication will not be performed.
     99     */
    100    char* client_cert;
    101
    102    /**
    103     * The key to use if performing SSL/TLS client authentication to
    104     * authenticate with the Kubernetes server, in PEM format. If omitted, SSL
    105     * client authentication will not be performed.
    106     */
    107    char* client_key;
    108
    109    /**
    110     * The certificate of the certificate authority that signed the certificate
    111     * of the Kubernetes server, in PEM format. If omitted. verification of
    112     * the Kubernetes server certificate will use the systemwide certificate
    113     * authorities.
    114     */
    115    char* ca_cert;
    116
    117    /**
    118     * Whether the certificate used by the Kubernetes server for SSL/TLS should
    119     * be ignored if it cannot be validated.
    120     */
    121    bool ignore_cert;
    122
    123    /**
    124     * Whether this connection is read-only, and user input should be dropped.
    125     */
    126    bool read_only;
    127
    128    /**
    129     * The maximum size of the scrollback buffer in rows.
    130     */
    131    int max_scrollback;
    132
    133    /**
    134     * The name of the font to use for display rendering.
    135     */
    136    char* font_name;
    137
    138    /**
    139     * The size of the font to use, in points.
    140     */
    141    int font_size;
    142
    143    /**
    144     * The name of the color scheme to use.
    145     */
    146    char* color_scheme; 
    147
    148    /**
    149     * The desired width of the terminal display, in pixels.
    150     */
    151    int width;
    152
    153    /**
    154     * The desired height of the terminal display, in pixels.
    155     */
    156    int height;
    157
    158    /**
    159     * The desired screen resolution, in DPI.
    160     */
    161    int resolution;
    162
    163    /**
    164     * Whether outbound clipboard access should be blocked. If set, it will not
    165     * be possible to copy data from the terminal to the client using the
    166     * clipboard.
    167     */
    168    bool disable_copy;
    169
    170    /**
    171     * Whether inbound clipboard access should be blocked. If set, it will not
    172     * be possible to paste data from the client to the terminal using the
    173     * clipboard.
    174     */
    175    bool disable_paste;
    176
    177    /**
    178     * The path in which the typescript should be saved, if enabled. If no
    179     * typescript should be saved, this will be NULL.
    180     */
    181    char* typescript_path;
    182
    183    /**
    184     * The filename to use for the typescript, if enabled.
    185     */
    186    char* typescript_name;
    187
    188    /**
    189     * Whether the typescript path should be automatically created if it does
    190     * not already exist.
    191     */
    192    bool create_typescript_path;
    193
    194    /**
    195     * The path in which the screen recording should be saved, if enabled. If
    196     * no screen recording should be saved, this will be NULL.
    197     */
    198    char* recording_path;
    199
    200    /**
    201     * The filename to use for the screen recording, if enabled.
    202     */
    203    char* recording_name;
    204
    205    /**
    206     * Whether the screen recording path should be automatically created if it
    207     * does not already exist.
    208     */
    209    bool create_recording_path;
    210
    211    /**
    212     * Whether output which is broadcast to each connected client (graphics,
    213     * streams, etc.) should NOT be included in the session recording. Output
    214     * is included by default, as it is necessary for any recording which must
    215     * later be viewable as video.
    216     */
    217    bool recording_exclude_output;
    218
    219    /**
    220     * Whether changes to mouse state, such as position and buttons pressed or
    221     * released, should NOT be included in the session recording. Mouse state
    222     * is included by default, as it is necessary for the mouse cursor to be
    223     * rendered in any resulting video.
    224     */
    225    bool recording_exclude_mouse;
    226
    227    /**
    228     * Whether keys pressed and released should be included in the session
    229     * recording. Key events are NOT included by default within the recording,
    230     * as doing so has privacy and security implications.  Including key events
    231     * may be necessary in certain auditing contexts, but should only be done
    232     * with caution. Key events can easily contain sensitive information, such
    233     * as passwords, credit card numbers, etc.
    234     */
    235    bool recording_include_keys;
    236
    237    /**
    238     * The ASCII code, as an integer, that the Kubernetes client will use when
    239     * the backspace key is pressed. By default, this is 127, ASCII delete, if
    240     * not specified in the client settings.
    241     */
    242    int backspace;
    243
    244} guac_kubernetes_settings;
    245
    246/**
    247 * Parses all given args, storing them in a newly-allocated settings object. If
    248 * the args fail to parse, NULL is returned.
    249 *
    250 * @param user
    251 *     The user who submitted the given arguments while joining the
    252 *     connection.
    253 *
    254 * @param argc
    255 *     The number of arguments within the argv array.
    256 *
    257 * @param argv
    258 *     The values of all arguments provided by the user.
    259 *
    260 * @return
    261 *     A newly-allocated settings object which must be freed with
    262 *     guac_kubernetes_settings_free() when no longer needed. If the arguments
    263 *     fail to parse, NULL is returned.
    264 */
    265guac_kubernetes_settings* guac_kubernetes_parse_args(guac_user* user,
    266        int argc, const char** argv);
    267
    268/**
    269 * Frees the given guac_kubernetes_settings object, having been previously
    270 * allocated via guac_kubernetes_parse_args().
    271 *
    272 * @param settings
    273 *     The settings object to free.
    274 */
    275void guac_kubernetes_settings_free(guac_kubernetes_settings* settings);
    276
    277/**
    278 * NULL-terminated array of accepted client args.
    279 */
    280extern const char* GUAC_KUBERNETES_CLIENT_ARGS[];
    281
    282#endif
    283