/[lwip]/lwip/src/api/sockets.c
ViewVC logotype

Diff of /lwip/src/api/sockets.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16.2.5 by kieranm, Mon Sep 22 09:38:09 2003 UTC revision 1.16.2.6 by jani, Tue Nov 4 11:47:53 2003 UTC
# Line 198  lwip_accept(int s, struct sockaddr *addr Line 198  lwip_accept(int s, struct sockaddr *addr
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;
# Line 225  lwip_bind(int s, struct sockaddr *name, Line 223  lwip_bind(int s, struct sockaddr *name,
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    
# Line 297  lwip_connect(int s, struct sockaddr *nam Line 293  lwip_connect(int s, struct sockaddr *nam
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     }     }
# Line 417  lwip_recvfrom(int s, void *mem, int len, Line 411  lwip_recvfrom(int s, void *mem, int len,
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);
# Line 541  lwip_sendto(int s, void *data, int size, Line 533  lwip_sendto(int s, void *data, int size,
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    
# Line 921  int lwip_getpeername (int s, struct sock Line 911  int lwip_getpeername (int s, struct sock
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;
# Line 957  int lwip_getsockname (int s, struct sock Line 945  int lwip_getsockname (int s, struct sock
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;

Legend:
Removed from v.1.16.2.5  
changed lines
  Added in v.1.16.2.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26