unbound 0.1
|
This file contains event notification functions. More...
#include "ldns/buffer.h"
Data Structures | |
struct | comm_base |
A communication point dispatcher. More... | |
struct | comm_reply |
Reply information for a communication point. More... | |
struct | comm_point |
Communication point to the network These behaviours can be accomplished by setting the flags and passing return values from the callback. More... | |
struct | comm_timer |
Structure only for making timeout events. More... | |
struct | comm_signal |
Structure only for signal events. More... | |
Defines | |
#define | NETEVENT_NOERROR 0 |
to pass no_error to callback function | |
#define | NETEVENT_CLOSED -1 |
to pass closed connection to callback function | |
#define | NETEVENT_TIMEOUT -2 |
to pass timeout happened to callback function | |
#define | NETEVENT_CAPSFAIL -3 |
to pass fallback from capsforID to callback function; 0x20 failed | |
Typedefs | |
typedef int | comm_point_callback_t (struct comm_point *, void *, int, struct comm_reply *) |
callback from communication point function type | |
Functions | |
struct comm_base * | comm_base_create (int sigs) |
Create a new comm base. | |
void | comm_base_delete (struct comm_base *b) |
Destroy a comm base. | |
void | comm_base_timept (struct comm_base *b, uint32_t **tt, struct timeval **tv) |
Obtain two pointers. | |
void | comm_base_dispatch (struct comm_base *b) |
Dispatch the comm base events. | |
void | comm_base_exit (struct comm_base *b) |
Exit from dispatch loop. | |
struct event_base * | comm_base_internal (struct comm_base *b) |
Access internal data structure (for util/tube.c on windows) | |
struct comm_point * | comm_point_create_udp (struct comm_base *base, int fd, ldns_buffer *buffer, comm_point_callback_t *callback, void *callback_arg) |
Create an UDP comm point. | |
struct comm_point * | comm_point_create_udp_ancil (struct comm_base *base, int fd, ldns_buffer *buffer, comm_point_callback_t *callback, void *callback_arg) |
Create an UDP with ancillary data comm point. | |
struct comm_point * | comm_point_create_tcp (struct comm_base *base, int fd, int num, size_t bufsize, comm_point_callback_t *callback, void *callback_arg) |
Create a TCP listener comm point. | |
struct comm_point * | comm_point_create_tcp_out (struct comm_base *base, size_t bufsize, comm_point_callback_t *callback, void *callback_arg) |
Create an outgoing TCP commpoint. | |
struct comm_point * | comm_point_create_local (struct comm_base *base, int fd, size_t bufsize, comm_point_callback_t *callback, void *callback_arg) |
Create commpoint to listen to a local domain file descriptor. | |
struct comm_point * | comm_point_create_raw (struct comm_base *base, int fd, int writing, comm_point_callback_t *callback, void *callback_arg) |
Create commpoint to listen to a local domain pipe descriptor. | |
void | comm_point_close (struct comm_point *c) |
Close a comm point fd. | |
void | comm_point_delete (struct comm_point *c) |
Close and deallocate (free) the comm point. | |
void | comm_point_send_reply (struct comm_reply *repinfo) |
Send reply. | |
void | comm_point_drop_reply (struct comm_reply *repinfo) |
Drop reply. | |
int | comm_point_send_udp_msg (struct comm_point *c, ldns_buffer *packet, struct sockaddr *addr, socklen_t addrlen) |
Send an udp message over a commpoint. | |
void | comm_point_stop_listening (struct comm_point *c) |
Stop listening for input on the commpoint. | |
void | comm_point_start_listening (struct comm_point *c, int newfd, int sec) |
Start listening again for input on the comm point. | |
void | comm_point_listen_for_rw (struct comm_point *c, int rd, int wr) |
Stop listening and start listening again for reading or writing. | |
size_t | comm_point_get_mem (struct comm_point *c) |
Get size of memory used by comm point. | |
struct comm_timer * | comm_timer_create (struct comm_base *base, void(*cb)(void *), void *cb_arg) |
create timer. | |
void | comm_timer_disable (struct comm_timer *timer) |
disable timer. | |
void | comm_timer_set (struct comm_timer *timer, struct timeval *tv) |
reset timevalue for timer. | |
void | comm_timer_delete (struct comm_timer *timer) |
delete timer. | |
int | comm_timer_is_set (struct comm_timer *timer) |
see if timeout has been set to a value. | |
size_t | comm_timer_get_mem (struct comm_timer *timer) |
Get size of memory used by comm timer. | |
struct comm_signal * | comm_signal_create (struct comm_base *base, void(*callback)(int, void *), void *cb_arg) |
Create a signal handler. | |
int | comm_signal_bind (struct comm_signal *comsig, int sig) |
Bind signal struct to catch a signal. | |
void | comm_signal_delete (struct comm_signal *comsig) |
Delete the signal communication point. | |
int | comm_point_perform_accept (struct comm_point *c, struct sockaddr_storage *addr, socklen_t *addrlen) |
perform accept(2) with error checking. | |
void | comm_point_udp_callback (int fd, short event, void *arg) |
This routine is published for checks and tests, and is only used internally. | |
void | comm_point_udp_ancil_callback (int fd, short event, void *arg) |
This routine is published for checks and tests, and is only used internally. | |
void | comm_point_tcp_accept_callback (int fd, short event, void *arg) |
This routine is published for checks and tests, and is only used internally. | |
void | comm_point_tcp_handle_callback (int fd, short event, void *arg) |
This routine is published for checks and tests, and is only used internally. | |
void | comm_timer_callback (int fd, short event, void *arg) |
This routine is published for checks and tests, and is only used internally. | |
void | comm_signal_callback (int fd, short event, void *arg) |
This routine is published for checks and tests, and is only used internally. | |
void | comm_point_local_handle_callback (int fd, short event, void *arg) |
This routine is published for checks and tests, and is only used internally. | |
void | comm_point_raw_handle_callback (int fd, short event, void *arg) |
This routine is published for checks and tests, and is only used internally. |
This file contains event notification functions.
There are three types of communication points o UDP socket - perthread buffer. o TCP-accept socket - array of TCP-sockets, socketcount. o TCP socket - own buffer, parent-TCPaccept, read/write state, number of bytes read/written, timeout.
There are sockets aimed towards our clients and towards the internet. o frontside - aimed towards our clients, queries come in, answers back. o behind - aimed towards internet, to the authoritative DNS servers.
Several event types are available: o comm_base - for thread safety of the comm points, one per thread. o comm_point - udp and tcp networking, with callbacks. o comm_timer - a timeout with callback. o comm_signal - callbacks when signal is caught. o comm_reply - holds reply info during networking callback.
struct comm_base* comm_base_create | ( | int | sigs | ) | [read] |
Create a new comm base.
sigs,: | if true it attempts to create a default loop for signal handling. |
References internal_base::base, comm_base_now(), comm_base::eb, fatal_exit(), macro_store_create(), internal_base::now, saved_scenario, replay_runtime::scenario, internal_base::secs, replay_runtime::vars, VERB_ALGO, and verbose().
Referenced by libworker_setup(), and worker_init().
void comm_base_delete | ( | struct comm_base * | b | ) |
Destroy a comm base.
All comm points must have been deleted.
b,: | the base to delete. |
References replay_runtime::answer_list, internal_base::base, delete_fake_pending(), delete_replay_answer(), comm_base::eb, macro_store_delete(), fake_timer::next, replay_answer::next, fake_pending::next, replay_runtime::pending_list, replay_runtime::scenario, replay_runtime::timer_list, and replay_runtime::vars.
Referenced by libworker_delete(), and worker_delete().
void comm_base_timept | ( | struct comm_base * | b, |
uint32_t ** | tt, | ||
struct timeval ** | tv | ||
) |
Obtain two pointers.
The pointers never change (until base_delete()). The pointers point to time values that are updated regularly.
b,: | the communication base that will update the time values. |
tt,: | pointer to time in seconds is returned. |
tv,: | pointer to time in microseconds is returned. |
References comm_base::eb, internal_base::now, replay_runtime::now_secs, replay_runtime::now_tv, and internal_base::secs.
Referenced by libworker_setup(), outside_network_create(), and worker_init().
void comm_base_dispatch | ( | struct comm_base * | b | ) |
Dispatch the comm base events.
b,: | the communication to perform. |
References internal_base::base, comm_base::eb, fatal_exit(), run_scenario(), replay_runtime::sig_cb, and replay_runtime::sig_cb_arg.
Referenced by libworker_dobg(), libworker_fg(), and worker_work().
void comm_base_exit | ( | struct comm_base * | b | ) |
Exit from dispatch loop.
b,: | the communication base that is in dispatch(). |
References internal_base::base, comm_base::eb, replay_runtime::exit_cleanly, fatal_exit(), and log_err().
Referenced by do_reload(), do_stop(), libworker_do_cmd(), libworker_fg_done_cb(), libworker_handle_control_cmd(), worker_handle_control_cmd(), worker_sighandler(), and worker_win_stop_cb().
struct event_base* comm_base_internal | ( | struct comm_base * | b | ) | [read] |
Access internal data structure (for util/tube.c on windows)
b,: | comm base |
References internal_base::base, and comm_base::eb.
Referenced by wsvc_setup_worker().
struct comm_point* comm_point_create_udp | ( | struct comm_base * | base, |
int | fd, | ||
ldns_buffer * | buffer, | ||
comm_point_callback_t * | callback, | ||
void * | callback_arg | ||
) | [read] |
Create an UDP comm point.
Calls malloc. setups the structure with the parameters you provide.
base,: | in which base to alloc the commpoint. |
fd | : file descriptor of open UDP socket. |
buffer,: | shared buffer by UDP sockets from this thread. |
callback,: | callback function pointer. |
callback_arg,: | will be passed to your callback function. |
References internal_base::base, internal_event::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point_delete(), comm_point_udp_callback(), comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, comm_point::inuse, log_err(), comm_point::max_tcp_count, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_do_close, comm_point::tcp_do_toggle_rw, comm_point::tcp_free, comm_point::tcp_handlers, comm_point::tcp_is_reading, comm_point::tcp_parent, comm_point::timeout, and comm_point::type.
Referenced by listen_create(), and outside_network_create().
struct comm_point* comm_point_create_udp_ancil | ( | struct comm_base * | base, |
int | fd, | ||
ldns_buffer * | buffer, | ||
comm_point_callback_t * | callback, | ||
void * | callback_arg | ||
) | [read] |
Create an UDP with ancillary data comm point.
Calls malloc. Uses recvmsg instead of recv to get udp message. setups the structure with the parameters you provide.
base,: | in which base to alloc the commpoint. |
fd | : file descriptor of open UDP socket. |
buffer,: | shared buffer by UDP sockets from this thread. |
callback,: | callback function pointer. |
callback_arg,: | will be passed to your callback function. |
References internal_base::base, internal_event::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point_delete(), comm_point_udp_ancil_callback(), comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, comm_point::inuse, log_err(), comm_point::max_tcp_count, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_do_close, comm_point::tcp_do_toggle_rw, comm_point::tcp_free, comm_point::tcp_handlers, comm_point::tcp_is_reading, comm_point::tcp_parent, comm_point::timeout, and comm_point::type.
Referenced by listen_create().
struct comm_point* comm_point_create_tcp | ( | struct comm_base * | base, |
int | fd, | ||
int | num, | ||
size_t | bufsize, | ||
comm_point_callback_t * | callback, | ||
void * | callback_arg | ||
) | [read] |
Create a TCP listener comm point.
Calls malloc. Setups the structure with the parameters you provide. Also Creates TCP Handlers, pre allocated for you. Uses the parameters you provide.
base,: | in which base to alloc the commpoint. |
fd,: | file descriptor of open TCP socket set to listen nonblocking. |
num,: | becomes max_tcp_count, the routine allocates that many tcp handler commpoints. |
bufsize,: | size of buffer to create for handlers. |
callback,: | callback function pointer for TCP handlers. |
callback_arg,: | will be passed to your callback function. |
References internal_base::base, internal_event::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point_create_tcp_handler(), comm_point_delete(), comm_point_tcp_accept_callback(), comm_point::comm_tcp_accept, comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, log_err(), comm_point::max_tcp_count, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_do_close, comm_point::tcp_do_toggle_rw, comm_point::tcp_free, comm_point::tcp_handlers, comm_point::tcp_is_reading, comm_point::tcp_parent, comm_point::timeout, and comm_point::type.
Referenced by listen_create().
struct comm_point* comm_point_create_tcp_out | ( | struct comm_base * | base, |
size_t | bufsize, | ||
comm_point_callback_t * | callback, | ||
void * | callback_arg | ||
) | [read] |
Create an outgoing TCP commpoint.
No file descriptor is opened, left at -1.
base,: | in which base to alloc the commpoint. |
bufsize,: | size of buffer to create for handlers. |
callback,: | callback function pointer for the handler. |
callback_arg,: | will be passed to your callback function. |
References internal_base::base, internal_event::base, comm_point::buffer, comm_reply::c, comm_point::callback, comm_point::cb_arg, comm_point_tcp_handle_callback(), comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, log_err(), comm_point::max_tcp_count, comm_point::repinfo, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_do_close, comm_point::tcp_do_toggle_rw, comm_point::tcp_free, comm_point::tcp_handlers, comm_point::tcp_is_reading, comm_point::tcp_parent, comm_point::timeout, and comm_point::type.
Referenced by create_pending_tcp().
struct comm_point* comm_point_create_local | ( | struct comm_base * | base, |
int | fd, | ||
size_t | bufsize, | ||
comm_point_callback_t * | callback, | ||
void * | callback_arg | ||
) | [read] |
Create commpoint to listen to a local domain file descriptor.
base,: | in which base to alloc the commpoint. |
fd,: | file descriptor of open AF_UNIX socket set to listen nonblocking. |
bufsize,: | size of buffer to create for handlers. |
callback,: | callback function pointer for the handler. |
callback_arg,: | will be passed to your callback function. |
References internal_base::base, internal_event::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point_local_handle_callback(), comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, log_err(), comm_point::max_tcp_count, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_do_close, comm_point::tcp_do_toggle_rw, comm_point::tcp_free, comm_point::tcp_handlers, comm_point::tcp_is_reading, comm_point::tcp_parent, comm_point::timeout, and comm_point::type.
struct comm_point* comm_point_create_raw | ( | struct comm_base * | base, |
int | fd, | ||
int | writing, | ||
comm_point_callback_t * | callback, | ||
void * | callback_arg | ||
) | [read] |
Create commpoint to listen to a local domain pipe descriptor.
base,: | in which base to alloc the commpoint. |
fd,: | file descriptor. |
writing,: | true if you want to listen to writes, false for reads. |
callback,: | callback function pointer for the handler. |
callback_arg,: | will be passed to your callback function. |
References internal_base::base, internal_event::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point_raw_handle_callback(), comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, log_err(), comm_point::max_tcp_count, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_do_close, comm_point::tcp_do_toggle_rw, comm_point::tcp_free, comm_point::tcp_handlers, comm_point::tcp_is_reading, comm_point::tcp_parent, comm_point::timeout, and comm_point::type.
Referenced by accept_open(), remote_accept_callback(), tube_setup_bg_listen(), and tube_setup_bg_write().
void comm_point_close | ( | struct comm_point * | c | ) |
Close a comm point fd.
c,: | comm point to close. |
References comm_point::do_not_close, internal_event::ev, comm_point::ev, comm_point::fd, log_err(), VERB_ALGO, and verbose().
Referenced by comm_point_delete(), decomission_pending_tcp(), outnet_tcptimer(), portcomm_loweruse(), and reclaim_tcp_handler().
void comm_point_delete | ( | struct comm_point * | c | ) |
Close and deallocate (free) the comm point.
If the comm point is a tcp-accept point, also its tcp-handler points are deleted.
c,: | comm point to delete. |
References comm_point::buffer, comm_point_close(), comm_point_delete(), comm_point::ev, comm_point::max_tcp_count, comm_point::tcp_handlers, comm_point::timeout, and comm_point::type.
Referenced by clean_point(), comm_point_create_tcp(), comm_point_create_udp(), comm_point_create_udp_ancil(), comm_point_delete(), daemon_remote_clear(), listen_create(), listen_list_delete(), outside_network_delete(), tube_remove_bg_listen(), and tube_remove_bg_write().
void comm_point_send_reply | ( | struct comm_reply * | repinfo | ) |
Send reply.
Put message into commpoint buffer.
repinfo,: | The reply info copied from a commpoint callback call. |
References comm_reply::addr, comm_reply::addrlen, replay_runtime::answer_last, replay_runtime::answer_list, comm_point::buffer, comm_reply::c, comm_point_send_udp_msg(), comm_point_send_udp_msg_if(), comm_point_start_listening(), comm_point::ev, fatal_exit(), log_assert, log_err(), log_info(), log_pkt(), replay_answer::next, replay_answer::pkt, replay_answer::repinfo, comm_reply::srctype, TCP_QUERY_TIMEOUT, and comm_point::type.
Referenced by fake_front_query(), mesh_new_client(), mesh_send_reply(), and reply_and_prefetch().
void comm_point_drop_reply | ( | struct comm_reply * | repinfo | ) |
Drop reply.
Cleans up.
repinfo,: | The reply info copied from a commpoint callback call. |
References comm_point::buffer, comm_reply::c, log_assert, log_info(), reclaim_tcp_handler(), and comm_point::type.
Referenced by mesh_new_client(), mesh_state_cleanup(), and worker_handle_request().
int comm_point_send_udp_msg | ( | struct comm_point * | c, |
ldns_buffer * | packet, | ||
struct sockaddr * | addr, | ||
socklen_t | addrlen | ||
) |
Send an udp message over a commpoint.
c,: | commpoint to send it from. |
packet,: | what to send. |
addr,: | where to send it to. |
addrlen,: | length of addr. |
References comm_point::fd, log_addr(), log_assert, log_err(), udp_send_errno_needs_log(), VERB_OPS, and verbose().
Referenced by comm_point_send_reply(), comm_point_udp_callback(), and randomize_and_send_udp().
void comm_point_stop_listening | ( | struct comm_point * | c | ) |
Stop listening for input on the commpoint.
No callbacks will happen.
c,: | commpoint to disable. The fd is not closed. |
References internal_event::ev, comm_point::ev, comm_point::fd, log_err(), VERB_ALGO, and verbose().
Referenced by comm_point_tcp_accept_callback(), remote_accept_callback(), tcp_callback_reader(), tcp_callback_writer(), and tube_handle_write().
void comm_point_start_listening | ( | struct comm_point * | c, |
int | newfd, | ||
int | sec | ||
) |
Start listening again for input on the comm point.
c,: | commpoint to enable again. |
newfd,: | new fd, or -1 to leave fd be. |
sec,: | timeout in seconds, or -1 for no (change to the) timeout. |
References internal_event::ev, comm_point::ev, comm_point::fd, log_err(), comm_point::tcp_free, comm_point::tcp_is_reading, comm_point::timeout, comm_point::type, VERB_ALGO, and verbose().
Referenced by comm_point_send_reply(), outnet_tcp_take_into_use(), reclaim_tcp_handler(), remote_accept_callback(), select_ifport(), setup_tcp_handler(), tcp_callback_reader(), tcp_callback_writer(), and tube_queue_item().
void comm_point_listen_for_rw | ( | struct comm_point * | c, |
int | rd, | ||
int | wr | ||
) |
Stop listening and start listening again for reading or writing.
c,: | commpoint |
rd,: | if true, listens for reading. |
wr,: | if true, listens for writing. |
References internal_event::ev, comm_point::ev, comm_point::fd, log_err(), comm_point::timeout, VERB_ALGO, and verbose().
Referenced by remote_control_callback().
size_t comm_point_get_mem | ( | struct comm_point * | c | ) |
Get size of memory used by comm point.
For TCP handlers this includes subhandlers. For UDP handlers, this does not include the (shared) UDP buffer.
c,: | commpoint. |
References comm_point::buffer, comm_point_get_mem(), comm_point::ev, comm_point::max_tcp_count, comm_point::tcp_handlers, comm_point::timeout, and comm_point::type.
Referenced by comm_point_get_mem(), if_get_mem(), listen_get_mem(), outnet_get_mem(), and worker_mem_report().
struct comm_timer* comm_timer_create | ( | struct comm_base * | base, |
void(*)(void *) | cb, | ||
void * | cb_arg | ||
) | [read] |
create timer.
Not active upon creation.
base,: | event handling base. |
cb,: | callback function: void myfunc(void* myarg); |
cb_arg,: | user callback argument. |
References internal_base::base, internal_timer::base, comm_timer::callback, fake_timer::cb, comm_timer::cb_arg, fake_timer::cb_arg, comm_timer_callback(), comm_base::eb, internal_timer::ev, comm_timer::ev_timer, fptr_ok, fptr_whitelist_comm_timer(), log_err(), fake_timer::next, fake_timer::runtime, and replay_runtime::timer_list.
Referenced by pending_tcp_query(), pending_udp_query(), worker_init(), and wsvc_setup_worker().
void comm_timer_disable | ( | struct comm_timer * | timer | ) |
disable timer.
Stops callbacks from happening.
timer,: | to disable. |
References internal_timer::enabled, fake_timer::enabled, internal_timer::ev, comm_timer::ev_timer, and log_info().
Referenced by comm_timer_delete(), comm_timer_set(), and outnet_udp_cb().
void comm_timer_set | ( | struct comm_timer * | timer, |
struct timeval * | tv | ||
) |
reset timevalue for timer.
timer,: | timer to (re)set. |
tv,: | when the timer should activate. if NULL timer is disabled. |
References internal_base::base, internal_timer::base, comm_timer_callback(), comm_timer_disable(), comm_base::eb, internal_timer::enabled, fake_timer::enabled, internal_timer::ev, comm_timer::ev_timer, log_assert, log_err(), log_info(), replay_runtime::now_tv, fake_timer::runtime, timeval_add(), and fake_timer::tv.
Referenced by pending_tcp_query(), randomize_and_send_udp(), reset_worker_timer(), set_cron_timer(), worker_init(), worker_probe_timer_cb(), and worker_restart_timer().
void comm_timer_delete | ( | struct comm_timer * | timer | ) |
delete timer.
timer,: | to delete. |
References comm_timer_disable(), comm_timer::ev_timer, fake_timer::next, fake_timer::runtime, and replay_runtime::timer_list.
Referenced by pending_delete(), pending_udp_query(), waiting_tcp_delete(), worker_delete(), and wsvc_desetup_worker().
int comm_timer_is_set | ( | struct comm_timer * | timer | ) |
see if timeout has been set to a value.
timer,: | the timer to examine. |
References internal_timer::enabled, and comm_timer::ev_timer.
size_t comm_timer_get_mem | ( | struct comm_timer * | timer | ) |
Get size of memory used by comm timer.
timer,: | the timer to examine. |
Referenced by serviced_get_mem(), waiting_tcp_get_mem(), and waiting_udp_get_mem().
struct comm_signal* comm_signal_create | ( | struct comm_base * | base, |
void(*)(int, void *) | callback, | ||
void * | cb_arg | ||
) | [read] |
Create a signal handler.
Call signal_bind() later to bind to a signal.
base,: | communication base to use. |
callback,: | called when signal is caught. |
cb_arg,: | user argument to callback |
References comm_signal::base, comm_signal::callback, comm_signal::cb_arg, replay_runtime::cb_arg, comm_signal::ev_signal, log_err(), replay_runtime::sig_cb, and replay_runtime::sig_cb_arg.
Referenced by worker_init().
int comm_signal_bind | ( | struct comm_signal * | comsig, |
int | sig | ||
) |
Bind signal struct to catch a signal.
A signle comm_signal can be bound to multiple signals, calling comm_signal_bind multiple times.
comsig,: | the communication point, with callback information. |
sig,: | signal number. |
References internal_base::base, comm_signal::base, comm_signal_callback(), comm_base::eb, internal_signal::ev, comm_signal::ev_signal, log_assert, log_err(), and internal_signal::next.
Referenced by worker_init().
void comm_signal_delete | ( | struct comm_signal * | comsig | ) |
Delete the signal communication point.
comsig,: | to delete. |
References internal_signal::ev, comm_signal::ev_signal, and internal_signal::next.
Referenced by worker_delete().
int comm_point_perform_accept | ( | struct comm_point * | c, |
struct sockaddr_storage * | addr, | ||
socklen_t * | addrlen | ||
) |
perform accept(2) with error checking.
c,: | commpoint with accept fd. |
addr,: | remote end returned here. |
addrlen,: | length of remote end returned here. |
References internal_event::ev, comm_point::ev, comm_point::fd, fd_set_nonblock(), log_addr(), and log_err().
Referenced by comm_point_tcp_accept_callback(), and remote_accept_callback().
void comm_point_udp_callback | ( | int | fd, |
short | event, | ||
void * | arg | ||
) |
This routine is published for checks and tests, and is only used internally.
handle libevent callback for udp comm point.
fd,: | file descriptor. |
event,: | event bits from libevent: EV_READ, EV_WRITE, EV_SIGNAL, EV_TIMEOUT. |
arg,: | the comm_point structure. |
References comm_reply::addr, comm_reply::addrlen, internal_event::base, comm_point::buffer, comm_reply::c, comm_point::callback, comm_point::cb_arg, comm_base_now(), comm_point_send_udp_msg(), comm_point::comm_udp, comm_point::ev, comm_point::fd, fptr_ok, fptr_whitelist_comm_point(), log_assert, log_err(), NETEVENT_NOERROR, NUM_UDP_PER_SELECT, comm_reply::srctype, and comm_point::type.
Referenced by comm_point_create_udp(), and fptr_whitelist_event().
void comm_point_udp_ancil_callback | ( | int | fd, |
short | event, | ||
void * | arg | ||
) |
This routine is published for checks and tests, and is only used internally.
handle libevent callback for udp ancillary data comm point.
fd,: | file descriptor. |
event,: | event bits from libevent: EV_READ, EV_WRITE, EV_SIGNAL, EV_TIMEOUT. |
arg,: | the comm_point structure. |
References comm_reply::addr, comm_reply::addrlen, internal_event::base, comm_point::buffer, comm_reply::c, comm_point::callback, comm_point::cb_arg, comm_base_now(), comm_point_send_udp_msg_if(), comm_point::comm_udp, comm_point::ev, fatal_exit(), comm_point::fd, fptr_ok, fptr_whitelist_comm_point(), log_assert, log_err(), NETEVENT_NOERROR, NUM_UDP_PER_SELECT, comm_reply::pktinfo, comm_reply::srctype, comm_point::type, VERB_ALGO, and verbosity.
Referenced by comm_point_create_udp_ancil(), and fptr_whitelist_event().
void comm_point_tcp_accept_callback | ( | int | fd, |
short | event, | ||
void * | arg | ||
) |
This routine is published for checks and tests, and is only used internally.
handle libevent callback for tcp accept comm point
fd,: | file descriptor. |
event,: | event bits from libevent: EV_READ, EV_WRITE, EV_SIGNAL, EV_TIMEOUT. |
arg,: | the comm_point structure. |
References comm_reply::addr, internal_event::base, comm_base_now(), comm_point_perform_accept(), comm_point_stop_listening(), comm_point::comm_tcp_accept, comm_point::ev, log_assert, log_info(), log_warn(), comm_point::repinfo, setup_tcp_handler(), comm_point::tcp_free, and comm_point::type.
Referenced by comm_point_create_tcp(), and fptr_whitelist_event().
void comm_point_tcp_handle_callback | ( | int | fd, |
short | event, | ||
void * | arg | ||
) |
This routine is published for checks and tests, and is only used internally.
handle libevent callback for tcp data comm point
fd,: | file descriptor. |
event,: | event bits from libevent: EV_READ, EV_WRITE, EV_SIGNAL, EV_TIMEOUT. |
arg,: | the comm_point structure. |
References internal_event::base, comm_point::callback, comm_point::cb_arg, comm_base_now(), comm_point_tcp_handle_read(), comm_point_tcp_handle_write(), comm_point::comm_tcp, comm_point::ev, fptr_ok, fptr_whitelist_comm_point(), log_assert, log_err(), NETEVENT_CLOSED, NETEVENT_TIMEOUT, reclaim_tcp_handler(), comm_point::tcp_do_close, comm_point::type, VERB_QUERY, and verbose().
Referenced by comm_point_create_tcp_handler(), comm_point_create_tcp_out(), and fptr_whitelist_event().
void comm_timer_callback | ( | int | fd, |
short | event, | ||
void * | arg | ||
) |
This routine is published for checks and tests, and is only used internally.
handle libevent callback for timer comm.
fd,: | file descriptor (always -1). |
event,: | event bits from libevent: EV_READ, EV_WRITE, EV_SIGNAL, EV_TIMEOUT. |
arg,: | the comm_timer structure. |
References internal_timer::base, comm_timer::callback, comm_timer::cb_arg, comm_base_now(), internal_timer::enabled, comm_timer::ev_timer, fptr_ok, fptr_whitelist_comm_timer(), and log_assert.
Referenced by comm_timer_create(), comm_timer_set(), and fptr_whitelist_event().
void comm_signal_callback | ( | int | fd, |
short | event, | ||
void * | arg | ||
) |
This routine is published for checks and tests, and is only used internally.
handle libevent callback for signal comm.
fd,: | file descriptor (used for the signal number). |
event,: | event bits from libevent: EV_READ, EV_WRITE, EV_SIGNAL, EV_TIMEOUT. |
arg,: | the internal commsignal structure. |
References comm_signal::base, comm_signal::callback, comm_signal::cb_arg, comm_base_now(), fptr_ok, fptr_whitelist_comm_signal(), and log_assert.
Referenced by comm_signal_bind(), and fptr_whitelist_event().
void comm_point_local_handle_callback | ( | int | fd, |
short | event, | ||
void * | arg | ||
) |
This routine is published for checks and tests, and is only used internally.
libevent callback for AF_UNIX fds
fd,: | file descriptor. |
event,: | event bits from libevent: EV_READ, EV_WRITE, EV_SIGNAL, EV_TIMEOUT. |
arg,: | the comm_point structure. |
References internal_event::base, comm_point::callback, comm_point::cb_arg, comm_base_now(), comm_point::comm_local, comm_point_tcp_handle_read(), comm_point::ev, fptr_ok, fptr_whitelist_comm_point(), log_assert, log_err(), NETEVENT_CLOSED, and comm_point::type.
Referenced by comm_point_create_local(), and fptr_whitelist_event().
void comm_point_raw_handle_callback | ( | int | fd, |
short | event, | ||
void * | arg | ||
) |
This routine is published for checks and tests, and is only used internally.
libevent callback for raw fd access.
fd,: | file descriptor. |
event,: | event bits from libevent: EV_READ, EV_WRITE, EV_SIGNAL, EV_TIMEOUT. |
arg,: | the comm_point structure. |
References internal_event::base, comm_point::callback, comm_point::cb_arg, comm_base_now(), comm_point::comm_raw, comm_point::ev, fptr_ok, fptr_whitelist_comm_point_raw(), log_assert, NETEVENT_NOERROR, NETEVENT_TIMEOUT, and comm_point::type.
Referenced by comm_point_create_raw(), and fptr_whitelist_event().