udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,

           u_int lport, int flags)

{

	struct sockaddr_in addr;

	struct socket *so;

	socklen_t addrlen = sizeof(struct sockaddr_in);



	so = socreate(slirp);

	if (!so) {



	so->s = qemu_socket(AF_INET,SOCK_DGRAM,0);





	so->so_expire = curtime + SO_EXPIRE;

	insque(so, &slirp->udb);



	addr.sin_family = AF_INET;

	addr.sin_addr.s_addr = haddr;

	addr.sin_port = hport;



	if (bind(so->s,(struct sockaddr *)&addr, addrlen) < 0) {

		udp_detach(so);



	socket_set_fast_reuse(so->s);



	getsockname(so->s,(struct sockaddr *)&addr,&addrlen);

	so->fhost.sin = addr;

	sotranslate_accept(so);

	so->so_lfamily = AF_INET;

	so->so_lport = lport;

	so->so_laddr.s_addr = laddr;

	if (flags != SS_FACCEPTONCE)

	   so->so_expire = 0;



	so->so_state &= SS_PERSISTENT_MASK;

	so->so_state |= SS_ISFCONNECTED | flags;



	return so;

udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,

           u_int lport, int flags)

{

	struct sockaddr_in addr;

	struct socket *so;

	socklen_t addrlen = sizeof(struct sockaddr_in);



	so = socreate(slirp);

	if (!so) {



	so->s = qemu_socket(AF_INET,SOCK_DGRAM,0);





	so->so_expire = curtime + SO_EXPIRE;

	insque(so, &slirp->udb);



	addr.sin_family = AF_INET;

	addr.sin_addr.s_addr = haddr;

	addr.sin_port = hport;



	if (bind(so->s,(struct sockaddr *)&addr, addrlen) < 0) {

		udp_detach(so);



	socket_set_fast_reuse(so->s);



	getsockname(so->s,(struct sockaddr *)&addr,&addrlen);

	so->fhost.sin = addr;

	sotranslate_accept(so);

	so->so_lfamily = AF_INET;

	so->so_lport = lport;

	so->so_laddr.s_addr = laddr;

	if (flags != SS_FACCEPTONCE)

	   so->so_expire = 0;



	so->so_state &= SS_PERSISTENT_MASK;

	so->so_state |= SS_ISFCONNECTED | flags;



	return so;

FUNC_0(Slirp *VAR_0, uint32_t VAR_1, u_int VAR_2, uint32_t VAR_3,

           u_int VAR_4, int VAR_5)

{

	struct sockaddr_in VAR_6;

	struct socket *VAR_7;

	socklen_t addrlen = sizeof(struct sockaddr_in);



	VAR_7 = socreate(VAR_0);

	if (!VAR_7) {



	VAR_7->s = qemu_socket(AF_INET,SOCK_DGRAM,0);





	VAR_7->so_expire = curtime + SO_EXPIRE;

	insque(VAR_7, &VAR_0->udb);



	VAR_6.sin_family = AF_INET;

	VAR_6.sin_addr.s_addr = VAR_1;

	VAR_6.sin_port = VAR_2;



	if (bind(VAR_7->s,(struct sockaddr *)&VAR_6, addrlen) < 0) {

		udp_detach(VAR_7);



	socket_set_fast_reuse(VAR_7->s);



	getsockname(VAR_7->s,(struct sockaddr *)&VAR_6,&addrlen);

	VAR_7->fhost.sin = VAR_6;

	sotranslate_accept(VAR_7);

	VAR_7->so_lfamily = AF_INET;

	VAR_7->so_lport = VAR_4;

	VAR_7->so_laddr.s_addr = VAR_3;

	if (VAR_5 != SS_FACCEPTONCE)

	   VAR_7->so_expire = 0;



	VAR_7->so_state &= SS_PERSISTENT_MASK;

	VAR_7->so_state |= SS_ISFCONNECTED | VAR_5;



	return VAR_7;

FUNC_0(Slirp *VAR_0, uint32_t VAR_1, u_int VAR_2, uint32_t VAR_3,
u_int VAR_4, int VAR_5)
{ struct sockaddr_in VAR_6; struct socket *VAR_7; socklen_t addrlen = sizeof(struct sockaddr_in); VAR_7 = socreate(VAR_0); if (!VAR_7) { VAR_7->s = qemu_socket(AF_INET,SOCK_DGRAM,0); VAR_7->so_expire = curtime + SO_EXPIRE; insque(VAR_7, &VAR_0->udb); VAR_6.sin_family = AF_INET; VAR_6.sin_addr.s_addr = VAR_1; VAR_6.sin_port = VAR_2; if (bind(VAR_7->s,(struct sockaddr *)&VAR_6, addrlen) < 0) { udp_detach(VAR_7); socket_set_fast_reuse(VAR_7->s); getsockname(VAR_7->s,(struct sockaddr *)&VAR_6,&addrlen); VAR_7->fhost.sin = VAR_6; sotranslate_accept(VAR_7); VAR_7->so_lfamily = AF_INET; VAR_7->so_lport = VAR_4; VAR_7->so_laddr.s_addr = VAR_3; if (VAR_5 != SS_FACCEPTONCE)
VAR_7->so_expire = 0; VAR_7->so_state &= SS_PERSISTENT_MASK; VAR_7->so_state |= SS_ISFCONNECTED | VAR_5; return VAR_7;