|
||||
File indexing completed on 2025-01-18 09:57:12
0001 /* 0002 * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> 0003 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 0004 * 0005 * Redistribution and use in source and binary forms, with or without 0006 * modification, are permitted provided that the following conditions 0007 * are met: 0008 * 1. Redistributions of source code must retain the above copyright 0009 * notice, this list of conditions and the following disclaimer. 0010 * 2. Redistributions in binary form must reproduce the above copyright 0011 * notice, this list of conditions and the following disclaimer in the 0012 * documentation and/or other materials provided with the distribution. 0013 * 3. The name of the author may not be used to endorse or promote products 0014 * derived from this software without specific prior written permission. 0015 * 0016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 0017 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 0018 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 0019 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 0020 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 0021 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0022 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0023 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0024 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 0025 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0026 */ 0027 #ifndef EVENT2_HTTP_STRUCT_H_INCLUDED_ 0028 #define EVENT2_HTTP_STRUCT_H_INCLUDED_ 0029 0030 /** @file event2/http_struct.h 0031 0032 Data structures for http. Using these structures may hurt forward 0033 compatibility with later versions of Libevent: be careful! 0034 0035 */ 0036 0037 #ifdef __cplusplus 0038 extern "C" { 0039 #endif 0040 0041 #include <event2/event-config.h> 0042 #ifdef EVENT__HAVE_SYS_TYPES_H 0043 #include <sys/types.h> 0044 #endif 0045 #ifdef EVENT__HAVE_SYS_TIME_H 0046 #include <sys/time.h> 0047 #endif 0048 0049 /* For int types. */ 0050 #include <event2/util.h> 0051 0052 /** 0053 * the request structure that a server receives. 0054 * WARNING: expect this structure to change. I will try to provide 0055 * reasonable accessors. 0056 */ 0057 struct evhttp_request { 0058 #if defined(TAILQ_ENTRY) 0059 TAILQ_ENTRY(evhttp_request) next; 0060 #else 0061 struct { 0062 struct evhttp_request *tqe_next; 0063 struct evhttp_request **tqe_prev; 0064 } next; 0065 #endif 0066 0067 /* the connection object that this request belongs to */ 0068 struct evhttp_connection *evcon; 0069 int flags; 0070 /** The request obj owns the evhttp connection and needs to free it */ 0071 #define EVHTTP_REQ_OWN_CONNECTION 0x0001 0072 /** Request was made via a proxy */ 0073 #define EVHTTP_PROXY_REQUEST 0x0002 0074 /** The request object is owned by the user; the user must free it */ 0075 #define EVHTTP_USER_OWNED 0x0004 0076 /** The request will be used again upstack; freeing must be deferred */ 0077 #define EVHTTP_REQ_DEFER_FREE 0x0008 0078 /** The request should be freed upstack */ 0079 #define EVHTTP_REQ_NEEDS_FREE 0x0010 0080 0081 struct evkeyvalq *input_headers; 0082 struct evkeyvalq *output_headers; 0083 0084 /* address of the remote host and the port connection came from */ 0085 char *remote_host; 0086 ev_uint16_t remote_port; 0087 0088 /* cache of the hostname for evhttp_request_get_host */ 0089 char *host_cache; 0090 0091 enum evhttp_request_kind kind; 0092 enum evhttp_cmd_type type; 0093 0094 size_t headers_size; 0095 size_t body_size; 0096 0097 char *uri; /* uri after HTTP request was parsed */ 0098 struct evhttp_uri *uri_elems; /* uri elements */ 0099 0100 char major; /* HTTP Major number */ 0101 char minor; /* HTTP Minor number */ 0102 0103 int response_code; /* HTTP Response code */ 0104 char *response_code_line; /* Readable response */ 0105 0106 struct evbuffer *input_buffer; /* read data */ 0107 ev_int64_t ntoread; 0108 unsigned chunked:1, /* a chunked request */ 0109 userdone:1; /* the user has sent all data */ 0110 0111 struct evbuffer *output_buffer; /* outgoing post or data */ 0112 0113 /* Callback */ 0114 void (*cb)(struct evhttp_request *, void *); 0115 void *cb_arg; 0116 0117 /* 0118 * Chunked data callback - call for each completed chunk if 0119 * specified. If not specified, all the data is delivered via 0120 * the regular callback. 0121 */ 0122 void (*chunk_cb)(struct evhttp_request *, void *); 0123 0124 /* 0125 * Callback added for forked-daapd so they can collect ICY 0126 * (shoutcast) metadata from the http header. If return 0127 * int is negative the connection will be closed. 0128 */ 0129 int (*header_cb)(struct evhttp_request *, void *); 0130 0131 /* 0132 * Error callback - called when error is occured. 0133 * @see evhttp_request_error for error types. 0134 * 0135 * @see evhttp_request_set_error_cb() 0136 */ 0137 void (*error_cb)(enum evhttp_request_error, void *); 0138 0139 /* 0140 * Send complete callback - called when the request is actually 0141 * sent and completed. 0142 */ 0143 void (*on_complete_cb)(struct evhttp_request *, void *); 0144 void *on_complete_cb_arg; 0145 }; 0146 0147 #ifdef __cplusplus 0148 } 0149 #endif 0150 0151 #endif /* EVENT2_HTTP_STRUCT_H_INCLUDED_ */ 0152
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |