static int net_socket_listen_init(NetClientState *peer,

                                  const char *model,

                                  const char *name,

                                  const char *host_str)

{

    NetClientState *nc;

    NetSocketState *s;

    struct sockaddr_in saddr;

    int fd, ret;

    Error *err = NULL;



    if (parse_host_port(&saddr, host_str, &err) < 0) {

        error_report_err(err);

        return -1;

    }



    fd = qemu_socket(PF_INET, SOCK_STREAM, 0);

    if (fd < 0) {

        perror("socket");

        return -1;

    }

    qemu_set_nonblock(fd);



    socket_set_fast_reuse(fd);



    ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));

    if (ret < 0) {

        perror("bind");

        closesocket(fd);

        return -1;

    }

    ret = listen(fd, 0);

    if (ret < 0) {

        perror("listen");

        closesocket(fd);

        return -1;

    }



    nc = qemu_new_net_client(&net_socket_info, peer, model, name);

    s = DO_UPCAST(NetSocketState, nc, nc);

    s->fd = -1;

    s->listen_fd = fd;

    s->nc.link_down = true;

    net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);



    qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);

    return 0;

}

static int net_socket_listen_init(NetClientState *peer,

                                  const char *model,

                                  const char *name,

                                  const char *host_str)

{

    NetClientState *nc;

    NetSocketState *s;

    struct sockaddr_in saddr;

    int fd, ret;

    Error *err = NULL;



    if (parse_host_port(&saddr, host_str, &err) < 0) {

        error_report_err(err);

        return -1;

    }



    fd = qemu_socket(PF_INET, SOCK_STREAM, 0);

    if (fd < 0) {

        perror("socket");

        return -1;

    }

    qemu_set_nonblock(fd);



    socket_set_fast_reuse(fd);



    ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));

    if (ret < 0) {

        perror("bind");

        closesocket(fd);

        return -1;

    }

    ret = listen(fd, 0);

    if (ret < 0) {

        perror("listen");

        closesocket(fd);

        return -1;

    }



    nc = qemu_new_net_client(&net_socket_info, peer, model, name);

    s = DO_UPCAST(NetSocketState, nc, nc);

    s->fd = -1;

    s->listen_fd = fd;

    s->nc.link_down = true;

    net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);



    qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);

    return 0;

}

                                  const char *host_str)     Error *err = NULL;     if (parse_host_port(&saddr, host_str, &err) < 0) {         error_report_err(err);         perror("socket");         perror("bind");         perror("listen");     Error *err = NULL;     if (parse_host_port(&saddr, host_str, &err) < 0) {         error_report_err(err);         perror("socket");         error_report_err(err);     Error *err = NULL;     if (parse_host_port(&saddr, host_str, &err) < 0) {         error_report_err(err);         error_report_err(err);         error_report_err(err);     Error *err = NULL;         error_report_err(err);         error_report_err(err);         perror("bind");         error_report_err(err);     Error *err = NULL;
static int FUNC_0(NetClientState *VAR_0,

                                  const char *VAR_1,

                                  const char *VAR_2,

                                  const char *VAR_3)

{

    NetClientState *nc;

    NetSocketState *s;

    struct sockaddr_in VAR_4;

    int VAR_5, VAR_6;

    Error *err = NULL;



    if (parse_host_port(&VAR_4, VAR_3, &err) < 0) {

        error_report_err(err);

        return -1;

    }



    VAR_5 = qemu_socket(PF_INET, SOCK_STREAM, 0);

    if (VAR_5 < 0) {

        perror("socket");

        return -1;

    }

    qemu_set_nonblock(VAR_5);



    socket_set_fast_reuse(VAR_5);



    VAR_6 = bind(VAR_5, (struct sockaddr *)&VAR_4, sizeof(VAR_4));

    if (VAR_6 < 0) {

        perror("bind");

        closesocket(VAR_5);

        return -1;

    }

    VAR_6 = listen(VAR_5, 0);

    if (VAR_6 < 0) {

        perror("listen");

        closesocket(VAR_5);

        return -1;

    }



    nc = qemu_new_net_client(&net_socket_info, VAR_0, VAR_1, VAR_2);

    s = DO_UPCAST(NetSocketState, nc, nc);

    s->VAR_5 = -1;

    s->listen_fd = VAR_5;

    s->nc.link_down = true;

    net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);



    qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);

    return 0;

}

static int FUNC_0(NetClientState *VAR_0,
const char *VAR_1,
const char *VAR_2,
const char *VAR_3)
{ NetClientState *nc; NetSocketState *s; struct sockaddr_in VAR_4; int VAR_5, VAR_6; Error *err = NULL; if (parse_host_port(&VAR_4, VAR_3, &err) < 0) { error_report_err(err); return -1; } VAR_5 = qemu_socket(PF_INET, SOCK_STREAM, 0); if (VAR_5 < 0) { perror("socket"); return -1; } qemu_set_nonblock(VAR_5); socket_set_fast_reuse(VAR_5); VAR_6 = bind(VAR_5, (struct sockaddr *)&VAR_4, sizeof(VAR_4)); if (VAR_6 < 0) { perror("bind"); closesocket(VAR_5); return -1; } VAR_6 = listen(VAR_5, 0); if (VAR_6 < 0) { perror("listen"); closesocket(VAR_5); return -1; } nc = qemu_new_net_client(&net_socket_info, VAR_0, VAR_1, VAR_2); s = DO_UPCAST(NetSocketState, nc, nc); s->VAR_5 = -1; s->listen_fd = VAR_5; s->nc.link_down = true; net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s); return 0; }