static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_data)

{

    const char *protocol  = qdict_get_str(qdict, "protocol");

    const char *fdname = qdict_get_str(qdict, "fdname");

    CharDriverState *s;



    if (strcmp(protocol, "spice") == 0) {

        int fd = monitor_get_fd(mon, fdname, NULL);

        int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);

        int tls = qdict_get_try_bool(qdict, "tls", 0);

        if (!using_spice) {

            /* correct one? spice isn't a device ,,, */

            qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");

            return -1;

        }

        if (qemu_spice_display_add_client(fd, skipauth, tls) < 0) {

            close(fd);

        }

        return 0;

#ifdef CONFIG_VNC

    } else if (strcmp(protocol, "vnc") == 0) {

	int fd = monitor_get_fd(mon, fdname, NULL);

        int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);

	vnc_display_add_client(NULL, fd, skipauth);

	return 0;

#endif

    } else if ((s = qemu_chr_find(protocol)) != NULL) {

	int fd = monitor_get_fd(mon, fdname, NULL);

	if (qemu_chr_add_client(s, fd) < 0) {

	    qerror_report(QERR_ADD_CLIENT_FAILED);

	    return -1;

	}

	return 0;

    }



    qerror_report(QERR_INVALID_PARAMETER, "protocol");

    return -1;

}

static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_data)

{

    const char *protocol  = qdict_get_str(qdict, "protocol");

    const char *fdname = qdict_get_str(qdict, "fdname");

    CharDriverState *s;



    if (strcmp(protocol, "spice") == 0) {

        int fd = monitor_get_fd(mon, fdname, NULL);

        int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);

        int tls = qdict_get_try_bool(qdict, "tls", 0);

        if (!using_spice) {

            

            qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");

            return -1;

        }

        if (qemu_spice_display_add_client(fd, skipauth, tls) < 0) {

            close(fd);

        }

        return 0;

#ifdef CONFIG_VNC

    } else if (strcmp(protocol, "vnc") == 0) {

	int fd = monitor_get_fd(mon, fdname, NULL);

        int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);

	vnc_display_add_client(NULL, fd, skipauth);

	return 0;

#endif

    } else if ((s = qemu_chr_find(protocol)) != NULL) {

	int fd = monitor_get_fd(mon, fdname, NULL);

	if (qemu_chr_add_client(s, fd) < 0) {

	    qerror_report(QERR_ADD_CLIENT_FAILED);

	    return -1;

	}

	return 0;

    }



    qerror_report(QERR_INVALID_PARAMETER, "protocol");

    return -1;

}

static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_data)     const char *protocol  = qdict_get_str(qdict, "protocol");     const char *fdname = qdict_get_str(qdict, "fdname");     CharDriverState *s;     if (strcmp(protocol, "spice") == 0) {         int fd = monitor_get_fd(mon, fdname, NULL);         int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);         int tls = qdict_get_try_bool(qdict, "tls", 0);         if (!using_spice) {             qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");             return -1;         if (qemu_spice_display_add_client(fd, skipauth, tls) < 0) {             close(fd);         return 0; #ifdef CONFIG_VNC     } else if (strcmp(protocol, "vnc") == 0) { 	int fd = monitor_get_fd(mon, fdname, NULL);         int skipauth = qdict_get_try_bool(qdict, "skipauth", 0); 	vnc_display_add_client(NULL, fd, skipauth); 	return 0; #endif     } else if ((s = qemu_chr_find(protocol)) != NULL) { 	int fd = monitor_get_fd(mon, fdname, NULL); 	if (qemu_chr_add_client(s, fd) < 0) { 	    qerror_report(QERR_ADD_CLIENT_FAILED); 	    return -1; 	return 0;     qerror_report(QERR_INVALID_PARAMETER, "protocol");     return -1;
static int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2)

{

    const char *VAR_3  = qdict_get_str(VAR_1, "VAR_3");

    const char *VAR_4 = qdict_get_str(VAR_1, "VAR_4");

    CharDriverState *s;



    if (strcmp(VAR_3, "spice") == 0) {

        int VAR_8 = monitor_get_fd(VAR_0, VAR_4, NULL);

        int VAR_6 = qdict_get_try_bool(VAR_1, "VAR_6", 0);

        int VAR_7 = qdict_get_try_bool(VAR_1, "VAR_7", 0);

        if (!using_spice) {

            

            qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");

            return -1;

        }

        if (qemu_spice_display_add_client(VAR_8, VAR_6, VAR_7) < 0) {

            close(VAR_8);

        }

        return 0;

#ifdef CONFIG_VNC

    } else if (strcmp(VAR_3, "vnc") == 0) {

	int VAR_8 = monitor_get_fd(VAR_0, VAR_4, NULL);

        int VAR_6 = qdict_get_try_bool(VAR_1, "VAR_6", 0);

	vnc_display_add_client(NULL, VAR_8, VAR_6);

	return 0;

#endif

    } else if ((s = qemu_chr_find(VAR_3)) != NULL) {

	int VAR_8 = monitor_get_fd(VAR_0, VAR_4, NULL);

	if (qemu_chr_add_client(s, VAR_8) < 0) {

	    qerror_report(QERR_ADD_CLIENT_FAILED);

	    return -1;

	}

	return 0;

    }



    qerror_report(QERR_INVALID_PARAMETER, "VAR_3");

    return -1;

}

static int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2)
{ const char *VAR_3  = qdict_get_str(VAR_1, "VAR_3"); const char *VAR_4 = qdict_get_str(VAR_1, "VAR_4"); CharDriverState *s; if (strcmp(VAR_3, "spice") == 0) { int VAR_8 = monitor_get_fd(VAR_0, VAR_4, NULL); int VAR_6 = qdict_get_try_bool(VAR_1, "VAR_6", 0); int VAR_7 = qdict_get_try_bool(VAR_1, "VAR_7", 0); if (!using_spice) { qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice"); return -1; } if (qemu_spice_display_add_client(VAR_8, VAR_6, VAR_7) < 0) { close(VAR_8); } return 0; #ifdef CONFIG_VNC
} else if (strcmp(VAR_3, "vnc") == 0) { int VAR_8 = monitor_get_fd(VAR_0, VAR_4, NULL); int VAR_6 = qdict_get_try_bool(VAR_1, "VAR_6", 0); vnc_display_add_client(NULL, VAR_8, VAR_6); return 0; #endif
} else if ((s = qemu_chr_find(VAR_3)) != NULL) { int VAR_8 = monitor_get_fd(VAR_0, VAR_4, NULL); if (qemu_chr_add_client(s, VAR_8) < 0) { qerror_report(QERR_ADD_CLIENT_FAILED); return -1; } return 0; } qerror_report(QERR_INVALID_PARAMETER, "VAR_3"); return -1; }