mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 16:48:06 +00:00
new libspice api: make spice_channel_name_t part of the public api.
This commit is contained in:
parent
d60d3eda88
commit
0c23da34c5
@ -341,9 +341,6 @@ typedef struct RedSSLParameters {
|
||||
char ciphersuite[256];
|
||||
} RedSSLParameters;
|
||||
|
||||
#define CHANNEL_SECURITY_NON (1 << 0)
|
||||
#define CHANNEL_SECURITY_SSL (1 << 1)
|
||||
|
||||
typedef struct ChannelSecurityOptions ChannelSecurityOptions;
|
||||
struct ChannelSecurityOptions {
|
||||
uint32_t channel_id;
|
||||
@ -367,7 +364,8 @@ static void reds_main_write(void *data);
|
||||
static void reds_push();
|
||||
|
||||
static ChannelSecurityOptions *channels_security = NULL;
|
||||
static int default_channel_security = CHANNEL_SECURITY_NON | CHANNEL_SECURITY_SSL;
|
||||
static int default_channel_security =
|
||||
SPICE_CHANNEL_SECURITY_NONE | SPICE_CHANNEL_SECURITY_SSL;
|
||||
|
||||
static RedSSLParameters ssl_parameters;
|
||||
|
||||
@ -2823,8 +2821,8 @@ static int reds_security_check(RedLinkInfo *link)
|
||||
{
|
||||
ChannelSecurityOptions *security_option = find_channel_security(link->link_mess->channel_type);
|
||||
uint32_t security = security_option ? security_option->options : default_channel_security;
|
||||
return (link->peer->ssl && (security & CHANNEL_SECURITY_SSL)) || (!link->peer->ssl &&
|
||||
(security & CHANNEL_SECURITY_NON));
|
||||
return (link->peer->ssl && (security & SPICE_CHANNEL_SECURITY_SSL)) ||
|
||||
(!link->peer->ssl && (security & SPICE_CHANNEL_SECURITY_NONE));
|
||||
}
|
||||
|
||||
static void reds_handle_read_link_done(void *opaque)
|
||||
@ -3809,25 +3807,14 @@ static OptionsMap _spice_options[] = {
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
enum {
|
||||
CHANNEL_NAME_INVALID,
|
||||
CHANNEL_NAME_ALL,
|
||||
CHANNEL_NAME_MAIN,
|
||||
CHANNEL_NAME_DISPLAY,
|
||||
CHANNEL_NAME_INPUTS,
|
||||
CHANNEL_NAME_CURSOR,
|
||||
CHANNEL_NAME_PLAYBACK,
|
||||
CHANNEL_NAME_RECORD,
|
||||
};
|
||||
|
||||
static OptionsMap _channel_map[] = {
|
||||
{"all", CHANNEL_NAME_ALL},
|
||||
{"main", CHANNEL_NAME_MAIN},
|
||||
{"display", CHANNEL_NAME_DISPLAY},
|
||||
{"inputs", CHANNEL_NAME_INPUTS},
|
||||
{"cursor", CHANNEL_NAME_CURSOR},
|
||||
{"playback", CHANNEL_NAME_PLAYBACK},
|
||||
{"record", CHANNEL_NAME_RECORD},
|
||||
{"all", SPICE_CHANNEL_NAME_ALL},
|
||||
{"main", SPICE_CHANNEL_NAME_MAIN},
|
||||
{"display", SPICE_CHANNEL_NAME_DISPLAY},
|
||||
{"inputs", SPICE_CHANNEL_NAME_INPUTS},
|
||||
{"cursor", SPICE_CHANNEL_NAME_CURSOR},
|
||||
{"playback", SPICE_CHANNEL_NAME_PLAYBACK},
|
||||
{"record", SPICE_CHANNEL_NAME_RECORD},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
@ -3875,30 +3862,30 @@ static int set_channels_security(const char *channels, uint32_t security)
|
||||
str = local_str;
|
||||
do {
|
||||
switch (channel_name = get_option(&str, &val, _channel_map, '+')) {
|
||||
case CHANNEL_NAME_ALL:
|
||||
case SPICE_CHANNEL_NAME_ALL:
|
||||
all++;
|
||||
break;
|
||||
case CHANNEL_NAME_MAIN:
|
||||
case SPICE_CHANNEL_NAME_MAIN:
|
||||
specific++;
|
||||
set_one_channel_security(SPICE_CHANNEL_MAIN, security);
|
||||
break;
|
||||
case CHANNEL_NAME_DISPLAY:
|
||||
case SPICE_CHANNEL_NAME_DISPLAY:
|
||||
specific++;
|
||||
set_one_channel_security(SPICE_CHANNEL_DISPLAY, security);
|
||||
break;
|
||||
case CHANNEL_NAME_INPUTS:
|
||||
case SPICE_CHANNEL_NAME_INPUTS:
|
||||
specific++;
|
||||
set_one_channel_security(SPICE_CHANNEL_INPUTS, security);
|
||||
break;
|
||||
case CHANNEL_NAME_CURSOR:
|
||||
case SPICE_CHANNEL_NAME_CURSOR:
|
||||
specific++;
|
||||
set_one_channel_security(SPICE_CHANNEL_CURSOR, security);
|
||||
break;
|
||||
case CHANNEL_NAME_PLAYBACK:
|
||||
case SPICE_CHANNEL_NAME_PLAYBACK:
|
||||
specific++;
|
||||
set_one_channel_security(SPICE_CHANNEL_PLAYBACK, security);
|
||||
break;
|
||||
case CHANNEL_NAME_RECORD:
|
||||
case SPICE_CHANNEL_NAME_RECORD:
|
||||
specific++;
|
||||
set_one_channel_security(SPICE_CHANNEL_RECORD, security);
|
||||
break;
|
||||
@ -4068,12 +4055,12 @@ int __attribute__ ((visibility ("default"))) spice_parse_args(const char *in_arg
|
||||
}
|
||||
break;
|
||||
case SPICE_SECURED_CHANNELS:
|
||||
if (!val || !set_channels_security(val, CHANNEL_SECURITY_SSL)) {
|
||||
if (!val || !set_channels_security(val, SPICE_CHANNEL_SECURITY_SSL)) {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case SPICE_UNSECURED_CHANNELS:
|
||||
if (!val || !set_channels_security(val, CHANNEL_SECURITY_NON)) {
|
||||
if (!val || !set_channels_security(val, SPICE_CHANNEL_SECURITY_NONE)) {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -63,4 +63,19 @@ int spice_server_set_image_compression(SpiceServer *s,
|
||||
spice_image_compression_t comp);
|
||||
spice_image_compression_t spice_server_get_image_compression(SpiceServer *s);
|
||||
|
||||
typedef enum {
|
||||
SPICE_CHANNEL_NAME_INVALID = 0,
|
||||
SPICE_CHANNEL_NAME_MAIN = 1,
|
||||
SPICE_CHANNEL_NAME_DISPLAY,
|
||||
SPICE_CHANNEL_NAME_INPUTS,
|
||||
SPICE_CHANNEL_NAME_CURSOR,
|
||||
SPICE_CHANNEL_NAME_PLAYBACK,
|
||||
SPICE_CHANNEL_NAME_RECORD,
|
||||
SPICE_CHANNEL_NAME_TUNNEL,
|
||||
SPICE_CHANNEL_NAME_ALL = 999,
|
||||
} spice_channel_name_t;
|
||||
|
||||
#define SPICE_CHANNEL_SECURITY_NONE (1 << 0)
|
||||
#define SPICE_CHANNEL_SECURITY_SSL (1 << 1)
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user