an_accept - accept a connection on a proxy-capable socket
#include <antinat.h>
int an_accept(ANCONN s, struct sockaddr *addr, int socklen);
The an_accept(3) function is used to accept an incoming connection on a socket that was created earlier and switched into listen mode using the an_listen(3) call. For proxy-based connections, only one incoming connection is allowed on any listening socket. Accepting a connection will use the primary socket for communication and will not create any other socket.
s is a socket previously created with an_new_connection(3), bound with the an_bind_tohostname(3) or an_bind_tosockaddr(3) calls, and placed into listen mode with an_listen(3).
Similar to accept, addr is filled in with the address of the connecting entity and socklen contains the length of addr. If addr is NULL then this data is not returned, but may be retrieved later with a call to an_getpeername(3).
Although there is planned support for non-blocking sockets in a future release, this call should be considered a blocking call. A non-blocking socket will be silently (and temporarily) changed to a blocking one to process the connection.
This call returns AN_ERROR_SUCCESS to indicate successful completion.
accept, an_bind_tohostname(3), an_bind_tosockaddr(3), an_getpeername(3), an_listen(3), an_new_connection(3)
Malcolm Smith <malxau@users.sourceforge.net>