Make evhttp_bound_socket visible, and provide an accessor to its fd

Declare the previously private struct evhttp_bound_socket in
event2/http.h as an opaque struct.

Implement evhttp_bound_socket_get_fd, which returns the file descriptor
of an evhttp_bound_socket.

[Patch from David Reiss]

svn:r1421
This commit is contained in:
Nick Mathewson 2009-08-16 19:21:57 +00:00
parent 0755833e84
commit 4bcd5646d8
2 changed files with 15 additions and 0 deletions

5
http.c
View File

@ -2433,6 +2433,11 @@ evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd)
return (0);
}
evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound)
{
return bound->bind_ev.ev_fd;
}
static struct evhttp*
evhttp_new_object(void)
{

View File

@ -69,6 +69,7 @@ struct event_base;
struct evhttp;
struct evhttp_request;
struct evkeyvalq;
struct evhttp_bound_socket;
/**
* Create a new HTTP server.
@ -111,6 +112,15 @@ int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t por
*/
int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
/**
* Get the raw file descriptor referenced by an evhttp_bound_socket.
*
* @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
* @return the file descriptor used by the bound socket
* @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
*/
evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_socket);
/**
* Free the previously created HTTP server.
*