xref: /freebsd/contrib/ntp/sntp/libevent/include/event2/http_compat.h (revision a466cc55373fc3cf86837f09da729535b57e69a1)
12b15cb3dSCy Schubert /*
22b15cb3dSCy Schubert  * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
32b15cb3dSCy Schubert  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
42b15cb3dSCy Schubert  *
52b15cb3dSCy Schubert  * Redistribution and use in source and binary forms, with or without
62b15cb3dSCy Schubert  * modification, are permitted provided that the following conditions
72b15cb3dSCy Schubert  * are met:
82b15cb3dSCy Schubert  * 1. Redistributions of source code must retain the above copyright
92b15cb3dSCy Schubert  *    notice, this list of conditions and the following disclaimer.
102b15cb3dSCy Schubert  * 2. Redistributions in binary form must reproduce the above copyright
112b15cb3dSCy Schubert  *    notice, this list of conditions and the following disclaimer in the
122b15cb3dSCy Schubert  *    documentation and/or other materials provided with the distribution.
132b15cb3dSCy Schubert  * 3. The name of the author may not be used to endorse or promote products
142b15cb3dSCy Schubert  *    derived from this software without specific prior written permission.
152b15cb3dSCy Schubert  *
162b15cb3dSCy Schubert  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
172b15cb3dSCy Schubert  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
182b15cb3dSCy Schubert  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
192b15cb3dSCy Schubert  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
202b15cb3dSCy Schubert  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
212b15cb3dSCy Schubert  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
222b15cb3dSCy Schubert  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
232b15cb3dSCy Schubert  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
242b15cb3dSCy Schubert  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
252b15cb3dSCy Schubert  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262b15cb3dSCy Schubert  */
272b15cb3dSCy Schubert #ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
282b15cb3dSCy Schubert #define EVENT2_HTTP_COMPAT_H_INCLUDED_
292b15cb3dSCy Schubert 
302b15cb3dSCy Schubert /** @file event2/http_compat.h
312b15cb3dSCy Schubert 
322b15cb3dSCy Schubert   Potentially non-threadsafe versions of the functions in http.h: provided
332b15cb3dSCy Schubert   only for backwards compatibility.
342b15cb3dSCy Schubert 
352b15cb3dSCy Schubert  */
362b15cb3dSCy Schubert 
372b15cb3dSCy Schubert #ifdef __cplusplus
382b15cb3dSCy Schubert extern "C" {
392b15cb3dSCy Schubert #endif
402b15cb3dSCy Schubert 
412b15cb3dSCy Schubert #include <event2/event-config.h>
422b15cb3dSCy Schubert #ifdef EVENT__HAVE_SYS_TYPES_H
432b15cb3dSCy Schubert #include <sys/types.h>
442b15cb3dSCy Schubert #endif
452b15cb3dSCy Schubert #ifdef EVENT__HAVE_SYS_TIME_H
462b15cb3dSCy Schubert #include <sys/time.h>
472b15cb3dSCy Schubert #endif
482b15cb3dSCy Schubert 
492b15cb3dSCy Schubert /* For int types. */
502b15cb3dSCy Schubert #include <event2/util.h>
512b15cb3dSCy Schubert 
522b15cb3dSCy Schubert /**
532b15cb3dSCy Schubert  * Start an HTTP server on the specified address and port
542b15cb3dSCy Schubert  *
552b15cb3dSCy Schubert  * @deprecated It does not allow an event base to be specified
562b15cb3dSCy Schubert  *
572b15cb3dSCy Schubert  * @param address the address to which the HTTP server should be bound
582b15cb3dSCy Schubert  * @param port the port number on which the HTTP server should listen
59*a466cc55SCy Schubert  * @return a pointer to a newly initialized evhttp server structure
60*a466cc55SCy Schubert  *   or NULL on error
612b15cb3dSCy Schubert  */
62*a466cc55SCy Schubert EVENT2_EXPORT_SYMBOL
63*a466cc55SCy Schubert struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
642b15cb3dSCy Schubert 
652b15cb3dSCy Schubert /**
662b15cb3dSCy Schubert  * A connection object that can be used to for making HTTP requests.  The
672b15cb3dSCy Schubert  * connection object tries to establish the connection when it is given an
682b15cb3dSCy Schubert  * http request object.
692b15cb3dSCy Schubert  *
702b15cb3dSCy Schubert  * @deprecated It does not allow an event base to be specified
712b15cb3dSCy Schubert  */
72*a466cc55SCy Schubert EVENT2_EXPORT_SYMBOL
732b15cb3dSCy Schubert struct evhttp_connection *evhttp_connection_new(
74*a466cc55SCy Schubert 	const char *address, ev_uint16_t port);
752b15cb3dSCy Schubert 
762b15cb3dSCy Schubert /**
772b15cb3dSCy Schubert  * Associates an event base with the connection - can only be called
782b15cb3dSCy Schubert  * on a freshly created connection object that has not been used yet.
792b15cb3dSCy Schubert  *
802b15cb3dSCy Schubert  * @deprecated XXXX Why?
812b15cb3dSCy Schubert  */
82*a466cc55SCy Schubert EVENT2_EXPORT_SYMBOL
832b15cb3dSCy Schubert void evhttp_connection_set_base(struct evhttp_connection *evcon,
842b15cb3dSCy Schubert     struct event_base *base);
852b15cb3dSCy Schubert 
862b15cb3dSCy Schubert 
872b15cb3dSCy Schubert /** Returns the request URI */
882b15cb3dSCy Schubert #define evhttp_request_uri evhttp_request_get_uri
892b15cb3dSCy Schubert 
902b15cb3dSCy Schubert #ifdef __cplusplus
912b15cb3dSCy Schubert }
922b15cb3dSCy Schubert #endif
932b15cb3dSCy Schubert 
942b15cb3dSCy Schubert #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
95