int slirp_remove_hostfwd(int is_udp, struct in_addr host_addr, int host_port)

{

    struct socket *so;

    struct socket *head = (is_udp ? &udb : &tcb);

    struct sockaddr_in addr;

    int port = htons(host_port);

    socklen_t addr_len;

    int n = 0;



 loop_again:

    for (so = head->so_next; so != head; so = so->so_next) {

        addr_len = sizeof(addr);

        if (getsockname(so->s, (struct sockaddr *)&addr, &addr_len) == 0 &&

            addr.sin_addr.s_addr == host_addr.s_addr &&

            addr.sin_port == port) {

            close(so->s);

            sofree(so);

            n++;

            goto loop_again;

        }

    }



    return n;

}

int slirp_remove_hostfwd(int is_udp, struct in_addr host_addr, int host_port)

{

    struct socket *so;

    struct socket *head = (is_udp ? &udb : &tcb);

    struct sockaddr_in addr;

    int port = htons(host_port);

    socklen_t addr_len;

    int n = 0;



 loop_again:

    for (so = head->so_next; so != head; so = so->so_next) {

        addr_len = sizeof(addr);

        if (getsockname(so->s, (struct sockaddr *)&addr, &addr_len) == 0 &&

            addr.sin_addr.s_addr == host_addr.s_addr &&

            addr.sin_port == port) {

            close(so->s);

            sofree(so);

            n++;

            goto loop_again;

        }

    }



    return n;

}

int FUNC_0(int VAR_0, struct in_addr VAR_1, int VAR_2)

{

    struct socket *VAR_3;

    struct socket *VAR_4 = (VAR_0 ? &udb : &tcb);

    struct sockaddr_in VAR_5;

    int VAR_6 = htons(VAR_2);

    socklen_t addr_len;

    int VAR_7 = 0;



 loop_again:

    for (VAR_3 = VAR_4->so_next; VAR_3 != VAR_4; VAR_3 = VAR_3->so_next) {

        addr_len = sizeof(VAR_5);

        if (getsockname(VAR_3->s, (struct sockaddr *)&VAR_5, &addr_len) == 0 &&

            VAR_5.sin_addr.s_addr == VAR_1.s_addr &&

            VAR_5.sin_port == VAR_6) {

            close(VAR_3->s);

            sofree(VAR_3);

            VAR_7++;

            goto loop_again;

        }

    }



    return VAR_7;

}

int FUNC_0(int VAR_0, struct in_addr VAR_1, int VAR_2)
{ struct socket *VAR_3; struct socket *VAR_4 = (VAR_0 ? &udb : &tcb); struct sockaddr_in VAR_5; int VAR_6 = htons(VAR_2); socklen_t addr_len; int VAR_7 = 0; loop_again:
for (VAR_3 = VAR_4->so_next; VAR_3 != VAR_4; VAR_3 = VAR_3->so_next) { addr_len = sizeof(VAR_5); if (getsockname(VAR_3->s, (struct sockaddr *)&VAR_5, &addr_len) == 0 &&
VAR_5.sin_addr.s_addr == VAR_1.s_addr &&
VAR_5.sin_port == VAR_6) { close(VAR_3->s); sofree(VAR_3); VAR_7++; goto loop_again; } } return VAR_7; }