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