int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)

{

    QemuOpts *opts;

    int fd;



    opts = qemu_opts_create_nofail(&socket_optslist);

    switch (remote->kind) {

    case SOCKET_ADDRESS_KIND_INET:

        qemu_opt_set(opts, "host", remote->inet->host);

        qemu_opt_set(opts, "port", remote->inet->port);

        if (local) {

            qemu_opt_set(opts, "localaddr", local->inet->host);

            qemu_opt_set(opts, "localport", local->inet->port);

        }

        fd = inet_dgram_opts(opts, errp);

        break;



    default:

        error_setg(errp, "socket type unsupported for datagram");

        return -1;

    }

    qemu_opts_del(opts);

    return fd;

}

int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)

{

    QemuOpts *opts;

    int fd;



    opts = qemu_opts_create_nofail(&socket_optslist);

    switch (remote->kind) {

    case SOCKET_ADDRESS_KIND_INET:

        qemu_opt_set(opts, "host", remote->inet->host);

        qemu_opt_set(opts, "port", remote->inet->port);

        if (local) {

            qemu_opt_set(opts, "localaddr", local->inet->host);

            qemu_opt_set(opts, "localport", local->inet->port);

        }

        fd = inet_dgram_opts(opts, errp);

        break;



    default:

        error_setg(errp, "socket type unsupported for datagram");

        return -1;

    }

    qemu_opts_del(opts);

    return fd;

}

        return -1;
int FUNC_0(SocketAddress *VAR_0, SocketAddress *VAR_1, Error **VAR_2)

{

    QemuOpts *opts;

    int VAR_3;



    opts = qemu_opts_create_nofail(&socket_optslist);

    switch (VAR_0->kind) {

    case SOCKET_ADDRESS_KIND_INET:

        qemu_opt_set(opts, "host", VAR_0->inet->host);

        qemu_opt_set(opts, "port", VAR_0->inet->port);

        if (VAR_1) {

            qemu_opt_set(opts, "localaddr", VAR_1->inet->host);

            qemu_opt_set(opts, "localport", VAR_1->inet->port);

        }

        VAR_3 = inet_dgram_opts(opts, VAR_2);

        break;



    default:

        error_setg(VAR_2, "socket type unsupported for datagram");

        return -1;

    }

    qemu_opts_del(opts);

    return VAR_3;

}

int FUNC_0(SocketAddress *VAR_0, SocketAddress *VAR_1, Error **VAR_2)
{ QemuOpts *opts; int VAR_3; opts = qemu_opts_create_nofail(&socket_optslist); switch (VAR_0->kind) { case SOCKET_ADDRESS_KIND_INET:
qemu_opt_set(opts, "host", VAR_0->inet->host); qemu_opt_set(opts, "port", VAR_0->inet->port); if (VAR_1) { qemu_opt_set(opts, "localaddr", VAR_1->inet->host); qemu_opt_set(opts, "localport", VAR_1->inet->port); } VAR_3 = inet_dgram_opts(opts, VAR_2); break; default:
error_setg(VAR_2, "socket type unsupported for datagram"); return -1; } qemu_opts_del(opts); return VAR_3; }