SpiceInfo *qmp_query_spice(Error **errp)

{

    QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);

    int port, tls_port;

    const char *addr;

    SpiceInfo *info;

    char version_string[20]; /* 12 = |255.255.255\0| is the max */



    info = g_malloc0(sizeof(*info));



    if (!spice_server || !opts) {

        info->enabled = false;

        return info;

    }



    info->enabled = true;

    info->migrated = spice_migration_completed;



    addr = qemu_opt_get(opts, "addr");

    port = qemu_opt_get_number(opts, "port", 0);

    tls_port = qemu_opt_get_number(opts, "tls-port", 0);



    info->has_auth = true;

    info->auth = g_strdup(auth);



    info->has_host = true;

    info->host = g_strdup(addr ? addr : "0.0.0.0");



    info->has_compiled_version = true;

    snprintf(version_string, sizeof(version_string), "%d.%d.%d",

             (SPICE_SERVER_VERSION & 0xff0000) >> 16,

             (SPICE_SERVER_VERSION & 0xff00) >> 8,

             SPICE_SERVER_VERSION & 0xff);

    info->compiled_version = g_strdup(version_string);



    if (port) {

        info->has_port = true;

        info->port = port;

    }

    if (tls_port) {

        info->has_tls_port = true;

        info->tls_port = tls_port;

    }



    info->mouse_mode = spice_server_is_server_mouse(spice_server) ?

                       SPICE_QUERY_MOUSE_MODE_SERVER :

                       SPICE_QUERY_MOUSE_MODE_CLIENT;



    /* for compatibility with the original command */

    info->has_channels = true;

    info->channels = qmp_query_spice_channels();



    return info;

}

SpiceInfo *qmp_query_spice(Error **errp)

{

    QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);

    int port, tls_port;

    const char *addr;

    SpiceInfo *info;

    char version_string[20]; 



    info = g_malloc0(sizeof(*info));



    if (!spice_server || !opts) {

        info->enabled = false;

        return info;

    }



    info->enabled = true;

    info->migrated = spice_migration_completed;



    addr = qemu_opt_get(opts, "addr");

    port = qemu_opt_get_number(opts, "port", 0);

    tls_port = qemu_opt_get_number(opts, "tls-port", 0);



    info->has_auth = true;

    info->auth = g_strdup(auth);



    info->has_host = true;

    info->host = g_strdup(addr ? addr : "0.0.0.0");



    info->has_compiled_version = true;

    snprintf(version_string, sizeof(version_string), "%d.%d.%d",

             (SPICE_SERVER_VERSION & 0xff0000) >> 16,

             (SPICE_SERVER_VERSION & 0xff00) >> 8,

             SPICE_SERVER_VERSION & 0xff);

    info->compiled_version = g_strdup(version_string);



    if (port) {

        info->has_port = true;

        info->port = port;

    }

    if (tls_port) {

        info->has_tls_port = true;

        info->tls_port = tls_port;

    }



    info->mouse_mode = spice_server_is_server_mouse(spice_server) ?

                       SPICE_QUERY_MOUSE_MODE_SERVER :

                       SPICE_QUERY_MOUSE_MODE_CLIENT;



    

    info->has_channels = true;

    info->channels = qmp_query_spice_channels();



    return info;

}

SpiceInfo *FUNC_0(Error **errp)

{

    QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);

    int VAR_0, VAR_1;

    const char *VAR_2;

    SpiceInfo *info;

    char VAR_3[20]; 



    info = g_malloc0(sizeof(*info));



    if (!spice_server || !opts) {

        info->enabled = false;

        return info;

    }



    info->enabled = true;

    info->migrated = spice_migration_completed;



    VAR_2 = qemu_opt_get(opts, "VAR_2");

    VAR_0 = qemu_opt_get_number(opts, "VAR_0", 0);

    VAR_1 = qemu_opt_get_number(opts, "tls-VAR_0", 0);



    info->has_auth = true;

    info->auth = g_strdup(auth);



    info->has_host = true;

    info->host = g_strdup(VAR_2 ? VAR_2 : "0.0.0.0");



    info->has_compiled_version = true;

    snprintf(VAR_3, sizeof(VAR_3), "%d.%d.%d",

             (SPICE_SERVER_VERSION & 0xff0000) >> 16,

             (SPICE_SERVER_VERSION & 0xff00) >> 8,

             SPICE_SERVER_VERSION & 0xff);

    info->compiled_version = g_strdup(VAR_3);



    if (VAR_0) {

        info->has_port = true;

        info->VAR_0 = VAR_0;

    }

    if (VAR_1) {

        info->has_tls_port = true;

        info->VAR_1 = VAR_1;

    }



    info->mouse_mode = spice_server_is_server_mouse(spice_server) ?

                       SPICE_QUERY_MOUSE_MODE_SERVER :

                       SPICE_QUERY_MOUSE_MODE_CLIENT;



    

    info->has_channels = true;

    info->channels = qmp_query_spice_channels();



    return info;

}

SpiceInfo *FUNC_0(Error **errp)
{ QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head); int VAR_0, VAR_1; const char *VAR_2; SpiceInfo *info; char VAR_3[20]; info = g_malloc0(sizeof(*info)); if (!spice_server || !opts) { info->enabled = false; return info; } info->enabled = true; info->migrated = spice_migration_completed; VAR_2 = qemu_opt_get(opts, "VAR_2"); VAR_0 = qemu_opt_get_number(opts, "VAR_0", 0); VAR_1 = qemu_opt_get_number(opts, "tls-VAR_0", 0); info->has_auth = true; info->auth = g_strdup(auth); info->has_host = true; info->host = g_strdup(VAR_2 ? VAR_2 : "0.0.0.0"); info->has_compiled_version = true; snprintf(VAR_3, sizeof(VAR_3), "%d.%d.%d",
(SPICE_SERVER_VERSION & 0xff0000) >> 16,
(SPICE_SERVER_VERSION & 0xff00) >> 8,
SPICE_SERVER_VERSION & 0xff); info->compiled_version = g_strdup(VAR_3); if (VAR_0) { info->has_port = true; info->VAR_0 = VAR_0; } if (VAR_1) { info->has_tls_port = true; info->VAR_1 = VAR_1; } info->mouse_mode = spice_server_is_server_mouse(spice_server) ?
SPICE_QUERY_MOUSE_MODE_SERVER :
SPICE_QUERY_MOUSE_MODE_CLIENT; info->has_channels = true; info->channels = qmp_query_spice_channels(); return info; }