summaryrefslogtreecommitdiff
path: root/http-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-09 13:25:50 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-09 16:43:40 -0400
commit90b3ed5bc840480f1c1d40f93bc2d850e3830d64 (patch)
treebebfd4f6273ae968290d916db98fd7b6d617aa75 /http-internal.h
parentff481a8e43999c4ba1556bc472b5e69fce7ea353 (diff)
downloadlibevent-90b3ed5bc840480f1c1d40f93bc2d850e3830d64.tar.gz
Add some comments to http.c and make a few functions static.
Diffstat (limited to 'http-internal.h')
-rw-r--r--http-internal.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/http-internal.h b/http-internal.h
index 0380d035..e9b296f7 100644
--- a/http-internal.h
+++ b/http-internal.h
@@ -40,8 +40,6 @@ struct evbuffer;
struct addrinfo;
struct evhttp_request;
-/* A stupid connection object - maybe make this a bufferevent later */
-
enum evhttp_connection_state {
EVCON_DISCONNECTED, /**< not currently connected not trying either*/
EVCON_CONNECTING, /**< tries to currently connect */
@@ -56,8 +54,9 @@ enum evhttp_connection_state {
struct event_base;
+/* A client or server connection. */
struct evhttp_connection {
- /* we use tailq only if they were created for an http server */
+ /* we use this tailq only if they were created for an http server */
TAILQ_ENTRY(evhttp_connection) (next);
evutil_socket_t fd;
@@ -100,6 +99,7 @@ struct evhttp_connection {
struct evdns_base *dns_base;
};
+/* A callback for an http server */
struct evhttp_cb {
TAILQ_ENTRY(evhttp_cb) next;
@@ -120,11 +120,15 @@ struct evhttp_bound_socket {
};
struct evhttp {
- TAILQ_ENTRY(evhttp) next;
+ /* Next vhost, if this is a vhost. */
+ TAILQ_ENTRY(evhttp) next_vhost;
+ /* All listeners for this host */
TAILQ_HEAD(boundq, evhttp_bound_socket) sockets;
TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
+
+ /* All live connections on this host. */
struct evconq connections;
TAILQ_HEAD(vhostsq, evhttp) virtualhosts;
@@ -137,12 +141,16 @@ struct evhttp {
size_t default_max_headers_size;
ev_uint64_t default_max_body_size;
+ /* Fallback callback if all the other callbacks for this connection
+ don't match. */
void (*gencb)(struct evhttp_request *req, void *);
void *gencbarg;
struct event_base *base;
};
+/* XXX most of these functions could be static. */
+
/* resets the connection; can be reused for more requests */
void evhttp_connection_reset(struct evhttp_connection *);
@@ -153,18 +161,12 @@ int evhttp_connection_connect(struct evhttp_connection *);
void evhttp_connection_fail(struct evhttp_connection *,
enum evhttp_connection_error error);
-void evhttp_get_request(struct evhttp *, evutil_socket_t, struct sockaddr *, ev_socklen_t);
-
enum message_read_status;
enum message_read_status evhttp_parse_firstline(struct evhttp_request *, struct evbuffer*);
enum message_read_status evhttp_parse_headers(struct evhttp_request *, struct evbuffer*);
void evhttp_start_read(struct evhttp_connection *);
-void evhttp_make_header(struct evhttp_connection *, struct evhttp_request *);
-
-void evhttp_write_buffer(struct evhttp_connection *,
- void (*)(struct evhttp_connection *, void *), void *);
/* response sending HTML the data in the buffer */
void evhttp_response_code(struct evhttp_request *, int, const char *);