41 static const char* xfrh_str =
"xfrhandler";
43 static void xfrhandler_handle_dns(
netio_type* netio,
76 ods_log_error(
"[%s] unable to create xfrhandler: " 77 "netio_create() failed", xfrh_str);
83 ods_log_error(
"[%s] unable to create xfrhandler: " 84 "buffer_create() failed", xfrh_str);
90 ods_log_error(
"[%s] unable to create xfrhandler: " 91 "tcp_set_create() failed", xfrh_str);
112 ods_log_assert(xfrhandler);
113 ods_log_assert(xfrhandler->
engine);
114 ods_log_debug(
"[%s] start", xfrh_str);
123 ods_log_deeebug(
"[%s] netio dispatch", xfrh_str);
125 if (errno != EINTR) {
126 ods_log_error(
"[%s] unable to dispatch netio: %s", xfrh_str,
132 ods_log_debug(
"[%s] shutdown", xfrh_str);
161 if (xfrhandler && xfrhandler->
started) {
162 janitor_thread_signal(xfrhandler->
thread_id);
172 xfrhandler_handle_dns(
netio_type* ATTR_UNUSED(netio),
177 ssize_t received = 0;
184 ods_log_debug(
"[%s] read forwarded dns packet: %d bytes received",
185 xfrh_str, (
int) received);
186 if (received == -1) {
187 ods_log_error(
"[%s] unable to forward dns packet: %s", xfrh_str,
void netio_cleanup_shallow(netio_type *netio)
xfrd_type * udp_waiting_first
xfrd_type * udp_waiting_last
xfrd_type * tcp_waiting_first
void xfrhandler_cleanup(xfrhandler_type *xfrhandler)
janitor_thread_t thread_id
enum netio_events_enum netio_events_type
netio_handler_type dnshandler
void netio_add_handler(netio_type *netio, netio_handler_type *handler)
time_t xfrhandler_time(xfrhandler_type *xfrhandler)
void buffer_cleanup(buffer_type *buffer)
xfrhandler_type * xfrhandler_create()
void xfrhandler_start(xfrhandler_type *xfrhandler)
notify_type * notify_waiting_first
netio_event_handler_type event_handler
notify_type * notify_waiting_last
void tcp_set_cleanup(tcp_set_type *set)
void xfrhandler_signal(xfrhandler_type *xfrhandler)
#define PACKET_BUFFER_SIZE
netio_events_type event_types
netio_type * netio_create()
struct timespec * timeout
tcp_set_type * tcp_set_create()
buffer_type * buffer_create(size_t capacity)
int netio_dispatch(netio_type *netio, const struct timespec *timeout, const sigset_t *sigmask)