libevent  2.2.1
Event notification library
event.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
3  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef EVENT2_EVENT_H_INCLUDED_
28 #define EVENT2_EVENT_H_INCLUDED_
29 
187 #include <event2/visibility.h>
188 
189 #ifdef __cplusplus
190 extern "C" {
191 #endif
192 
193 #include <event2/event-config.h>
194 #ifdef EVENT__HAVE_SYS_TYPES_H
195 #include <sys/types.h>
196 #endif
197 #ifdef EVENT__HAVE_SYS_TIME_H
198 #include <sys/time.h>
199 #endif
200 
201 #include <stdio.h>
202 
203 /* For int types. */
204 #include <event2/util.h>
205 
220 #ifdef EVENT_IN_DOXYGEN_
221 {/*Empty body so that doxygen will generate documentation here.*/}
222 #endif
223 ;
224 
276 struct event
277 #ifdef EVENT_IN_DOXYGEN_
278 {/*Empty body so that doxygen will generate documentation here.*/}
279 #endif
280 ;
281 
296 #ifdef EVENT_IN_DOXYGEN_
297 {/*Empty body so that doxygen will generate documentation here.*/}
298 #endif
299 ;
300 
321 EVENT2_EXPORT_SYMBOL
322 void event_enable_debug_mode(void);
323 
333 EVENT2_EXPORT_SYMBOL
334 void event_debug_unassign(struct event *);
335 
343 EVENT2_EXPORT_SYMBOL
344 struct event_base *event_base_new(void);
345 
356 EVENT2_EXPORT_SYMBOL
357 int event_reinit(struct event_base *base);
358 
372 EVENT2_EXPORT_SYMBOL
373 int event_base_dispatch(struct event_base *base);
374 
381 EVENT2_EXPORT_SYMBOL
382 const char *event_base_get_method(const struct event_base *eb);
383 
393 EVENT2_EXPORT_SYMBOL
394 const char *event_base_get_signal_method(const struct event_base *eb);
395 
408 EVENT2_EXPORT_SYMBOL
409 const char **event_get_supported_methods(void);
410 
414 EVENT2_EXPORT_SYMBOL
415 int event_gettime_monotonic(struct event_base *base, struct timeval *tp);
416 
425 #define EVENT_BASE_COUNT_ACTIVE 1U
426 
428 #define EVENT_BASE_COUNT_VIRTUAL 2U
429 
431 #define EVENT_BASE_COUNT_ADDED 4U
432 
452 EVENT2_EXPORT_SYMBOL
453 int event_base_get_num_events(struct event_base *eb, unsigned int flags);
454 
465 EVENT2_EXPORT_SYMBOL
466 int event_base_get_max_events(struct event_base *eb, unsigned int flags, int clear);
467 
478 EVENT2_EXPORT_SYMBOL
479 struct event_config *event_config_new(void);
480 
486 EVENT2_EXPORT_SYMBOL
487 void event_config_free(struct event_config *cfg);
488 
501 EVENT2_EXPORT_SYMBOL
502 int event_config_avoid_method(struct event_config *cfg, const char *method);
503 
531 };
532 
565 
581 
588 
601 
607 };
608 
616 EVENT2_EXPORT_SYMBOL
617 int event_base_get_features(const struct event_base *base);
618 
641 EVENT2_EXPORT_SYMBOL
642 int event_config_require_features(struct event_config *cfg, int feature);
643 
650 EVENT2_EXPORT_SYMBOL
651 int event_config_set_flag(struct event_config *cfg, int flag);
652 
662 EVENT2_EXPORT_SYMBOL
663 int event_config_set_num_cpus_hint(struct event_config *cfg, int cpus);
664 
693 EVENT2_EXPORT_SYMBOL
695  const struct timeval *max_interval, int max_callbacks,
696  int min_priority);
697 
710 EVENT2_EXPORT_SYMBOL
711 struct event_base *event_base_new_with_config(const struct event_config *cfg);
712 
724 EVENT2_EXPORT_SYMBOL
725 void event_base_free(struct event_base *eb);
726 
730 EVENT2_EXPORT_SYMBOL
732 
736 #define EVENT_LOG_DEBUG 0
737 #define EVENT_LOG_MSG 1
738 #define EVENT_LOG_WARN 2
739 #define EVENT_LOG_ERR 3
740 
742 /* Obsolete names: these are deprecated, but older programs might use them.
743  * They violate the reserved-identifier namespace. */
744 #define _EVENT_LOG_DEBUG EVENT_LOG_DEBUG
745 #define _EVENT_LOG_MSG EVENT_LOG_MSG
746 #define _EVENT_LOG_WARN EVENT_LOG_WARN
747 #define _EVENT_LOG_ERR EVENT_LOG_ERR
748 
754 typedef void (*event_log_cb)(int severity, const char *msg);
765 EVENT2_EXPORT_SYMBOL
767 
773 typedef void (*event_fatal_cb)(int err);
774 
787 EVENT2_EXPORT_SYMBOL
789 
790 #define EVENT_DBG_ALL 0xffffffffu
791 #define EVENT_DBG_NONE 0
792 
807 EVENT2_EXPORT_SYMBOL
808 void event_enable_debug_logging(ev_uint32_t which);
809 
819 EVENT2_EXPORT_SYMBOL
820 int event_base_set(struct event_base *eb, struct event *ev);
821 
829 #define EVLOOP_ONCE 0x01
830 
832 #define EVLOOP_NONBLOCK 0x02
833 
837 #define EVLOOP_NO_EXIT_ON_EMPTY 0x04
838 
859 EVENT2_EXPORT_SYMBOL
860 int event_base_loop(struct event_base *eb, int flags);
861 
877 EVENT2_EXPORT_SYMBOL
878 int event_base_loopexit(struct event_base *eb, const struct timeval *tv);
879 
893 EVENT2_EXPORT_SYMBOL
894 int event_base_loopbreak(struct event_base *eb);
895 
913 EVENT2_EXPORT_SYMBOL
914 int event_base_loopcontinue(struct event_base *eb);
915 
928 EVENT2_EXPORT_SYMBOL
929 int event_base_got_exit(struct event_base *eb);
930 
943 EVENT2_EXPORT_SYMBOL
944 int event_base_got_break(struct event_base *eb);
945 
955 #define EV_TIMEOUT 0x01
956 
957 #define EV_READ 0x02
958 
959 #define EV_WRITE 0x04
960 
961 #define EV_SIGNAL 0x08
962 
968 #define EV_PERSIST 0x10
969 
970 #define EV_ET 0x20
971 
979 #define EV_FINALIZE 0x40
980 
988 #define EV_CLOSED 0x80
989 
998 #define evtimer_assign(ev, b, cb, arg) \
999  event_assign((ev), (b), -1, 0, (cb), (arg))
1000 #define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
1001 #define evtimer_add(ev, tv) event_add((ev), (tv))
1002 #define evtimer_del(ev) event_del(ev)
1003 #define evtimer_pending(ev, tv) event_pending((ev), EV_TIMEOUT, (tv))
1004 #define evtimer_initialized(ev) event_initialized(ev)
1005 
1013 #define evsignal_add(ev, tv) event_add((ev), (tv))
1014 #define evsignal_assign(ev, b, x, cb, arg) \
1015  event_assign((ev), (b), (x), EV_SIGNAL|EV_PERSIST, cb, (arg))
1016 #define evsignal_new(b, x, cb, arg) \
1017  event_new((b), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
1018 #define evsignal_del(ev) event_del(ev)
1019 #define evsignal_pending(ev, tv) event_pending((ev), EV_SIGNAL, (tv))
1020 #define evsignal_initialized(ev) event_initialized(ev)
1021 
1030 #define evuser_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
1031 #define evuser_del(ev) event_del(ev)
1032 #define evuser_pending(ev, tv) event_pending((ev), 0, (tv))
1033 #define evuser_initialized(ev) event_initialized(ev)
1034 #define evuser_trigger(ev) event_active((ev), 0, 0)
1035 
1048 typedef void (*event_callback_fn)(evutil_socket_t, short, void *);
1049 
1072 EVENT2_EXPORT_SYMBOL
1073 void *event_self_cbarg(void);
1074 
1123 EVENT2_EXPORT_SYMBOL
1124 struct event *event_new(struct event_base *base, evutil_socket_t fd, short events, event_callback_fn callback, void *callback_arg);
1125 
1126 
1165 EVENT2_EXPORT_SYMBOL
1166 int event_assign(struct event *ev, struct event_base *base, evutil_socket_t fd, short events, event_callback_fn callback, void *callback_arg);
1167 
1174 EVENT2_EXPORT_SYMBOL
1175 void event_free(struct event *);
1176 
1180 typedef void (*event_finalize_callback_fn)(struct event *, void *);
1212 EVENT2_EXPORT_SYMBOL
1213 int event_finalize(unsigned, struct event *, event_finalize_callback_fn);
1214 EVENT2_EXPORT_SYMBOL
1215 int event_free_finalize(unsigned, struct event *, event_finalize_callback_fn);
1242 EVENT2_EXPORT_SYMBOL
1243 int event_base_once(struct event_base *base, evutil_socket_t fd, short events, event_callback_fn callback, void *arg, const struct timeval *timeout);
1244 
1266 EVENT2_EXPORT_SYMBOL
1267 int event_add(struct event *ev, const struct timeval *timeout);
1268 
1278 EVENT2_EXPORT_SYMBOL
1279 int event_remove_timer(struct event *ev);
1280 
1292 EVENT2_EXPORT_SYMBOL
1293 int event_del(struct event *ev);
1294 
1300 EVENT2_EXPORT_SYMBOL
1301 int event_del_noblock(struct event *ev);
1307 EVENT2_EXPORT_SYMBOL
1308 int event_del_block(struct event *ev);
1309 
1327 EVENT2_EXPORT_SYMBOL
1328 void event_active(struct event *ev, int res, short ncalls);
1329 
1343 EVENT2_EXPORT_SYMBOL
1344 int event_pending(const struct event *ev, short events, struct timeval *tv);
1345 
1352 EVENT2_EXPORT_SYMBOL
1353 struct event *event_base_get_running_event(struct event_base *base);
1354 
1370 EVENT2_EXPORT_SYMBOL
1371 int event_initialized(const struct event *ev);
1372 
1376 #define event_get_signal(ev) ((int)event_get_fd(ev))
1377 
1382 EVENT2_EXPORT_SYMBOL
1383 evutil_socket_t event_get_fd(const struct event *ev);
1384 
1388 EVENT2_EXPORT_SYMBOL
1389 struct event_base *event_get_base(const struct event *ev);
1390 
1394 EVENT2_EXPORT_SYMBOL
1395 short event_get_events(const struct event *ev);
1396 
1400 EVENT2_EXPORT_SYMBOL
1401 event_callback_fn event_get_callback(const struct event *ev);
1402 
1406 EVENT2_EXPORT_SYMBOL
1407 void *event_get_callback_arg(const struct event *ev);
1408 
1413 EVENT2_EXPORT_SYMBOL
1414 int event_get_priority(const struct event *ev);
1415 
1423 EVENT2_EXPORT_SYMBOL
1424 void event_get_assignment(const struct event *event,
1425  struct event_base **base_out, evutil_socket_t *fd_out, short *events_out,
1426  event_callback_fn *callback_out, void **arg_out);
1427 
1441 EVENT2_EXPORT_SYMBOL
1442 size_t event_get_struct_event_size(void);
1443 
1453 EVENT2_EXPORT_SYMBOL
1454 const char *event_get_version(void);
1455 
1467 EVENT2_EXPORT_SYMBOL
1468 ev_uint32_t event_get_version_number(void);
1469 
1471 #define LIBEVENT_VERSION EVENT__VERSION
1472 
1474 #define LIBEVENT_VERSION_NUMBER EVENT__NUMERIC_VERSION
1475 
1477 #define EVENT_MAX_PRIORITIES 256
1478 
1505 EVENT2_EXPORT_SYMBOL
1506 int event_base_priority_init(struct event_base *eb, int npriorities);
1507 
1515 EVENT2_EXPORT_SYMBOL
1516 int event_base_get_npriorities(struct event_base *eb);
1517 
1526 EVENT2_EXPORT_SYMBOL
1527 int event_priority_set(struct event *ev, int priority);
1528 
1548 EVENT2_EXPORT_SYMBOL
1549 const struct timeval *event_base_init_common_timeout(struct event_base *base,
1550  const struct timeval *duration);
1551 
1552 #if !defined(EVENT__DISABLE_MM_REPLACEMENT) || defined(EVENT_IN_DOXYGEN_)
1553 
1575 EVENT2_EXPORT_SYMBOL
1577  void *(*malloc_fn)(size_t sz),
1578  void *(*realloc_fn)(void *ptr, size_t sz),
1579  void (*free_fn)(void *ptr));
1582 #define EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
1583 #endif
1584 
1595 EVENT2_EXPORT_SYMBOL
1596 void event_base_dump_events(struct event_base *base, FILE *output);
1597 
1598 
1609 EVENT2_EXPORT_SYMBOL
1610 void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events);
1611 
1621 EVENT2_EXPORT_SYMBOL
1622 void event_base_active_by_signal(struct event_base *base, int sig);
1623 
1627 typedef int (*event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *);
1628 
1654 EVENT2_EXPORT_SYMBOL
1655 int event_base_foreach_event(struct event_base *base, event_base_foreach_event_cb fn, void *arg);
1656 
1657 
1669 EVENT2_EXPORT_SYMBOL
1671  struct timeval *tv);
1672 
1685 EVENT2_EXPORT_SYMBOL
1686 int event_base_update_cache_time(struct event_base *base);
1687 
1702 EVENT2_EXPORT_SYMBOL
1703 void libevent_global_shutdown(void);
1704 
1705 #ifdef __cplusplus
1706 }
1707 #endif
1708 
1709 #endif /* EVENT2_EVENT_H_INCLUDED_ */
event_free
EVENT2_EXPORT_SYMBOL void event_free(struct event *)
Deallocate a struct event * returned by event_new().
event_base_get_signal_method
const EVENT2_EXPORT_SYMBOL char * event_base_get_signal_method(const struct event_base *eb)
Get the kernel signal handling mechanism used by Libevent.
event_fatal_cb
void(* event_fatal_cb)(int err)
A function to be called if Libevent encounters a fatal internal error.
Definition: event.h:773
event_base_get_npriorities
EVENT2_EXPORT_SYMBOL int event_base_get_npriorities(struct event_base *eb)
Get the number of different event priorities.
event_base_get_features
EVENT2_EXPORT_SYMBOL int event_base_get_features(const struct event_base *base)
Return a bitmask of the features implemented by an event base.
event_base_update_cache_time
EVENT2_EXPORT_SYMBOL int event_base_update_cache_time(struct event_base *base)
Update cached_tv in the 'base' to the current time.
event_base_active_by_fd
EVENT2_EXPORT_SYMBOL void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events)
Activates all pending events for the given fd and event mask.
event_new
EVENT2_EXPORT_SYMBOL struct event * event_new(struct event_base *base, evutil_socket_t fd, short events, event_callback_fn callback, void *callback_arg)
Allocate and assign a new event structure, ready to be added.
event_del
EVENT2_EXPORT_SYMBOL int event_del(struct event *ev)
Remove an event from the set of monitored events.
event_set_mem_functions
EVENT2_EXPORT_SYMBOL void event_set_mem_functions(void *(*malloc_fn)(size_t sz), void *(*realloc_fn)(void *ptr, size_t sz), void(*free_fn)(void *ptr))
Override the functions that Libevent uses for memory management.
event_assign
EVENT2_EXPORT_SYMBOL int event_assign(struct event *ev, 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.
event_config_set_num_cpus_hint
EVENT2_EXPORT_SYMBOL int event_config_set_num_cpus_hint(struct event_config *cfg, int cpus)
Records a hint for the number of CPUs in the system.
event_base_once
EVENT2_EXPORT_SYMBOL int event_base_once(struct event_base *base, evutil_socket_t fd, short events, event_callback_fn callback, void *arg, const struct timeval *timeout)
Schedule a one-time event.
event_config_set_max_dispatch_interval
EVENT2_EXPORT_SYMBOL int event_config_set_max_dispatch_interval(struct event_config *cfg, const struct timeval *max_interval, int max_callbacks, int min_priority)
Record an interval and/or a number of callbacks after which the event base should check for new event...
event_get_priority
EVENT2_EXPORT_SYMBOL int event_get_priority(const struct event *ev)
Return the priority of an event.
event_config_set_flag
EVENT2_EXPORT_SYMBOL int event_config_set_flag(struct event_config *cfg, int flag)
Sets one or more flags to configure what parts of the eventual event_base will be initialized,...
event_get_supported_methods
const EVENT2_EXPORT_SYMBOL char ** event_get_supported_methods(void)
Gets all event notification mechanisms supported by Libevent.
event_gettime_monotonic
EVENT2_EXPORT_SYMBOL int event_gettime_monotonic(struct event_base *base, struct timeval *tp)
Query the current monotonic time from the timer for a struct event_base.
event_set_fatal_callback
EVENT2_EXPORT_SYMBOL void event_set_fatal_callback(event_fatal_cb cb)
Override Libevent's behavior in the event of a fatal internal error.
event_enable_debug_mode
EVENT2_EXPORT_SYMBOL void event_enable_debug_mode(void)
Enable some relatively expensive debugging checks in Libevent that would normally be turned off.
event_reinit
EVENT2_EXPORT_SYMBOL int event_reinit(struct event_base *base)
Reinitialize the event base after a fork.
event_base_new_with_config
EVENT2_EXPORT_SYMBOL struct event_base * event_base_new_with_config(const struct event_config *cfg)
Initialize the event API.
event_base
Structure to hold information and state for a Libevent dispatch loop.
Definition: event.h:219
EVENT_BASE_FLAG_NOLOCK
@ EVENT_BASE_FLAG_NOLOCK
Do not allocate a lock for the event base, even if we have locking set up.
Definition: event.h:548
event_get_callback
EVENT2_EXPORT_SYMBOL event_callback_fn event_get_callback(const struct event *ev)
Return the callback assigned to an event.
event
Structure to represent a single event.
Definition: event.h:276
event_base_free_nofinalize
EVENT2_EXPORT_SYMBOL void event_base_free_nofinalize(struct event_base *)
As event_base_free, but do not run finalizers.
event_get_assignment
EVENT2_EXPORT_SYMBOL void event_get_assignment(const struct event *event, struct event_base **base_out, evutil_socket_t *fd_out, short *events_out, event_callback_fn *callback_out, void **arg_out)
Extract all of arguments given to construct a given event.
EVENT_BASE_FLAG_STARTUP_IOCP
@ EVENT_BASE_FLAG_STARTUP_IOCP
Windows only: enable the IOCP dispatcher at startup.
Definition: event.h:560
event_priority_set
EVENT2_EXPORT_SYMBOL int event_priority_set(struct event *ev, int priority)
Assign a priority to an event.
event_get_version_number
EVENT2_EXPORT_SYMBOL ev_uint32_t event_get_version_number(void)
Return a numeric representation of Libevent's version.
event_log_cb
void(* event_log_cb)(int severity, const char *msg)
A callback function used to intercept Libevent's log messages.
Definition: event.h:754
event_get_struct_event_size
EVENT2_EXPORT_SYMBOL size_t event_get_struct_event_size(void)
Return the size of struct event that the Libevent library was compiled with.
EV_FEATURE_O1
@ EV_FEATURE_O1
Require an event method where having one event triggered among many is [approximately] an O(1) operat...
Definition: event.h:520
event_get_events
EVENT2_EXPORT_SYMBOL short event_get_events(const struct event *ev)
Return the events (EV_READ, EV_WRITE, etc) assigned to an event.
event_initialized
EVENT2_EXPORT_SYMBOL int event_initialized(const struct event *ev)
Test if an event structure might be initialized.
event_config_new
EVENT2_EXPORT_SYMBOL struct event_config * event_config_new(void)
Allocates a new event configuration object.
EVENT_BASE_FLAG_USE_SIGNALFD
@ EVENT_BASE_FLAG_USE_SIGNALFD
Use signalfd(2) to handle signals over sigaction/signal.
Definition: event.h:606
event_get_callback_arg
EVENT2_EXPORT_SYMBOL void * event_get_callback_arg(const struct event *ev)
Return the callback argument assigned to an event.
event_active
EVENT2_EXPORT_SYMBOL void event_active(struct event *ev, int res, short ncalls)
Make an event active.
event_method_feature
event_method_feature
A flag used to describe which features an event_base (must) provide.
Definition: event.h:513
event_finalize_callback_fn
void(* event_finalize_callback_fn)(struct event *, void *)
Callback type for event_finalize and event_free_finalize().
Definition: event.h:1180
event_base_got_exit
EVENT2_EXPORT_SYMBOL int event_base_got_exit(struct event_base *eb)
Checks if the event loop was told to exit by event_base_loopexit().
event_base_get_max_events
EVENT2_EXPORT_SYMBOL int event_base_get_max_events(struct event_base *eb, unsigned int flags, int clear)
Get the maximum number of events in a given event_base as specified in the flags.
libevent_global_shutdown
EVENT2_EXPORT_SYMBOL void libevent_global_shutdown(void)
Release up all globally-allocated resources allocated by Libevent.
event_get_version
const EVENT2_EXPORT_SYMBOL char * event_get_version(void)
Get the Libevent version.
event_get_fd
EVENT2_EXPORT_SYMBOL evutil_socket_t event_get_fd(const struct event *ev)
Get the socket or signal assigned to an event, or -1 if the event has no socket.
EV_FEATURE_ET
@ EV_FEATURE_ET
Require an event method that allows edge-triggered events with EV_ET.
Definition: event.h:515
event_del_noblock
EVENT2_EXPORT_SYMBOL int event_del_noblock(struct event *ev)
As event_del(), but never blocks while the event's callback is running in another thread,...
event_config_free
EVENT2_EXPORT_SYMBOL void event_config_free(struct event_config *cfg)
Deallocates all memory associated with an event configuration object.
event_base_get_method
const EVENT2_EXPORT_SYMBOL char * event_base_get_method(const struct event_base *eb)
Get the kernel event notification mechanism used by Libevent.
event_base_config_flag
event_base_config_flag
A flag passed to event_config_set_flag().
Definition: event.h:541
event_config_require_features
EVENT2_EXPORT_SYMBOL int event_config_require_features(struct event_config *cfg, int feature)
Enters a required event method feature that the application demands.
event_base_dump_events
EVENT2_EXPORT_SYMBOL void event_base_dump_events(struct event_base *base, FILE *output)
Writes a human-readable description of all inserted and/or active events to a provided stdio stream.
event_self_cbarg
EVENT2_EXPORT_SYMBOL void * event_self_cbarg(void)
Return a value used to specify that the event itself must be used as the callback argument.
event_base_init_common_timeout
EVENT2_EXPORT_SYMBOL const struct timeval * event_base_init_common_timeout(struct event_base *base, const struct timeval *duration)
Prepare an event_base to use a large number of timeouts with the same duration.
event_base_loop
EVENT2_EXPORT_SYMBOL int event_base_loop(struct event_base *eb, int flags)
Wait for events to become active, and run their callbacks.
event_base_active_by_signal
EVENT2_EXPORT_SYMBOL void event_base_active_by_signal(struct event_base *base, int sig)
Activates all pending signals with a given signal number.
event_base_priority_init
EVENT2_EXPORT_SYMBOL int event_base_priority_init(struct event_base *eb, int npriorities)
Set the number of different event priorities.
event_del_block
EVENT2_EXPORT_SYMBOL int event_del_block(struct event *ev)
As event_del(), but always blocks while the event's callback is running in another thread,...
EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST
@ EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST
If we are using the epoll backend, this flag says that it is safe to use Libevent's internal change-l...
Definition: event.h:580
event_base_loopexit
EVENT2_EXPORT_SYMBOL int event_base_loopexit(struct event_base *eb, const struct timeval *tv)
Exit the event loop after the specified time.
event_debug_unassign
EVENT2_EXPORT_SYMBOL void event_debug_unassign(struct event *)
When debugging mode is enabled, informs Libevent that an event should no longer be considered as assi...
event_base_get_running_event
EVENT2_EXPORT_SYMBOL struct event * event_base_get_running_event(struct event_base *base)
If called from within the callback for an event, returns that event.
event_base_free
EVENT2_EXPORT_SYMBOL void event_base_free(struct event_base *eb)
Deallocate all memory associated with an event_base, and free the base.
event_pending
EVENT2_EXPORT_SYMBOL int event_pending(const struct event *ev, short events, struct timeval *tv)
Checks if a specific event is pending or scheduled.
event_config
Configuration for an event_base.
Definition: event.h:295
event_remove_timer
EVENT2_EXPORT_SYMBOL int event_remove_timer(struct event *ev)
Remove a timer from a pending event without removing the event itself.
EVENT_BASE_FLAG_PRECISE_TIMER
@ EVENT_BASE_FLAG_PRECISE_TIMER
Ordinarily, Libevent implements its time and timeout code using the fastest monotonic timer that we h...
Definition: event.h:587
event_base_dispatch
EVENT2_EXPORT_SYMBOL int event_base_dispatch(struct event_base *base)
Event dispatching loop.
EV_FEATURE_EARLY_CLOSE
@ EV_FEATURE_EARLY_CLOSE
Require an event method that allows you to use EV_CLOSED to detect connection close without the neces...
Definition: event.h:530
EVENT_BASE_FLAG_IGNORE_ENV
@ EVENT_BASE_FLAG_IGNORE_ENV
Do not check the EVENT_* environment variables when configuring an event_base
Definition: event.h:551
event_config_avoid_method
EVENT2_EXPORT_SYMBOL int event_config_avoid_method(struct event_config *cfg, const char *method)
Enters an event method that should be avoided into the configuration.
event_base_get_num_events
EVENT2_EXPORT_SYMBOL int event_base_get_num_events(struct event_base *eb, unsigned int flags)
Gets the number of events in event_base, as specified in the flags.
event_add
EVENT2_EXPORT_SYMBOL int event_add(struct event *ev, const struct timeval *timeout)
Add an event to the set of pending events.
event_base_set
EVENT2_EXPORT_SYMBOL int event_base_set(struct event_base *eb, struct event *ev)
Associate a different event base with an event.
event_base_foreach_event
EVENT2_EXPORT_SYMBOL int event_base_foreach_event(struct event_base *base, event_base_foreach_event_cb fn, void *arg)
Iterate over all added or active events events in an event loop, and invoke a given callback on each ...
event_enable_debug_logging
EVENT2_EXPORT_SYMBOL void event_enable_debug_logging(ev_uint32_t which)
Turn on debugging logs and have them sent to the default log handler.
event_base_foreach_event_cb
int(* event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *)
Callback for iterating events in an event base via event_base_foreach_event.
Definition: event.h:1627
event_callback_fn
void(* event_callback_fn)(evutil_socket_t, short, void *)
A callback function for an event.
Definition: event.h:1048
EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD
@ EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD
With EVENT_BASE_FLAG_PRECISE_TIMER, epoll backend will use timerfd for more accurate timers,...
Definition: event.h:600
EV_FEATURE_FDS
@ EV_FEATURE_FDS
Require an event method that allows file descriptors as well as sockets.
Definition: event.h:523
util.h
Common convenience functions for cross-platform portability and related socket manipulations.
EVENT_BASE_FLAG_NO_CACHE_TIME
@ EVENT_BASE_FLAG_NO_CACHE_TIME
Instead of checking the current time every time the event loop is ready to run timeout callbacks,...
Definition: event.h:564
event_base_new
EVENT2_EXPORT_SYMBOL struct event_base * event_base_new(void)
Create and return a new event_base to use with the rest of Libevent.
event_base_loopcontinue
EVENT2_EXPORT_SYMBOL int event_base_loopcontinue(struct event_base *eb)
Tell the active event_base_loop() to scan for new events immediately.
event_base_loopbreak
EVENT2_EXPORT_SYMBOL int event_base_loopbreak(struct event_base *eb)
Abort the active event_base_loop() immediately.
event_base_got_break
EVENT2_EXPORT_SYMBOL int event_base_got_break(struct event_base *eb)
Checks if the event loop was told to abort immediately by event_base_loopbreak().
event_get_base
EVENT2_EXPORT_SYMBOL struct event_base * event_get_base(const struct event *ev)
Get the event_base associated with an event.
event_base_gettimeofday_cached
EVENT2_EXPORT_SYMBOL int event_base_gettimeofday_cached(struct event_base *base, struct timeval *tv)
Sets 'tv' to the current time (as returned by gettimeofday()), looking at the cached value in 'base' ...
evutil_socket_t
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition: util.h:325
event_set_log_callback
EVENT2_EXPORT_SYMBOL void event_set_log_callback(event_log_cb cb)
Redirect Libevent's log messages.