Watt-32 tcp/ip  2.2 dev-rel.10
Functions
accept.c File Reference

Go to the source code of this file.

Functions

static int dup_bind (Socket *socket, Socket **clone, int idx)
 
static int alloc_addr (Socket *socket, Socket *clone)
 
static void listen_free (Socket *socket, int idx)
 
int W32_CALL accept (int s, struct sockaddr *addr, int *addrlen)
 
int _sock_append (_tcp_Socket **tcp)
 Called from tcp_fsm.c / tcp_listen_state() (via _bsd_socket_hook) to append a new connection to the listen-queue of socket 'sock'. More...
 

Detailed Description

BSD accept().

Definition in file accept.c.

Function Documentation

int _sock_append ( _tcp_Socket **  tcp)

Called from tcp_fsm.c / tcp_listen_state() (via _bsd_socket_hook) to append a new connection to the listen-queue of socket 'sock'.

TCB on input ('orig') has received a SYN. Replace TCB on output with a cloned TCB that we append to the listen-queue and eventually is used by accept() to create a new socket.

TCB on input ('orig') must still be listening for further connections on the same port as specified in call to _TCP_listen().

Todo:
Implement SYN-cookies. Ref. http://cr.yp.to/syncookies.html
Todo:
Implement SYN-cookies and drop the segment if no match
Todo:
drop the oldest (or a random) slot in the listen-queue.

Definition at line 418 of file accept.c.

References _bsd_socket_hook(), _sock_set_rcv_buf(), _tcp_allsocs, tcp_Socket::last_acknum, tcp_Socket::last_seqnum, tcp_Socket::max_tx_data, tcp_Socket::my6addr, tcp_Socket::next, tcp_Socket::send_next, set_timeout(), tcp_recv_win, tcp_Socket::tx_buf, tcp_Socket::tx_data, tcp_Socket::tx_datalen, and tcp_Socket::unhappy.

int W32_CALL accept ( int  s,
struct sockaddr addr,
int *  addrlen 
)
Todo:
Should maybe loop over all maxconn TCBs and accept the one with oldest 'syn_timestamp'.

Definition at line 59 of file accept.c.

References _inet6_ntoa(), _sock_crit_start(), _sock_crit_stop(), _sock_free_rcv_buf(), _socklist_find(), _tcp_unthread(), chk_timeout(), tcp_Socket::his6addr, set_timeout(), sock_noflush(), socket(), tcp_Socket::state, and tcp_tick().