summaryrefslogtreecommitdiff
path: root/src/options.h
blob: 343da2c58cf51a369b3aaa32b78878db51b2a004 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
    Copyright (C) 2016  Jeremy White <jwhite@codeweavers.com>
    All rights reserved.

    This file is part of x11spice

    x11spice is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    x11spice is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with x11spice.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef OPTIONS_H_
#define OPTIONS_H_

/*----------------------------------------------------------------------------
**  constants
**--------------------------------------------------------------------------*/
#define DEFAULT_PASSWORD_LENGTH     8

/*----------------------------------------------------------------------------
**  Structure definitions
**--------------------------------------------------------------------------*/
typedef struct {
    int enabled;
    char *ca_cert_file;
    char *certs_file;
    char *private_key_file;
    char *key_password;
    char *dh_key_file;
    char *ciphersuite;
} ssl_options_t;

typedef enum { AUTO_TRUST, ALWAYS_TRUST, NEVER_TRUST } damage_trust_t;

typedef struct {
    /* Both config and command line arguments */
    long timeout;
    int minimize;
    int allow_control;
    int generate_password;
    int hide;
    char *display;
    char *listen;

    ssl_options_t ssl;

    /* config only */
    char *spice_password;
    char *password_file;
    int disable_ticketing;
    int exit_on_disconnect;
    char *virtio_path;
    char *uinput_path;
    char *on_connect;
    char *on_disconnect;
    int audit;
    int audit_message_type;
    damage_trust_t trust_damage;
    int full_screen_fps;

    /* file names of config files */
    char *user_config_file;
} options_t;


/*----------------------------------------------------------------------------
**  Prototypes
**--------------------------------------------------------------------------*/
void options_init(options_t *options);
void options_free(options_t *options);
int options_load(options_t *options, int argc, char *argv[]);
int options_impossible_config(options_t *options);

#endif