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