198 |
newconn->socket = newsock; |
newconn->socket = newsock; |
199 |
sys_sem_signal(socksem); |
sys_sem_signal(socksem); |
200 |
|
|
|
#if SOCKETS_DEBUG |
|
201 |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d addr=", s, newsock)); |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d addr=", s, newsock)); |
202 |
ip_addr_debug_print(SOCKETS_DEBUG, &naddr); |
ip_addr_debug_print(SOCKETS_DEBUG, &naddr); |
203 |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u\n", port)); |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u\n", port)); |
|
#endif |
|
204 |
|
|
205 |
sock_set_errno(sock, 0); |
sock_set_errno(sock, 0); |
206 |
return newsock; |
return newsock; |
223 |
local_addr.addr = ((struct sockaddr_in *)name)->sin_addr.s_addr; |
local_addr.addr = ((struct sockaddr_in *)name)->sin_addr.s_addr; |
224 |
local_port = ((struct sockaddr_in *)name)->sin_port; |
local_port = ((struct sockaddr_in *)name)->sin_port; |
225 |
|
|
|
#if SOCKETS_DEBUG |
|
226 |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d, addr=", s)); |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d, addr=", s)); |
227 |
ip_addr_debug_print(SOCKETS_DEBUG, &local_addr); |
ip_addr_debug_print(SOCKETS_DEBUG, &local_addr); |
228 |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(local_port))); |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(local_port))); |
|
#endif |
|
229 |
|
|
230 |
err = netconn_bind(sock->conn, &local_addr, ntohs(local_port)); |
err = netconn_bind(sock->conn, &local_addr, ntohs(local_port)); |
231 |
|
|
293 |
remote_addr.addr = ((struct sockaddr_in *)name)->sin_addr.s_addr; |
remote_addr.addr = ((struct sockaddr_in *)name)->sin_addr.s_addr; |
294 |
remote_port = ((struct sockaddr_in *)name)->sin_port; |
remote_port = ((struct sockaddr_in *)name)->sin_port; |
295 |
|
|
|
#if SOCKETS_DEBUG |
|
296 |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d, addr=", s)); |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d, addr=", s)); |
297 |
ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr); |
ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr); |
298 |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(remote_port))); |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(remote_port))); |
|
#endif |
|
299 |
|
|
300 |
err = netconn_connect(sock->conn, &remote_addr, ntohs(remote_port)); |
err = netconn_connect(sock->conn, &remote_addr, ntohs(remote_port)); |
301 |
} |
} |
411 |
|
|
412 |
memcpy(from, &sin, *fromlen); |
memcpy(from, &sin, *fromlen); |
413 |
|
|
|
#if SOCKETS_DEBUG |
|
414 |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s)); |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s)); |
415 |
ip_addr_debug_print(SOCKETS_DEBUG, addr); |
ip_addr_debug_print(SOCKETS_DEBUG, addr); |
416 |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u len=%u\n", port, copylen)); |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u len=%u\n", port, copylen)); |
|
#endif |
|
417 |
} else { |
} else { |
418 |
#if SOCKETS_DEBUG > 0 |
#if SOCKETS_DEBUG > 0 |
419 |
addr = netbuf_fromaddr(buf); |
addr = netbuf_fromaddr(buf); |
533 |
remote_addr.addr = ((struct sockaddr_in *)to)->sin_addr.s_addr; |
remote_addr.addr = ((struct sockaddr_in *)to)->sin_addr.s_addr; |
534 |
remote_port = ((struct sockaddr_in *)to)->sin_port; |
remote_port = ((struct sockaddr_in *)to)->sin_port; |
535 |
|
|
|
#if SOCKETS_DEBUG |
|
536 |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_sendto(%d, data=%p, size=%d, flags=0x%x to=", s, data, size, flags)); |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_sendto(%d, data=%p, size=%d, flags=0x%x to=", s, data, size, flags)); |
537 |
ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr); |
ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr); |
538 |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u\n", ntohs(remote_port))); |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u\n", ntohs(remote_port))); |
|
#endif |
|
539 |
|
|
540 |
netconn_connect(sock->conn, &remote_addr, ntohs(remote_port)); |
netconn_connect(sock->conn, &remote_addr, ntohs(remote_port)); |
541 |
|
|
911 |
/* get the IP address and port of the remote host */ |
/* get the IP address and port of the remote host */ |
912 |
netconn_peer(sock->conn, &naddr, &sin.sin_port); |
netconn_peer(sock->conn, &naddr, &sin.sin_port); |
913 |
|
|
|
#if SOCKETS_DEBUG |
|
914 |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getpeername(%d, addr=", s)); |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getpeername(%d, addr=", s)); |
915 |
ip_addr_debug_print(SOCKETS_DEBUG, &naddr); |
ip_addr_debug_print(SOCKETS_DEBUG, &naddr); |
916 |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%d)\n", sin.sin_port)); |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%d)\n", sin.sin_port)); |
|
#endif |
|
917 |
|
|
918 |
sin.sin_port = htons(sin.sin_port); |
sin.sin_port = htons(sin.sin_port); |
919 |
sin.sin_addr.s_addr = naddr.addr; |
sin.sin_addr.s_addr = naddr.addr; |
945 |
/* get the IP address and port of the remote host */ |
/* get the IP address and port of the remote host */ |
946 |
netconn_addr(sock->conn, &naddr, &sin.sin_port); |
netconn_addr(sock->conn, &naddr, &sin.sin_port); |
947 |
|
|
|
#if SOCKETS_DEBUG |
|
948 |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockname(%d, addr=", s)); |
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockname(%d, addr=", s)); |
949 |
ip_addr_debug_print(SOCKETS_DEBUG, naddr); |
ip_addr_debug_print(SOCKETS_DEBUG, naddr); |
950 |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%d)\n", sin.sin_port)); |
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%d)\n", sin.sin_port)); |
|
#endif |
|
951 |
|
|
952 |
sin.sin_port = htons(sin.sin_port); |
sin.sin_port = htons(sin.sin_port); |
953 |
sin.sin_addr.s_addr = naddr->addr; |
sin.sin_addr.s_addr = naddr->addr; |