ABI
Tracker

(Libevent)




Headers diff: 2.1.12 vs current



 event.h (2.1.12)   event.h (current) 
skipping to change at line 57 skipping to change at line 57
#endif #endif
#ifdef EVENT__HAVE_SYS_TIME_H #ifdef EVENT__HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#ifdef EVENT__HAVE_STDINT_H #ifdef EVENT__HAVE_STDINT_H
#include <stdint.h> #include <stdint.h>
#endif #endif
#include <stdarg.h> #include <stdarg.h>
/* For int types. */ /* For int types. */
#include <evutil.h> #include <event2/util.h>
#ifdef _WIN32 #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <winsock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 buffer.h (2.1.12)   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 531 skipping to change at line 552
@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 evbuffer_add_file(struct evbuffer *outbuf, int fd, ev_off_t offset, int evbuffer_add_file(struct evbuffer *outbuf, int fd, ev_off_t offset,
ev_off_t length); ev_off_t length);
/** /**
An evbuffer_file_segment holds a reference to a range of a file -- An evbuffer_file_segment holds a reference to a range of a file --
possibly the whole file! -- for use in writing from an evbuffer to a possibly the whole file! -- for use in writing from an evbuffer to a
socket. It could be implemented with mmap, sendfile, splice, or (if all socket. It could be implemented with mmap or sendfile, or (if all else
else fails) by just pulling all the data into RAM. A single fails) by just pulling all the data into RAM. A single evbuffer_file_segm
evbuffer_file_segment can be added more than once, and to more than one ent
evbuffer. can be added more than once, and to more than one evbuffer.
*/ */
struct evbuffer_file_segment; struct evbuffer_file_segment;
/** /**
Flag for creating evbuffer_file_segment: If this flag is set, then when Flag for creating evbuffer_file_segment: If this flag is set, then when
the evbuffer_file_segment is freed and no longer in use by any the evbuffer_file_segment is freed and no longer in use by any
evbuffer, the underlying fd is closed. evbuffer, the underlying fd is closed.
*/ */
#define EVBUF_FS_CLOSE_ON_FREE 0x01 #define EVBUF_FS_CLOSE_ON_FREE 0x01
/** /**
Flag for creating evbuffer_file_segment: Disable memory-map based Flag for creating evbuffer_file_segment: Disable memory-map based
implementations. implementations.
*/ */
#define EVBUF_FS_DISABLE_MMAP 0x02 #define EVBUF_FS_DISABLE_MMAP 0x02
/** /**
Flag for creating evbuffer_file_segment: Disable direct fd-to-fd Flag for creating evbuffer_file_segment: Disable direct fd-to-fd
implementations (including sendfile and splice). implementations (sendfile).
You might want to use this option if data needs to be taken from the You might want to use this option if data needs to be taken from the
evbuffer by any means other than writing it to the network: the sendfile evbuffer by any means other than writing it to the network: the sendfile
backend is fast, but it only works for sending files directly to the backend is fast, but it only works for sending files directly to the
network. network.
*/ */
#define EVBUF_FS_DISABLE_SENDFILE 0x04 #define EVBUF_FS_DISABLE_SENDFILE 0x04
/** /**
Flag for creating evbuffer_file_segment: Do not allocate a lock for this Flag for creating evbuffer_file_segment: Do not allocate a lock for this
segment. If this option is set, then neither the segment nor any segment. If this option is set, then neither the segment nor any
skipping to change at line 579 skipping to change at line 599
for reference. for reference.
*/ */
typedef void (*evbuffer_file_segment_cleanup_cb)( typedef void (*evbuffer_file_segment_cleanup_cb)(
struct evbuffer_file_segment const* seg, int flags, void* arg); struct evbuffer_file_segment const* seg, int flags, void* arg);
/** /**
Create and return a new evbuffer_file_segment for reading data from a Create and return a new evbuffer_file_segment for reading data from a
file and sending it out via an evbuffer. file and sending it out via an evbuffer.
This function avoids unnecessary data copies between userland and This function avoids unnecessary data copies between userland and
kernel. Where available, it uses sendfile or splice. kernel. Where available, it uses sendfile.
The file descriptor must not be closed so long as any evbuffer is using The file descriptor must not be closed so long as any evbuffer is using
this segment. this segment.
The results of using evbuffer_remove() or evbuffer_pullup() or any other The results of using evbuffer_remove() or evbuffer_pullup() or any other
function that reads bytes from an evbuffer on any evbuffer containing function that reads bytes from an evbuffer on any evbuffer containing
the newly returned segment are undefined, unless you pass the the newly returned segment are undefined, unless you pass the
EVBUF_FS_DISABLE_SENDFILE flag to this function. EVBUF_FS_DISABLE_SENDFILE flag to this function.
@param fd an open file to read from. @param fd an open file to read from.
 End of changes. 7 change blocks. 
11 lines changed or deleted 34 lines changed or added


 buffer_compat.h (2.1.12)   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.12)   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 358 skipping to change at line 379
Changes the file descriptor on which the bufferevent operates. Changes the file descriptor on which the bufferevent operates.
Not supported for all bufferevent types. Not supported for all bufferevent types.
@param bufev the bufferevent object for which to change the file descript or @param bufev the bufferevent object for which to change the file descript or
@param fd the file descriptor to operate on @param fd the file descriptor to operate on
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd); int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd);
/** /**
Replaces the file descriptor on which the bufferevent operates.
Not supported for all bufferevent types.
Unlike bufferevent_setfd() it will close previous file descriptor (if any
).
@param bufev the bufferevent object for which to change the file descript
or
@param fd the file descriptor to operate on
*/
EVENT2_EXPORT_SYMBOL
int bufferevent_replacefd(struct bufferevent *bufev, evutil_socket_t fd);
/**
Returns the file descriptor associated with a bufferevent, or -1 if Returns the file descriptor associated with a bufferevent, or -1 if
no file descriptor is associated with the bufferevent. no file descriptor is associated with the bufferevent.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
evutil_socket_t bufferevent_getfd(struct bufferevent *bufev); evutil_socket_t bufferevent_getfd(struct bufferevent *bufev);
/** /**
Returns the underlying bufferevent associated with a bufferevent (if Returns the underlying bufferevent associated with a bufferevent (if
the bufferevent is a wrapper), or NULL if there is no underlying buffere vent. the bufferevent is a wrapper), or NULL if there is no underlying buffere vent.
*/ */
skipping to change at line 408 skipping to change at line 441
int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *bu f); int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *bu f);
/** /**
Read data from a bufferevent buffer. Read data from a bufferevent buffer.
The bufferevent_read() function is used to read data from the input buffe r. The bufferevent_read() function is used to read data from the input buffe r.
@param bufev the bufferevent to be read from @param bufev the bufferevent to be read from
@param data pointer to a buffer that will store the data @param data pointer to a buffer that will store the data
@param size the size of the data buffer, in bytes @param size the size of the data buffer, in bytes
@return the amount of data read, in bytes. @return the amount of data read, in bytes. If 0 is returned, it is possib
le
that there is no data in the buffer or that the read failed.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size) ; size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size) ;
/** /**
Read data from a bufferevent buffer into an evbuffer. This avoids Read data from a bufferevent buffer into an evbuffer. This avoids
memory copies. memory copies.
@param bufev the bufferevent to be read from @param bufev the bufferevent to be read from
@param buf the evbuffer to which to add data @param buf the evbuffer to which to add data
skipping to change at line 889 skipping to change at line 923
/** 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. 7 change blocks. 
8 lines changed or deleted 52 lines changed or added


 bufferevent_compat.h (2.1.12)   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.12)   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
/* This is what openssl's SSL objects are underneath. */
struct ssl_st;
/** /**
The state of an SSL object to be used when creating a new The state of an SSL object to be used when creating a new
SSL bufferevent. SSL bufferevent.
*/ */
enum bufferevent_ssl_state { enum bufferevent_ssl_state {
BUFFEREVENT_SSL_OPEN = 0, BUFFEREVENT_SSL_OPEN = 0,
BUFFEREVENT_SSL_CONNECTING = 1, BUFFEREVENT_SSL_CONNECTING = 1,
BUFFEREVENT_SSL_ACCEPTING = 2 BUFFEREVENT_SSL_ACCEPTING = 2
}; };
/** Control how to report dirty SSL shutdowns.
If the peer (or the network, or an attacker) closes the TCP
connection before closing the SSL channel, and the protocol is SSL >= v
3,
this is a "dirty" shutdown. If BUFFEREVENT_SSL_DIRTY_SHUTDOWN is not s
et
(default), this is reported as BEV_EVENT_ERROR.
If instead BUFFEREVENT_SSL_DIRTY_SHUTDOWN is set, a dirty shutdown is
reported as BEV_EVENT_EOF.
(Note that if the protocol is < SSLv3, you will always receive
BEV_EVENT_EOF, since SSL 2 and earlier cannot distinguish a secure
connection close from a dirty one. This is one reason (among many)
not to use SSL 2.)
*/
#define BUFFEREVENT_SSL_DIRTY_SHUTDOWN 1
/** Control writes in the SSL bufferevents.
By default SSL bufferevent will peek bytes from the buffer as the arriv
ed.
with respect to the segment boundaries in the buffer.
However, by ignoring these segment boundaries number of packets to send
can be decreased.
This flags will ignore the segment boundaries.
Useful in conjunction with http layer.
*/
#define BUFFEREVENT_SSL_BATCH_WRITE 2
#if defined(EVENT__HAVE_OPENSSL) || defined(EVENT__HAVE_MBEDTLS)
/**
* Get flags of the SSL bufferevent.
*
* @see BUFFEREVENT_SSL_*
* @return flags or SIZE_MAX in case of error (if bufferevent is not SSL).
*/
EVENT2_EXPORT_SYMBOL
ev_uint64_t bufferevent_ssl_get_flags(struct bufferevent *bev);
/** Change the flags that are set for an ssl bufferevent by adding more.
*
* @param bev the ssl bufferevent.
* @param flags One or more BUFFEREVENT_SSL_* options
* @return old flags success, EV_UINT64_MAX on failure.
*/
EVENT2_EXPORT_SYMBOL
ev_uint64_t bufferevent_ssl_set_flags(struct bufferevent *bev, ev_uint64_t
flags);
/** Change the flags that are set for an ssl bufferevent by removing some.
*
* @param bev the bufferevent.
* @param flags One or more BUFFEREVENT_SSL_* options
* @return old flags success, EV_UINT64_MAX on failure.
*/
EVENT2_EXPORT_SYMBOL
ev_uint64_t bufferevent_ssl_clear_flags(struct bufferevent *bev, ev_uint64_
t flags);
#endif /* defined(EVENT__HAVE_OPENSSL) || defined(EVENT__HAVE_MBEDTLS) */
#if defined(EVENT__HAVE_OPENSSL) || defined(EVENT_IN_DOXYGEN_) #if defined(EVENT__HAVE_OPENSSL) || defined(EVENT_IN_DOXYGEN_)
/* This is what openssl's SSL objects are underneath. */
struct ssl_st;
/** /**
Create a new SSL bufferevent to send its data over another bufferevent. Create a new SSL bufferevent to send its data over another bufferevent.
@param base An event_base to use to detect reading and writing. It @param base An event_base to use to detect reading and writing. It
must also be the base for the underlying bufferevent. must also be the base for the underlying bufferevent.
@param underlying A socket to use for this SSL @param underlying A socket to use for this SSL
@param ssl A SSL* object from openssl. @param ssl A SSL* object from openssl.
@param state The current state of the SSL connection @param state The current state of the SSL connection
@param options One or more bufferevent_options @param options One or more bufferevent_options
@return A new bufferevent on success, or NULL on failure @return A new bufferevent on success, or NULL on failure
skipping to change at line 93 skipping to change at line 150
@return A new bufferevent on success, or NULL on failure. @return A new bufferevent on success, or NULL on failure.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct bufferevent * struct bufferevent *
bufferevent_openssl_socket_new(struct event_base *base, bufferevent_openssl_socket_new(struct event_base *base,
evutil_socket_t fd, evutil_socket_t fd,
struct ssl_st *ssl, struct ssl_st *ssl,
enum bufferevent_ssl_state state, enum bufferevent_ssl_state state,
int options); int options);
/** Control how to report dirty SSL shutdowns. /**
* Get value of the BUFFEREVENT_SSL_DIRTY_SHUTDOWN flag.
If the peer (or the network, or an attacker) closes the TCP *
connection before closing the SSL channel, and the protocol is SSL >= v * @see BUFFEREVENT_SSL_DIRTY_SHUTDOWN
3, * @deprecated This function is deprecated, use bufferevent_ssl_get_flags()
this is a "dirty" shutdown. If allow_dirty_shutdown is 0 (default), instead.
this is reported as BEV_EVENT_ERROR. * @see bufferevent_ssl_get_flags()
*/
If instead allow_dirty_shutdown=1, a dirty shutdown is reported as
BEV_EVENT_EOF.
(Note that if the protocol is < SSLv3, you will always receive
BEV_EVENT_EOF, since SSL 2 and earlier cannot distinguish a secure
connection close from a dirty one. This is one reason (among many)
not to use SSL 2.)
*/
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev); int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev);
/**
* Set value of the BUFFEREVENT_SSL_DIRTY_SHUTDOWN flag.
*
* @see BUFFEREVENT_SSL_DIRTY_SHUTDOWN
* @deprecated This function is deprecated, use bufferevent_ssl_set_flags()
instead.
* @see bufferevent_ssl_set_flags()
*/
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev, void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev,
int allow_dirty_shutdown); int allow_dirty_shutdown);
/** Return the underlying openssl SSL * object for an SSL bufferevent. */ /** Return the underlying openssl SSL * object for an SSL bufferevent. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct ssl_st * struct ssl_st *
bufferevent_openssl_get_ssl(struct bufferevent *bufev); bufferevent_openssl_get_ssl(struct bufferevent *bufev);
/** Tells a bufferevent to begin SSL renegotiation. */ /** Tells a bufferevent to begin SSL renegotiation. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int bufferevent_ssl_renegotiate(struct bufferevent *bev); int bufferevent_ssl_renegotiate(struct bufferevent *bev);
/** Return the most recent OpenSSL error reported on an SSL bufferevent. */ /** Return the most recent OpenSSL error reported on an SSL bufferevent. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
unsigned long bufferevent_get_openssl_error(struct bufferevent *bev); unsigned long bufferevent_get_openssl_error(struct bufferevent *bev);
#endif #endif
#if defined(EVENT__HAVE_MBEDTLS) || defined(EVENT_IN_DOXYGEN_)
struct mbedtls_ssl_context;
struct mbedtls_ssl_config;
typedef struct mbedtls_ssl_context mbedtls_dyncontext;
/**
Create a new SSL bufferevent to send its data over another bufferevent.
@param base An event_base to use to detect reading and writing. It
must also be the base for the underlying bufferevent.
@param underlying A socket to use for this SSL
@param ssl A SSL* object from openssl.
@param state The current state of the SSL connection
@param options One or more bufferevent_options
@return A new bufferevent on success, or NULL on failure
*/
EVENT2_EXPORT_SYMBOL
struct bufferevent *
bufferevent_mbedtls_filter_new(struct event_base *base,
struct bufferevent *underlying,
mbedtls_dyncontext *ssl,
enum bufferevent_ssl_state state,
int options);
/**
Create a new SSL bufferevent to send its data over an SSL * on a socket.
@param base An event_base to use to detect reading and writing
@param fd A socket to use for this SSL
@param ssl A SSL* object from mbedtls.
@param state The current state of the SSL connection
@param options One or more bufferevent_options
@return A new bufferevent on success, or NULL on failure.
*/
EVENT2_EXPORT_SYMBOL
struct bufferevent *
bufferevent_mbedtls_socket_new(struct event_base *base,
evutil_socket_t fd,
mbedtls_dyncontext *ssl,
enum bufferevent_ssl_state state,
int options);
/**
* Get value of the BUFFEREVENT_SSL_DIRTY_SHUTDOWN flag.
*
* @see BUFFEREVENT_SSL_DIRTY_SHUTDOWN
* @deprecated This function is deprecated, use bufferevent_ssl_get_flags()
instead.
* @see bufferevent_ssl_get_flags()
*/
EVENT2_EXPORT_SYMBOL
int bufferevent_mbedtls_get_allow_dirty_shutdown(struct bufferevent *bev);
/**
* Set value of the BUFFEREVENT_SSL_DIRTY_SHUTDOWN flag.
*
* @see BUFFEREVENT_SSL_DIRTY_SHUTDOWN
* @deprecated This function is deprecated, use bufferevent_ssl_set_flags()
instead.
* @see bufferevent_ssl_set_flags()
*/
EVENT2_EXPORT_SYMBOL
void bufferevent_mbedtls_set_allow_dirty_shutdown(struct bufferevent *bev,
int allow_dirty_shutdown);
/** Return the underlying mbedtls SSL * object for an SSL bufferevent. */
EVENT2_EXPORT_SYMBOL
struct mbedtls_ssl_context *
bufferevent_mbedtls_get_ssl(struct bufferevent *bufev);
/** Tells a bufferevent to begin SSL renegotiation. */
EVENT2_EXPORT_SYMBOL
int bufferevent_mbedtls_renegotiate(struct bufferevent *bev);
/** Return the most recent MbedTLS error reported on an SSL bufferevent. */
EVENT2_EXPORT_SYMBOL
unsigned long bufferevent_get_mbedtls_error(struct bufferevent *bev);
/** Create a new heap-based MbedTLS context for use it in bufferevent_mbedt
ls_* functions */
EVENT2_EXPORT_SYMBOL
mbedtls_dyncontext *
bufferevent_mbedtls_dyncontext_new(struct mbedtls_ssl_config *conf);
/** Deallocate heap-based MbedTLS context */
EVENT2_EXPORT_SYMBOL
void
bufferevent_mbedtls_dyncontext_free(mbedtls_dyncontext *ctx);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ */ #endif /* EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ */
 End of changes. 7 change blocks. 
21 lines changed or deleted 171 lines changed or added


 bufferevent_struct.h (2.1.12)   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.12)   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 179 skipping to change at line 185
/** The request was canceled via a call to evdns_cancel_request */ /** The request was canceled via a call to evdns_cancel_request */
#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_CNAME 4
#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
/** Make a separate callback for CNAME in answer */
#define DNS_CNAME_CALLBACK 0x80
/* 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:
* - max-probe-timeout:
* - probe-backoff-factor:
* - 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 244 skipping to change at line 264
/** Flag for evdns_base_new: process resolv.conf. */ /** Flag for evdns_base_new: process resolv.conf. */
#define EVDNS_BASE_INITIALIZE_NAMESERVERS 1 #define EVDNS_BASE_INITIALIZE_NAMESERVERS 1
/** Flag for evdns_base_new: Do not prevent the libevent event loop from /** Flag for evdns_base_new: Do not prevent the libevent event loop from
* exiting when we have no active dns requests. */ * exiting when we have no active dns requests. */
#define EVDNS_BASE_DISABLE_WHEN_INACTIVE 0x8000 #define EVDNS_BASE_DISABLE_WHEN_INACTIVE 0x8000
/** Flag for evdns_base_new: If EVDNS_BASE_INITIALIZE_NAMESERVERS isset, do not /** Flag for evdns_base_new: If EVDNS_BASE_INITIALIZE_NAMESERVERS isset, do not
* add default nameserver if there are no nameservers in resolv.conf * add default nameserver if there are no nameservers in resolv.conf
* @see DNS_OPTION_NAMESERVERS_NO_DEFAULT */ * @see DNS_OPTION_NAMESERVERS_NO_DEFAULT */
#define EVDNS_BASE_NAMESERVERS_NO_DEFAULT 0x10000 #define EVDNS_BASE_NAMESERVERS_NO_DEFAULT 0x10000
/* No errors */
#define EVDNS_ERROR_NONE 0
/* Failed to open file */
#define EVDNS_ERROR_FAILED_TO_OPEN_FILE 1
/* Failed to stat file */
#define EVDNS_ERROR_FAILED_TO_STAT_FILE 2
/* File too large */
#define EVDNS_ERROR_FILE_TOO_LARGE 3
/* Out of memory */
#define EVDNS_ERROR_OUT_OF_MEMORY 4
/* Short read from file */
#define EVDNS_ERROR_SHORT_READ_FROM_FILE 5
/* No nameservers configured */
#define EVDNS_ERROR_NO_NAMESERVERS_CONFIGURED 6
/** /**
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 flags 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 flags );
/** /**
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 419
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 454 skipping to change at line 489
*/ */
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, max-probe-timeout, probe-backoff-factor
so-rcvbuf, so-sndbuf. ,
getaddrinfo-allow-skew, so-rcvbuf, so-sndbuf, tcp-idle-timeout, use-vc,
ignore-tc, edns-udp-size.
- probe-backoff-factor
Backoff factor of probe timeout
- max-probe-timeout
Maximum timeout between two probe packets will change initial-probe-tim
eout
when this value is smaller
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.
The 'flags' parameter determines what information is parsed from the The 'flags' parameter determines what information is parsed from the
resolv.conf file. See the man page for resolv.conf for the format of this resolv.conf file. See the man page for resolv.conf for the format of this
file. file.
The following directives are not parsed from the file: sortlist, rotate, The following directives are not parsed from the file: sortlist, rotate,
no-check-names, inet6, debug. no-check-names, inet6, debug.
If this function encounters an error, the possible return values are: 1 = If this function encounters an error, the possible return values are:
failed to open file, 2 = failed to stat file, 3 = file too large, 4 = out EVDNS_ERROR_FAILED_TO_OPEN_FILE (1) - failed to open file
of EVDNS_ERROR_FAILED_TO_STAT_FILE (2) - failed to stat file
memory, 5 = short read from file, 6 = no nameservers listed in the file EVDNS_ERROR_FILE_TOO_LARGE (3) - file too large
EVDNS_ERROR_OUT_OF_MEMORY (4) - out of memory
EVDNS_ERROR_SHORT_READ_FROM_FILE (5) - short read from file
EVDNS_ERROR_NO_NAMESERVERS_CONFIGURED (6) - no nameservers configured.
@param base the evdns_base to which to apply this operation @param base the evdns_base to which to apply this operation
@param flags any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_M ISC| @param flags any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_M ISC|
DNS_OPTION_HOSTSFILE|DNS_OPTIONS_ALL|DNS_OPTION_NAMESERVERS_NO_DEFAULT DNS_OPTION_HOSTSFILE|DNS_OPTIONS_ALL|DNS_OPTION_NAMESERVERS_NO_DEFAULT
@param filename the path to the resolv.conf file @param filename the path to the resolv.conf file
@return 0 if successful, or various positive error codes if an error @return 0 if successful, or various positive error codes if an error
occurred (see above) occurred (see above)
@see resolv.conf(3), evdns_config_windows_nameservers() @see resolv.conf(3), evdns_config_windows_nameservers()
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
skipping to change at line 568 skipping to change at line 618
/** /**
Set the callback function to handle DNS log messages. If this Set the callback function to handle DNS log messages. If this
callback is not set, evdns log messages are handled with the regular callback is not set, evdns log messages are handled with the regular
Libevent logging system. Libevent logging system.
@param fn the callback to be invoked when a log message is generated @param fn the callback to be invoked when a log message is generated
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evdns_set_log_fn(evdns_debug_log_fn_type fn); void evdns_set_log_fn(evdns_debug_log_fn_type fn);
/**
Set a callback that will be invoked to generate transaction IDs. By
default, we pick transaction IDs based on the current clock time, which
is bad for security.
@param fn the new callback, or NULL to use the default.
NOTE: This function has no effect in Libevent 2.0.4-alpha and later,
since Libevent now provides its own secure RNG.
*/
EVENT2_EXPORT_SYMBOL
void evdns_set_transaction_id_fn(ev_uint16_t (*fn)(void));
/**
Set a callback used to generate random bytes. By default, we use
the same function as passed to evdns_set_transaction_id_fn to generate
bytes two at a time. If a function is provided here, it's also used
to generate transaction IDs.
NOTE: This function has no effect in Libevent 2.0.4-alpha and later,
since Libevent now provides its own secure RNG.
*/
EVENT2_EXPORT_SYMBOL
void evdns_set_random_bytes_fn(void (*fn)(char *, size_t));
/* /*
* Functions used to implement a DNS server. * Functions used to implement a DNS server.
*/ */
struct evdns_server_request; struct evdns_server_request;
struct evdns_server_question; struct evdns_server_question;
/** /**
A callback to implement a DNS server. The callback function receives a DNS A callback to implement a DNS server. The callback function receives a DNS
request. It should then optionally add a number of answers to the reply request. It should then optionally add a number of answers to the reply
skipping to change at line 634 skipping to change at line 659
#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);
skipping to change at line 738 skipping to change at line 813
@param len The number of bytes available at sa. @param len The number of bytes available at sa.
@return the number of bytes written into sa on success. On failure, ret urns @return the number of bytes written into sa on success. On failure, ret urns
-1 if idx is greater than the number of configured nameservers, or a -1 if idx is greater than the number of configured nameservers, or a
value greater than 'len' if len was not high enough. value greater than 'len' if len was not high enough.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evdns_base_get_nameserver_addr(struct evdns_base *base, int idx, int evdns_base_get_nameserver_addr(struct evdns_base *base, int idx,
struct sockaddr *sa, ev_socklen_t len); struct sockaddr *sa, ev_socklen_t len);
/**
Retrieve the fd of the 'idx'th configured nameserver.
@param base The evdns_base to examine.
@param idx The index of the nameserver to get the address of.
@return the fd value. On failure, returns
-1 if idx is greater than the number of configured nameservers
*/
EVENT2_EXPORT_SYMBOL
int evdns_base_get_nameserver_fd(struct evdns_base *base, int idx);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* !EVENT2_DNS_H_INCLUDED_ */ #endif /* !EVENT2_DNS_H_INCLUDED_ */
 End of changes. 24 change blocks. 
42 lines changed or deleted 135 lines changed or added


 dns_compat.h (2.1.12)   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.12)   event-config.h (current) 
skipping to change at line 17 skipping to change at line 17
* *
* Do not rely on macros in this file existing in later versions. * Do not rely on macros in this file existing in later versions.
*/ */
#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_ #ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_
#define EVENT2_EVENT_CONFIG_H_INCLUDED_ #define EVENT2_EVENT_CONFIG_H_INCLUDED_
/* config.h. Generated from config.h.in by configure. */ /* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */ /* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
/* #undef EVENT__AC_APPLE_UNIVERSAL_BUILD */
/* Define if libevent should build without support for a debug mode */ /* Define if libevent should build without support for a debug mode */
/* #undef EVENT__DISABLE_DEBUG_MODE */ /* #undef EVENT__DISABLE_DEBUG_MODE */
/* 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. */
skipping to change at line 70 skipping to change at line 73
/* 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
/* Define to 1 if you have the `epoll_create1' function. */ /* Define to 1 if you have the `epoll_create1' function. */
#define EVENT__HAVE_EPOLL_CREATE1 1 #define EVENT__HAVE_EPOLL_CREATE1 1
/* Define to 1 if you have the `epoll_ctl' function. */ /* Define to 1 if you have the `epoll_ctl' function. */
#define EVENT__HAVE_EPOLL_CTL 1 #define EVENT__HAVE_EPOLL_CTL 1
/* Define to 1 if you have the `epoll_pwait2' function. */
/* #undef EVENT__HAVE_EPOLL_PWAIT2 */
/* Define to 1 if you have the <errno.h> header file. */ /* Define to 1 if you have the <errno.h> header file. */
#define EVENT__HAVE_ERRNO_H 1 #define EVENT__HAVE_ERRNO_H 1
/* Define to 1 if you have the `eventfd' function. */ /* Define to 1 if you have the `eventfd' function. */
#define EVENT__HAVE_EVENTFD 1 #define EVENT__HAVE_EVENTFD 1
/* Define if your system supports event ports */ /* Define if your system supports event ports */
/* #undef EVENT__HAVE_EVENT_PORTS */ /* #undef EVENT__HAVE_EVENT_PORTS */
/* Define to 1 if you have the `fcntl' function. */ /* Define to 1 if you have the `fcntl' function. */
skipping to change at line 160 skipping to change at line 166
/* 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. */ /* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef EVENT__HAVE_MACH_MACH_H */ /* #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 if the system has mbedtls */
/* #undef EVENT__HAVE_MBEDTLS */
/* Define to 1 if you have the <mbedtls/ssl.h> header file. */
/* #undef EVENT__HAVE_MBEDTLS_SSL_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 `mmap64' function. */
#define EVENT__HAVE_MMAP64 1
/* Define to 1 if you have the `nanosleep' function. */ /* Define to 1 if you have the `nanosleep' function. */
#define EVENT__HAVE_NANOSLEEP 1 #define EVENT__HAVE_NANOSLEEP 1
/* Define to 1 if you have the <netdb.h> header file. */ /* Define to 1 if you have the <netdb.h> header file. */
#define EVENT__HAVE_NETDB_H 1 #define EVENT__HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in6.h> header file. */ /* Define to 1 if you have the <netinet/in6.h> header file. */
/* #undef EVENT__HAVE_NETINET_IN6_H */ /* #undef EVENT__HAVE_NETINET_IN6_H */
/* Define to 1 if you have the <netinet/in.h> header file. */ /* Define to 1 if you have the <netinet/in.h> header file. */
skipping to change at line 205 skipping to change at line 220
/* Define to 1 if you have the <poll.h> header file. */ /* Define to 1 if you have the <poll.h> header file. */
#define EVENT__HAVE_POLL_H 1 #define EVENT__HAVE_POLL_H 1
/* Define to 1 if you have the `port_create' function. */ /* Define to 1 if you have the `port_create' function. */
/* #undef EVENT__HAVE_PORT_CREATE */ /* #undef EVENT__HAVE_PORT_CREATE */
/* Define to 1 if you have the <port.h> header file. */ /* Define to 1 if you have the <port.h> header file. */
/* #undef EVENT__HAVE_PORT_H */ /* #undef EVENT__HAVE_PORT_H */
/* Define if you have POSIX threads libraries and header files. */ /* Define to 1 if you have the `pread' function. */
/* #undef EVENT__HAVE_PTHREAD */ #define EVENT__HAVE_PREAD 1
/* Define if we have pthreads on this system */ /* Define if we have pthreads on this system */
#define EVENT__HAVE_PTHREADS 1 #define EVENT__HAVE_PTHREADS 1
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
#define EVENT__HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1
/* Have PTHREAD_PRIO_INHERIT. */
#define EVENT__HAVE_PTHREAD_PRIO_INHERIT 1
/* Define to 1 if you have the `putenv' function. */ /* Define to 1 if you have the `putenv' function. */
#define EVENT__HAVE_PUTENV 1 #define EVENT__HAVE_PUTENV 1
/* Define to 1 if the system has the type `sa_family_t'. */ /* Define to 1 if the system has the type `sa_family_t'. */
#define EVENT__HAVE_SA_FAMILY_T 1 #define EVENT__HAVE_SA_FAMILY_T 1
/* Define to 1 if you have the `select' function. */ /* Define to 1 if you have the `select' function. */
#define EVENT__HAVE_SELECT 1 #define EVENT__HAVE_SELECT 1
/* Define to 1 if you have the `sendfile' function. */ /* Define to 1 if you have the `sendfile' function. */
skipping to change at line 238 skipping to change at line 259
/* Define to 1 if you have the `setrlimit' function. */ /* Define to 1 if you have the `setrlimit' function. */
#define EVENT__HAVE_SETRLIMIT 1 #define EVENT__HAVE_SETRLIMIT 1
/* Define to 1 if you have the `sigaction' function. */ /* Define to 1 if you have the `sigaction' function. */
#define EVENT__HAVE_SIGACTION 1 #define EVENT__HAVE_SIGACTION 1
/* Define to 1 if you have the `signal' function. */ /* Define to 1 if you have the `signal' function. */
#define EVENT__HAVE_SIGNAL 1 #define EVENT__HAVE_SIGNAL 1
/* Define to 1 if you have the `splice' function. */
#define EVENT__HAVE_SPLICE 1
/* Define to 1 if you have the <stdarg.h> header file. */ /* Define to 1 if you have the <stdarg.h> header file. */
#define EVENT__HAVE_STDARG_H 1 #define EVENT__HAVE_STDARG_H 1
/* Define to 1 if you have the <stddef.h> header file. */ /* Define to 1 if you have the <stddef.h> header file. */
#define EVENT__HAVE_STDDEF_H 1 #define EVENT__HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */ /* Define to 1 if you have the <stdint.h> header file. */
#define EVENT__HAVE_STDINT_H 1 #define EVENT__HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */ /* Define to 1 if you have the <stdlib.h> header file. */
skipping to change at line 265 skipping to change at line 283
/* 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 346 skipping to change at line 367
/* 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/signalfd.h> header file. */
#define EVENT__HAVE_SYS_SIGNALFD_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. */
/* #undef EVENT__HAVE_SYS_SYSCTL_H */ /* #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. */
skipping to change at line 418 skipping to change at line 442
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#define EVENT__HAVE_UNISTD_H 1 #define EVENT__HAVE_UNISTD_H 1
/* 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 if your system supports the wepoll module */
#define EVENT__HAVE_VASPRINTF 1 /* #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. */ /* Define to 1 if you have the `_gmtime64' function. */
/* #undef EVENT__HAVE__GMTIME64 */ /* #undef EVENT__HAVE__GMTIME64 */
skipping to change at line 443 skipping to change at line 467
/* 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 0x02010c00 #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.12-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.12-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 500 skipping to change at line 524
/* The size of `time_t', as computed by sizeof. */ /* The size of `time_t', as computed by sizeof. */
#define EVENT__SIZEOF_TIME_T 8 #define EVENT__SIZEOF_TIME_T 8
/* The size of `void *', as computed by sizeof. */ /* The size of `void *', as computed by sizeof. */
#define EVENT__SIZEOF_VOID_P 8 #define EVENT__SIZEOF_VOID_P 8
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define EVENT__TIME_WITH_SYS_TIME 1
/* Enable extensions on AIX 3, Interix. */ /* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE #ifndef _ALL_SOURCE
# define _ALL_SOURCE 1 # define _ALL_SOURCE 1
#endif #endif
/* Enable GNU extensions on systems that have them. */ /* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
# define _GNU_SOURCE 1 # define _GNU_SOURCE 1
#endif #endif
/* Enable threading extensions on Solaris. */ /* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS #ifndef _POSIX_PTHREAD_SEMANTICS
skipping to change at line 525 skipping to change at line 546
/* 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.12-stable" #define EVENT__VERSION "2.2.0-alpha-dev"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define EVENT__WORDS_BIGENDIAN 1
# endif
#else
# ifndef EVENT__nORDS_BIGENDIAN
/* # undef EVENT__WORDS_BIGENDIAN */
# endif
#endif
/* 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. */
skipping to change at line 548 skipping to change at line 581
/* Define to 1 if on MINIX. */ /* Define to 1 if on MINIX. */
/* #undef _MINIX */ /* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with /* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */ this defined. */
/* #undef _POSIX_1_SOURCE */ /* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */ /* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */ /* #undef _POSIX_SOURCE */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler /* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */ calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus #ifndef __cplusplus
/* #undef inline */ /* #undef inline */
#endif #endif
/* Define to `int' if <sys/types.h> does not define. */ /* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */ /* #undef pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
 End of changes. 16 change blocks. 
17 lines changed or deleted 47 lines changed or added


 event.h (2.1.12)   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);
/**
Get the kernel signal handling mechanism used by Libevent.
@param eb the event_base structure returned by event_base_new()
@return a string identifying the kernel signal handling mechanism,
which is "signal" for traditional UNIX signal handlers,
"kqueue_signal" for kqueue(2)-based method on *BSD and macOS,
and "signalfd_signal" for Linux-only signalfd(2)-based method.
*/
EVENT2_EXPORT_SYMBOL
const char *event_base_get_signal_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.
The end of the array is indicated by a NULL pointer. If an The end of the array is indicated by a NULL pointer. If an
error is encountered NULL is returned. error is encountered NULL is returned.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
const char **event_get_supported_methods(void); const char **event_get_supported_methods(void);
/** Query the current monotonic time from a the timer for a struct /** Query the current monotonic time from the timer for a struct
* event_base. * event_base.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int event_gettime_monotonic(struct event_base *base, struct timeval *tp); int event_gettime_monotonic(struct event_base *base, struct timeval *tp);
/** /**
@name event type flag @name event type flag
Flags to pass to event_base_get_num_events() to specify the kinds of eve nts Flags to pass to event_base_get_num_events() to specify the kinds of eve nts
we want to aggregate counts for we want to aggregate counts for
skipping to change at line 440 skipping to change at line 452
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 544 skipping to change at line 556
*/ */
EVENT_BASE_FLAG_NOLOCK = 0x01, EVENT_BASE_FLAG_NOLOCK = 0x01,
/** Do not check the EVENT_* environment variables when configuring /** Do not check the EVENT_* environment variables when configuring
an event_base */ an event_base */
EVENT_BASE_FLAG_IGNORE_ENV = 0x02, EVENT_BASE_FLAG_IGNORE_ENV = 0x02,
/** Windows only: enable the IOCP dispatcher at startup /** Windows only: enable the IOCP dispatcher at startup
If this flag is set then bufferevent_socket_new() and If this flag is set then bufferevent_socket_new() and
evconn_listener_new() will use IOCP-backed implementations evconn_listener_new() will use IOCP-backed implementations
instead of the usual select-based one on Windows. instead of the usual select-based one on Windows.
Note: it is experimental feature, and has some bugs.
*/ */
EVENT_BASE_FLAG_STARTUP_IOCP = 0x04, EVENT_BASE_FLAG_STARTUP_IOCP = 0x04,
/** Instead of checking the current time every time the event loop i s /** Instead of checking the current time every time the event loop i s
ready to run timeout callbacks, check after each timeout callbac k. ready to run timeout callbacks, check after each timeout callbac k.
*/ */
EVENT_BASE_FLAG_NO_CACHE_TIME = 0x08, EVENT_BASE_FLAG_NO_CACHE_TIME = 0x08,
/** If we are using the epoll backend, this flag says that it is /** If we are using the epoll backend, this flag says that it is
safe to use Libevent's internal change-list code to batch up safe to use Libevent's internal change-list code to batch up
adds and deletes in order to try to do as few syscalls as adds and deletes in order to try to do as few syscalls as
skipping to change at line 572 skipping to change at line 586
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,
/** Do not use signalfd(2) to handle signals even if supported.
*/
EVENT_BASE_FLAG_DISALLOW_SIGNALFD = 0x80,
}; };
/** /**
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 708
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 817
/** /**
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 818 skipping to change at line 849
This is a more flexible version of event_base_dispatch(). This is a more flexible version of event_base_dispatch().
By default, this loop will run the event base until either there are no m ore By default, this loop will run the event base until either there are no m ore
pending or active events, or until something calls event_base_loopbreak() or pending or active events, or until something calls event_base_loopbreak() or
event_base_loopexit(). You can override this behavior with the 'flags' event_base_loopexit(). You can override this behavior with the 'flags'
argument. argument.
@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 |
EVLOOP_NO_EXIT_ON_EMPTY
@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 1067 skipping to change at line 1099
The EV_PERSIST flag can also be passed in the events argument: it makes The EV_PERSIST flag can also be passed in the events argument: it makes
event_add() persistent until event_del() is called. event_add() persistent until event_del() is called.
The EV_ET flag is compatible with EV_READ and EV_WRITE, and supported The EV_ET flag is compatible with EV_READ and EV_WRITE, and supported
only by certain backends. It tells Libevent to use edge-triggered only by certain backends. It tells Libevent to use edge-triggered
events. events.
The EV_TIMEOUT flag has no effect here. The EV_TIMEOUT flag has no effect here.
It is okay to have multiple events all listening on the same fds; but It is okay to have multiple events all listening on the same fds; but
they must either all be edge-triggered, or all not be edge triggered. they must either all be edge-triggered, or not be edge-triggered at all.
When the event becomes active, the event loop will run the provided When the event becomes active, the event loop will run the provided
callback function, with three arguments. The first will be the provided callback function, with three arguments. The first will be the provided
fd value. The second will be a bitfield of the events that triggered: fd value. The second will be a bitfield of the events that triggered:
EV_READ, EV_WRITE, or EV_SIGNAL. Here the EV_TIMEOUT flag indicates EV_READ, EV_WRITE, or EV_SIGNAL. Here the EV_TIMEOUT flag indicates
that a timeout occurred, and EV_ET indicates that an edge-triggered that a timeout occurred, and EV_ET indicates that an edge-triggered
event occurred. The third event will be the callback_arg pointer that event occurred. The third event will be the callback_arg pointer that
you provide. you provide.
@param base the event base to which the event should be attached. @param base the event base to which the event should be attached.
skipping to change at line 1089 skipping to change at line 1121
@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 1162
@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 1239
@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 1289
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 1499
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 1589
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 1611
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. 29 change blocks. 
28 lines changed or deleted 64 lines changed or added


 event_compat.h (2.1.12)   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.12)   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.12)   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_CONTINUE 100 /**< client should proceed to send *
/
#define HTTP_SWITCH_PROTOCOLS 101 /**< switching to another protocol *
/
#define HTTP_PROCESSING 102 /**< processing the request,
but no response is available yet */
#define HTTP_EARLYHINTS 103 /**< return some response he
aders */
#define HTTP_OK 200 /**< request completed ok */ #define HTTP_OK 200 /**< request completed ok */
#define HTTP_CREATED 201 /**< new resource is created */
#define HTTP_ACCEPTED 202 /**< accepted for processing */
#define HTTP_NONAUTHORITATIVE 203 /**< returning a modified version of
the origin's response */
#define HTTP_NOCONTENT 204 /**< request does not have content * / #define HTTP_NOCONTENT 204 /**< request does not have content * /
#define HTTP_MOVEPERM 301 /**< the uri moved permanently */ #define HTTP_MOVEPERM 301 /**< the uri moved permanently */
#define HTTP_MOVETEMP 302 /**< the uri moved temporarily */ #define HTTP_MOVETEMP 302 /**< the uri moved temporarily */
#define HTTP_NOTMODIFIED 304 /**< page was not modified from last */ #define HTTP_NOTMODIFIED 304 /**< page was not modified from last */
#define HTTP_BADREQUEST 400 /**< invalid http request wa s made */ #define HTTP_BADREQUEST 400 /**< invalid http request wa s made */
#define HTTP_UNAUTHORIZED 401 /**< authentication is required */
#define HTTP_PAYMENTREQUIRED 402 /**< user exceeded limit on requests
*/
#define HTTP_FORBIDDEN 403 /**< user not having the necessary p
ermissions */
#define HTTP_NOTFOUND 404 /**< could not find content for uri */ #define HTTP_NOTFOUND 404 /**< could not find content for uri */
#define HTTP_BADMETHOD 405 /**< method not allowed for this uri */ #define HTTP_BADMETHOD 405 /**< method not allowed for this uri */
#define HTTP_ENTITYTOOLARGE 413 /**< */ #define HTTP_ENTITYTOOLARGE 413 /**< request is larger than the serv er is able to process */
#define HTTP_EXPECTATIONFAILED 417 /**< we can't handle this expectatio n */ #define HTTP_EXPECTATIONFAILED 417 /**< we can't handle this expectatio n */
#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_BADGATEWAY 502 /**< received an invalid res ponse from the upstream */
#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 163 skipping to change at line 175
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evhttp_bound_socket *evhttp_bind_listener(struct evhttp *http, struc t evconnlistener *listener); struct evhttp_bound_socket *evhttp_bind_listener(struct evhttp *http, struc t evconnlistener *listener);
/** /**
* Return the listener used to implement a bound socket. * Return the listener used to implement a bound socket.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evconnlistener *evhttp_bound_socket_get_listener(struct evhttp_bound _socket *bound); struct evconnlistener *evhttp_bound_socket_get_listener(struct evhttp_bound _socket *bound);
/*
* Like evhttp_set_bevcb.
* If cb returns a non-NULL bufferevent, * the callback supplied through
* evhttp_set_bevcb isn't used.
*/
EVENT2_EXPORT_SYMBOL
void evhttp_bound_set_bevcb(struct evhttp_bound_socket *bound, struct buffe
revent* (*cb)(struct event_base *, void *), void *cbarg);
typedef void evhttp_bound_socket_foreach_fn(struct evhttp_bound_socket *, v oid *); typedef void evhttp_bound_socket_foreach_fn(struct evhttp_bound_socket *, v oid *);
/** /**
* Applies the function specified in the first argument to all * Applies the function specified in the first argument to all
* evhttp_bound_sockets associated with "http". The user must not * evhttp_bound_sockets associated with "http". The user must not
* attempt to free or remove any connections, sockets or listeners * attempt to free or remove any connections, sockets or listeners
* in the callback "function". * in the callback "function".
* *
* @param http pointer to an evhttp object * @param http pointer to an evhttp object
* @param function function to apply to every bound socket * @param function function to apply to every bound socket
* @param argument pointer value passed to function for every socket iterat ed * @param argument pointer value passed to function for every socket iterat ed
skipping to change at line 226 skipping to change at line 246
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 287
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 286 skipping to change at line 344
@param cb the callback to invoke for any unmatched requests @param cb the callback to invoke for any unmatched requests
@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_gencb(struct evhttp *http, void evhttp_set_gencb(struct evhttp *http,
void (*cb)(struct evhttp_request *, void *), void *arg); void (*cb)(struct evhttp_request *, void *), void *arg);
/** /**
Set a callback used to create new bufferevents for connections Set a callback used to create new bufferevents for connections
to a given evhttp object. to a given evhttp object.
cb is not called if a non-NULL bufferevent was supplied by
evhttp_bound_set_bevcb.
You can use this to override the default bufferevent type -- for example , You can use this to override the default bufferevent type -- for example ,
to make this evhttp object use SSL bufferevents rather than unencrypted to make this evhttp object use SSL bufferevents rather than unencrypted
ones. ones.
New bufferevents must be allocated with no fd set on them. New bufferevents must be allocated with no fd set on them.
@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 467
@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 594
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 bufferevent will be freed
* 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
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evhttp_connection_base_bufferevent_new( struct evhttp_connection *evhttp_connection_base_bufferevent_new(
struct event_base *base, struct evdns_base *dnsbase, struct bufferev ent* bev, const char *address, ev_uint16_t port); struct event_base *base, struct evdns_base *dnsbase, struct bufferev ent* bev, const char *address, ev_uint16_t port);
/** /**
* Create and return a connection object that can be used to for making HTT
P
* requests over an unix domain socket.
*
* @param base the event_base to use for handling the connection
* @param bev a bufferevent to use for connecting to the server; if NULL, a
* socket-based bufferevent will be created. This bufferevent will be
freed
* when the connection closes. It must have no fd set on it.
* @param path path of unix domain socket
* @return an evhttp_connection object that can be used for making requests
*/
EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evhttp_connection_base_bufferevent_unix_new(
struct event_base *base, struct bufferevent* bev, const char *path);
/**
* Return the bufferevent that an evhttp_connection is using. * Return the bufferevent that an evhttp_connection is using.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connect ion *evcon); struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connect ion *evcon);
/** /**
* Return the HTTP server associated with this connection, or NULL. * Return the HTTP server associated with this connection, or NULL.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evhttp *evhttp_connection_get_server(struct evhttp_connection *evcon ); struct evhttp *evhttp_connection_get_server(struct evhttp_connection *evcon );
skipping to change at line 690 skipping to change at line 864
* 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 724 skipping to change at line 907
void evhttp_connection_free(struct evhttp_connection *evcon); void evhttp_connection_free(struct evhttp_connection *evcon);
/** Disowns a given connection object /** Disowns a given connection object
* *
* Can be used to tell libevent to free the connection object after * Can be used to tell libevent to free the connection object after
* the last request has completed or failed. * the last request has completed or failed.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_free_on_completion(struct evhttp_connection *evcon); void evhttp_connection_free_on_completion(struct evhttp_connection *evcon);
/** sets the ip address from which http connections are made */ /** Sets the IP address from which http connections are made
*
* Note this resets internal bufferevent fd, so any options that had been
* installed will be flushed.
*/
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. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_closecb(struct evhttp_connection *evcon, void evhttp_connection_set_closecb(struct evhttp_connection *evcon,
void (*)(struct evhttp_connection *, void *), void *); void (*)(struct evhttp_connection *, void *), void *);
/** Get the remote address and port associated with this connection. */ /** Get the remote address and port associated with this connection. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evhttp_connection_get_peer(struct evhttp_connection *evcon, void evhttp_connection_get_peer(struct evhttp_connection *evcon,
char **address, ev_uint16_t *port); const char **address, ev_uint16_t *port);
/** Get the remote address associated with this connection. /** Get the remote address associated with this connection.
* extracted from getpeername() OR from nameserver. * extracted from getpeername() OR from nameserver.
* *
* @return NULL if getpeername() return non success, * @return NULL if getpeername() return non success,
* or connection is not connected, * or connection is not connected,
* otherwise it return pointer to struct sockaddr_storage */ * otherwise it return pointer to struct sockaddr_storage */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
const struct sockaddr* const struct sockaddr*
evhttp_connection_get_addr(struct evhttp_connection *evcon); evhttp_connection_get_addr(struct evhttp_connection *evcon);
skipping to change at line 988 skipping to change at line 1223
@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
skipping to change at line 1059 skipping to change at line 1322
* bracketed IPv6 address, or a bracketed 'IP-Future' address. * bracketed IPv6 address, or a bracketed 'IP-Future' address.
* *
* Note that having a NULL host means that the URI has no authority * Note that having a NULL host means that the URI has no authority
* section, but having an empty-string host means that the URI has an * section, but having an empty-string host means that the URI has an
* authority section with no host part. For example, * authority section with no host part. For example,
* "mailto:user@example.com" has a host of NULL, but "file:///etc/motd" * "mailto:user@example.com" has a host of NULL, but "file:///etc/motd"
* has a host of "". * has a host of "".
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_host(const struct evhttp_uri *uri); const char *evhttp_uri_get_host(const struct evhttp_uri *uri);
/** Return the unix socket part of an evhttp_uri, or NULL if there is no un
ix
* socket set */
EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_unixsocket(const struct evhttp_uri *uri);
/** Return the port part of an evhttp_uri, or -1 if there is no port set. * / /** Return the port part of an evhttp_uri, or -1 if there is no port set. * /
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_uri_get_port(const struct evhttp_uri *uri); int evhttp_uri_get_port(const struct evhttp_uri *uri);
/** Return the path part of an evhttp_uri, or NULL if it has no path set */ /** Return the path part of an evhttp_uri, or NULL if it has no path set */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_path(const struct evhttp_uri *uri); const char *evhttp_uri_get_path(const struct evhttp_uri *uri);
/** Return the query part of an evhttp_uri (excluding the leading "?"), or /** Return the query part of an evhttp_uri (excluding the leading "?"), or
* NULL if it has no query set */ * NULL if it has no query set */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
const char *evhttp_uri_get_query(const struct evhttp_uri *uri); const char *evhttp_uri_get_query(const struct evhttp_uri *uri);
skipping to change at line 1086 skipping to change at line 1353
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_scheme(struct evhttp_uri *uri, const char *scheme); int evhttp_uri_set_scheme(struct evhttp_uri *uri, const char *scheme);
/** Set the userinfo of an evhttp_uri, or clear the userinfo if userinfo==N ULL. /** Set the userinfo of an evhttp_uri, or clear the userinfo if userinfo==N ULL.
* Returns 0 on success, -1 if userinfo is not well-formed. */ * Returns 0 on success, -1 if userinfo is not well-formed. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_userinfo(struct evhttp_uri *uri, const char *userinfo); int evhttp_uri_set_userinfo(struct evhttp_uri *uri, const char *userinfo);
/** Set the host of an evhttp_uri, or clear the host if host==NULL. /** Set the host of an evhttp_uri, or clear the host if host==NULL.
* Returns 0 on success, -1 if host is not well-formed. */ * Returns 0 on success, -1 if host is not well-formed. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_host(struct evhttp_uri *uri, const char *host); int evhttp_uri_set_host(struct evhttp_uri *uri, const char *host);
/** Set the unix socket of an evhttp_uri, or clear the unix socket if unixs
ocket==NULL.
* Returns 0 on success, -1 if unixsocket is not well-formed */
EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_unixsocket(struct evhttp_uri *uri, const char *unixsocke
t);
/** Set the port of an evhttp_uri, or clear the port if port==-1. /** Set the port of an evhttp_uri, or clear the port if port==-1.
* Returns 0 on success, -1 if port is not well-formed. */ * Returns 0 on success, -1 if port is not well-formed. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_port(struct evhttp_uri *uri, int port); int evhttp_uri_set_port(struct evhttp_uri *uri, int port);
/** Set the path of an evhttp_uri, or clear the path if path==NULL. /** Set the path of an evhttp_uri, or clear the path if path==NULL.
* Returns 0 on success, -1 if path is not well-formed. */ * Returns 0 on success, -1 if path is not well-formed. */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evhttp_uri_set_path(struct evhttp_uri *uri, const char *path); int evhttp_uri_set_path(struct evhttp_uri *uri, const char *path);
/** Set the query of an evhttp_uri, or clear the query if query==NULL. /** Set the query of an evhttp_uri, or clear the query if query==NULL.
* The query should not include a leading "?". * The query should not include a leading "?".
skipping to change at line 1157 skipping to change at line 1429
* do so by passing this flag to evhttp_uri_parse_with_flags. * do so by passing this flag to evhttp_uri_parse_with_flags.
* *
* Currently, these changes are: * Currently, these changes are:
* <ul> * <ul>
* <li> Nonconformant URIs are allowed to contain otherwise unreasonable * <li> Nonconformant URIs are allowed to contain otherwise unreasonable
* characters in their path, query, and fragment components. * characters in their path, query, and fragment components.
* </ul> * </ul>
*/ */
#define EVHTTP_URI_NONCONFORMANT 0x01 #define EVHTTP_URI_NONCONFORMANT 0x01
/**
* Strip brackets from the IPv6 address and only for evhttp_uri_get_host(),
* evhttp_uri_join() returns the host with brackets.
*
* Thus you can use host part of the evhttp_uri for getaddrinfo().
*
* @see also _EVHTTP_URI_HOST_HAS_BRACKETS
*/
#define EVHTTP_URI_HOST_STRIP_BRACKETS 0x04
/**
* Parse unix domain socket URIs, for example:
*
* http://unix:/run/control.sock:/controller
*/
#define EVHTTP_URI_UNIX_SOCKET 0x08
/** Alias for evhttp_uri_parse_with_flags(source_uri, 0) */ /** Alias for evhttp_uri_parse_with_flags(source_uri, 0) */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
struct evhttp_uri *evhttp_uri_parse(const char *source_uri); struct evhttp_uri *evhttp_uri_parse(const char *source_uri);
/** /**
* Free all memory allocated for a parsed uri. Only use this for URIs * Free all memory allocated for a parsed uri. Only use this for URIs
* generated by evhttp_uri_parse. * generated by evhttp_uri_parse.
* *
* @param uri container with parsed data * @param uri container with parsed data
* @see evhttp_uri_parse() * @see evhttp_uri_parse()
 End of changes. 39 change blocks. 
26 lines changed or deleted 339 lines changed or added


 http_compat.h (2.1.12)   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


 http_struct.h (2.1.12)   http_struct.h (current) 
skipping to change at line 132 skipping to change at line 132
void (*chunk_cb)(struct evhttp_request *, void *); void (*chunk_cb)(struct evhttp_request *, void *);
/* /*
* Callback added for forked-daapd so they can collect ICY * Callback added for forked-daapd so they can collect ICY
* (shoutcast) metadata from the http header. If return * (shoutcast) metadata from the http header. If return
* int is negative the connection will be closed. * int is negative the connection will be closed.
*/ */
int (*header_cb)(struct evhttp_request *, void *); int (*header_cb)(struct evhttp_request *, void *);
/* /*
* Error callback - called when error is occured. * Error callback - called when error is occurred.
* @see evhttp_request_error for error types. * @see evhttp_request_error for error types.
* *
* @see evhttp_request_set_error_cb() * @see evhttp_request_set_error_cb()
*/ */
void (*error_cb)(enum evhttp_request_error, void *); void (*error_cb)(enum evhttp_request_error, void *);
/* /*
* Send complete callback - called when the request is actually * Send complete callback - called when the request is actually
* sent and completed. * sent and completed.
*/ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 listener.h (2.1.12)   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 109 skipping to change at line 110
#define LEV_OPT_REUSEABLE_PORT (1u<<7) #define LEV_OPT_REUSEABLE_PORT (1u<<7)
/** Flag: Indicates that the listener wants to work only in IPv6 socket. /** Flag: Indicates that the listener wants to work only in IPv6 socket.
* *
* According to RFC3493 and most Linux distributions, default value is to * According to RFC3493 and most Linux distributions, default value is to
* work in IPv4-mapped mode. If there is a requirement to bind same port * work in IPv4-mapped mode. If there is a requirement to bind same port
* on same ip addresses but different handlers for both IPv4 and IPv6, * on same ip addresses but different handlers for both IPv4 and IPv6,
* it is required to set IPV6_V6ONLY socket option to be sure that the * it is required to set IPV6_V6ONLY socket option to be sure that the
* code works as expected without affected by bindv6only sysctl setting in * code works as expected without affected by bindv6only sysctl setting in
* system. * system.
* *
* This socket option also supported by Windows. * This socket option on Windows is instead enabled by default.
*/ */
#define LEV_OPT_BIND_IPV6ONLY (1u<<8) #define LEV_OPT_BIND_IPV6ONLY (1u<<8)
/** Flag: Indicates that the listener wants to work only in both IPv4 and
* IPv6 socket.
*
* This flag exists as copmlement to LEV_OPT_BIND_IPV6ONLY to account for
* the different default behaviour on Windows so that the code can
* explicitly request the socket to support both modes without having
* to rely on the default option.
*/
#define LEV_OPT_BIND_IPV4_AND_IPV6 (1u<<9)
/** /**
Allocate a new evconnlistener object to listen for incoming TCP connecti ons Allocate a new evconnlistener object to listen for incoming TCP connecti ons
on a given file descriptor. on a given file descriptor.
@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 th e @param cb A callback to be invoked when a new connection arrives. If th e
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.
skipping to change at line 146 skipping to change at line 156
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. 4 change blocks. 
4 lines changed or deleted 14 lines changed or added


 rpc.h (2.1.12)   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.12)   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.12)   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.12)   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.12)   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
* (if pthread_mutexattr_setprotocol() is supported). */
#define EVTHREAD_PTHREAD_PRIO_INHERIT 0x01
/**
* Sets up Libevent for use with Pthreads locking and thread ID functions.
* Use evthread_use_pthreads_with_flags() to use Pthreads locking, taking t
he
* 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 22 lines changed or added


 util.h (2.1.12)   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 431 skipping to change at line 431
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evutil_make_listen_socket_reuseable_port(evutil_socket_t sock); int evutil_make_listen_socket_reuseable_port(evutil_socket_t sock);
/** Set ipv6 only bind socket option to make listener work only in ipv6 soc kets. /** Set ipv6 only bind socket option to make listener work only in ipv6 soc kets.
According to RFC3493 and most Linux distributions, default value for th e According to RFC3493 and most Linux distributions, default value for th e
sockets is to work in IPv4-mapped mode. In IPv4-mapped mode, it is not possible sockets is to work in IPv4-mapped mode. In IPv4-mapped mode, it is not possible
to bind same port from different IPv4 and IPv6 handlers. to bind same port from different IPv4 and IPv6 handlers.
On Windows the default value is instead to only work in IPv6 mode.
@param sock The socket to make in ipv6only working mode @param sock The socket to make in ipv6only working mode
@return 0 on success, -1 on failure @return 0 on success, -1 on failure
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evutil_make_listen_socket_ipv6only(evutil_socket_t sock); int evutil_make_listen_socket_ipv6only(evutil_socket_t sock);
/** Set ipv6 only bind socket option to make listener work in both ipv4 and
ipv6 sockets.
According to RFC3493 and most Linux distributions, default value for th
e
sockets is to work in IPv4-mapped mode. In IPv4-mapped mode, it is not
possible
to bind same port from different IPv4 and IPv6 handlers.
On Windows the default value is instead to only work in IPv6 mode.
@param sock The socket to make in ipv6only working mode
@return 0 on success, -1 on failure
*/
EVENT2_EXPORT_SYMBOL
int evutil_make_listen_socket_not_ipv6only(evutil_socket_t sock);
/** Do platform-specific operations as needed to close a socket upon a /** Do platform-specific operations as needed to close a socket upon a
successful execution of one of the exec*() functions. successful execution of one of the exec*() functions.
@param sock The socket to be closed @param sock The socket to be closed
@return 0 on success, -1 on failure @return 0 on success, -1 on failure
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evutil_make_socket_closeonexec(evutil_socket_t sock); int evutil_make_socket_closeonexec(evutil_socket_t sock);
/** Do the platform-specific call needed to close a socket returned from /** Do the platform-specific call needed to close a socket returned from
skipping to change at line 820 skipping to change at line 836
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evutil_freeaddrinfo(struct evutil_addrinfo *ai); void evutil_freeaddrinfo(struct evutil_addrinfo *ai);
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
const char *evutil_gai_strerror(int err); const char *evutil_gai_strerror(int err);
/** Generate n bytes of secure pseudorandom data, and store them in buf. /** Generate n bytes of secure pseudorandom data, and store them in buf.
* *
* Current versions of Libevent use an ARC4-based random number generator, * Current versions of Libevent use an ARC4-based random number generator,
* seeded using the platform's entropy source (/dev/urandom on Unix-like * seeded using the platform's entropy source (/dev/urandom on Unix-like
* systems; CryptGenRandom on Windows). This is not actually as secure as it * systems; BCryptGenRandom on Windows). This is not actually as secure as it
* should be: ARC4 is a pretty lousy cipher, and the current implementation * should be: ARC4 is a pretty lousy cipher, and the current implementation
* provides only rudimentary prediction- and backtracking-resistance. Don' t * provides only rudimentary prediction- and backtracking-resistance. Don' t
* use this for serious cryptographic applications. * use this for serious cryptographic applications.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evutil_secure_rng_get_bytes(void *buf, size_t n); void evutil_secure_rng_get_bytes(void *buf, size_t n);
/** /**
* Seed the secure random number generator if needed, and return 0 on * Seed the secure random number generator if needed, and return 0 on
* success or -1 on failure. * success or -1 on failure.
skipping to change at line 863 skipping to change at line 879
* *
* (This string will _NOT_ be copied internally. Do not free it while any * (This string will _NOT_ be copied internally. Do not free it while any
* user of the secure RNG might be running. Don't pass anything other than a * user of the secure RNG might be running. Don't pass anything other than a
* real /dev/...random device file here, or you might lose security.) * real /dev/...random device file here, or you might lose security.)
* *
* This API is unstable, and might change in a future libevent version. * This API is unstable, and might change in a future libevent version.
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
int evutil_secure_rng_set_urandom_device_file(char *fname); int evutil_secure_rng_set_urandom_device_file(char *fname);
#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDR ANDOM)
/** Seed the random number generator with extra random bytes. /** Seed the random number generator with extra random bytes.
You should almost never need to call this function; it should be You should almost never need to call this function; it should be
sufficient to invoke evutil_secure_rng_init(), or let Libevent take sufficient to invoke evutil_secure_rng_init(), or let Libevent take
care of calling evutil_secure_rng_init() on its own. care of calling evutil_secure_rng_init() on its own.
If you call this function as a _replacement_ for the regular If you call this function as a _replacement_ for the regular
entropy sources, then you need to be sure that your input entropy sources, then you need to be sure that your input
contains a fairly large amount of strong entropy. Doing so is contains a fairly large amount of strong entropy. Doing so is
notoriously hard: most people who try get it wrong. Watch out! notoriously hard: most people who try get it wrong. Watch out!
This function does nothing when the system provides arc4random()
function because it will provide proper entropy.
@param dat a buffer full of a strong source of random numbers @param dat a buffer full of a strong source of random numbers
@param datlen the number of bytes to read from datlen @param datlen the number of bytes to read from datlen
*/ */
EVENT2_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
void evutil_secure_rng_add_bytes(const char *dat, size_t datlen); void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* EVENT1_EVUTIL_H_INCLUDED_ */ #endif /* EVENT1_EVUTIL_H_INCLUDED_ */
 End of changes. 7 change blocks. 
4 lines changed or deleted 24 lines changed or added


 visibility.h (2.1.12)   visibility.h (current) 
skipping to change at line 36 skipping to change at line 36
*/ */
#ifndef EVENT2_VISIBILITY_H_INCLUDED_ #ifndef EVENT2_VISIBILITY_H_INCLUDED_
#define EVENT2_VISIBILITY_H_INCLUDED_ #define EVENT2_VISIBILITY_H_INCLUDED_
#include <event2/event-config.h> #include <event2/event-config.h>
#if defined(event_shared_EXPORTS) || \ #if defined(event_shared_EXPORTS) || \
defined(event_extra_shared_EXPORTS) || \ defined(event_extra_shared_EXPORTS) || \
defined(event_core_shared_EXPORTS) || \ defined(event_core_shared_EXPORTS) || \
defined(event_pthreads_shared_EXPORTS) || \ defined(event_pthreads_shared_EXPORTS) || \
defined(event_openssl_shared_EXPORTS) defined(event_openssl_shared_EXPORTS) || \
defined(event_mbedtls_shared_EXPORTS)
# if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define EVENT2_EXPORT_SYMBOL __global # define EVENT2_EXPORT_SYMBOL __global
# elif defined __GNUC__ # elif defined __GNUC__
# define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default"))) # define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
# elif defined(_MSC_VER) # elif defined(_MSC_VER)
# define EVENT2_EXPORT_SYMBOL __declspec(dllexport) # define EVENT2_EXPORT_SYMBOL __declspec(dllexport)
# else # else
# define EVENT2_EXPORT_SYMBOL /* unknown compiler */ # define EVENT2_EXPORT_SYMBOL /* unknown compiler */
# endif # endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 2 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/