|
unbound 0.1
|
This file contains and implementation for the indirection layer for pluggable events that transparently passes it either directly to libevent, or calls the libevent compatibility layer functions. More...
#include "config.h"#include <sys/time.h>#include "util/ub_event.h"#include "util/log.h"#include "util/netevent.h"#include "util/tube.h"#include "daemon/remote.h"#include "event2/event.h"#include "event2/event_struct.h"#include "event2/event_compat.h"Macros | |
| #define | NATIVE_BITS(b) |
| #define | NATIVE_BITS_CB(c) |
| #define | EVFLAG_AUTO 0 |
| #define | AS_EVENT_BASE(x) |
| #define | AS_UB_EVENT_BASE(x) |
| #define | AS_EVENT(x) |
| #define | AS_UB_EVENT(x) |
Functions | |
| const char * | ub_event_get_version (void) |
| Returns event-base type. | |
| void | ub_get_event_sys (struct ub_event_base *base, const char **n, const char **s, const char **m) |
| Return the name, system and method for the pluggable event base. | |
| struct ub_event_base * | ub_default_event_base (int sigs, time_t *time_secs, struct timeval *time_tv) |
| Return a default event base. | |
| struct ub_event_base * | ub_libevent_event_base (struct event_base *libevent_base) |
| Return an ub_event_base constructed for the given libevent event base. | |
| struct event_base * | ub_libevent_get_event_base (struct ub_event_base *base) |
| Return the libevent base underlying the given ub_event_base. | |
| void | ub_event_base_free (struct ub_event_base *base) |
| Free event base. | |
| int | ub_event_base_dispatch (struct ub_event_base *base) |
| Run the event base. | |
| int | ub_event_base_loopexit (struct ub_event_base *base) |
| exit that loop | |
| struct ub_event * | ub_event_new (struct ub_event_base *base, int fd, short bits, void(*cb)(int, short, void *), void *arg) |
| Create a new ub_event for the event base. | |
| struct ub_event * | ub_signal_new (struct ub_event_base *base, int fd, void(*cb)(int, short, void *), void *arg) |
| Create a new ub_event signal for the event base. | |
| struct ub_event * | ub_winsock_register_wsaevent (struct ub_event_base *base, void *wsaevent, void(*cb)(int, short, void *), void *arg) |
| Create a new ub_event associated with the wsaevent for the event base. | |
| void | ub_event_add_bits (struct ub_event *ev, short bits) |
| Add event bits for this event to fire on. | |
| void | ub_event_del_bits (struct ub_event *ev, short bits) |
| Configure the event so it will not longer fire on given bits. | |
| void | ub_event_set_fd (struct ub_event *ev, int fd) |
| Change or set the file descriptor on the event. | |
| void | ub_event_free (struct ub_event *ev) |
| free the event | |
| int | ub_event_add (struct ub_event *ev, struct timeval *tv) |
| Activate the event. | |
| int | ub_event_del (struct ub_event *ev) |
| Deactivate the event. | |
| int | ub_timer_add (struct ub_event *ev, struct ub_event_base *base, void(*cb)(int, short, void *), void *arg, struct timeval *tv) |
| Reconfigure and activate a timeout event. | |
| int | ub_timer_del (struct ub_event *ev) |
| Deactivate the timeout event. | |
| int | ub_signal_add (struct ub_event *ev, struct timeval *tv) |
| Activate a signal event. | |
| int | ub_signal_del (struct ub_event *ev) |
| Deactivate a signal event. | |
| void | ub_winsock_unregister_wsaevent (struct ub_event *ev) |
| Free a with a wsaevent associated event. | |
| void | ub_winsock_tcp_wouldblock (struct ub_event *ev, int eventbits) |
| Signal the eventloop when a TCP windows socket will block on next read or write (given by the eventbits). | |
| void | ub_comm_base_now (struct comm_base *cb) |
| Equip the comm_base with the current time. | |
This file contains and implementation for the indirection layer for pluggable events that transparently passes it either directly to libevent, or calls the libevent compatibility layer functions.
| #define NATIVE_BITS | ( | b | ) |
| #define NATIVE_BITS_CB | ( | c | ) |
| #define AS_EVENT_BASE | ( | x | ) |
| #define AS_UB_EVENT_BASE | ( | x | ) |
| #define AS_EVENT | ( | x | ) |
| #define AS_UB_EVENT | ( | x | ) |
| const char * ub_event_get_version | ( | void | ) |
Returns event-base type.
Could be "mini-event", "winsock-event" for the daemon compile, and will be "pluggable-event<PACKAGE_VERSION>" for libunbound.
References ub_event_get_version().
Referenced by checkrlimits(), and ub_event_get_version().
| void ub_get_event_sys | ( | struct ub_event_base * | base, |
| const char ** | n, | ||
| const char ** | s, | ||
| const char ** | m ) |
Return the name, system and method for the pluggable event base.
References ub_get_event_sys().
Referenced by comm_base_create(), print_build_options(), setup_and_run(), ub_get_event_sys(), and ub_get_event_sys().
| struct ub_event_base * ub_default_event_base | ( | int | sigs, |
| time_t * | time_secs, | ||
| struct timeval * | time_tv ) |
Return a default event base.
In the daemon this will be the only event bases used.
References ub_default_event_base().
Referenced by comm_base_create(), dtio_control_stop_flush(), dtio_setup_base(), print_build_options(), setup_and_run(), and ub_default_event_base().
| struct ub_event_base * ub_libevent_event_base | ( | struct event_base * | libevent_base | ) |
Return an ub_event_base constructed for the given libevent event base.
References ub_libevent_event_base().
Referenced by ub_ctx_create_event(), ub_ctx_set_event(), ub_libevent_event_base(), and ub_libevent_event_base().
| struct event_base * ub_libevent_get_event_base | ( | struct ub_event_base * | base | ) |
Return the libevent base underlying the given ub_event_base.
Will return NULL when the ub_event_base does not have an underlying libevent event base
References ub_libevent_get_event_base().
Referenced by ub_ctx_set_event(), ub_get_event_sys(), and ub_libevent_get_event_base().
| void ub_event_base_free | ( | struct ub_event_base * | base | ) |
Free event base.
Free events yourself
References ub_event_base_free().
Referenced by comm_base_delete(), dtio_control_stop_flush(), dtio_desetup(), print_build_options(), setup_and_run(), ub_ctx_delete(), and ub_event_base_free().
| int ub_event_base_dispatch | ( | struct ub_event_base * | base | ) |
Run the event base.
References ub_event_base_dispatch().
Referenced by comm_base_dispatch(), dnstap_io(), dtio_control_stop_flush(), setup_and_run(), and ub_event_base_dispatch().
| int ub_event_base_loopexit | ( | struct ub_event_base * | base | ) |
exit that loop
References ub_event_base_loopexit().
Referenced by comm_base_exit(), dtio_cmd_cb(), dtio_stop_flush_exit(), main_sigh(), and ub_event_base_loopexit().
| struct ub_event * ub_event_new | ( | struct ub_event_base * | base, |
| int | fd, | ||
| short | bits, | ||
| void(* | cb )(int, short, void *), | ||
| void * | arg ) |
Create a new ub_event for the event base.
References ub_event_new().
Referenced by comm_point_create_doq(), comm_point_create_http_out(), comm_point_create_local(), comm_point_create_raw(), comm_point_create_tcp(), comm_point_create_tcp_handler(), comm_point_create_tcp_out(), comm_point_create_udp(), comm_point_perform_accept(), comm_point_slow_accept(), comm_point_tcp_accept_callback(), comm_timer_create(), dtio_control_stop_flush(), dtio_mainfdcallback(), dtio_open_output(), dtio_setup_cmd(), dtio_setup_reconnect(), fast_reload_thread_start(), tap_socket_setup(), and ub_event_new().
| struct ub_event * ub_signal_new | ( | struct ub_event_base * | base, |
| int | fd, | ||
| void(* | cb )(int, short, void *), | ||
| void * | arg ) |
Create a new ub_event signal for the event base.
References ub_signal_new().
Referenced by comm_signal_bind(), and ub_signal_new().
| struct ub_event * ub_winsock_register_wsaevent | ( | struct ub_event_base * | base, |
| void * | wsaevent, | ||
| void(* | cb )(int, short, void *), | ||
| void * | arg ) |
Create a new ub_event associated with the wsaevent for the event base.
References ub_winsock_register_wsaevent().
Referenced by ub_winsock_register_wsaevent(), and wsvc_setup_worker().
| void ub_event_add_bits | ( | struct ub_event * | ev, |
| short | bits ) |
Add event bits for this event to fire on.
References ub_event_add_bits().
Referenced by comm_point_listen_for_rw(), comm_point_start_listening(), dtio_add_output_event_write(), and ub_event_add_bits().
| void ub_event_del_bits | ( | struct ub_event * | ev, |
| short | bits ) |
Configure the event so it will not longer fire on given bits.
References ub_event_del_bits().
Referenced by comm_point_listen_for_rw(), comm_point_start_listening(), dtio_add_output_event_read(), and ub_event_del_bits().
| void ub_event_set_fd | ( | struct ub_event * | ev, |
| int | fd ) |
Change or set the file descriptor on the event.
References ub_event_set_fd().
Referenced by comm_point_start_listening(), and ub_event_set_fd().
| void ub_event_free | ( | struct ub_event * | ev | ) |
free the event
References ub_event_free().
Referenced by comm_base_delete(), comm_base_delete_no_base(), comm_point_create_local(), comm_point_create_raw(), comm_point_delete(), comm_point_tcp_accept_callback(), comm_signal_bind(), comm_signal_delete(), comm_timer_delete(), dtio_close_output(), dtio_control_stop_flush(), dtio_desetup(), dtio_open_output(), fast_reload_thread_desetup(), tap_data_free(), tap_socket_delete(), and ub_event_free().
| int ub_event_add | ( | struct ub_event * | ev, |
| struct timeval * | tv ) |
Activate the event.
The given timeval is an timeout value.
References ub_event_add().
Referenced by comm_point_create_doq(), comm_point_create_local(), comm_point_create_raw(), comm_point_create_tcp(), comm_point_create_udp(), comm_point_listen_for_rw(), comm_point_perform_accept(), comm_point_slow_accept(), comm_point_start_listening(), dtio_add_output_event_read(), dtio_add_output_event_write(), dtio_control_stop_flush(), dtio_mainfdcallback(), dtio_setup_cmd(), fast_reload_thread_start(), tap_socket_setup(), and ub_event_add().
| int ub_event_del | ( | struct ub_event * | ev | ) |
Deactivate the event.
References ub_event_del().
Referenced by comm_base_delete(), comm_base_delete_no_base(), comm_point_close(), comm_point_listen_for_rw(), comm_point_start_listening(), comm_point_stop_listening(), dtio_add_output_event_read(), dtio_add_output_event_write(), dtio_control_stop_flush(), dtio_del_output_event(), dtio_desetup(), fast_reload_thread_desetup(), tap_data_free(), tap_socket_delev(), and ub_event_del().
| int ub_timer_add | ( | struct ub_event * | ev, |
| struct ub_event_base * | base, | ||
| void(* | cb )(int, short, void *), | ||
| void * | arg, | ||
| struct timeval * | tv ) |
Reconfigure and activate a timeout event.
References ub_timer_add().
Referenced by comm_timer_set(), dtio_control_stop_flush(), dtio_reconnect_enable_timeout(), and ub_timer_add().
| int ub_timer_del | ( | struct ub_event * | ev | ) |
Deactivate the timeout event.
References ub_timer_del().
Referenced by comm_timer_disable(), dtio_control_stop_flush(), dtio_reconnect_del(), and ub_timer_del().
| int ub_signal_add | ( | struct ub_event * | ev, |
| struct timeval * | tv ) |
Activate a signal event.
References ub_signal_add().
Referenced by comm_signal_bind(), and ub_signal_add().
| int ub_signal_del | ( | struct ub_event * | ev | ) |
Deactivate a signal event.
References ub_signal_del().
Referenced by comm_signal_delete(), and ub_signal_del().
| void ub_winsock_unregister_wsaevent | ( | struct ub_event * | ev | ) |
Free a with a wsaevent associated event.
References ub_winsock_unregister_wsaevent().
Referenced by ub_winsock_unregister_wsaevent().
| void ub_winsock_tcp_wouldblock | ( | struct ub_event * | ev, |
| int | eventbits ) |
Signal the eventloop when a TCP windows socket will block on next read or write (given by the eventbits).
References ub_winsock_tcp_wouldblock().
Referenced by comm_point_close(), comm_point_perform_accept(), comm_point_tcp_handle_read(), comm_point_tcp_handle_write(), dtio_check_nb_connect(), dtio_mainfdcallback(), dtio_write_buf(), fr_check_cmd_from_thread(), fr_client_send_item_fd(), fr_main_handle_cmd(), http_check_connect(), http_read_more(), http_write_more(), receive_bytes(), receive_bytes(), ssl_handle_read(), ssl_handle_write(), and ub_winsock_tcp_wouldblock().
| void ub_comm_base_now | ( | struct comm_base * | cb | ) |
Equip the comm_base with the current time.
fillup the time values in the event base
References comm_base_timept(), log_err(), and ub_comm_base_now().
Referenced by comm_base_create(), comm_base_create_event(), comm_point_http_handle_callback(), comm_point_local_handle_callback(), comm_point_perform_accept(), comm_point_slow_accept(), comm_point_tcp_accept_callback(), comm_point_tcp_handle_callback(), comm_point_udp_callback(), comm_signal_callback(), ub_comm_base_now(), and ub_resolve_event().