ABI
Tracker

(Libevent)




Headers diff: 2.1.11 vs current



 buffer.h (2.1.11)   buffer.h (current) 
skipping to change at line 31 skipping to change at line 31
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_BUFFER_H_INCLUDED_ #ifndef EVENT2_BUFFER_H_INCLUDED_
#define EVENT2_BUFFER_H_INCLUDED_ #define EVENT2_BUFFER_H_INCLUDED_
/** @file event2/buffer.h /** @file event2/buffer.h
Functions for buffering data for network sending or receiving. @brief Functions for buffering data for network sending or receiving.
An evbuffer can be used for preparing data before sending it to An evbuffer can be used for preparing data before sending it to
the network or conversely for reading data from the network. the network or conversely for reading data from the network.
Evbuffers try to avoid memory copies as much as possible. As a Evbuffers try to avoid memory copies as much as possible. As a
result, evbuffers can be used to pass data around without actually result, evbuffers can be used to pass data around without actually
incurring the overhead of copying the data. incurring the overhead of copying the data.
A new evbuffer can be allocated with evbuffer_new(), and can be A new evbuffer can be allocated with evbuffer_new(), and can be
freed with evbuffer_free(). Most users will be using evbuffers via freed with evbuffer_free(). Most users will be using evbuffers via
the bufferevent interface. To access a bufferevent's evbuffers, use the bufferevent interface. To access a bufferevent's evbuffers, use
skipping to change at line 162 skipping to change at line 162
struct evbuffer *evbuffer_new(void); struct evbuffer *evbuffer_new(void);
/** /**
Deallocate storage for an evbuffer. Deallocate storage for an evbuffer.
@param buf pointer to the evbuffer to be freed @param buf pointer to the evbuffer to be freed
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evbuffer_free(struct evbuffer *buf); void evbuffer_free(struct evbuffer *buf);
/** /**
Set maximum read buffer size
Default is 4096 and it works fine most of time, so before increasing the
default check carefully, since this has some negative effects (like memor
y
fragmentation and unfair resource distribution, i.e. some events will mak
e
less progress than others).
@param buf pointer to the evbuffer
@param max buffer size
@return 0 on success, -1 on failure (if max > INT_MAX).
*/
EVENT2_EXPORT_SYMBOL
int evbuffer_set_max_read(struct evbuffer *buf, size_t max);
/**
Get maximum read buffer size
@param buf pointer to the evbuffer
@return current maximum buffer read
*/
EVENT2_EXPORT_SYMBOL
size_t evbuffer_get_max_read(struct evbuffer *buf);
/**
Enable locking on an evbuffer so that it can safely be used by multiple Enable locking on an evbuffer so that it can safely be used by multiple
threads at the same time. threads at the same time.
NOTE: when locking is enabled, the lock will be held when callbacks are NOTE: when locking is enabled, the lock will be held when callbacks are
invoked. This could result in deadlock if you aren't careful. Plan invoked. This could result in deadlock if you aren't careful. Plan
accordingly! accordingly!
@param buf An evbuffer to make lockable. @param buf An evbuffer to make lockable.
@param lock A lock object, or NULL if we should allocate our own. @param lock A lock object, or NULL if we should allocate our own.
@return 0 on success, -1 on failure. @return 0 on success, -1 on failure.
skipping to change at line 209 skipping to change at line 232
* information. * information.
* *
* This flag is on by default for bufferevents that can take advantage * This flag is on by default for bufferevents that can take advantage
* of it; you should never actually need to set it on a bufferevent's * of it; you should never actually need to set it on a bufferevent's
* output buffer. * output buffer.
*/ */
#define EVBUFFER_FLAG_DRAINS_TO_FD 1 #define EVBUFFER_FLAG_DRAINS_TO_FD 1
/** Change the flags that are set for an evbuffer by adding more. /** Change the flags that are set for an evbuffer by adding more.
* *
* @param buffer the evbuffer that the callback is watching. * @param buf the evbuffer that the callback is watching.
* @param cb the callback whose status we want to change.
* @param flags One or more EVBUFFER_FLAG_* options * @param flags One or more EVBUFFER_FLAG_* options
* @return 0 on success, -1 on failure. * @return 0 on success, -1 on failure.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags); int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags);
/** Change the flags that are set for an evbuffer by removing some. /** Change the flags that are set for an evbuffer by removing some.
* *
* @param buffer the evbuffer that the callback is watching. * @param buf the evbuffer that the callback is watching.
* @param cb the callback whose status we want to change.
* @param flags One or more EVBUFFER_FLAG_* options * @param flags One or more EVBUFFER_FLAG_* options
* @return 0 on success, -1 on failure. * @return 0 on success, -1 on failure.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags); int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags);
/** /**
Returns the total number of bytes stored in the evbuffer Returns the total number of bytes stored in the evbuffer
@param buf pointer to the evbuffer @param buf pointer to the evbuffer
skipping to change at line 725 skipping to change at line 746
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd, int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
ev_ssize_t howmuch); ev_ssize_t howmuch);
/** /**
Read from a file descriptor and store the result in an evbuffer. Read from a file descriptor and store the result in an evbuffer.
@param buffer the evbuffer to store the result @param buffer the evbuffer to store the result
@param fd the file descriptor to read from @param fd the file descriptor to read from
@param howmuch the number of bytes to be read @param howmuch the number of bytes to be read. If the given number is neg
ative
or out of maximum bytes per one read, as many bytes as we can will be rea
d.
@return the number of bytes read, or -1 if an error occurred @return the number of bytes read, or -1 if an error occurred
@see evbuffer_write() @see evbuffer_write()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch) ; int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch) ;
/** /**
Search for a string within an evbuffer. Search for a string within an evbuffer.
@param buffer the evbuffer to be searched @param buffer the evbuffer to be searched
 End of changes. 5 change blocks. 
6 lines changed or deleted 32 lines changed or added


 buffer_compat.h (2.1.11)   buffer_compat.h (current) 
skipping to change at line 34 skipping to change at line 34
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_BUFFER_COMPAT_H_INCLUDED_ #ifndef EVENT2_BUFFER_COMPAT_H_INCLUDED_
#define EVENT2_BUFFER_COMPAT_H_INCLUDED_ #define EVENT2_BUFFER_COMPAT_H_INCLUDED_
#include <event2/visibility.h> #include <event2/visibility.h>
/** @file event2/buffer_compat.h /** @file event2/buffer_compat.h
Obsolete and deprecated versions of the functions in buffer.h: provi ded @brief Obsolete and deprecated versions of the functions in buffer.h : provided
only for backward compatibility. only for backward compatibility.
*/ */
/** /**
Obsolete alias for evbuffer_readln(buffer, NULL, EVBUFFER_EOL_ANY). Obsolete alias for evbuffer_readln(buffer, NULL, EVBUFFER_EOL_ANY).
@deprecated This function is deprecated because its behavior is not corr ect @deprecated This function is deprecated because its behavior is not corr ect
for almost any protocol, and also because it's wholly subsumed by for almost any protocol, and also because it's wholly subsumed by
evbuffer_readln(). evbuffer_readln().
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 bufferevent.h (2.1.11)   bufferevent.h (current) 
skipping to change at line 33 skipping to change at line 33
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_BUFFEREVENT_H_INCLUDED_ #ifndef EVENT2_BUFFEREVENT_H_INCLUDED_
#define EVENT2_BUFFEREVENT_H_INCLUDED_ #define EVENT2_BUFFEREVENT_H_INCLUDED_
/** /**
@file event2/bufferevent.h @file event2/bufferevent.h
Functions for buffering data for network sending or receiving. Buffereve @brief Functions for buffering data for network sending or receiving.
nts
are higher level than evbuffers: each has an underlying evbuffer for read Bufferevents are higher level than evbuffers: each has an underlying evbu
ing ffer for reading
and one for writing, and callbacks that are invoked under certain and one for writing, and callbacks that are invoked under certain
circumstances. circumstances.
A bufferevent provides input and output buffers that get filled and A bufferevent provides input and output buffers that get filled and
drained automatically. The user of a bufferevent no longer deals drained automatically. The user of a bufferevent no longer deals
directly with the I/O, but instead is reading from input and writing directly with the I/O, but instead is reading from input and writing
to output buffers. to output buffers.
Once initialized, the bufferevent structure can be used repeatedly Once initialized, the bufferevent structure can be used repeatedly
with bufferevent_enable() and bufferevent_disable(). with bufferevent_enable() and bufferevent_disable().
skipping to change at line 212 skipping to change at line 213
and configure the bufferevent so that a BEV_EVENT_CONNECTED event will b e and configure the bufferevent so that a BEV_EVENT_CONNECTED event will b e
yielded when it is done connecting. yielded when it is done connecting.
@param bufev an existing bufferevent allocated with @param bufev an existing bufferevent allocated with
bufferevent_socket_new(). bufferevent_socket_new().
@param addr the address we should connect to @param addr the address we should connect to
@param socklen The length of the address @param socklen The length of the address
@return 0 on success, -1 on failure. @return 0 on success, -1 on failure.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int bufferevent_socket_connect(struct bufferevent *, const struct sockaddr *, int); int bufferevent_socket_connect(struct bufferevent *bufev, const struct sock addr *addr, int socklen);
struct evdns_base; struct evdns_base;
/** /**
Resolve the hostname 'hostname' and connect to it as with Resolve the hostname 'hostname' and connect to it as with
bufferevent_socket_connect(). bufferevent_socket_connect().
@param bufev An existing bufferevent allocated with bufferevent_socket_n ew() @param bufev An existing bufferevent allocated with bufferevent_socket_n ew()
@param evdns_base Optionally, an evdns_base to use for resolving hostnam es @param evdns_base Optionally, an evdns_base to use for resolving hostnam es
asynchronously. May be set to NULL for a blocking resolve. asynchronously. May be set to NULL for a blocking resolve.
@param family A preferred address family to resolve addresses to, or @param family A preferred address family to resolve addresses to, or
AF_UNSPEC for no preference. Only AF_INET, AF_INET6, and AF_UNSPEC a re AF_UNSPEC for no preference. Only AF_INET, AF_INET6, and AF_UNSPEC a re
supported. supported.
@param hostname The hostname to resolve; see below for notes on recogniz ed @param hostname The hostname to resolve; see below for notes on recogniz ed
formats formats
@param port The port to connect to on the resolved address. @param port The port to connect to on the resolved address.
@return 0 if successful, -1 on failure. @return 0 if successful, -1 on failure.
@see bufferevent_socket_connect_hostname_hints()
*/
EVENT2_EXPORT_SYMBOL
int bufferevent_socket_connect_hostname(struct bufferevent *bufev,
struct evdns_base *evdns_base, int family, const char *hostname, int po
rt);
/**
Resolve the hostname 'hostname' and connect to it as with
bufferevent_socket_connect().
@param bufev An existing bufferevent allocated with bufferevent_socket_n
ew()
@param evdns_base Optionally, an evdns_base to use for resolving hostnam
es
asynchronously. May be set to NULL for a blocking resolve.
@param hints_in points to an addrinfo structure that specifies criteria
for
selecting the socket address structures to be used
@param hostname The hostname to resolve; see below for notes on recogniz
ed
formats
@param port The port to connect to on the resolved address.
@return 0 if successful, -1 on failure.
Recognized hostname formats are: Recognized hostname formats are:
www.example.com (hostname) www.example.com (hostname)
1.2.3.4 (ipv4address) 1.2.3.4 (ipv4address)
::1 (ipv6address) ::1 (ipv6address)
[::1] ([ipv6address]) [::1] ([ipv6address])
Performance note: If you do not provide an evdns_base, this function Performance note: If you do not provide an evdns_base, this function
may block while it waits for a DNS response. This is probably no t may block while it waits for a DNS response. This is probably no t
what you want. what you want.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int bufferevent_socket_connect_hostname(struct bufferevent *, int bufferevent_socket_connect_hostname_hints(struct bufferevent *bufev,
struct evdns_base *, int, const char *, int); struct evdns_base *evdns_base, const struct evutil_addrinfo *hints_in,
const char *hostname, int port);
/** /**
Return the error code for the last failed DNS lookup attempt made by Return the error code for the last failed DNS lookup attempt made by
bufferevent_socket_connect_hostname(). bufferevent_socket_connect_hostname().
@param bev The bufferevent object. @param bev The bufferevent object.
@return DNS error code. @return DNS error code.
@see evutil_gai_strerror() @see evutil_gai_strerror()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
skipping to change at line 889 skipping to change at line 910
/** Remove 'bev' from its current rate-limit group (if any). */ /** Remove 'bev' from its current rate-limit group (if any). */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int bufferevent_remove_from_rate_limit_group(struct bufferevent *bev); int bufferevent_remove_from_rate_limit_group(struct bufferevent *bev);
/** /**
Set the size limit for single read operation. Set the size limit for single read operation.
Set to 0 for a reasonable default. Set to 0 for a reasonable default.
Return 0 on success and -1 on failure. Return 0 on success and -1 on failure.
@see evbuffer_set_max_read()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int bufferevent_set_max_single_read(struct bufferevent *bev, size_t size); int bufferevent_set_max_single_read(struct bufferevent *bev, size_t size);
/** /**
Set the size limit for single write operation. Set the size limit for single write operation.
Set to 0 for a reasonable default. Set to 0 for a reasonable default.
Return 0 on success and -1 on failure. Return 0 on success and -1 on failure.
 End of changes. 5 change blocks. 
7 lines changed or deleted 35 lines changed or added


 bufferevent_compat.h (2.1.11)   bufferevent_compat.h (current) 
skipping to change at line 31 skipping to change at line 31
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE , * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE ,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_ #ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
#define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_ #define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
/** @file event2/bufferevent_compat.h
*
* @brief Deprecated versions of the functions in bufferevent.h: provided
* only for backwards compatibility.
*/
#include <event2/visibility.h> #include <event2/visibility.h>
#define evbuffercb bufferevent_data_cb #define evbuffercb bufferevent_data_cb
#define everrorcb bufferevent_event_cb #define everrorcb bufferevent_event_cb
/** /**
Create a new bufferevent for an fd. Create a new bufferevent for an fd.
This function is deprecated. Use bufferevent_socket_new and This function is deprecated. Use bufferevent_socket_new and
bufferevent_set_callbacks instead. bufferevent_set_callbacks instead.
skipping to change at line 84 skipping to change at line 90
error occurred error occurred
@see bufferevent_base_set(), bufferevent_free() @see bufferevent_base_set(), bufferevent_free()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct bufferevent *bufferevent_new(evutil_socket_t fd, struct bufferevent *bufferevent_new(evutil_socket_t fd,
evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg); evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
/** /**
Set the read and write timeout for a buffered event. Set the read and write timeout for a buffered event.
@deprecated Use bufferevent_set_timeouts instead.
@param bufev the bufferevent to be modified @param bufev the bufferevent to be modified
@param timeout_read the read timeout @param timeout_read the read timeout
@param timeout_write the write timeout @param timeout_write the write timeout
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void bufferevent_settimeout(struct bufferevent *bufev, void bufferevent_settimeout(struct bufferevent *bufev,
int timeout_read, int timeout_write); int timeout_read, int timeout_write);
#define EVBUFFER_READ BEV_EVENT_READING #define EVBUFFER_READ BEV_EVENT_READING
#define EVBUFFER_WRITE BEV_EVENT_WRITING #define EVBUFFER_WRITE BEV_EVENT_WRITING
 End of changes. 2 change blocks. 
0 lines changed or deleted 8 lines changed or added


 bufferevent_ssl.h (2.1.11)   bufferevent_ssl.h (current) 
skipping to change at line 31 skipping to change at line 31
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ #ifndef EVENT2_BUFFEREVENT_SSL_H_INCLUDED_
#define EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ #define EVENT2_BUFFEREVENT_SSL_H_INCLUDED_
/** @file event2/bufferevent_ssl.h /** @file event2/bufferevent_ssl.h
OpenSSL support for bufferevents. @brief OpenSSL support for bufferevents.
*/ */
#include <event2/visibility.h> #include <event2/visibility.h>
#include <event2/event-config.h> #include <event2/event-config.h>
#include <event2/bufferevent.h> #include <event2/bufferevent.h>
#include <event2/util.h> #include <event2/util.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 bufferevent_struct.h (2.1.11)   bufferevent_struct.h (current) 
skipping to change at line 90 skipping to change at line 90
struct event ev_read; struct event ev_read;
/** A write event that triggers when a timeout has happened or a soc ket /** A write event that triggers when a timeout has happened or a soc ket
is ready to write data. Only used by some subtypes of is ready to write data. Only used by some subtypes of
bufferevent. */ bufferevent. */
struct event ev_write; struct event ev_write;
/** An input buffer. Only the bufferevent is allowed to add data to /** An input buffer. Only the bufferevent is allowed to add data to
this buffer, though the user is allowed to drain it. */ this buffer, though the user is allowed to drain it. */
struct evbuffer *input; struct evbuffer *input;
/** An input buffer. Only the bufferevent is allowed to drain data /** An output buffer. Only the bufferevent is allowed to drain data
from this buffer, though the user is allowed to add it. */ from this buffer, though the user is allowed to add it. */
struct evbuffer *output; struct evbuffer *output;
struct event_watermark wm_read; struct event_watermark wm_read;
struct event_watermark wm_write; struct event_watermark wm_write;
bufferevent_data_cb readcb; bufferevent_data_cb readcb;
bufferevent_data_cb writecb; bufferevent_data_cb writecb;
/* This should be called 'eventcb', but renaming it would break /* This should be called 'eventcb', but renaming it would break
* backward compatibility */ * backward compatibility */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 dns.h (2.1.11)   dns.h (current) 
skipping to change at line 52 skipping to change at line 52
* *
* You may wish to replace the word "Parts" with something else depending o n * You may wish to replace the word "Parts" with something else depending o n
* the amount of original code. * the amount of original code.
* *
* (Derivative works does not include programs which link against, run or i nclude * (Derivative works does not include programs which link against, run or i nclude
* the source verbatim in their source distributions) * the source verbatim in their source distributions)
*/ */
/** @file event2/dns.h /** @file event2/dns.h
* *
* @brief Provides a few APIs to use for resolving DNS names, and a facilit
y
* for implementing simple DNS servers.
*
* Welcome, gentle reader * Welcome, gentle reader
* *
* Async DNS lookups are really a whole lot harder than they should be, * Async DNS lookups are really a whole lot harder than they should be,
* mostly stemming from the fact that the libc resolver has never been * mostly stemming from the fact that the libc resolver has never been
* very good at them. Before you use this library you should see if libc * very good at them. Before you use this library you should see if libc
* can do the job for you with the modern async call getaddrinfo_a * can do the job for you with the modern async call getaddrinfo_a
* (see http://www.imperialviolet.org/page25.html#e498). Otherwise, * (see http://www.imperialviolet.org/page25.html#e498). Otherwise,
* please continue. * please continue.
* *
* The library keeps track of the state of nameservers and will avoid * The library keeps track of the state of nameservers and will avoid
* them when they go down. Otherwise it will round robin between them. * them when they go down. Otherwise it will round robin between them.
* *
* Quick start guide: * Quick start guide:
* @code
* #include "evdns.h" * #include "evdns.h"
* void callback(int result, char type, int count, int ttl, * void callback(int result, char type, int count, int ttl,
* void *addresses, void *arg); * void *addresses, void *arg);
* evdns_resolv_conf_parse(DNS_OPTIONS_ALL, "/etc/resolv.conf"); * evdns_resolv_conf_parse(DNS_OPTIONS_ALL, "/etc/resolv.conf");
* evdns_resolve("www.hostname.com", 0, callback, NULL); * evdns_resolve("www.hostname.com", 0, callback, NULL);
* *@endcode
* When the lookup is complete the callback function is called. The * When the lookup is complete the callback function is called. The
* first argument will be one of the DNS_ERR_* defines in evdns.h. * first argument will be one of the DNS_ERR_* defines in evdns.h.
* Hopefully it will be DNS_ERR_NONE, in which case type will be * Hopefully it will be DNS_ERR_NONE, in which case type will be
* DNS_IPv4_A, count will be the number of IP addresses, ttl is the time * DNS_IPv4_A, count will be the number of IP addresses, ttl is the time
* which the data can be cached for (in seconds), addresses will point * which the data can be cached for (in seconds), addresses will point
* to an array of uint32_t's and arg will be whatever you passed to * to an array of uint32_t's and arg will be whatever you passed to
* evdns_resolve. * evdns_resolve.
* *
* Searching: * Searching:
* *
skipping to change at line 109 skipping to change at line 113
* *
* The order of searches depends on the number of dots in the name. If the * The order of searches depends on the number of dots in the name. If the
* number is greater than the ndots setting then the names is first tried * number is greater than the ndots setting then the names is first tried
* globally. Otherwise each search domain is appended in turn. * globally. Otherwise each search domain is appended in turn.
* *
* The ndots setting can either be set from a resolv.conf, or by calling * The ndots setting can either be set from a resolv.conf, or by calling
* evdns_search_ndots_set. * evdns_search_ndots_set.
* *
* For example, with ndots set to 1 (the default) and a search domain list of * For example, with ndots set to 1 (the default) and a search domain list of
* ["myhome.net"]: * ["myhome.net"]:
*
* <pre>
* Query: www * Query: www
* Order: www.myhome.net, www. * Order: www.myhome.net, www.
* *
* Query: www.abc * Query: www.abc
* Order: www.abc., www.abc.myhome.net * Order: www.abc., www.abc.myhome.net
* * </pre>
* Internals: * Internals:
* *
* Requests are kept in two queues. The first is the inflight queue. In * Requests are kept in two queues. The first is the inflight queue. In
* this queue requests have an allocated transaction id and nameserver. * this queue requests have an allocated transaction id and nameserver.
* They will soon be transmitted if they haven't already been. * They will soon be transmitted if they haven't already been.
* *
* The second is the waiting queue. The size of the inflight ring is * The second is the waiting queue. The size of the inflight ring is
* limited and all other requests wait in waiting queue for space. This * limited and all other requests wait in waiting queue for space. This
* bounds the number of concurrent requests so that we don't flood the * bounds the number of concurrent requests so that we don't flood the
* nameserver. Several algorithms require a full walk of the inflight * nameserver. Several algorithms require a full walk of the inflight
skipping to change at line 180 skipping to change at line 186
#define DNS_ERR_CANCEL 69 #define DNS_ERR_CANCEL 69
/** There were no answers and no error condition in the DNS packet. /** There were no answers and no error condition in the DNS packet.
* This can happen when you ask for an address that exists, but a record * This can happen when you ask for an address that exists, but a record
* type that doesn't. */ * type that doesn't. */
#define DNS_ERR_NODATA 70 #define DNS_ERR_NODATA 70
#define DNS_IPv4_A 1 #define DNS_IPv4_A 1
#define DNS_PTR 2 #define DNS_PTR 2
#define DNS_IPv6_AAAA 3 #define DNS_IPv6_AAAA 3
#define DNS_QUERY_NO_SEARCH 1 /** Disable searching for the query. */
#define DNS_QUERY_NO_SEARCH 0x01
/** Use TCP connections ("virtual circuits") for queries rather than UDP da
tagrams. */
#define DNS_QUERY_USEVC 0x02
/** Ignore trancation flag in responses (don't fallback to TCP connections)
. */
#define DNS_QUERY_IGNTC 0x04
/* Allow searching */ /* Allow searching */
#define DNS_OPTION_SEARCH 1 #define DNS_OPTION_SEARCH 1
/* Parse "nameserver" and add default if no such section */ /* Parse "nameserver" and add default if no such section */
#define DNS_OPTION_NAMESERVERS 2 #define DNS_OPTION_NAMESERVERS 2
/* Parse additional options like: /* Parse additional options like:
* - timeout: * - timeout:
* - getaddrinfo-allow-skew: * - getaddrinfo-allow-skew:
* - max-timeouts: * - max-timeouts:
* - max-inflight: * - max-inflight:
* - attempts: * - attempts:
* - randomize-case: * - randomize-case:
* - initial-probe-timeout: * - initial-probe-timeout:
* - tcp-idle-timeout:
* - edns-udp-size:
* - use-vc
* - ignore-tc
*/ */
#define DNS_OPTION_MISC 4 #define DNS_OPTION_MISC 4
/* Load hosts file (i.e. "/etc/hosts") */ /* Load hosts file (i.e. "/etc/hosts") */
#define DNS_OPTION_HOSTSFILE 8 #define DNS_OPTION_HOSTSFILE 8
/** /**
* All above: * All above:
* - DNS_OPTION_SEARCH * - DNS_OPTION_SEARCH
* - DNS_OPTION_NAMESERVERS * - DNS_OPTION_NAMESERVERS
* - DNS_OPTION_MISC * - DNS_OPTION_MISC
* - DNS_OPTION_HOSTSFILE * - DNS_OPTION_HOSTSFILE
skipping to change at line 252 skipping to change at line 267
#define EVDNS_BASE_NAMESERVERS_NO_DEFAULT 0x10000 #define EVDNS_BASE_NAMESERVERS_NO_DEFAULT 0x10000
/** /**
Initialize the asynchronous DNS library. Initialize the asynchronous DNS library.
This function initializes support for non-blocking name resolution by This function initializes support for non-blocking name resolution by
calling evdns_resolv_conf_parse() on UNIX and calling evdns_resolv_conf_parse() on UNIX and
evdns_config_windows_nameservers() on Windows. evdns_config_windows_nameservers() on Windows.
@param event_base the event base to associate the dns client with @param event_base the event base to associate the dns client with
@param flags any of EVDNS_BASE_INITIALIZE_NAMESERVERS| @param initialize_nameservers any of EVDNS_BASE_INITIALIZE_NAMESERVERS|
EVDNS_BASE_DISABLE_WHEN_INACTIVE|EVDNS_BASE_NAMESERVERS_NO_DEFAULT EVDNS_BASE_DISABLE_WHEN_INACTIVE|EVDNS_BASE_NAMESERVERS_NO_DEFAULT
@return evdns_base object if successful, or NULL if an error occurred. @return evdns_base object if successful, or NULL if an error occurred.
@see evdns_base_free() @see evdns_base_free()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evdns_base * evdns_base_new(struct event_base *event_base, int initi alize_nameservers); struct evdns_base * evdns_base_new(struct event_base *event_base, int initi alize_nameservers);
/** /**
Shut down the asynchronous DNS resolver and terminate all active requests . Shut down the asynchronous DNS resolver and terminate all active requests .
If the 'fail_requests' option is enabled, all active requests will return If the 'fail_requests' option is enabled, all active requests will return
an empty result with the error flag set to DNS_ERR_SHUTDOWN. Otherwise, an empty result with the error flag set to DNS_ERR_SHUTDOWN. Otherwise,
the requests will be silently discarded. the requests will be silently discarded.
@param evdns_base the evdns base to free @param base the evdns base to free
@param fail_requests if zero, active requests will be aborted; if non-zer o, @param fail_requests if zero, active requests will be aborted; if non-zer o,
active requests will return DNS_ERR_SHUTDOWN. active requests will return DNS_ERR_SHUTDOWN.
@see evdns_base_new() @see evdns_base_new()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evdns_base_free(struct evdns_base *base, int fail_requests); void evdns_base_free(struct evdns_base *base, int fail_requests);
/** /**
Remove all hosts entries that have been loaded into the event_base via Remove all hosts entries that have been loaded into the event_base via
evdns_base_load_hosts or via event_base_resolv_conf_parse. evdns_base_load_hosts or via event_base_resolv_conf_parse.
@param evdns_base the evdns base to remove outdated host addresses from @param base the evdns base to remove outdated host addresses from
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evdns_base_clear_host_addresses(struct evdns_base *base); void evdns_base_clear_host_addresses(struct evdns_base *base);
/** /**
Convert a DNS error code to a string. Convert a DNS error code to a string.
@param err the DNS error code @param err the DNS error code
@return a string containing an explanation of the error code @return a string containing an explanation of the error code
*/ */
skipping to change at line 384 skipping to change at line 399
evdns_base_nameserver_sockaddr_add(struct evdns_base *base, evdns_base_nameserver_sockaddr_add(struct evdns_base *base,
const struct sockaddr *sa, ev_socklen_t len, unsigned flags); const struct sockaddr *sa, ev_socklen_t len, unsigned flags);
struct evdns_request; struct evdns_request;
/** /**
Lookup an A record for a given name. Lookup an A record for a given name.
@param base the evdns_base to which to apply this operation @param base the evdns_base to which to apply this operation
@param name a DNS hostname @param name a DNS hostname
@param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for th is query. @param flags either 0, or combination of DNS_QUERY_* flags.
@param callback a callback function to invoke when the request is complet ed @param callback a callback function to invoke when the request is complet ed
@param ptr an argument to pass to the callback function @param ptr an argument to pass to the callback function
@return an evdns_request object if successful, or NULL if an error occurr ed. @return an evdns_request object if successful, or NULL if an error occurr ed.
@see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse _ipv6(), evdns_cancel_request() @see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse _ipv6(), evdns_cancel_request()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evdns_request *evdns_base_resolve_ipv4(struct evdns_base *base, cons t char *name, int flags, evdns_callback_type callback, void *ptr); struct evdns_request *evdns_base_resolve_ipv4(struct evdns_base *base, cons t char *name, int flags, evdns_callback_type callback, void *ptr);
/** /**
Lookup an AAAA record for a given name. Lookup an AAAA record for a given name.
@param base the evdns_base to which to apply this operation @param base the evdns_base to which to apply this operation
@param name a DNS hostname @param name a DNS hostname
@param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for th is query. @param flags either 0, or combination of DNS_QUERY_* flags.
@param callback a callback function to invoke when the request is complet ed @param callback a callback function to invoke when the request is complet ed
@param ptr an argument to pass to the callback function @param ptr an argument to pass to the callback function
@return an evdns_request object if successful, or NULL if an error occurr ed. @return an evdns_request object if successful, or NULL if an error occurr ed.
@see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse _ipv6(), evdns_cancel_request() @see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse _ipv6(), evdns_cancel_request()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evdns_request *evdns_base_resolve_ipv6(struct evdns_base *base, cons t char *name, int flags, evdns_callback_type callback, void *ptr); struct evdns_request *evdns_base_resolve_ipv6(struct evdns_base *base, cons t char *name, int flags, evdns_callback_type callback, void *ptr);
struct in_addr; struct in_addr;
struct in6_addr; struct in6_addr;
/** /**
Lookup a PTR record for a given IP address. Lookup a PTR record for a given IP address.
@param base the evdns_base to which to apply this operation @param base the evdns_base to which to apply this operation
@param in an IPv4 address @param in an IPv4 address
@param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for th is query. @param flags either 0, or combination of DNS_QUERY_* flags.
@param callback a callback function to invoke when the request is complet ed @param callback a callback function to invoke when the request is complet ed
@param ptr an argument to pass to the callback function @param ptr an argument to pass to the callback function
@return an evdns_request object if successful, or NULL if an error occurr ed. @return an evdns_request object if successful, or NULL if an error occurr ed.
@see evdns_resolve_reverse_ipv6(), evdns_cancel_request() @see evdns_resolve_reverse_ipv6(), evdns_cancel_request()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evdns_request *evdns_base_resolve_reverse(struct evdns_base *base, c onst struct in_addr *in, int flags, evdns_callback_type callback, void *ptr ); struct evdns_request *evdns_base_resolve_reverse(struct evdns_base *base, c onst struct in_addr *in, int flags, evdns_callback_type callback, void *ptr );
/** /**
Lookup a PTR record for a given IPv6 address. Lookup a PTR record for a given IPv6 address.
@param base the evdns_base to which to apply this operation @param base the evdns_base to which to apply this operation
@param in an IPv6 address @param in an IPv6 address
@param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for th is query. @param flags either 0, or combination of DNS_QUERY_* flags.
@param callback a callback function to invoke when the request is complet ed @param callback a callback function to invoke when the request is complet ed
@param ptr an argument to pass to the callback function @param ptr an argument to pass to the callback function
@return an evdns_request object if successful, or NULL if an error occurr ed. @return an evdns_request object if successful, or NULL if an error occurr ed.
@see evdns_resolve_reverse_ipv6(), evdns_cancel_request() @see evdns_resolve_reverse_ipv6(), evdns_cancel_request()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evdns_request *evdns_base_resolve_reverse_ipv6(struct evdns_base *ba se, const struct in6_addr *in, int flags, evdns_callback_type callback, voi d *ptr); struct evdns_request *evdns_base_resolve_reverse_ipv6(struct evdns_base *ba se, const struct in6_addr *in, int flags, evdns_callback_type callback, voi d *ptr);
/** /**
Cancels a pending DNS resolution request. Cancels a pending DNS resolution request.
skipping to change at line 455 skipping to change at line 470
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evdns_cancel_request(struct evdns_base *base, struct evdns_request *re q); void evdns_cancel_request(struct evdns_base *base, struct evdns_request *re q);
/** /**
Set the value of a configuration option. Set the value of a configuration option.
The currently available configuration options are: The currently available configuration options are:
ndots, timeout, max-timeouts, max-inflight, attempts, randomize-case, ndots, timeout, max-timeouts, max-inflight, attempts, randomize-case,
bind-to, initial-probe-timeout, getaddrinfo-allow-skew, bind-to, initial-probe-timeout, getaddrinfo-allow-skew,
so-rcvbuf, so-sndbuf. so-rcvbuf, so-sndbuf, tcp-idle-timeout, use-vc, ignore-tc,
edns-udp-size.
In versions before Libevent 2.0.3-alpha, the option name needed to end wi th In versions before Libevent 2.0.3-alpha, the option name needed to end wi th
a colon. a colon.
In case of options without values (use-vc, ingore-tc) val should be an em
pty
string or NULL.
@param base the evdns_base to which to apply this operation @param base the evdns_base to which to apply this operation
@param option the name of the configuration option to be modified @param option the name of the configuration option to be modified
@param val the value to be set @param val the value to be set
@return 0 if successful, or -1 if an error occurred @return 0 if successful, or -1 if an error occurred
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evdns_base_set_option(struct evdns_base *base, const char *option, cons t char *val); int evdns_base_set_option(struct evdns_base *base, const char *option, cons t char *val);
/** /**
Parse a resolv.conf file. Parse a resolv.conf file.
skipping to change at line 634 skipping to change at line 653
#define EVDNS_QTYPE_AXFR 252 #define EVDNS_QTYPE_AXFR 252
#define EVDNS_QTYPE_ALL 255 #define EVDNS_QTYPE_ALL 255
#define EVDNS_CLASS_INET 1 #define EVDNS_CLASS_INET 1
/* flags that can be set in answers; as part of the err parameter */ /* flags that can be set in answers; as part of the err parameter */
#define EVDNS_FLAGS_AA 0x400 #define EVDNS_FLAGS_AA 0x400
#define EVDNS_FLAGS_RD 0x080 #define EVDNS_FLAGS_RD 0x080
/** Create a new DNS server port. /** Create a new UDP DNS server port.
@param base The event base to handle events for the server port. @param base The event base to handle events for the server port.
@param socket A UDP socket to accept DNS requests. @param socket A UDP socket to accept DNS requests.
@param flags Always 0 for now. @param flags Always 0 for now.
@param callback A function to invoke whenever we get a DNS request @param callback A function to invoke whenever we get a DNS request
on the socket. on the socket.
@param user_data Data to pass to the callback. @param user_data Data to pass to the callback.
@return an evdns_server_port structure for this server port or NULL if @return an evdns_server_port structure for this server port or NULL if
an error occurred. an error occurred.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evdns_server_port *evdns_add_server_port_with_base(struct event_base *base, evutil_socket_t socket, int flags, evdns_request_callback_fn_type c allback, void *user_data); struct evdns_server_port *evdns_add_server_port_with_base(struct event_base *base, evutil_socket_t socket, int flags, evdns_request_callback_fn_type c allback, void *user_data);
struct evconnlistener;
/** Create a new TCP DNS server port.
@param base The event base to handle events for the server port.
@param listener A TCP listener to accept DNS requests.
@param flags Always 0 for now.
@param callback A function to invoke whenever we get a DNS request
on the socket.
@param user_data Data to pass to the callback.
@return an evdns_server_port structure for this server port or NULL if
an error occurred.
*/
EVENT2_EXPORT_SYMBOL
struct evdns_server_port *evdns_add_server_port_with_listener(
struct event_base *base, struct evconnlistener *listener, int flags,
evdns_request_callback_fn_type callback, void *user_data);
/** Close down a DNS server port, and free associated structures. */ /** Close down a DNS server port, and free associated structures. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evdns_close_server_port(struct evdns_server_port *port); void evdns_close_server_port(struct evdns_server_port *port);
/**
* List of configurable evdns_server_port options.
*
* @see evdns_server_port_set_option()
*/
enum evdns_server_option {
/**
* Maximum number of simultaneous tcp connections (clients)
* that server can hold. Can be set only for TCP DNS servers.
*/
EVDNS_SOPT_TCP_MAX_CLIENTS,
/**
* Idle timeout (in seconds) of incoming TCP connections.
* If client doesn't send any requests via the connection
* during this period connection is closed by the server.
* Can be set only for TCP DNS servers.
*/
EVDNS_SOPT_TCP_IDLE_TIMEOUT,
};
/**
Configure DNS server.
@param port the evdns_server_port to which to apply this operation
@param option @see evdns_server_option for the list of possible options
@param val value of the option
@return 0 if successful, or -1 if an error occurred
*/
EVENT2_EXPORT_SYMBOL
int evdns_server_port_set_option(struct evdns_server_port *port, enum evdns
_server_option option, size_t value);
/** Sets some flags in a reply we're building. /** Sets some flags in a reply we're building.
Allows setting of the AA or RD flags Allows setting of the AA or RD flags
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evdns_server_request_set_flags(struct evdns_server_request *req, int f lags); void evdns_server_request_set_flags(struct evdns_server_request *req, int f lags);
/* Functions to add an answer to an in-progress DNS reply. /* Functions to add an answer to an in-progress DNS reply.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evdns_server_request_add_reply(struct evdns_server_request *req, int se ction, const char *name, int type, int dns_class, int ttl, int datalen, int is_name, const char *data); int evdns_server_request_add_reply(struct evdns_server_request *req, int se ction, const char *name, int type, int dns_class, int ttl, int datalen, int is_name, const char *data);
 End of changes. 19 change blocks. 
12 lines changed or deleted 86 lines changed or added


 dns_compat.h (2.1.11)   dns_compat.h (current) 
skipping to change at line 32 skipping to change at line 32
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_DNS_COMPAT_H_INCLUDED_ #ifndef EVENT2_DNS_COMPAT_H_INCLUDED_
#define EVENT2_DNS_COMPAT_H_INCLUDED_ #define EVENT2_DNS_COMPAT_H_INCLUDED_
/** @file event2/dns_compat.h /** @file event2/dns_compat.h
Potentially non-threadsafe versions of the functions in dns.h: provided @brief Potentially non-threadsafe versions of the functions in dns.h: pro vided
only for backwards compatibility. only for backwards compatibility.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <event2/event-config.h> #include <event2/event-config.h>
#ifdef EVENT__HAVE_SYS_TYPES_H #ifdef EVENT__HAVE_SYS_TYPES_H
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 event-config.h (2.1.11)   event-config.h (current) 
skipping to change at line 29 skipping to change at line 29
/* Define if libevent should not allow replacing the mm functions */ /* Define if libevent should not allow replacing the mm functions */
/* #undef EVENT__DISABLE_MM_REPLACEMENT */ /* #undef EVENT__DISABLE_MM_REPLACEMENT */
/* Define if libevent should not be compiled with thread support */ /* Define if libevent should not be compiled with thread support */
/* #undef EVENT__DISABLE_THREAD_SUPPORT */ /* #undef EVENT__DISABLE_THREAD_SUPPORT */
/* Define to 1 if you have the `accept4' function. */ /* Define to 1 if you have the `accept4' function. */
#define EVENT__HAVE_ACCEPT4 1 #define EVENT__HAVE_ACCEPT4 1
/* Define to 1 if you have the <afunix.h> header file. */
/* #undef EVENT__HAVE_AFUNIX_H */
/* Define to 1 if you have the `arc4random' function. */ /* Define to 1 if you have the `arc4random' function. */
/* #undef EVENT__HAVE_ARC4RANDOM */ /* #undef EVENT__HAVE_ARC4RANDOM */
/* Define to 1 if you have the `arc4random_addrandom' function. */ /* Define to 1 if you have the `arc4random_addrandom' function. */
/* #undef EVENT__HAVE_ARC4RANDOM_ADDRANDOM */ /* #undef EVENT__HAVE_ARC4RANDOM_ADDRANDOM */
/* Define to 1 if you have the `arc4random_buf' function. */ /* Define to 1 if you have the `arc4random_buf' function. */
/* #undef EVENT__HAVE_ARC4RANDOM_BUF */ /* #undef EVENT__HAVE_ARC4RANDOM_BUF */
/* Define to 1 if you have the <arpa/inet.h> header file. */ /* Define to 1 if you have the <arpa/inet.h> header file. */
#define EVENT__HAVE_ARPA_INET_H 1 #define EVENT__HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `clock_gettime' function. */ /* Define to 1 if you have the `clock_gettime' function. */
#define EVENT__HAVE_CLOCK_GETTIME 1 #define EVENT__HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you /* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
don't. */ don't. */
#define EVENT__HAVE_DECL_CTL_KERN 1 /* #undef EVENT__HAVE_DECL_CTL_KERN */
/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you /* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you
don't. */ don't. */
#define EVENT__HAVE_DECL_KERN_ARND 0 /* #undef EVENT__HAVE_DECL_KERN_ARND */
/* Define to 1 if you have the declaration of `KERN_RANDOM', and to 0 if yo
u
don't. */
#define EVENT__HAVE_DECL_KERN_RANDOM 1
/* Define to 1 if you have the declaration of `RANDOM_UUID', and to 0 if yo
u
don't. */
#define EVENT__HAVE_DECL_RANDOM_UUID 1
/* Define if /dev/poll is available */ /* Define if /dev/poll is available */
/* #undef EVENT__HAVE_DEVPOLL */ /* #undef EVENT__HAVE_DEVPOLL */
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#define EVENT__HAVE_DLFCN_H 1 #define EVENT__HAVE_DLFCN_H 1
/* Define if your system supports the epoll system calls */ /* Define if your system supports the epoll system calls */
#define EVENT__HAVE_EPOLL 1 #define EVENT__HAVE_EPOLL 1
skipping to change at line 123 skipping to change at line 118
/* Define to 1 if you have the `getifaddrs' function. */ /* Define to 1 if you have the `getifaddrs' function. */
#define EVENT__HAVE_GETIFADDRS 1 #define EVENT__HAVE_GETIFADDRS 1
/* Define to 1 if you have the `getnameinfo' function. */ /* Define to 1 if you have the `getnameinfo' function. */
#define EVENT__HAVE_GETNAMEINFO 1 #define EVENT__HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getprotobynumber' function. */ /* Define to 1 if you have the `getprotobynumber' function. */
#define EVENT__HAVE_GETPROTOBYNUMBER 1 #define EVENT__HAVE_GETPROTOBYNUMBER 1
/* Define to 1 if you have the `getrandom' function. */
#define EVENT__HAVE_GETRANDOM 1
/* Define to 1 if you have the `getservbyname' function. */ /* Define to 1 if you have the `getservbyname' function. */
#define EVENT__HAVE_GETSERVBYNAME 1 #define EVENT__HAVE_GETSERVBYNAME 1
/* Define to 1 if you have the `gettimeofday' function. */ /* Define to 1 if you have the `gettimeofday' function. */
#define EVENT__HAVE_GETTIMEOFDAY 1 #define EVENT__HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <ifaddrs.h> header file. */ /* Define to 1 if you have the <ifaddrs.h> header file. */
#define EVENT__HAVE_IFADDRS_H 1 #define EVENT__HAVE_IFADDRS_H 1
/* Define to 1 if you have the `inet_ntop' function. */ /* Define to 1 if you have the `inet_ntop' function. */
skipping to change at line 147 skipping to change at line 145
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#define EVENT__HAVE_INTTYPES_H 1 #define EVENT__HAVE_INTTYPES_H 1
/* Define to 1 if you have the `issetugid' function. */ /* Define to 1 if you have the `issetugid' function. */
/* #undef EVENT__HAVE_ISSETUGID */ /* #undef EVENT__HAVE_ISSETUGID */
/* Define to 1 if you have the `kqueue' function. */ /* Define to 1 if you have the `kqueue' function. */
/* #undef EVENT__HAVE_KQUEUE */ /* #undef EVENT__HAVE_KQUEUE */
/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
/* #undef EVENT__HAVE_LIBWS2_32 */
/* Define if the system has zlib */ /* Define if the system has zlib */
#define EVENT__HAVE_LIBZ 1 #define EVENT__HAVE_LIBZ 1
/* Define to 1 if you have the `mach_absolute_time' function. */ /* Define to 1 if you have the `mach_absolute_time' function. */
/* #undef EVENT__HAVE_MACH_ABSOLUTE_TIME */ /* #undef EVENT__HAVE_MACH_ABSOLUTE_TIME */
/* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef EVENT__HAVE_MACH_MACH_H */
/* Define to 1 if you have the <mach/mach_time.h> header file. */ /* Define to 1 if you have the <mach/mach_time.h> header file. */
/* #undef EVENT__HAVE_MACH_MACH_TIME_H */ /* #undef EVENT__HAVE_MACH_MACH_TIME_H */
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#define EVENT__HAVE_MEMORY_H 1 #define EVENT__HAVE_MEMORY_H 1
/* Define to 1 if you have the `mmap' function. */ /* Define to 1 if you have the `mmap' function. */
#define EVENT__HAVE_MMAP 1 #define EVENT__HAVE_MMAP 1
/* Define to 1 if you have the `nanosleep' function. */ /* Define to 1 if you have the `nanosleep' function. */
skipping to change at line 261 skipping to change at line 265
/* Define to 1 if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#define EVENT__HAVE_STRING_H 1 #define EVENT__HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */ /* Define to 1 if you have the `strlcpy' function. */
/* #undef EVENT__HAVE_STRLCPY */ /* #undef EVENT__HAVE_STRLCPY */
/* Define to 1 if you have the `strsep' function. */ /* Define to 1 if you have the `strsep' function. */
#define EVENT__HAVE_STRSEP 1 #define EVENT__HAVE_STRSEP 1
/* Define to 1 if you have the `strsignal' function. */
#define EVENT__HAVE_STRSIGNAL 1
/* Define to 1 if you have the `strtok_r' function. */ /* Define to 1 if you have the `strtok_r' function. */
#define EVENT__HAVE_STRTOK_R 1 #define EVENT__HAVE_STRTOK_R 1
/* Define to 1 if you have the `strtoll' function. */ /* Define to 1 if you have the `strtoll' function. */
#define EVENT__HAVE_STRTOLL 1 #define EVENT__HAVE_STRTOLL 1
/* Define to 1 if the system has the type `struct addrinfo'. */ /* Define to 1 if the system has the type `struct addrinfo'. */
#define EVENT__HAVE_STRUCT_ADDRINFO 1 #define EVENT__HAVE_STRUCT_ADDRINFO 1
/* Define to 1 if the system has the type `struct in6_addr'. */ /* Define to 1 if the system has the type `struct in6_addr'. */
skipping to change at line 330 skipping to change at line 337
/* Define to 1 if you have the <sys/mman.h> header file. */ /* Define to 1 if you have the <sys/mman.h> header file. */
#define EVENT__HAVE_SYS_MMAN_H 1 #define EVENT__HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */ /* Define to 1 if you have the <sys/param.h> header file. */
#define EVENT__HAVE_SYS_PARAM_H 1 #define EVENT__HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/queue.h> header file. */ /* Define to 1 if you have the <sys/queue.h> header file. */
#define EVENT__HAVE_SYS_QUEUE_H 1 #define EVENT__HAVE_SYS_QUEUE_H 1
/* Define to 1 if you have the <sys/random.h> header file. */
#define EVENT__HAVE_SYS_RANDOM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */ /* Define to 1 if you have the <sys/resource.h> header file. */
#define EVENT__HAVE_SYS_RESOURCE_H 1 #define EVENT__HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */ /* Define to 1 if you have the <sys/select.h> header file. */
#define EVENT__HAVE_SYS_SELECT_H 1 #define EVENT__HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sendfile.h> header file. */ /* Define to 1 if you have the <sys/sendfile.h> header file. */
#define EVENT__HAVE_SYS_SENDFILE_H 1 #define EVENT__HAVE_SYS_SENDFILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */ /* Define to 1 if you have the <sys/socket.h> header file. */
#define EVENT__HAVE_SYS_SOCKET_H 1 #define EVENT__HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the <sys/stat.h> header file. */
#define EVENT__HAVE_SYS_STAT_H 1 #define EVENT__HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */ /* Define to 1 if you have the <sys/sysctl.h> header file. */
#define EVENT__HAVE_SYS_SYSCTL_H 1 /* #undef EVENT__HAVE_SYS_SYSCTL_H */
/* Define to 1 if you have the <sys/timerfd.h> header file. */ /* Define to 1 if you have the <sys/timerfd.h> header file. */
#define EVENT__HAVE_SYS_TIMERFD_H 1 #define EVENT__HAVE_SYS_TIMERFD_H 1
/* Define to 1 if you have the <sys/time.h> header file. */ /* Define to 1 if you have the <sys/time.h> header file. */
#define EVENT__HAVE_SYS_TIME_H 1 #define EVENT__HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */ /* Define to 1 if you have the <sys/types.h> header file. */
#define EVENT__HAVE_SYS_TYPES_H 1 #define EVENT__HAVE_SYS_TYPES_H 1
skipping to change at line 414 skipping to change at line 424
/* Define to 1 if you have the `unsetenv' function. */ /* Define to 1 if you have the `unsetenv' function. */
#define EVENT__HAVE_UNSETENV 1 #define EVENT__HAVE_UNSETENV 1
/* Define to 1 if you have the `usleep' function. */ /* Define to 1 if you have the `usleep' function. */
#define EVENT__HAVE_USLEEP 1 #define EVENT__HAVE_USLEEP 1
/* Define to 1 if you have the `vasprintf' function. */ /* Define to 1 if you have the `vasprintf' function. */
#define EVENT__HAVE_VASPRINTF 1 #define EVENT__HAVE_VASPRINTF 1
/* Define if your system supports the wepoll module */
/* #undef EVENT__HAVE_WEPOLL */
/* Define if kqueue works correctly with pipes */ /* Define if kqueue works correctly with pipes */
/* #undef EVENT__HAVE_WORKING_KQUEUE */ /* #undef EVENT__HAVE_WORKING_KQUEUE */
/* Define to 1 if you have the <zlib.h> header file. */ /* Define to 1 if you have the <zlib.h> header file. */
#define EVENT__HAVE_ZLIB_H 1 #define EVENT__HAVE_ZLIB_H 1
/* Define to 1 if you have the `_gmtime64' function. */
/* #undef EVENT__HAVE__GMTIME64 */
/* Define to 1 if you have the `_gmtime64_s' function. */
/* #undef EVENT__HAVE__GMTIME64_S */
/* Define to 1 if compiler have __FUNCTION__ */ /* Define to 1 if compiler have __FUNCTION__ */
#define EVENT__HAVE___FUNCTION__ 1 #define EVENT__HAVE___FUNCTION__ 1
/* Define to 1 if compiler have __func__ */ /* Define to 1 if compiler have __func__ */
#define EVENT__HAVE___func__ 1 #define EVENT__HAVE___func__ 1
/* Define to the sub-directory where libtool stores uninstalled libraries. */ /* Define to the sub-directory where libtool stores uninstalled libraries. */
#define EVENT__LT_OBJDIR ".libs/" #define EVENT__LT_OBJDIR ".libs/"
/* Numeric representation of the version */ /* Numeric representation of the version */
#define EVENT__NUMERIC_VERSION 0x02010b00 #define EVENT__NUMERIC_VERSION 0x02020001
/* Name of package */ /* Name of package */
#define EVENT__PACKAGE "libevent" #define EVENT__PACKAGE "libevent"
/* Define to the address where bug reports for this package should be sent. */ /* Define to the address where bug reports for this package should be sent. */
#define EVENT__PACKAGE_BUGREPORT "" #define EVENT__PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */ /* Define to the full name of this package. */
#define EVENT__PACKAGE_NAME "libevent" #define EVENT__PACKAGE_NAME "libevent"
/* Define to the full name and version of this package. */ /* Define to the full name and version of this package. */
#define EVENT__PACKAGE_STRING "libevent 2.1.11-stable" #define EVENT__PACKAGE_STRING "libevent 2.2.0-alpha-dev"
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#define EVENT__PACKAGE_TARNAME "libevent" #define EVENT__PACKAGE_TARNAME "libevent"
/* Define to the home page for this package. */ /* Define to the home page for this package. */
#define EVENT__PACKAGE_URL "" #define EVENT__PACKAGE_URL ""
/* Define to the version of this package. */ /* Define to the version of this package. */
#define EVENT__PACKAGE_VERSION "2.1.11-stable" #define EVENT__PACKAGE_VERSION "2.2.0-alpha-dev"
/* Define to necessary symbol if this constant uses a non-standard name on /* Define to necessary symbol if this constant uses a non-standard name on
your system. */ your system. */
/* #undef EVENT__PTHREAD_CREATE_JOINABLE */ /* #undef EVENT__PTHREAD_CREATE_JOINABLE */
/* The size of `int', as computed by sizeof. */ /* The size of `int', as computed by sizeof. */
#define EVENT__SIZEOF_INT 4 #define EVENT__SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */ /* The size of `long', as computed by sizeof. */
#define EVENT__SIZEOF_LONG 8 #define EVENT__SIZEOF_LONG 8
skipping to change at line 512 skipping to change at line 531
/* Enable extensions on HP NonStop. */ /* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE #ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1 # define _TANDEM_SOURCE 1
#endif #endif
/* Enable general extensions on Solaris. */ /* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__ #ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1 # define __EXTENSIONS__ 1
#endif #endif
/* Version number of package */ /* Version number of package */
#define EVENT__VERSION "2.1.11-stable" #define EVENT__VERSION "2.2.0-alpha-dev"
/* Enable large inode numbers on Mac OS X 10.5. */ /* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE #ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1 # define _DARWIN_USE_64_BIT_INODE 1
#endif #endif
/* Number of bits in a file offset, on hosts where this is settable. */ /* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */ /* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */ /* Define for large files, on AIX-style hosts. */
 End of changes. 15 change blocks. 
17 lines changed or deleted 34 lines changed or added


 event.h (2.1.11)   event.h (current) 
skipping to change at line 177 skipping to change at line 177
event2/dns.h event2/dns.h
Asynchronous DNS resolution Asynchronous DNS resolution
event2/http.h event2/http.h
An embedded libevent-based HTTP server An embedded libevent-based HTTP server
event2/rpc.h event2/rpc.h
A framework for creating RPC servers and clients A framework for creating RPC servers and clients
event2/watch.h
"Prepare" and "check" watchers.
*/ */
/** @file event2/event.h /** @file event2/event.h
Core functions for waiting for and receiving events, and using event base s. @brief Core functions for waiting for and receiving events, and using eve nt bases.
*/ */
#include <event2/visibility.h> #include <event2/visibility.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <event2/event-config.h> #include <event2/event-config.h>
#ifdef EVENT__HAVE_SYS_TYPES_H #ifdef EVENT__HAVE_SYS_TYPES_H
skipping to change at line 223 skipping to change at line 225
* @see event_base_new(), event_base_free(), event_base_loop(), * @see event_base_new(), event_base_free(), event_base_loop(),
* event_base_new_with_config() * event_base_new_with_config()
*/ */
struct event_base struct event_base
#ifdef EVENT_IN_DOXYGEN_ #ifdef EVENT_IN_DOXYGEN_
{/*Empty body so that doxygen will generate documentation here.*/} {/*Empty body so that doxygen will generate documentation here.*/}
#endif #endif
; ;
/** /**
* @struct event
*
* Structure to represent a single event. * Structure to represent a single event.
* *
* An event can have some underlying condition it represents: a socket * An event can have some underlying condition it represents: a socket
* becoming readable or writeable (or both), or a signal becoming raised. * becoming readable or writeable (or both), or a signal becoming raised.
* (An event that represents no underlying condition is still useful: you * (An event that represents no underlying condition is still useful: you
* can use one to implement a timer, or to communicate between threads.) * can use one to implement a timer, or to communicate between threads.)
* *
* Generally, you can create events with event_new(), then make them * Generally, you can create events with event_new(), then make them
* pending with event_add(). As your event_base runs, it will run the * pending with event_add(). As your event_base runs, it will run the
* callbacks of an events whose conditions are triggered. When you no * callbacks of an events whose conditions are triggered. When you no
skipping to change at line 372 skipping to change at line 372
active, or until something calls event_base_loopbreak() or active, or until something calls event_base_loopbreak() or
event_base_loopexit(). event_base_loopexit().
@param base the event_base structure returned by event_base_new() or @param base the event_base structure returned by event_base_new() or
event_base_new_with_config() event_base_new_with_config()
@return 0 if successful, -1 if an error occurred, or 1 if we exited becau se @return 0 if successful, -1 if an error occurred, or 1 if we exited becau se
no events were pending or active. no events were pending or active.
@see event_base_loop() @see event_base_loop()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_dispatch(struct event_base *); int event_base_dispatch(struct event_base *base);
/** /**
Get the kernel event notification mechanism used by Libevent. Get the kernel event notification mechanism used by Libevent.
@param eb the event_base structure returned by event_base_new() @param eb the event_base structure returned by event_base_new()
@return a string identifying the kernel event mechanism (kqueue, epoll, et c.) @return a string identifying the kernel event mechanism (kqueue, epoll, et c.)
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
const char *event_base_get_method(const struct event_base *); const char *event_base_get_method(const struct event_base *eb);
/** /**
Gets all event notification mechanisms supported by Libevent. Gets all event notification mechanisms supported by Libevent.
This functions returns the event mechanism in order preferred by This functions returns the event mechanism in order preferred by
Libevent. Note that this list will include all backends that Libevent. Note that this list will include all backends that
Libevent has compiled-in support for, and will not necessarily check Libevent has compiled-in support for, and will not necessarily check
your OS to see whether it has the required resources. your OS to see whether it has the required resources.
@return an array with pointers to the names of support methods. @return an array with pointers to the names of support methods.
skipping to change at line 440 skipping to change at line 440
future libevent versions. The return value is an indication of the work future libevent versions. The return value is an indication of the work
load, but the user shouldn't rely on the exact value as this may change in load, but the user shouldn't rely on the exact value as this may change in
the future. the future.
@param eb the event_base structure returned by event_base_new() @param eb the event_base structure returned by event_base_new()
@param flags a bitwise combination of the kinds of events to aggregate @param flags a bitwise combination of the kinds of events to aggregate
counts for counts for
@return the number of events specified in the flags @return the number of events specified in the flags
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_get_num_events(struct event_base *, unsigned int); int event_base_get_num_events(struct event_base *eb, unsigned int flags);
/** /**
Get the maximum number of events in a given event_base as specified in th e Get the maximum number of events in a given event_base as specified in th e
flags. flags.
@param eb the event_base structure returned by event_base_new() @param eb the event_base structure returned by event_base_new()
@param flags a bitwise combination of the kinds of events to aggregate @param flags a bitwise combination of the kinds of events to aggregate
counts for counts for
@param clear option used to reset the maximum count. @param clear option used to reset the maximum count.
@return the number of events specified in the flags @return the number of events specified in the flags
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_get_max_events(struct event_base *, unsigned int, int); int event_base_get_max_events(struct event_base *eb, unsigned int flags, in t clear);
/** /**
Allocates a new event configuration object. Allocates a new event configuration object.
The event configuration object can be used to change the behavior of The event configuration object can be used to change the behavior of
an event base. an event base.
@return an event_config object that can be used to store configuration, or @return an event_config object that can be used to store configuration, or
NULL if an error is encountered. NULL if an error is encountered.
@see event_base_new_with_config(), event_config_free(), event_config @see event_base_new_with_config(), event_config_free(), event_config
skipping to change at line 572 skipping to change at line 572
This flag has no effect if you wind up using a backend other tha n This flag has no effect if you wind up using a backend other tha n
epoll. epoll.
*/ */
EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST = 0x10, EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST = 0x10,
/** Ordinarily, Libevent implements its time and timeout code using /** Ordinarily, Libevent implements its time and timeout code using
the fastest monotonic timer that we have. If this flag is set, the fastest monotonic timer that we have. If this flag is set,
however, we use less efficient more precise timer, assuming one is however, we use less efficient more precise timer, assuming one is
present. present.
*/ */
EVENT_BASE_FLAG_PRECISE_TIMER = 0x20 EVENT_BASE_FLAG_PRECISE_TIMER = 0x20,
/** With EVENT_BASE_FLAG_PRECISE_TIMER,
epoll backend will use timerfd for more accurate timers, this wi
ll
allows to disable this.
That said that this is something in between lack of
(CLOCK_MONOTONIC_COARSE) and enabled EVENT_BASE_FLAG_PRECISE_TIM
ER
(CLOCK_MONOTONIC + timerfd).
This flag has no effect if you wind up using a backend other tha
n
epoll and if you do not have EVENT_BASE_FLAG_PRECISE_TIMER enabl
ed.
*/
EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD = 0x40,
}; };
/** /**
Return a bitmask of the features implemented by an event base. This Return a bitmask of the features implemented by an event base. This
will be a bitwise OR of one or more of the values of will be a bitwise OR of one or more of the values of
event_method_feature event_method_feature
@see event_method_feature @see event_method_feature
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
skipping to change at line 677 skipping to change at line 690
Use event_base_new_with_config() to initialize a new event base, taking Use event_base_new_with_config() to initialize a new event base, taking
the specified configuration under consideration. The configuration objec t the specified configuration under consideration. The configuration objec t
can currently be used to avoid certain event notification mechanisms. can currently be used to avoid certain event notification mechanisms.
@param cfg the event configuration object @param cfg the event configuration object
@return an initialized event_base that can be used to registering events, @return an initialized event_base that can be used to registering events,
or NULL if no event base can be created with the requested event_confi g. or NULL if no event base can be created with the requested event_confi g.
@see event_base_new(), event_base_free(), event_init(), event_assign() @see event_base_new(), event_base_free(), event_init(), event_assign()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct event_base *event_base_new_with_config(const struct event_config *); struct event_base *event_base_new_with_config(const struct event_config *cf g);
/** /**
Deallocate all memory associated with an event_base, and free the base. Deallocate all memory associated with an event_base, and free the base.
Note that this function will not close any fds or free any memory passed Note that this function will not close any fds or free any memory passed
to event_new as the argument to callback. to event_new as the argument to callback.
If there are any pending finalizer callbacks, this function will invoke If there are any pending finalizer callbacks, this function will invoke
them. them.
@param eb an event_base to be freed @param eb an event_base to be freed
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void event_base_free(struct event_base *); void event_base_free(struct event_base *eb);
/** /**
As event_base_free, but do not run finalizers. As event_base_free, but do not run finalizers.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void event_base_free_nofinalize(struct event_base *); void event_base_free_nofinalize(struct event_base *);
/** @name Log severities /** @name Log severities
*/ */
/**@{*/ /**@{*/
skipping to change at line 786 skipping to change at line 799
/** /**
Associate a different event base with an event. Associate a different event base with an event.
The event to be associated must not be currently active or pending. The event to be associated must not be currently active or pending.
@param eb the event base @param eb the event base
@param ev the event @param ev the event
@return 0 on success, -1 on failure. @return 0 on success, -1 on failure.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_set(struct event_base *, struct event *); int event_base_set(struct event_base *eb, struct event *ev);
/** @name Loop flags /** @name Loop flags
These flags control the behavior of event_base_loop(). These flags control the behavior of event_base_loop().
*/ */
/**@{*/ /**@{*/
/** Block until we have an active event, then exit once all active events /** Block until we have an active event, then exit once all active events
* have had their callbacks run. */ * have had their callbacks run. */
#define EVLOOP_ONCE 0x01 #define EVLOOP_ONCE 0x01
/** Do not block: see which events are ready now, run the callbacks /** Do not block: see which events are ready now, run the callbacks
skipping to change at line 825 skipping to change at line 838
@param eb the event_base structure returned by event_base_new() or @param eb the event_base structure returned by event_base_new() or
event_base_new_with_config() event_base_new_with_config()
@param flags any combination of EVLOOP_ONCE | EVLOOP_NONBLOCK @param flags any combination of EVLOOP_ONCE | EVLOOP_NONBLOCK
@return 0 if successful, -1 if an error occurred, or 1 if we exited becau se @return 0 if successful, -1 if an error occurred, or 1 if we exited becau se
no events were pending or active. no events were pending or active.
@see event_base_loopexit(), event_base_dispatch(), EVLOOP_ONCE, @see event_base_loopexit(), event_base_dispatch(), EVLOOP_ONCE,
EVLOOP_NONBLOCK EVLOOP_NONBLOCK
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_loop(struct event_base *, int); int event_base_loop(struct event_base *eb, int flags);
/** /**
Exit the event loop after the specified time Exit the event loop after the specified time
The next event_base_loop() iteration after the given timer expires will The next event_base_loop() iteration after the given timer expires will
complete normally (handling all queued events) then exit without complete normally (handling all queued events) then exit without
blocking for events again. blocking for events again.
Subsequent invocations of event_base_loop() will proceed normally. Subsequent invocations of event_base_loop() will proceed normally.
@param eb the event_base structure returned by event_init() @param eb the event_base structure returned by event_init()
@param tv the amount of time after which the loop should terminate, @param tv the amount of time after which the loop should terminate,
or NULL to exit after running all currently active events. or NULL to exit after running all currently active events.
@return 0 if successful, or -1 if an error occurred @return 0 if successful, or -1 if an error occurred
@see event_base_loopbreak() @see event_base_loopbreak()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_loopexit(struct event_base *, const struct timeval *); int event_base_loopexit(struct event_base *eb, const struct timeval *tv);
/** /**
Abort the active event_base_loop() immediately. Abort the active event_base_loop() immediately.
event_base_loop() will abort the loop after the next event is completed; event_base_loop() will abort the loop after the next event is completed;
event_base_loopbreak() is typically invoked from this event's callback. event_base_loopbreak() is typically invoked from this event's callback.
This behavior is analogous to the "break;" statement. This behavior is analogous to the "break;" statement.
Subsequent invocations of event_base_loop() will proceed normally. Subsequent invocations of event_base_loop() will proceed normally.
@param eb the event_base structure returned by event_init() @param eb the event_base structure returned by event_init()
@return 0 if successful, or -1 if an error occurred @return 0 if successful, or -1 if an error occurred
@see event_base_loopexit() @see event_base_loopexit()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_loopbreak(struct event_base *); int event_base_loopbreak(struct event_base *eb);
/** /**
Tell the active event_base_loop() to scan for new events immediately. Tell the active event_base_loop() to scan for new events immediately.
Calling this function makes the currently active event_base_loop() Calling this function makes the currently active event_base_loop()
start the loop over again (scanning for new events) after the current start the loop over again (scanning for new events) after the current
event callback finishes. If the event loop is not running, this event callback finishes. If the event loop is not running, this
function has no effect. function has no effect.
event_base_loopbreak() is typically invoked from this event's callback. event_base_loopbreak() is typically invoked from this event's callback.
This behavior is analogous to the "continue;" statement. This behavior is analogous to the "continue;" statement.
Subsequent invocations of event loop will proceed normally. Subsequent invocations of event loop will proceed normally.
@param eb the event_base structure returned by event_init() @param eb the event_base structure returned by event_init()
@return 0 if successful, or -1 if an error occurred @return 0 if successful, or -1 if an error occurred
@see event_base_loopbreak() @see event_base_loopbreak()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_loopcontinue(struct event_base *); int event_base_loopcontinue(struct event_base *eb);
/** /**
Checks if the event loop was told to exit by event_base_loopexit(). Checks if the event loop was told to exit by event_base_loopexit().
This function will return true for an event_base at every point after This function will return true for an event_base at every point after
event_loopexit() is called, until the event loop is next entered. event_loopexit() is called, until the event loop is next entered.
@param eb the event_base structure returned by event_init() @param eb the event_base structure returned by event_init()
@return true if event_base_loopexit() was called on this event base, @return true if event_base_loopexit() was called on this event base,
or 0 otherwise or 0 otherwise
@see event_base_loopexit() @see event_base_loopexit()
@see event_base_got_break() @see event_base_got_break()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_got_exit(struct event_base *); int event_base_got_exit(struct event_base *eb);
/** /**
Checks if the event loop was told to abort immediately by event_base_loop break(). Checks if the event loop was told to abort immediately by event_base_loop break().
This function will return true for an event_base at every point after This function will return true for an event_base at every point after
event_base_loopbreak() is called, until the event loop is next entered. event_base_loopbreak() is called, until the event loop is next entered.
@param eb the event_base structure returned by event_init() @param eb the event_base structure returned by event_init()
@return true if event_base_loopbreak() was called on this event base, @return true if event_base_loopbreak() was called on this event base,
or 0 otherwise or 0 otherwise
@see event_base_loopbreak() @see event_base_loopbreak()
@see event_base_got_exit() @see event_base_got_exit()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_got_break(struct event_base *); int event_base_got_break(struct event_base *eb);
/** /**
* @name event flags * @name event flags
* *
* Flags to pass to event_new(), event_assign(), event_pending(), and * Flags to pass to event_new(), event_assign(), event_pending(), and
* anything else with an argument of the form "short events" * anything else with an argument of the form "short events"
*/ */
/**@{*/ /**@{*/
/** Indicates that a timeout has occurred. It's not necessary to pass /** Indicates that a timeout has occurred. It's not necessary to pass
* this flag to event_for new()/event_assign() to get a timeout. */ * this flag to event_for new()/event_assign() to get a timeout. */
skipping to change at line 1089 skipping to change at line 1102
@param events desired events to monitor: bitfield of EV_READ, EV_WRITE, @param events desired events to monitor: bitfield of EV_READ, EV_WRITE,
EV_SIGNAL, EV_PERSIST, EV_ET. EV_SIGNAL, EV_PERSIST, EV_ET.
@param callback callback function to be invoked when the event occurs @param callback callback function to be invoked when the event occurs
@param callback_arg an argument to be passed to the callback function @param callback_arg an argument to be passed to the callback function
@return a newly allocated struct event that must later be freed with @return a newly allocated struct event that must later be freed with
event_free() or NULL if an error occurred. event_free() or NULL if an error occurred.
@see event_free(), event_add(), event_del(), event_assign() @see event_free(), event_add(), event_del(), event_assign()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct event *event_new(struct event_base *, evutil_socket_t, short, event_ callback_fn, void *); struct event *event_new(struct event_base *base, evutil_socket_t fd, short events, event_callback_fn callback, void *callback_arg);
/** /**
Prepare a new, already-allocated event structure to be added. Prepare a new, already-allocated event structure to be added.
The function event_assign() prepares the event structure ev to be used The function event_assign() prepares the event structure ev to be used
in future calls to event_add() and event_del(). Unlike event_new(), it in future calls to event_add() and event_del(). Unlike event_new(), it
doesn't allocate memory itself: it requires that you have already doesn't allocate memory itself: it requires that you have already
allocated a struct event, probably on the heap. Doing this will allocated a struct event, probably on the heap. Doing this will
typically make your code depend on the size of the event structure, and typically make your code depend on the size of the event structure, and
thereby create incompatibility with future versions of Libevent. thereby create incompatibility with future versions of Libevent.
skipping to change at line 1130 skipping to change at line 1143
@param events desired events to monitor; can be EV_READ and/or EV_WRITE @param events desired events to monitor; can be EV_READ and/or EV_WRITE
@param callback callback function to be invoked when the event occurs @param callback callback function to be invoked when the event occurs
@param callback_arg an argument to be passed to the callback function @param callback_arg an argument to be passed to the callback function
@return 0 if success, or -1 on invalid arguments. @return 0 if success, or -1 on invalid arguments.
@see event_new(), event_add(), event_del(), event_base_once(), @see event_new(), event_add(), event_del(), event_base_once(),
event_get_struct_event_size() event_get_struct_event_size()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_assign(struct event *, struct event_base *, evutil_socket_t, shor t, event_callback_fn, void *); int event_assign(struct event *ev, struct event_base *base, evutil_socket_t fd, short events, event_callback_fn callback, void *callback_arg);
/** /**
Deallocate a struct event * returned by event_new(). Deallocate a struct event * returned by event_new().
If the event is pending or active, this function makes it non-pending If the event is pending or active, this function makes it non-pending
and non-active first. and non-active first.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void event_free(struct event *); void event_free(struct event *);
skipping to change at line 1207 skipping to change at line 1220
@param events event(s) to monitor; can be any of EV_READ | @param events event(s) to monitor; can be any of EV_READ |
EV_WRITE, or EV_TIMEOUT EV_WRITE, or EV_TIMEOUT
@param callback callback function to be invoked when the event occurs @param callback callback function to be invoked when the event occurs
@param arg an argument to be passed to the callback function @param arg an argument to be passed to the callback function
@param timeout the maximum amount of time to wait for the event. NULL @param timeout the maximum amount of time to wait for the event. NULL
makes an EV_READ/EV_WRITE event make forever; NULL makes an makes an EV_READ/EV_WRITE event make forever; NULL makes an
EV_TIMEOUT event success immediately. EV_TIMEOUT event success immediately.
@return 0 if successful, or -1 if an error occurred @return 0 if successful, or -1 if an error occurred
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_once(struct event_base *, evutil_socket_t, short, event_call back_fn, void *, const struct timeval *); int event_base_once(struct event_base *base, evutil_socket_t fd, short even ts, event_callback_fn callback, void *arg, const struct timeval *timeout);
/** /**
Add an event to the set of pending events. Add an event to the set of pending events.
The function event_add() schedules the execution of the event 'ev' when t he The function event_add() schedules the execution of the event 'ev' when t he
condition specified by event_assign() or event_new() occurs, or when the time condition specified by event_assign() or event_new() occurs, or when the time
specified in timeout has elapsed. If a timeout is NULL, no timeout specified in timeout has elapsed. If a timeout is NULL, no timeout
occurs and the function will only be occurs and the function will only be
called if a matching event occurs. The event in the called if a matching event occurs. The event in the
ev argument must be already initialized by event_assign() or event_new() ev argument must be already initialized by event_assign() or event_new()
skipping to change at line 1257 skipping to change at line 1270
The function event_del() will cancel the event in the argument ev. If th e The function event_del() will cancel the event in the argument ev. If th e
event has already executed or has never been added the call will have no event has already executed or has never been added the call will have no
effect. effect.
@param ev an event struct to be removed from the working set @param ev an event struct to be removed from the working set
@return 0 if successful, or -1 if an error occurred @return 0 if successful, or -1 if an error occurred
@see event_add() @see event_add()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_del(struct event *); int event_del(struct event *ev);
/** /**
As event_del(), but never blocks while the event's callback is running As event_del(), but never blocks while the event's callback is running
in another thread, even if the event was constructed without the in another thread, even if the event was constructed without the
EV_FINALIZE flag. EV_FINALIZE flag.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_del_noblock(struct event *ev); int event_del_noblock(struct event *ev);
/** /**
As event_del(), but always blocks while the event's callback is running As event_del(), but always blocks while the event's callback is running
skipping to change at line 1467 skipping to change at line 1480
events again, before running less-urgent events. Less-urgent events events again, before running less-urgent events. Less-urgent events
will not have their callbacks run until there are no events more urgent will not have their callbacks run until there are no events more urgent
than them that want to be active. than them that want to be active.
@param eb the event_base structure returned by event_base_new() @param eb the event_base structure returned by event_base_new()
@param npriorities the maximum number of priorities @param npriorities the maximum number of priorities
@return 0 if successful, or -1 if an error occurred @return 0 if successful, or -1 if an error occurred
@see event_priority_set() @see event_priority_set()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_priority_init(struct event_base *, int); int event_base_priority_init(struct event_base *eb, int npriorities);
/** /**
Get the number of different event priorities. Get the number of different event priorities.
@param eb the event_base structure returned by event_base_new() @param eb the event_base structure returned by event_base_new()
@return Number of different event priorities @return Number of different event priorities
@see event_base_priority_init() @see event_base_priority_init()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_base_get_npriorities(struct event_base *eb); int event_base_get_npriorities(struct event_base *eb);
/** /**
Assign a priority to an event. Assign a priority to an event.
@param ev an event struct @param ev an event struct
@param priority the new priority to be assigned @param priority the new priority to be assigned
@return 0 if successful, or -1 if an error occurred @return 0 if successful, or -1 if an error occurred
@see event_priority_init(), event_get_priority() @see event_priority_init(), event_get_priority()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_priority_set(struct event *, int); int event_priority_set(struct event *ev, int priority);
/** /**
Prepare an event_base to use a large number of timeouts with the same Prepare an event_base to use a large number of timeouts with the same
duration. duration.
Libevent's default scheduling algorithm is optimized for having a large Libevent's default scheduling algorithm is optimized for having a large
number of timeouts with their durations more or less randomly number of timeouts with their durations more or less randomly
distributed. But if you have a large number of timeouts that all have distributed. But if you have a large number of timeouts that all have
the same duration (for example, if you have a large number of the same duration (for example, if you have a large number of
connections that all have a 10-second timeout), then you can improve connections that all have a 10-second timeout), then you can improve
skipping to change at line 1557 skipping to change at line 1570
Writes a human-readable description of all inserted and/or active Writes a human-readable description of all inserted and/or active
events to a provided stdio stream. events to a provided stdio stream.
This is intended for debugging; its format is not guaranteed to be the s ame This is intended for debugging; its format is not guaranteed to be the s ame
between libevent versions. between libevent versions.
@param base An event_base on which to scan the events. @param base An event_base on which to scan the events.
@param output A stdio file to write on. @param output A stdio file to write on.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void event_base_dump_events(struct event_base *, FILE *); void event_base_dump_events(struct event_base *base, FILE *output);
/** /**
Activates all pending events for the given fd and event mask. Activates all pending events for the given fd and event mask.
This function activates pending events only. Events which have not been This function activates pending events only. Events which have not been
added will not become active. added will not become active.
@param base the event_base on which to activate the events. @param base the event_base on which to activate the events.
@param fd An fd to active events on. @param fd An fd to active events on.
@param events One or more of EV_{READ,WRITE,TIMEOUT}. @param events One or more of EV_{READ,WRITE,TIMEOUT}.
skipping to change at line 1579 skipping to change at line 1592
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, s hort events); void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, s hort events);
/** /**
Activates all pending signals with a given signal number Activates all pending signals with a given signal number
This function activates pending events only. Events which have not been This function activates pending events only. Events which have not been
added will not become active. added will not become active.
@param base the event_base on which to activate the events. @param base the event_base on which to activate the events.
@param fd The signal to active events on. @param sig The signal to active events on.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void event_base_active_by_signal(struct event_base *base, int sig); void event_base_active_by_signal(struct event_base *base, int sig);
/** /**
* Callback for iterating events in an event base via event_base_foreach_ev ent * Callback for iterating events in an event base via event_base_foreach_ev ent
*/ */
typedef int (*event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *); typedef int (*event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *);
/** /**
 End of changes. 25 change blocks. 
25 lines changed or deleted 42 lines changed or added


 event_compat.h (2.1.11)   event_compat.h (current) 
skipping to change at line 32 skipping to change at line 32
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_EVENT_COMPAT_H_INCLUDED_ #ifndef EVENT2_EVENT_COMPAT_H_INCLUDED_
#define EVENT2_EVENT_COMPAT_H_INCLUDED_ #define EVENT2_EVENT_COMPAT_H_INCLUDED_
/** @file event2/event_compat.h /** @file event2/event_compat.h
Potentially non-threadsafe versions of the functions in event.h: provided @brief Potentially non-threadsafe versions of the functions in event.h: p rovided
only for backwards compatibility. only for backwards compatibility.
In the oldest versions of Libevent, event_base was not a first-class In the oldest versions of Libevent, event_base was not a first-class
structure. Instead, there was a single event base that every function structure. Instead, there was a single event base that every function
manipulated. Later, when separate event bases were added, the old functi ons manipulated. Later, when separate event bases were added, the old functi ons
that didn't take an event_base argument needed to work by manipulating th e that didn't take an event_base argument needed to work by manipulating th e
"current" event base. This could lead to thread-safety issues, and obscu re, "current" event base. This could lead to thread-safety issues, and obscu re,
hard-to-diagnose bugs. hard-to-diagnose bugs.
@deprecated All functions in this file are by definition deprecated. @deprecated All functions in this file are by definition deprecated.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 event_struct.h (2.1.11)   event_struct.h (current) 
skipping to change at line 129 skipping to change at line 129
void *evcb_arg; void *evcb_arg;
}; };
struct event_base; struct event_base;
struct event { struct event {
struct event_callback ev_evcallback; struct event_callback ev_evcallback;
/* for managing timeouts */ /* for managing timeouts */
union { union {
TAILQ_ENTRY(event) ev_next_with_common_timeout; TAILQ_ENTRY(event) ev_next_with_common_timeout;
int min_heap_idx; size_t min_heap_idx;
} ev_timeout_pos; } ev_timeout_pos;
evutil_socket_t ev_fd; evutil_socket_t ev_fd;
short ev_events;
short ev_res; /* result passed to event callback */
struct event_base *ev_base; struct event_base *ev_base;
union { union {
/* used for io events */ /* used for io events */
struct { struct {
LIST_ENTRY (event) ev_io_next; LIST_ENTRY (event) ev_io_next;
struct timeval ev_timeout; struct timeval ev_timeout;
} ev_io; } ev_io;
/* used by signal events */ /* used by signal events */
struct { struct {
LIST_ENTRY (event) ev_signal_next; LIST_ENTRY (event) ev_signal_next;
short ev_ncalls; short ev_ncalls;
/* Allows deletes in callback */ /* Allows deletes in callback */
short *ev_pncalls; short *ev_pncalls;
} ev_signal; } ev_signal;
} ev_; } ev_;
short ev_events;
short ev_res; /* result passed to event callback */
struct timeval ev_timeout; struct timeval ev_timeout;
}; };
TAILQ_HEAD (event_list, event); TAILQ_HEAD (event_list, event);
#ifdef EVENT_DEFINED_TQENTRY_ #ifdef EVENT_DEFINED_TQENTRY_
#undef TAILQ_ENTRY #undef TAILQ_ENTRY
#endif #endif
#ifdef EVENT_DEFINED_TQHEAD_ #ifdef EVENT_DEFINED_TQHEAD_
 End of changes. 3 change blocks. 
3 lines changed or deleted 4 lines changed or added


 http.h (2.1.11)   http.h (current) 
skipping to change at line 46 skipping to change at line 46
#endif #endif
/* In case we haven't included the right headers yet. */ /* In case we haven't included the right headers yet. */
struct evbuffer; struct evbuffer;
struct event_base; struct event_base;
struct bufferevent; struct bufferevent;
struct evhttp_connection; struct evhttp_connection;
/** @file event2/http.h /** @file event2/http.h
* *
* Basic support for HTTP serving. * @brief Basic support for HTTP serving.
* *
* As Libevent is a library for dealing with event notification and most * As Libevent is a library for dealing with event notification and most
* interesting applications are networked today, I have often found the * interesting applications are networked today, I have often found the
* need to write HTTP code. The following prototypes and definitions provi de * need to write HTTP code. The following prototypes and definitions provi de
* an application with a minimal interface for making HTTP requests and for * an application with a minimal interface for making HTTP requests and for
* creating a very simple HTTP server. * creating a very simple HTTP server.
*/ */
/* Response codes */ /* Response codes */
#define HTTP_OK 200 /**< request completed ok */ #define HTTP_OK 200 /**< request completed ok */
skipping to change at line 76 skipping to change at line 76
#define HTTP_INTERNAL 500 /**< internal error */ #define HTTP_INTERNAL 500 /**< internal error */
#define HTTP_NOTIMPLEMENTED 501 /**< not implemented */ #define HTTP_NOTIMPLEMENTED 501 /**< not implemented */
#define HTTP_SERVUNAVAIL 503 /**< the server is not available */ #define HTTP_SERVUNAVAIL 503 /**< the server is not available */
struct evhttp; struct evhttp;
struct evhttp_request; struct evhttp_request;
struct evkeyvalq; struct evkeyvalq;
struct evhttp_bound_socket; struct evhttp_bound_socket;
struct evconnlistener; struct evconnlistener;
struct evdns_base; struct evdns_base;
struct evhttp_ext_method;
/** /**
* Create a new HTTP server. * Create a new HTTP server.
* *
* @param base (optional) the event base to receive the HTTP events * @param base (optional) the event base to receive the HTTP events
* @return a pointer to a newly initialized evhttp server structure or NULL * @return a pointer to a newly initialized evhttp server structure or NULL
* on error * on error
* @see evhttp_free() * @see evhttp_free()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
skipping to change at line 226 skipping to change at line 227
void evhttp_free(struct evhttp* http); void evhttp_free(struct evhttp* http);
/** XXX Document. */ /** XXX Document. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_set_max_headers_size(struct evhttp* http, ev_ssize_t max_header s_size); void evhttp_set_max_headers_size(struct evhttp* http, ev_ssize_t max_header s_size);
/** XXX Document. */ /** XXX Document. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size ); void evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size );
/** /**
* Set the maximum number of simultaneous connections for this server.
* A value of zero or less disables the limit.
*
* @param http the http server on which to set the max connection limit
* @param max_connections the maximum number of simultaneous connections or
0
*/
EVENT2_EXPORT_SYMBOL
void evhttp_set_max_connections(struct evhttp* http, int max_connections);
/**
* Get the current number of connections.
*
* @return The current number of connections for this server.
*/
EVENT2_EXPORT_SYMBOL
int evhttp_get_connection_count(struct evhttp* http);
/**
Set the value to use for the Content-Type header when none was provided. If Set the value to use for the Content-Type header when none was provided. If
the content type string is NULL, the Content-Type header will not be the content type string is NULL, the Content-Type header will not be
automatically added. automatically added.
@param http the http server on which to set the default content type @param http the http server on which to set the default content type
@param content_type the value for the Content-Type header @param content_type the value for the Content-Type header
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_set_default_content_type(struct evhttp *http, void evhttp_set_default_content_type(struct evhttp *http,
const char *content_type); const char *content_type);
skipping to change at line 249 skipping to change at line 268
server, and passed to user callbacks. server, and passed to user callbacks.
If not supported they will generate a "405 Method not allowed" response. If not supported they will generate a "405 Method not allowed" response.
By default this includes the following methods: GET, POST, HEAD, PUT, DEL ETE By default this includes the following methods: GET, POST, HEAD, PUT, DEL ETE
@param http the http server on which to set the methods @param http the http server on which to set the methods
@param methods bit mask constructed from evhttp_cmd_type values @param methods bit mask constructed from evhttp_cmd_type values
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_set_allowed_methods(struct evhttp* http, ev_uint16_t methods); void evhttp_set_allowed_methods(struct evhttp* http, ev_uint32_t methods);
typedef int (*evhttp_ext_method_cb)(struct evhttp_ext_method *);
/**
Sets the callback function which allows HTTP extended methods
to be supported by this server.
The callback should :
- if method field is NULL : set method field according to type field
- else : set type and flags fields according to method string
- return 0 for success (known method / type)
- return -1 for error (unknown method / type)
evhttp_set_allowed_methods still needs to be called.
@param http the http server on which to add support to the methods
@param cmp the extended method callback
@see evhttp_ext_method
*/
EVENT2_EXPORT_SYMBOL
void evhttp_set_ext_method_cmp(struct evhttp *http, evhttp_ext_method_cb cm
p);
/** /**
Set a callback for a specified URI Set a callback for a specified URI
@param http the http sever on which to set the callback @param http the http sever on which to set the callback
@param path the path for which to invoke the callback @param path the path for which to invoke the callback
@param cb the callback function that gets invoked on requesting path @param cb the callback function that gets invoked on requesting path
@param cb_arg an additional context argument for the callback @param cb_arg an additional context argument for the callback
@return 0 on success, -1 if the callback existed already, -2 on failure @return 0 on success, -1 if the callback existed already, -2 on failure
*/ */
skipping to change at line 302 skipping to change at line 341
@param http the evhttp server object for which to set the callback @param http the evhttp server object for which to set the callback
@param cb the callback to invoke for incoming connections @param cb the callback to invoke for incoming connections
@param arg an context argument for the callback @param arg an context argument for the callback
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_set_bevcb(struct evhttp *http, void evhttp_set_bevcb(struct evhttp *http,
struct bufferevent *(*cb)(struct event_base *, void *), void *arg); struct bufferevent *(*cb)(struct event_base *, void *), void *arg);
/** /**
Set a callback which allows the user to note or throttle incoming reques
ts.
The requests are not populated with HTTP level information. They
are just associated to a connection.
If the callback returns -1, the associated connection is terminated
and the request is closed.
@param http the evhttp server object for which to set the callback
@param cb the callback to invoke for incoming connections
@param arg an context argument for the callback
*/
EVENT2_EXPORT_SYMBOL
void evhttp_set_newreqcb(struct evhttp *http,
int (*cb)(struct evhttp_request*, void *), void *arg);
/**
Set a callback to output for any error pages sent for requests of a give
n
evhttp object.
You can use this to override the default error pages sent, allowing such
things as multi-lingual support or customization to match other pages.
The callback should use the supplied buffer to output the text for an
error page. If the callback returns a negative value or doesn't output
anything to the buffer, the default error page will be sent instead. The
buffer will be automatically be sent when the callback returns, so the
callback shouldn't do so itself.
Microsoft Internet Explorer may display its own error pages if ones sent
by
an HTTP server are smaller than certain sizes, depending on the status c
ode.
To reliably suppress this feature an error page should be at least 512
bytes in size.
@param http the evhttp server object for which to set the callback
@param cb the callback to invoke to format error pages
@param arg an context argument for the callback
*/
EVENT2_EXPORT_SYMBOL
void evhttp_set_errorcb(struct evhttp *http,
int (*cb)(struct evhttp_request *req, struct evbuffer *buffer, int erro
r, const char *reason, void *cbarg),
void *cbarg);
/**
Adds a virtual host to the http server. Adds a virtual host to the http server.
A virtual host is a newly initialized evhttp object that has request A virtual host is a newly initialized evhttp object that has request
callbacks set on it via evhttp_set_cb() or evhttp_set_gencb(). It callbacks set on it via evhttp_set_cb() or evhttp_set_gencb(). It
most not have any listing sockets associated with it. most not have any listing sockets associated with it.
If the virtual host has not been removed by the time that evhttp_free() If the virtual host has not been removed by the time that evhttp_free()
is called on the main http server, it will be automatically freed, too. is called on the main http server, it will be automatically freed, too.
It is possible to have hierarchical vhosts. For example: A vhost It is possible to have hierarchical vhosts. For example: A vhost
skipping to change at line 363 skipping to change at line 446
@param alias the alias to remove @param alias the alias to remove
@see evhttp_add_server_alias() @see evhttp_add_server_alias()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_remove_server_alias(struct evhttp *http, const char *alias); int evhttp_remove_server_alias(struct evhttp *http, const char *alias);
/** /**
* Set the timeout for an HTTP request. * Set the timeout for an HTTP request.
* *
* @param http an evhttp object * @param http an evhttp object
* @param timeout_in_secs the timeout, in seconds * @param timeout the timeout, in seconds
* @see evhttp_set_timeout_tv()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_set_timeout(struct evhttp *http, int timeout_in_secs); void evhttp_set_timeout(struct evhttp *http, int timeout);
/** /**
* Set the timeout for an HTTP request. * Set read and write timeout for an HTTP request.
* *
* @param http an evhttp object * @param http an evhttp object
* @param tv the timeout, or NULL * @param tv the timeout, or NULL
*
* For more precise control:
* @see evhttp_set_read_timeout_tv()
* @see evhttp_set_write_timeout_tv()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_set_timeout_tv(struct evhttp *http, const struct timeval* tv); void evhttp_set_timeout_tv(struct evhttp *http, const struct timeval* tv);
/**
* Set read timeout for an HTTP request.
*
* @param http an evhttp object
* @param tv the timeout, or NULL
*/
EVENT2_EXPORT_SYMBOL
void evhttp_set_read_timeout_tv(struct evhttp *http, const struct timeval*
tv);
/**
* Set write timeout for an HTTP request.
*
* @param http an evhttp object
* @param tv the timeout, or NULL
*/
EVENT2_EXPORT_SYMBOL
void evhttp_set_write_timeout_tv(struct evhttp *http, const struct timeval*
tv);
/* Read all the clients body, and only after this respond with an error if the /* Read all the clients body, and only after this respond with an error if the
* clients body exceed max_body_size */ * clients body exceed max_body_size */
#define EVHTTP_SERVER_LINGERING_CLOSE 0x0001 #define EVHTTP_SERVER_LINGERING_CLOSE 0x0001
/** /**
* Set connection flags for HTTP server. * Set connection flags for HTTP server.
* *
* @see EVHTTP_SERVER_* * @see EVHTTP_SERVER_*
* @return 0 on success, otherwise non zero (for example if flag doesn't * @return 0 on success, otherwise non zero (for example if flag doesn't
* supported). * supported).
*/ */
skipping to change at line 467 skipping to change at line 573
Send another data chunk as part of an ongoing chunked reply. Send another data chunk as part of an ongoing chunked reply.
The reply chunk consists of the data in databuf. After calling The reply chunk consists of the data in databuf. After calling
evhttp_send_reply_chunk() databuf will be empty, but the buffer is evhttp_send_reply_chunk() databuf will be empty, but the buffer is
still owned by the caller and needs to be deallocated by the caller still owned by the caller and needs to be deallocated by the caller
if necessary. if necessary.
@param req a request object @param req a request object
@param databuf the data chunk to send as part of the reply. @param databuf the data chunk to send as part of the reply.
@param cb callback funcion @param cb callback funcion
@param call back's argument. @param arg call back's argument.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_send_reply_chunk_with_cb(struct evhttp_request *, struct evbuff er *, void evhttp_send_reply_chunk_with_cb(struct evhttp_request *req, struct evb uffer *databuf,
void (*cb)(struct evhttp_connection *, void *), void *arg); void (*cb)(struct evhttp_connection *, void *), void *arg);
/** /**
Complete a chunked reply, freeing the request as appropriate. Complete a chunked reply, freeing the request as appropriate.
@param req a request object @param req a request object
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_send_reply_end(struct evhttp_request *req); void evhttp_send_reply_end(struct evhttp_request *req);
/* /*
* Interfaces for making requests * Interfaces for making requests
*/ */
/** The different request types supported by evhttp. These are as specifie d /** The different request types supported by evhttp. These are as specifie d
* in RFC2616, except for PATCH which is specified by RFC5789. * in RFC2616, except for:
* - PATCH which is specified by RFC5789
* - PROPFIND, PROPPATCH, MKCOL, LOCK, UNLOCK, COPY, MOVE
* which are specified by RFC4918
* *
* By default, only some of these methods are accepted and passed to user * By default, only some of these methods are accepted and passed to user
* callbacks; use evhttp_set_allowed_methods() to change which methods * callbacks; use evhttp_set_allowed_methods() to change which methods
* are allowed. * are allowed.
*/ */
enum evhttp_cmd_type { enum evhttp_cmd_type {
EVHTTP_REQ_GET = 1 << 0, EVHTTP_REQ_GET = 1 << 0,
EVHTTP_REQ_POST = 1 << 1, EVHTTP_REQ_POST = 1 << 1,
EVHTTP_REQ_HEAD = 1 << 2, EVHTTP_REQ_HEAD = 1 << 2,
EVHTTP_REQ_PUT = 1 << 3, EVHTTP_REQ_PUT = 1 << 3,
EVHTTP_REQ_DELETE = 1 << 4, EVHTTP_REQ_DELETE = 1 << 4,
EVHTTP_REQ_OPTIONS = 1 << 5, EVHTTP_REQ_OPTIONS = 1 << 5,
EVHTTP_REQ_TRACE = 1 << 6, EVHTTP_REQ_TRACE = 1 << 6,
EVHTTP_REQ_CONNECT = 1 << 7, EVHTTP_REQ_CONNECT = 1 << 7,
EVHTTP_REQ_PATCH = 1 << 8 EVHTTP_REQ_PATCH = 1 << 8,
EVHTTP_REQ_PROPFIND= 1 << 9,
EVHTTP_REQ_PROPPATCH=1 << 10,
EVHTTP_REQ_MKCOL = 1 << 11,
EVHTTP_REQ_LOCK = 1 << 12,
EVHTTP_REQ_UNLOCK = 1 << 13,
EVHTTP_REQ_COPY = 1 << 14,
EVHTTP_REQ_MOVE = 1 << 15,
}; };
#define EVHTTP_REQ_MAX EVHTTP_REQ_MOVE
/**
* @brief stucture that is passed to (and modified by) the
* extended method callback function
*
* @see evhttp_set_ext_method_cmp
* @see evhttp_connection_set_ext_method_cmp
*/
struct evhttp_ext_method {
const char *method;
ev_uint32_t type; /* @see enum evhttp_cmd_type */
ev_uint16_t flags; /* Available flag : EVHTTP_METHOD_HAS_BODY *
/
};
#define EVHTTP_METHOD_HAS_BODY 0x0001
/** a request object can represent either a request or a reply */ /** a request object can represent either a request or a reply */
enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE }; enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE };
/** /**
* Create and return a connection object that can be used to for making HTT P * Create and return a connection object that can be used to for making HTT P
* requests. The connection object tries to resolve address and establish the * requests. The connection object tries to resolve address and establish the
* connection when it is given an http request object. * connection when it is given an http request object.
* *
* Connection also has default timeouts for the following events:
* - connect HTTP_CONNECT_TIMEOUT, which is 45 seconds
* - read HTTP_READ_TIMEOUT which is 50 seconds
* - write HTTP_WRITE_TIMEOUT, which is 50 seconds
*
* @param base the event_base to use for handling the connection * @param base the event_base to use for handling the connection
* @param dnsbase the dns_base to use for resolving host names; if not * @param dnsbase the dns_base to use for resolving host names; if not
* specified host name resolution will block. * specified host name resolution will block.
* @param bev a bufferevent to use for connecting to the server; if NULL, a * @param bev a bufferevent to use for connecting to the server; if NULL, a
* socket-based bufferevent will be created. This buffrevent will be f reed * socket-based bufferevent will be created. This buffrevent will be f reed
* when the connection closes. It must have no fd set on it. * when the connection closes. It must have no fd set on it.
* @param address the address to which to connect * @param address the address to which to connect
* @param port the port to connect to * @param port the port to connect to
* @return an evhttp_connection object that can be used for making requests or * @return an evhttp_connection object that can be used for making requests or
* NULL on error * NULL on error
skipping to change at line 690 skipping to change at line 828
* evhttp_request_free() is explicitly called by the user. * evhttp_request_free() is explicitly called by the user.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_request_own(struct evhttp_request *req); void evhttp_request_own(struct evhttp_request *req);
/** Returns 1 if the request is owned by the user */ /** Returns 1 if the request is owned by the user */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_request_is_owned(struct evhttp_request *req); int evhttp_request_is_owned(struct evhttp_request *req);
/** /**
* Sets extended method cmp callback for this http connection.
*
* @see evhttp_set_ext_method_cmp
*/
EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_ext_method_cmp(struct evhttp_connection *evcon,
evhttp_ext_method_cb cmp);
/**
* Returns the connection object associated with the request or NULL * Returns the connection object associated with the request or NULL
* *
* The user needs to either free the request explicitly or call * The user needs to either free the request explicitly or call
* evhttp_send_reply_end(). * evhttp_send_reply_end().
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evhttp_request_get_connection(struct evhttp_reque st *req); struct evhttp_connection *evhttp_request_get_connection(struct evhttp_reque st *req);
/** /**
* Returns the underlying event_base for this connection * Returns the underlying event_base for this connection
skipping to change at line 734 skipping to change at line 881
/** sets the ip address from which http connections are made */ /** sets the ip address from which http connections are made */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_local_address(struct evhttp_connection *evcon, void evhttp_connection_set_local_address(struct evhttp_connection *evcon,
const char *address); const char *address);
/** sets the local port from which http connections are made */ /** sets the local port from which http connections are made */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_local_port(struct evhttp_connection *evcon, void evhttp_connection_set_local_port(struct evhttp_connection *evcon,
ev_uint16_t port); ev_uint16_t port);
/** Sets the timeout in seconds for events related to this connection */ /**
* Sets the timeout for this connection.
*
* @see evhttp_connection_set_timeout_tv()
*/
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_timeout(struct evhttp_connection *evcon, void evhttp_connection_set_timeout(struct evhttp_connection *evcon,
int timeout_in_secs); int timeout);
/** Sets the timeout for events related to this connection. Takes a struct /**
* timeval. */ * Sets the timeout for this connection for the following events:
* - read, if tv==NULL then it uses default timeout (HTTP_READ_TIMEOUT)
* - write, if tv==NULL then it uses default timeout (HTTP_WRITE_TIMEOUT)
*
* But it does not adjust timeout for the "connect" (for historical reasons
).
*
* @param tv the timeout, or NULL
*
* For more precise control:
* @see evhttp_connection_set_connect_timeout_tv()
* @see evhttp_connection_set_read_timeout_tv()
* @see evhttp_connection_set_write_timeout_tv()
*/
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon, void evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon,
const struct timeval *tv); const struct timeval *tv);
/** Sets the delay before retrying requests on this connection. This is onl /**
y * Sets the connect timeout for this connection
* used if evhttp_connection_set_retries is used to make the number of retr *
ies * @param tv the timeout, or NULL
* at least one. Each retry after the first is twice as long as the one bef */
ore EVENT2_EXPORT_SYMBOL
* it. */ void evhttp_connection_set_connect_timeout_tv(struct evhttp_connection *evc
on,
const struct timeval *tv);
/**
* Sets the read timeout for this connection
*
* @param tv the timeout, or NULL
*/
EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_read_timeout_tv(struct evhttp_connection *evcon,
const struct timeval *tv);
/**
* Sets the write timeout for this connection
*
* @param tv the timeout, or NULL
*/
EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_write_timeout_tv(struct evhttp_connection *evcon
,
const struct timeval *tv);
/**
* Sets the delay before retrying requests on this connection.
*
* This is only used if evhttp_connection_set_retries is used to make the
* number of retries at least one. Each retry after the first is twice as l
ong
* as the one before it.
*
* Default delay is HTTP_INITIAL_RETRY_TIMEOUT, which is 2 seconds.
*/
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon , void evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon ,
const struct timeval *tv); const struct timeval *tv);
/** Sets the retry limit for this connection - -1 repeats indefinitely */ /** Sets the retry limit for this connection - -1 repeats indefinitely */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_retries(struct evhttp_connection *evcon, void evhttp_connection_set_retries(struct evhttp_connection *evcon,
int retry_max); int retry_max);
/** Set a callback for connection close. */ /** Set a callback for connection close. */
skipping to change at line 988 skipping to change at line 1183
@deprecated This function is deprecated as of Libevent 2.0.9. Use @deprecated This function is deprecated as of Libevent 2.0.9. Use
evhttp_uri_parse and evhttp_parse_query_str instead. evhttp_uri_parse and evhttp_parse_query_str instead.
@param uri the request URI @param uri the request URI
@param headers the head of the evkeyval queue @param headers the head of the evkeyval queue
@return 0 on success, -1 on failure @return 0 on success, -1 on failure
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_parse_query(const char *uri, struct evkeyvalq *headers); int evhttp_parse_query(const char *uri, struct evkeyvalq *headers);
/** @see evhttp_parse_query_str_flags() */
EVENT2_EXPORT_SYMBOL
int evhttp_parse_query_str(const char *uri, struct evkeyvalq *headers);
/** Tolerate queries that are not standard conformant.
*
* Here are some examples:
*
* - test=123&test2
* with with this flag test2 will be present in the output headers
*
* - test=123&&test2=1
* will parse the query with this flag
*
* - test=123&=456&test2=1
* will parse the queyr with this flag, however there won't be empty key
* present
*/
#define EVHTTP_URI_QUERY_NONCONFORMANT 0x01
/** Prefer last value over the first from query args
*
* Example: test=123&test=456
* Without: test=123
* With : test=456
*/
#define EVHTTP_URI_QUERY_LAST_VAL 0x02
/** /**
Helper function to parse out arguments from the query portion of an Helper function to parse out arguments from the query portion of an
HTTP URI. HTTP URI.
Parsing a query string like Parsing a query string like
q=test&s=some+thing q=test&s=some+thing
will result in two entries in the key value queue. will result in two entries in the key value queue.
The first entry is: key="q", value="test" The first entry is: key="q", value="test"
The second entry is: key="s", value="some thing" The second entry is: key="s", value="some thing"
@param query_parse the query portion of the URI @param uri the query portion of the URI
@param headers the head of the evkeyval queue @param headers the head of the evkeyval queue
@param flags one or more of EVHTTP_URI_QUERY_*
@return 0 on success, -1 on failure @return 0 on success, -1 on failure
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_parse_query_str(const char *uri, struct evkeyvalq *headers); int evhttp_parse_query_str_flags(const char *uri, struct evkeyvalq *headers , unsigned flags);
/** /**
* Escape HTML character entities in a string. * Escape HTML character entities in a string.
* *
* Replaces <, >, ", ' and & with &lt;, &gt;, &quot;, * Replaces <, >, ", ' and & with &lt;, &gt;, &quot;,
* &#039; and &amp; correspondingly. * &#039; and &amp; correspondingly.
* *
* The returned string needs to be freed by the caller. * The returned string needs to be freed by the caller.
* *
* @param html an unescaped HTML string * @param html an unescaped HTML string
 End of changes. 25 change blocks. 
22 lines changed or deleted 256 lines changed or added


 http_compat.h (2.1.11)   http_compat.h (current) 
skipping to change at line 32 skipping to change at line 32
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_ #ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
#define EVENT2_HTTP_COMPAT_H_INCLUDED_ #define EVENT2_HTTP_COMPAT_H_INCLUDED_
/** @file event2/http_compat.h /** @file event2/http_compat.h
Potentially non-threadsafe versions of the functions in http.h: provided @brief Potentially non-threadsafe versions of the functions in http.h: pr ovided
only for backwards compatibility. only for backwards compatibility.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <event2/event-config.h> #include <event2/event-config.h>
#ifdef EVENT__HAVE_SYS_TYPES_H #ifdef EVENT__HAVE_SYS_TYPES_H
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 listener.h (2.1.11)   listener.h (current) 
skipping to change at line 41 skipping to change at line 41
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <event2/event.h> #include <event2/event.h>
struct sockaddr; struct sockaddr;
struct evconnlistener; struct evconnlistener;
/** /**@file event2/listener.h
A callback that we invoke when a listener has a new connection.
@brief A callback that we invoke when a listener has a new connection.
@param listener The evconnlistener @param listener The evconnlistener
@param fd The new file descriptor @param fd The new file descriptor
@param addr The source address of the connection @param addr The source address of the connection
@param socklen The length of addr @param socklen The length of addr
@param user_arg the pointer passed to evconnlistener_new() @param user_arg the pointer passed to evconnlistener_new()
*/ */
typedef void (*evconnlistener_cb)(struct evconnlistener *, evutil_socket_t, struct sockaddr *, int socklen, void *); typedef void (*evconnlistener_cb)(struct evconnlistener *, evutil_socket_t, struct sockaddr *, int socklen, void *);
/** /**
skipping to change at line 146 skipping to change at line 147
on a given address. on a given address.
@param base The event base to associate the listener with. @param base The event base to associate the listener with.
@param cb A callback to be invoked when a new connection arrives. If the @param cb A callback to be invoked when a new connection arrives. If the
callback is NULL, the listener will be treated as disabled until the callback is NULL, the listener will be treated as disabled until the
callback is set. callback is set.
@param ptr A user-supplied pointer to give to the callback. @param ptr A user-supplied pointer to give to the callback.
@param flags Any number of LEV_OPT_* flags @param flags Any number of LEV_OPT_* flags
@param backlog Passed to the listen() call to determine the length of th e @param backlog Passed to the listen() call to determine the length of th e
acceptable connection backlog. Set to -1 for a reasonable default. acceptable connection backlog. Set to -1 for a reasonable default.
@param addr The address to listen for connections on. @param sa The address to listen for connections on.
@param socklen The length of the address. @param socklen The length of the address.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evconnlistener *evconnlistener_new_bind(struct event_base *base, struct evconnlistener *evconnlistener_new_bind(struct event_base *base,
evconnlistener_cb cb, void *ptr, unsigned flags, int backlog, evconnlistener_cb cb, void *ptr, unsigned flags, int backlog,
const struct sockaddr *sa, int socklen); const struct sockaddr *sa, int socklen);
/** /**
Disable and deallocate an evconnlistener. Disable and deallocate an evconnlistener.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
 End of changes. 2 change blocks. 
3 lines changed or deleted 4 lines changed or added


 rpc.h (2.1.11)   rpc.h (current) 
skipping to change at line 38 skipping to change at line 38
#define EVENT2_RPC_H_INCLUDED_ #define EVENT2_RPC_H_INCLUDED_
/* For int types. */ /* For int types. */
#include <event2/util.h> #include <event2/util.h>
#include <event2/visibility.h> #include <event2/visibility.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** @file rpc.h /** @file event2/rpc.h
* *
* This header files provides basic support for an RPC server and client. * @brief This header files provides basic support for an RPC server and cl ient.
* *
* To support RPCs in a server, every supported RPC command needs to be * To support RPCs in a server, every supported RPC command needs to be
* defined and registered. * defined and registered.
* *
* EVRPC_HEADER(SendCommand, Request, Reply); * EVRPC_HEADER(SendCommand, Request, Reply);
* *
* SendCommand is the name of the RPC command. * SendCommand is the name of the RPC command.
* Request is the name of a structure generated by event_rpcgen.py. * Request is the name of a structure generated by event_rpcgen.py.
* It contains all parameters relating to the SendCommand RPC. The * It contains all parameters relating to the SendCommand RPC. The
* server needs to fill in the Reply structure. * server needs to fill in the Reply structure.
skipping to change at line 172 skipping to change at line 172
struct evrpc_hook_meta; struct evrpc_hook_meta;
/** Creates the definitions and prototypes for an RPC /** Creates the definitions and prototypes for an RPC
* *
* You need to use EVRPC_HEADER to create structures and function prototype s * You need to use EVRPC_HEADER to create structures and function prototype s
* needed by the server and client implementation. The structures have to be * needed by the server and client implementation. The structures have to be
* defined in an .rpc file and converted to source code via event_rpcgen.py * defined in an .rpc file and converted to source code via event_rpcgen.py
* *
* @param rpcname the name of the RPC * @param rpcname the name of the RPC
* @param reqstruct the name of the RPC request structure * @param reqstruct the name of the RPC request structure
* @param replystruct the name of the RPC reply structure * @param rplystruct the name of the RPC reply structure
* @see EVRPC_GENERATE() * @see EVRPC_GENERATE()
*/ */
#define EVRPC_HEADER(rpcname, reqstruct, rplystruct) \ #define EVRPC_HEADER(rpcname, reqstruct, rplystruct) \
EVRPC_STRUCT(rpcname) { \ EVRPC_STRUCT(rpcname) { \
struct evrpc_hook_meta *hook_meta; \ struct evrpc_hook_meta *hook_meta; \
struct reqstruct* request; \ struct reqstruct* request; \
struct rplystruct* reply; \ struct rplystruct* reply; \
struct evrpc* rpc; \ struct evrpc* rpc; \
struct evhttp_request* http_req; \ struct evhttp_request* http_req; \
struct evbuffer* rpc_data; \ struct evbuffer* rpc_data; \
skipping to change at line 211 skipping to change at line 211
void (*cb)(struct evrpc_status *, void *, void *, void *), void (*cb)(struct evrpc_status *, void *, void *, void *),
void *cbarg); void *cbarg);
/** Creates a context structure that contains rpc specific information. /** Creates a context structure that contains rpc specific information.
* *
* EVRPC_MAKE_CTX is used to populate a RPC specific context that * EVRPC_MAKE_CTX is used to populate a RPC specific context that
* contains information about marshaling the RPC data types. * contains information about marshaling the RPC data types.
* *
* @param rpcname the name of the RPC * @param rpcname the name of the RPC
* @param reqstruct the name of the RPC request structure * @param reqstruct the name of the RPC request structure
* @param replystruct the name of the RPC reply structure * @param rplystruct the name of the RPC reply structure
* @param pool the evrpc_pool over which to make the request * @param pool the evrpc_pool over which to make the request
* @param request a pointer to the RPC request structure object * @param request a pointer to the RPC request structure object
* @param reply a pointer to the RPC reply structure object * @param reply a pointer to the RPC reply structure object
* @param cb the callback function to call when the RPC has completed * @param cb the callback function to call when the RPC has completed
* @param cbarg the argument to supply to the callback * @param cbarg the argument to supply to the callback
*/ */
#define EVRPC_MAKE_CTX(rpcname, reqstruct, rplystruct, \ #define EVRPC_MAKE_CTX(rpcname, reqstruct, rplystruct, \
pool, request, reply, cb, cbarg) \ pool, request, reply, cb, cbarg) \
evrpc_make_request_ctx(pool, request, reply, \ evrpc_make_request_ctx(pool, request, reply, \
#rpcname, \ #rpcname, \
skipping to change at line 235 skipping to change at line 235
(void (*)(struct evrpc_status *, void *, void *, void *))cb, \ (void (*)(struct evrpc_status *, void *, void *, void *))cb, \
cbarg) cbarg)
/** Generates the code for receiving and sending an RPC message /** Generates the code for receiving and sending an RPC message
* *
* EVRPC_GENERATE is used to create the code corresponding to sending * EVRPC_GENERATE is used to create the code corresponding to sending
* and receiving a particular RPC message * and receiving a particular RPC message
* *
* @param rpcname the name of the RPC * @param rpcname the name of the RPC
* @param reqstruct the name of the RPC request structure * @param reqstruct the name of the RPC request structure
* @param replystruct the name of the RPC reply structure * @param rplystruct the name of the RPC reply structure
* @see EVRPC_HEADER() * @see EVRPC_HEADER()
*/ */
#define EVRPC_GENERATE(rpcname, reqstruct, rplystruct) \ #define EVRPC_GENERATE(rpcname, reqstruct, rplystruct) \
int evrpc_send_request_##rpcname(struct evrpc_pool *pool, \ int evrpc_send_request_##rpcname(struct evrpc_pool *pool, \
struct reqstruct *request, struct rplystruct *reply, \ struct reqstruct *request, struct rplystruct *reply, \
void (*cb)(struct evrpc_status *, \ void (*cb)(struct evrpc_status *, \
struct reqstruct *, struct rplystruct *, void *cbarg), \ struct reqstruct *, struct rplystruct *, void *cbarg), \
void *cbarg) { \ void *cbarg) { \
return evrpc_send_request_generic(pool, request, reply, \ return evrpc_send_request_generic(pool, request, reply, \
(void (*)(struct evrpc_status *, void *, void *, void *))cb, \ (void (*)(struct evrpc_status *, void *, void *, void *))cb, \
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added


 rpc_compat.h (2.1.11)   rpc_compat.h (current) 
skipping to change at line 32 skipping to change at line 32
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_RPC_COMPAT_H_INCLUDED_ #ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
#define EVENT2_RPC_COMPAT_H_INCLUDED_ #define EVENT2_RPC_COMPAT_H_INCLUDED_
/** @file event2/rpc_compat.h /** @file event2/rpc_compat.h
Deprecated versions of the functions in rpc.h: provided only for @brief Deprecated versions of the functions in rpc.h: provided only for
backwards compatibility. backwards compatibility.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** backwards compatible accessors that work only with gcc */ /** backwards compatible accessors that work only with gcc */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 tag.h (2.1.11)   tag.h (current) 
skipping to change at line 32 skipping to change at line 32
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_TAG_H_INCLUDED_ #ifndef EVENT2_TAG_H_INCLUDED_
#define EVENT2_TAG_H_INCLUDED_ #define EVENT2_TAG_H_INCLUDED_
/** @file event2/tag.h /** @file event2/tag.h
Helper functions for reading and writing tagged data onto buffers. @brief Helper functions for reading and writing tagged data onto buffers.
*/ */
#include <event2/visibility.h> #include <event2/visibility.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <event2/event-config.h> #include <event2/event-config.h>
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 tag_compat.h (2.1.11)   tag_compat.h (current) 
skipping to change at line 32 skipping to change at line 32
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_TAG_COMPAT_H_INCLUDED_ #ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
#define EVENT2_TAG_COMPAT_H_INCLUDED_ #define EVENT2_TAG_COMPAT_H_INCLUDED_
/** @file event2/tag_compat.h /** @file event2/tag_compat.h
Obsolete/deprecated functions from tag.h; provided only for backwards @brief Obsolete/deprecated functions from tag.h; provided only for back wards
compatibility. compatibility.
*/ */
/** /**
@name Misnamed functions @name Misnamed functions
@deprecated These macros are deprecated because their names don't follow @deprecated These macros are deprecated because their names don't follow
Libevent's naming conventions. Use evtag_encode_int and Libevent's naming conventions. Use evtag_encode_int and
evtag_encode_int64 instead. evtag_encode_int64 instead.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 thread.h (2.1.11)   thread.h (current) 
skipping to change at line 31 skipping to change at line 31
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_THREAD_H_INCLUDED_ #ifndef EVENT2_THREAD_H_INCLUDED_
#define EVENT2_THREAD_H_INCLUDED_ #define EVENT2_THREAD_H_INCLUDED_
/** @file event2/thread.h /** @file event2/thread.h
Functions for multi-threaded applications using Libevent. @brief Functions for multi-threaded applications using Libevent.
When using a multi-threaded application in which multiple threads When using a multi-threaded application in which multiple threads
add and delete events from a single event base, Libevent needs to add and delete events from a single event base, Libevent needs to
lock its data structures. lock its data structures.
Like the memory-management function hooks, all of the threading functions Like the memory-management function hooks, all of the threading functions
_must_ be set up before an event_base is created if you want the base to _must_ be set up before an event_base is created if you want the base to
use them. use them.
Most programs will either be using Windows threads or Posix threads. You Most programs will either be using Windows threads or Posix threads. You
can configure Libevent to use one of these event_use_windows_threads() or can configure Libevent to use one of these evthread_use_windows_threads()
event_use_pthreads() respectively. If you're using another threading or
evthread_use_pthreads() respectively. If you're using another threading
library, you'll need to configure threading functions manually using library, you'll need to configure threading functions manually using
evthread_set_lock_callbacks() and evthread_set_condition_callbacks(). evthread_set_lock_callbacks() and evthread_set_condition_callbacks().
*/ */
#include <event2/visibility.h> #include <event2/visibility.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
skipping to change at line 187 skipping to change at line 187
* probably shouldn't call this function; instead, use * probably shouldn't call this function; instead, use
* evthread_use_windows_threads() or evthread_use_pthreads() if you can. * evthread_use_windows_threads() or evthread_use_pthreads() if you can.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evthread_set_condition_callbacks( int evthread_set_condition_callbacks(
const struct evthread_condition_callbacks *); const struct evthread_condition_callbacks *);
/** /**
Sets the function for determining the thread id. Sets the function for determining the thread id.
@param base the event base for which to set the id function
@param id_fn the identify function Libevent should invoke to @param id_fn the identify function Libevent should invoke to
determine the identity of a thread. determine the identity of a thread.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evthread_set_id_callback( void evthread_set_id_callback(
unsigned long (*id_fn)(void)); unsigned long (*id_fn)(void));
#if (defined(_WIN32) && !defined(EVENT__DISABLE_THREAD_SUPPORT)) || defined (EVENT_IN_DOXYGEN_) #if (defined(_WIN32) && !defined(EVENT__DISABLE_THREAD_SUPPORT)) || defined (EVENT_IN_DOXYGEN_)
/** Sets up Libevent for use with Windows builtin locking and thread ID /** Sets up Libevent for use with Windows builtin locking and thread ID
functions. Unavailable if Libevent is not built for Windows. functions. Unavailable if Libevent is not built for Windows.
skipping to change at line 216 skipping to change at line 215
#endif #endif
#if defined(EVENT__HAVE_PTHREADS) || defined(EVENT_IN_DOXYGEN_) #if defined(EVENT__HAVE_PTHREADS) || defined(EVENT_IN_DOXYGEN_)
/** Sets up Libevent for use with Pthreads locking and thread ID functions. /** Sets up Libevent for use with Pthreads locking and thread ID functions.
Unavailable if Libevent is not build for use with pthreads. Requires Unavailable if Libevent is not build for use with pthreads. Requires
libraries to link against Libevent_pthreads as well as Libevent. libraries to link against Libevent_pthreads as well as Libevent.
@return 0 on success, -1 on failure. */ @return 0 on success, -1 on failure. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evthread_use_pthreads(void); int evthread_use_pthreads(void);
/* Enables posix mutex priority inheritance. */
#define EVTHREAD_PTHREAD_PRIO_INHERIT 0x01
/**
* Sets up Libevent for use with Pthreads locking and thread ID functions.
* Use evthred_use_pthreads_with_flags() to use Pthreads locking, taking th
e
* specified flags under consideration.
*
* @param flags the flags to apply when setting up Pthreads locking. @see E
VTHREAD_PTHREAD_*
* @return 0 on success, -1 on failure.
**/
EVENT2_EXPORT_SYMBOL
int evthread_use_pthreads_with_flags(int flags);
/** Defined if Libevent was built with support for evthread_use_pthreads() */ /** Defined if Libevent was built with support for evthread_use_pthreads() */
#define EVTHREAD_USE_PTHREADS_IMPLEMENTED 1 #define EVTHREAD_USE_PTHREADS_IMPLEMENTED 1
#endif #endif
/** Enable debugging wrappers around the current lock callbacks. If Libeve nt /** Enable debugging wrappers around the current lock callbacks. If Libeve nt
* makes one of several common locking errors, exit with an assertion failu re. * makes one of several common locking errors, exit with an assertion failu re.
* *
* If you're going to call this function, you must do so before any locks a re * If you're going to call this function, you must do so before any locks a re
* allocated. * allocated.
 End of changes. 4 change blocks. 
4 lines changed or deleted 21 lines changed or added


 util.h (2.1.11)   util.h (current) 
skipping to change at line 31 skipping to change at line 31
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef EVENT2_UTIL_H_INCLUDED_ #ifndef EVENT2_UTIL_H_INCLUDED_
#define EVENT2_UTIL_H_INCLUDED_ #define EVENT2_UTIL_H_INCLUDED_
/** @file event2/util.h /** @file event2/util.h
Common convenience functions for cross-platform portability and @brief Common convenience functions for cross-platform portability and
related socket manipulations. related socket manipulations.
*/ */
#include <event2/visibility.h> #include <event2/visibility.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <event2/event-config.h> #include <event2/event-config.h>
skipping to change at line 613 skipping to change at line 613
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap) int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__((format(printf, 3, 0))) __attribute__((format(printf, 3, 0)))
#endif #endif
; ;
/** Replacement for inet_ntop for platforms which lack it. */ /** Replacement for inet_ntop for platforms which lack it. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
const char *evutil_inet_ntop(int af, const void *src, char *dst, size_t len ); const char *evutil_inet_ntop(int af, const void *src, char *dst, size_t len );
/** Variation of inet_pton that also parses IPv6 scopes. Public for
unit tests. No reason to call this directly.
*/
EVENT2_EXPORT_SYMBOL
int evutil_inet_pton_scope(int af, const char *src, void *dst,
unsigned *indexp);
/** Replacement for inet_pton for platforms which lack it. */ /** Replacement for inet_pton for platforms which lack it. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evutil_inet_pton(int af, const char *src, void *dst); int evutil_inet_pton(int af, const char *src, void *dst);
struct sockaddr; struct sockaddr;
/** Parse an IPv4 or IPv6 address, with optional port, from a string. /** Parse an IPv4 or IPv6 address, with optional port, from a string.
Recognized formats are: Recognized formats are:
- [IPv6Address]:port - [IPv6Address]:port
- [IPv6Address] - [IPv6Address]
 End of changes. 2 change blocks. 
1 lines changed or deleted 7 lines changed or added

This html diff was produced by rfcdiff 1.41.The latest version is available from http://tools.ietf.org/tools/rfcdiff/