static void qemu_chr_parse_udp(QemuOpts *opts, ChardevBackend *backend,

                               Error **errp)

{

    const char *host = qemu_opt_get(opts, "host");

    const char *port = qemu_opt_get(opts, "port");

    const char *localaddr = qemu_opt_get(opts, "localaddr");

    const char *localport = qemu_opt_get(opts, "localport");

    bool has_local = false;

    SocketAddress *addr;



    if (host == NULL || strlen(host) == 0) {

        host = "localhost";

    }

    if (port == NULL || strlen(port) == 0) {

        error_setg(errp, "chardev: udp: remote port not specified");

        return;

    }

    if (localport == NULL || strlen(localport) == 0) {

        localport = "0";

    } else {

        has_local = true;

    }

    if (localaddr == NULL || strlen(localaddr) == 0) {

        localaddr = "";

    } else {

        has_local = true;

    }



    backend->udp = g_new0(ChardevUdp, 1);



    addr = g_new0(SocketAddress, 1);

    addr->kind = SOCKET_ADDRESS_KIND_INET;

    addr->inet = g_new0(InetSocketAddress, 1);

    addr->inet->host = g_strdup(host);

    addr->inet->port = g_strdup(port);

    addr->inet->has_ipv4 = qemu_opt_get(opts, "ipv4");

    addr->inet->ipv4 = qemu_opt_get_bool(opts, "ipv4", 0);

    addr->inet->has_ipv6 = qemu_opt_get(opts, "ipv6");

    addr->inet->ipv6 = qemu_opt_get_bool(opts, "ipv6", 0);

    backend->udp->remote = addr;



    if (has_local) {

        backend->udp->has_local = true;

        addr = g_new0(SocketAddress, 1);

        addr->kind = SOCKET_ADDRESS_KIND_INET;

        addr->inet = g_new0(InetSocketAddress, 1);

        addr->inet->host = g_strdup(localaddr);

        addr->inet->port = g_strdup(localport);

        backend->udp->local = addr;

    }

}

static void qemu_chr_parse_udp(QemuOpts *opts, ChardevBackend *backend,

                               Error **errp)

{

    const char *host = qemu_opt_get(opts, "host");

    const char *port = qemu_opt_get(opts, "port");

    const char *localaddr = qemu_opt_get(opts, "localaddr");

    const char *localport = qemu_opt_get(opts, "localport");

    bool has_local = false;

    SocketAddress *addr;



    if (host == NULL || strlen(host) == 0) {

        host = "localhost";

    }

    if (port == NULL || strlen(port) == 0) {

        error_setg(errp, "chardev: udp: remote port not specified");

        return;

    }

    if (localport == NULL || strlen(localport) == 0) {

        localport = "0";

    } else {

        has_local = true;

    }

    if (localaddr == NULL || strlen(localaddr) == 0) {

        localaddr = "";

    } else {

        has_local = true;

    }



    backend->udp = g_new0(ChardevUdp, 1);



    addr = g_new0(SocketAddress, 1);

    addr->kind = SOCKET_ADDRESS_KIND_INET;

    addr->inet = g_new0(InetSocketAddress, 1);

    addr->inet->host = g_strdup(host);

    addr->inet->port = g_strdup(port);

    addr->inet->has_ipv4 = qemu_opt_get(opts, "ipv4");

    addr->inet->ipv4 = qemu_opt_get_bool(opts, "ipv4", 0);

    addr->inet->has_ipv6 = qemu_opt_get(opts, "ipv6");

    addr->inet->ipv6 = qemu_opt_get_bool(opts, "ipv6", 0);

    backend->udp->remote = addr;



    if (has_local) {

        backend->udp->has_local = true;

        addr = g_new0(SocketAddress, 1);

        addr->kind = SOCKET_ADDRESS_KIND_INET;

        addr->inet = g_new0(InetSocketAddress, 1);

        addr->inet->host = g_strdup(localaddr);

        addr->inet->port = g_strdup(localport);

        backend->udp->local = addr;

    }

}

static void FUNC_0(QemuOpts *VAR_0, ChardevBackend *VAR_1,

                               Error **VAR_2)

{

    const char *VAR_3 = qemu_opt_get(VAR_0, "VAR_3");

    const char *VAR_4 = qemu_opt_get(VAR_0, "VAR_4");

    const char *VAR_5 = qemu_opt_get(VAR_0, "VAR_5");

    const char *VAR_6 = qemu_opt_get(VAR_0, "VAR_6");

    bool has_local = false;

    SocketAddress *addr;



    if (VAR_3 == NULL || strlen(VAR_3) == 0) {

        VAR_3 = "localhost";

    }

    if (VAR_4 == NULL || strlen(VAR_4) == 0) {

        error_setg(VAR_2, "chardev: udp: remote VAR_4 not specified");

        return;

    }

    if (VAR_6 == NULL || strlen(VAR_6) == 0) {

        VAR_6 = "0";

    } else {

        has_local = true;

    }

    if (VAR_5 == NULL || strlen(VAR_5) == 0) {

        VAR_5 = "";

    } else {

        has_local = true;

    }



    VAR_1->udp = g_new0(ChardevUdp, 1);



    addr = g_new0(SocketAddress, 1);

    addr->kind = SOCKET_ADDRESS_KIND_INET;

    addr->inet = g_new0(InetSocketAddress, 1);

    addr->inet->VAR_3 = g_strdup(VAR_3);

    addr->inet->VAR_4 = g_strdup(VAR_4);

    addr->inet->has_ipv4 = qemu_opt_get(VAR_0, "ipv4");

    addr->inet->ipv4 = qemu_opt_get_bool(VAR_0, "ipv4", 0);

    addr->inet->has_ipv6 = qemu_opt_get(VAR_0, "ipv6");

    addr->inet->ipv6 = qemu_opt_get_bool(VAR_0, "ipv6", 0);

    VAR_1->udp->remote = addr;



    if (has_local) {

        VAR_1->udp->has_local = true;

        addr = g_new0(SocketAddress, 1);

        addr->kind = SOCKET_ADDRESS_KIND_INET;

        addr->inet = g_new0(InetSocketAddress, 1);

        addr->inet->VAR_3 = g_strdup(VAR_5);

        addr->inet->VAR_4 = g_strdup(VAR_6);

        VAR_1->udp->local = addr;

    }

}

static void FUNC_0(QemuOpts *VAR_0, ChardevBackend *VAR_1,
Error **VAR_2)
{ const char *VAR_3 = qemu_opt_get(VAR_0, "VAR_3"); const char *VAR_4 = qemu_opt_get(VAR_0, "VAR_4"); const char *VAR_5 = qemu_opt_get(VAR_0, "VAR_5"); const char *VAR_6 = qemu_opt_get(VAR_0, "VAR_6"); bool has_local = false; SocketAddress *addr; if (VAR_3 == NULL || strlen(VAR_3) == 0) { VAR_3 = "localhost"; } if (VAR_4 == NULL || strlen(VAR_4) == 0) { error_setg(VAR_2, "chardev: udp: remote VAR_4 not specified"); return; } if (VAR_6 == NULL || strlen(VAR_6) == 0) { VAR_6 = "0"; } else { has_local = true; } if (VAR_5 == NULL || strlen(VAR_5) == 0) { VAR_5 = ""; } else { has_local = true; } VAR_1->udp = g_new0(ChardevUdp, 1); addr = g_new0(SocketAddress, 1); addr->kind = SOCKET_ADDRESS_KIND_INET; addr->inet = g_new0(InetSocketAddress, 1); addr->inet->VAR_3 = g_strdup(VAR_3); addr->inet->VAR_4 = g_strdup(VAR_4); addr->inet->has_ipv4 = qemu_opt_get(VAR_0, "ipv4"); addr->inet->ipv4 = qemu_opt_get_bool(VAR_0, "ipv4", 0); addr->inet->has_ipv6 = qemu_opt_get(VAR_0, "ipv6"); addr->inet->ipv6 = qemu_opt_get_bool(VAR_0, "ipv6", 0); VAR_1->udp->remote = addr; if (has_local) { VAR_1->udp->has_local = true; addr = g_new0(SocketAddress, 1); addr->kind = SOCKET_ADDRESS_KIND_INET; addr->inet = g_new0(InetSocketAddress, 1); addr->inet->VAR_3 = g_strdup(VAR_5); addr->inet->VAR_4 = g_strdup(VAR_6); VAR_1->udp->local = addr; } }