X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/ff92debd29cab62e0f824ca3e40914f64e0bcb05..8ab2aa9fd51a89e06d92a4f7c3792aaa4a08cc71:/lib/client.c diff --git a/lib/client.c b/lib/client.c index 1967e0e..fb1b1cc 100644 --- a/lib/client.c +++ b/lib/client.c @@ -41,9 +41,6 @@ #if HAVE_NETDB_H # include #endif -#if HAVE_PCRE_H -# include -#endif #include "log.h" #include "mem.h" @@ -117,9 +114,22 @@ void disorder_force_unpriv(disorder_client *c) { c->trypriv = 0; } -/** @brief Return the address family used by this client */ -int disorder_client_af(disorder_client *c) { - return c->family; +/** @brief Determine the local socket address of this client */ +int disorder_client_sockname(disorder_client *c, + struct sockaddr *sa, socklen_t *len_inout) { + int rc; + if((rc = getsockname(c->sio.sd, sa, len_inout))) + disorder_error(errno, "failed to read client socket name"); + return rc; +} + +/** @brief Determine the remote peer address for this client */ +int disorder_client_peername(disorder_client *c, + struct sockaddr *sa, socklen_t *len_inout) { + int rc; + if((rc = getpeername(c->sio.sd, sa, len_inout))) + disorder_error(errno, "failed to read client socket name"); + return rc; } /** @brief Read a response line