1*663afb9bSAndroid Build Coastguard Worker /* 2*663afb9bSAndroid Build Coastguard Worker * Copyright (c) 2000-2007 Niels Provos <[email protected]> 3*663afb9bSAndroid Build Coastguard Worker * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4*663afb9bSAndroid Build Coastguard Worker * 5*663afb9bSAndroid Build Coastguard Worker * Redistribution and use in source and binary forms, with or without 6*663afb9bSAndroid Build Coastguard Worker * modification, are permitted provided that the following conditions 7*663afb9bSAndroid Build Coastguard Worker * are met: 8*663afb9bSAndroid Build Coastguard Worker * 1. Redistributions of source code must retain the above copyright 9*663afb9bSAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer. 10*663afb9bSAndroid Build Coastguard Worker * 2. Redistributions in binary form must reproduce the above copyright 11*663afb9bSAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer in the 12*663afb9bSAndroid Build Coastguard Worker * documentation and/or other materials provided with the distribution. 13*663afb9bSAndroid Build Coastguard Worker * 3. The name of the author may not be used to endorse or promote products 14*663afb9bSAndroid Build Coastguard Worker * derived from this software without specific prior written permission. 15*663afb9bSAndroid Build Coastguard Worker * 16*663afb9bSAndroid Build Coastguard Worker * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17*663afb9bSAndroid Build Coastguard Worker * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18*663afb9bSAndroid Build Coastguard Worker * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19*663afb9bSAndroid Build Coastguard Worker * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20*663afb9bSAndroid Build Coastguard Worker * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21*663afb9bSAndroid Build Coastguard Worker * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22*663afb9bSAndroid Build Coastguard Worker * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23*663afb9bSAndroid Build Coastguard Worker * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24*663afb9bSAndroid Build Coastguard Worker * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25*663afb9bSAndroid Build Coastguard Worker * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26*663afb9bSAndroid Build Coastguard Worker */ 27*663afb9bSAndroid Build Coastguard Worker #ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_ 28*663afb9bSAndroid Build Coastguard Worker #define EVENT2_HTTP_COMPAT_H_INCLUDED_ 29*663afb9bSAndroid Build Coastguard Worker 30*663afb9bSAndroid Build Coastguard Worker /** @file event2/http_compat.h 31*663afb9bSAndroid Build Coastguard Worker 32*663afb9bSAndroid Build Coastguard Worker Potentially non-threadsafe versions of the functions in http.h: provided 33*663afb9bSAndroid Build Coastguard Worker only for backwards compatibility. 34*663afb9bSAndroid Build Coastguard Worker 35*663afb9bSAndroid Build Coastguard Worker */ 36*663afb9bSAndroid Build Coastguard Worker 37*663afb9bSAndroid Build Coastguard Worker #ifdef __cplusplus 38*663afb9bSAndroid Build Coastguard Worker extern "C" { 39*663afb9bSAndroid Build Coastguard Worker #endif 40*663afb9bSAndroid Build Coastguard Worker 41*663afb9bSAndroid Build Coastguard Worker #include <event2/event-config.h> 42*663afb9bSAndroid Build Coastguard Worker #ifdef EVENT__HAVE_SYS_TYPES_H 43*663afb9bSAndroid Build Coastguard Worker #include <sys/types.h> 44*663afb9bSAndroid Build Coastguard Worker #endif 45*663afb9bSAndroid Build Coastguard Worker #ifdef EVENT__HAVE_SYS_TIME_H 46*663afb9bSAndroid Build Coastguard Worker #include <sys/time.h> 47*663afb9bSAndroid Build Coastguard Worker #endif 48*663afb9bSAndroid Build Coastguard Worker 49*663afb9bSAndroid Build Coastguard Worker /* For int types. */ 50*663afb9bSAndroid Build Coastguard Worker #include <event2/util.h> 51*663afb9bSAndroid Build Coastguard Worker 52*663afb9bSAndroid Build Coastguard Worker /** 53*663afb9bSAndroid Build Coastguard Worker * Start an HTTP server on the specified address and port 54*663afb9bSAndroid Build Coastguard Worker * 55*663afb9bSAndroid Build Coastguard Worker * @deprecated It does not allow an event base to be specified 56*663afb9bSAndroid Build Coastguard Worker * 57*663afb9bSAndroid Build Coastguard Worker * @param address the address to which the HTTP server should be bound 58*663afb9bSAndroid Build Coastguard Worker * @param port the port number on which the HTTP server should listen 59*663afb9bSAndroid Build Coastguard Worker * @return a pointer to a newly initialized evhttp server structure 60*663afb9bSAndroid Build Coastguard Worker * or NULL on error 61*663afb9bSAndroid Build Coastguard Worker */ 62*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 63*663afb9bSAndroid Build Coastguard Worker struct evhttp *evhttp_start(const char *address, ev_uint16_t port); 64*663afb9bSAndroid Build Coastguard Worker 65*663afb9bSAndroid Build Coastguard Worker /** 66*663afb9bSAndroid Build Coastguard Worker * A connection object that can be used to for making HTTP requests. The 67*663afb9bSAndroid Build Coastguard Worker * connection object tries to establish the connection when it is given an 68*663afb9bSAndroid Build Coastguard Worker * http request object. 69*663afb9bSAndroid Build Coastguard Worker * 70*663afb9bSAndroid Build Coastguard Worker * @deprecated It does not allow an event base to be specified 71*663afb9bSAndroid Build Coastguard Worker */ 72*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 73*663afb9bSAndroid Build Coastguard Worker struct evhttp_connection *evhttp_connection_new( 74*663afb9bSAndroid Build Coastguard Worker const char *address, ev_uint16_t port); 75*663afb9bSAndroid Build Coastguard Worker 76*663afb9bSAndroid Build Coastguard Worker /** 77*663afb9bSAndroid Build Coastguard Worker * Associates an event base with the connection - can only be called 78*663afb9bSAndroid Build Coastguard Worker * on a freshly created connection object that has not been used yet. 79*663afb9bSAndroid Build Coastguard Worker * 80*663afb9bSAndroid Build Coastguard Worker * @deprecated XXXX Why? 81*663afb9bSAndroid Build Coastguard Worker */ 82*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 83*663afb9bSAndroid Build Coastguard Worker void evhttp_connection_set_base(struct evhttp_connection *evcon, 84*663afb9bSAndroid Build Coastguard Worker struct event_base *base); 85*663afb9bSAndroid Build Coastguard Worker 86*663afb9bSAndroid Build Coastguard Worker 87*663afb9bSAndroid Build Coastguard Worker /** Returns the request URI */ 88*663afb9bSAndroid Build Coastguard Worker #define evhttp_request_uri evhttp_request_get_uri 89*663afb9bSAndroid Build Coastguard Worker 90*663afb9bSAndroid Build Coastguard Worker #ifdef __cplusplus 91*663afb9bSAndroid Build Coastguard Worker } 92*663afb9bSAndroid Build Coastguard Worker #endif 93*663afb9bSAndroid Build Coastguard Worker 94*663afb9bSAndroid Build Coastguard Worker #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */ 95