This file contains event notification functions. More...
#include "config.h"#include "util/netevent.h"#include "util/ub_event.h"#include "util/log.h"#include "util/net_help.h"#include "util/tcp_conn_limit.h"#include "util/fptr_wlist.h"#include "util/proxy_protocol.h"#include "util/timeval_func.h"#include "sldns/pkthdr.h"#include "sldns/sbuffer.h"#include "sldns/str2wire.h"#include "dnstap/dnstap.h"#include "dnscrypt/dnscrypt.h"#include "services/listen_dnsport.h"#include "util/random.h"Data Structures | |
| struct | internal_event | 
| The internal event structure for keeping ub_event info for the event.  More... | |
| struct | internal_base | 
| Internal base structure, so that every thread has its own events.  More... | |
| struct | internal_timer | 
| Internal timer structure, to store timer event in.  More... | |
| struct | internal_signal | 
| Internal signal structure, to store signal event in.  More... | |
Macros | |
| #define | CMSG_ALIGN(len) (((len)+sizeof(long)-1) & ~(sizeof(long)-1)) | 
| if CMSG_ALIGN is not defined on this platform, a workaround  | |
| #define | CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr))+(len)) | 
| if CMSG_LEN is not defined on this platform, a workaround  | |
| #define | CMSG_SPACE(l) (CMSG_ALIGN(l)+CMSG_ALIGN(sizeof(struct cmsghdr))) | 
| if CMSG_SPACE is not defined on this platform, a workaround  | |
| #define | TCP_QUERY_TIMEOUT 120000 | 
| The TCP writing query timeout in milliseconds.  | |
| #define | TCP_QUERY_TIMEOUT_MINIMUM 200 | 
| The minimum actual TCP timeout to use, regardless of what we advertise, in msec.  | |
| #define | NUM_UDP_PER_SELECT 100 | 
| number of UDP reads to perform per read indication from select  | |
| #define | SEND_BLOCKED_WAIT_TIMEOUT 200 | 
| timeout in millisec to wait for write to unblock, packets dropped after.  | |
| #define | SEND_BLOCKED_MAX_RETRY 5 | 
| max number of times to wait for write to unblock, packets dropped after.  | |
| #define | SO_TIMESTAMP 29 | 
| Let's make timestamping code cleaner and redefine SO_TIMESTAMP*.  | |
| #define | SO_TIMESTAMPNS 35 | 
| #define | SO_TIMESTAMPING 37 | 
Functions | |
| static struct comm_point * | comm_point_create_tcp_handler (struct comm_base *base, struct comm_point *parent, size_t bufsize, struct sldns_buffer *spoolbuf, comm_point_callback_type *callback, void *callback_arg, struct unbound_socket *socket) | 
| create a tcp handler with a parent  | |
| struct comm_base * | comm_base_create (int sigs) | 
| Create a new comm base.   | |
| struct comm_base * | comm_base_create_event (struct ub_event_base *base) | 
| Create comm base that uses the given ub_event_base (underlying pluggable event mechanism pointer).   | |
| void | comm_base_delete (struct comm_base *b) | 
| Destroy a comm base.   | |
| void | comm_base_delete_no_base (struct comm_base *b) | 
| Delete comm base structure but not the underlying lib event base.   | |
| void | comm_base_timept (struct comm_base *b, time_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.   | |
| void | comm_base_set_slow_accept_handlers (struct comm_base *b, void(*stop_acc)(void *), void(*start_acc)(void *), void *arg) | 
| Set the slow_accept mode handlers.   | |
| struct ub_event_base * | comm_base_internal (struct comm_base *b) | 
| Access internal data structure (for util/tube.c on windows)   | |
| struct ub_event * | comm_point_internal (struct comm_point *c) | 
| Access internal event structure.   | |
| static int | udp_send_errno_needs_log (struct sockaddr *addr, socklen_t addrlen) | 
| see if errno for udp has to be logged or not uses globals  | |
| int | tcp_connect_errno_needs_log (struct sockaddr *addr, socklen_t addrlen) | 
| See if errno for tcp connect has to be logged or not.   | |
| int | comm_point_send_udp_msg (struct comm_point *c, sldns_buffer *packet, struct sockaddr *addr, socklen_t addrlen, int is_connected) | 
| Send an udp message over a commpoint.   | |
| static int | comm_point_send_udp_msg_if (struct comm_point *c, sldns_buffer *packet, struct sockaddr *addr, socklen_t addrlen, struct comm_reply *r) | 
| send a UDP reply over specified interface  | |
| static int | udp_recv_needs_log (int err) | 
| return true is UDP receive error needs to be logged  | |
| static int | consume_pp2_header (struct sldns_buffer *buf, struct comm_reply *rep, int stream) | 
| Parses the PROXYv2 header from buf and updates the comm_reply struct.   | |
| void | comm_point_udp_callback (int fd, short event, void *arg) | 
| This routine is published for checks and tests, and is only used internally.   | |
| int | adjusted_tcp_timeout (struct comm_point *c) | 
| For TCP handlers that use c->tcp_timeout_msec, this routine adjusts it with the minimum.   | |
| static void | setup_tcp_handler (struct comm_point *c, int fd, int cur, int max) | 
| Use a new tcp handler for new query fd, set to read query.  | |
| void | comm_base_handle_slow_accept (int ATTR_UNUSED(fd), short ATTR_UNUSED(event), void *arg) | 
| int | comm_point_perform_accept (struct comm_point *c, struct sockaddr_storage *addr, socklen_t *addrlen) | 
| perform accept(2) with error checking.   | |
| static void | http2_session_server_delete (struct http2_session *h2_session) | 
| delete http2 session server.   | |
| 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.   | |
| static void | reclaim_tcp_handler (struct comm_point *c) | 
| Make tcp handler free for next assignment.  | |
| static void | tcp_callback_writer (struct comm_point *c) | 
| do the callback when writing is done  | |
| static void | tcp_callback_reader (struct comm_point *c) | 
| do the callback when reading is done  | |
| static int | ssl_handle_read (struct comm_point *c) | 
| continue ssl handshake   | |
| static int | ssl_handle_write (struct comm_point *c) | 
| ssl write callback on TCP  | |
| static int | ssl_handle_it (struct comm_point *c, int is_write) | 
| handle ssl tcp connection with dns contents  | |
| static int | comm_point_tcp_handle_read (int fd, struct comm_point *c, int short_ok) | 
| Handle tcp reading callback.   | |
| static int | comm_point_tcp_handle_write (int fd, struct comm_point *c) | 
| Handle tcp writing callback.   | |
| static int | tcp_req_info_read_again (int fd, struct comm_point *c) | 
| read again to drain buffers when there could be more to read, returns 0 on failure which means the comm point is closed.  | |
| static void | tcp_more_read_again (int fd, struct comm_point *c) | 
| read again to drain buffers when there could be more to read  | |
| static void | tcp_more_write_again (int fd, struct comm_point *c) | 
| write again to fill up when there could be more to write  | |
| 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.   | |
| static void | reclaim_http_handler (struct comm_point *c) | 
| Make http handler free for next assignment.  | |
| static int | ssl_http_read_more (struct comm_point *c) | 
| read more data for http (with ssl)  | |
| static int | http_read_more (int fd, struct comm_point *c) | 
| read more data for http  | |
| static int | http_header_done (sldns_buffer *buf) | 
| return true if http header has been read (one line complete)  | |
| static char * | http_header_line (sldns_buffer *buf) | 
| return character string into buffer for header line, moves buffer past that line and puts zero terminator into linefeed-newline  | |
| static void | http_moveover_buffer (sldns_buffer *buf) | 
| move unread buffer to start and clear rest for putting the rest into it  | |
| static int | http_process_initial_header (struct comm_point *c) | 
| a http header is complete, process it  | |
| static int | http_process_chunk_header (struct comm_point *c) | 
| a chunk header is complete, process it, return 0=fail, 1=continue next header line, 2=done with chunked transfer  | |
| static int | http_nonchunk_segment (struct comm_point *c) | 
| handle nonchunked data segment, 0=fail, 1=wait  | |
| static int | http_chunked_segment (struct comm_point *c) | 
| handle chunked data segment, return 0=fail, 1=wait, 2=process more  | |
| static void | http2_session_delete (struct http2_session *h2_session) | 
| Delete http2 session.   | |
| void | http2_stream_add_meshstate (struct http2_stream *h2_stream, struct mesh_area *mesh, struct mesh_state *m) | 
| Add mesh state to stream.   | |
| void | http2_stream_remove_mesh_state (struct http2_stream *h2_stream) | 
| Remove mesh state from stream.   | |
| static int | comm_point_http2_handle_read (int ATTR_UNUSED(fd), struct comm_point *c) | 
| Handle http2 read.  | |
| static int | comm_point_http_handle_read (int fd, struct comm_point *c) | 
| Handle http reading callback.   | |
| static int | http_check_connect (int fd, struct comm_point *c) | 
| check pending connect for http  | |
| static int | ssl_http_write_more (struct comm_point *c) | 
| write more data for http (with ssl)  | |
| static int | http_write_more (int fd, struct comm_point *c) | 
| write more data for http  | |
| static int | comm_point_http2_handle_write (int ATTR_UNUSED(fd), struct comm_point *c) | 
| Handle http2 writing.  | |
| static int | comm_point_http_handle_write (int fd, struct comm_point *c) | 
| Handle http writing callback.   | |
| void | comm_point_http_handle_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 ATTR_UNUSED(fd), short event, void *arg) | 
| struct comm_point * | comm_point_create_udp (struct comm_base *base, int fd, sldns_buffer *buffer, int pp2_enabled, comm_point_callback_type *callback, void *callback_arg, struct unbound_socket *socket) | 
| Create an UDP comm point.   | |
| struct comm_point * | comm_point_create_doq (struct comm_base *base, int fd, sldns_buffer *buffer, comm_point_callback_type *callback, void *callback_arg, struct unbound_socket *socket, struct doq_table *table, struct ub_randstate *rnd, const void *quic_sslctx, struct config_file *cfg) | 
| Create an UDP comm point for DoQ.   | |
| static struct comm_point * | comm_point_create_http_handler (struct comm_base *base, struct comm_point *parent, size_t bufsize, int harden_large_queries, uint32_t http_max_streams, char *http_endpoint, comm_point_callback_type *callback, void *callback_arg, struct unbound_socket *socket) | 
| struct comm_point * | comm_point_create_tcp (struct comm_base *base, int fd, int num, int idle_timeout, int harden_large_queries, uint32_t http_max_streams, char *http_endpoint, struct tcl_list *tcp_conn_limit, size_t bufsize, struct sldns_buffer *spoolbuf, enum listen_type port_type, int pp2_enabled, comm_point_callback_type *callback, void *callback_arg, struct unbound_socket *socket) | 
| Create a TCP listener comm point.   | |
| struct comm_point * | comm_point_create_tcp_out (struct comm_base *base, size_t bufsize, comm_point_callback_type *callback, void *callback_arg) | 
| Create an outgoing TCP commpoint.   | |
| struct comm_point * | comm_point_create_http_out (struct comm_base *base, size_t bufsize, comm_point_callback_type *callback, void *callback_arg, sldns_buffer *temp) | 
| Create an outgoing HTTP commpoint.   | |
| struct comm_point * | comm_point_create_local (struct comm_base *base, int fd, size_t bufsize, comm_point_callback_type *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_type *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.   | |
| 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 msec) | 
| 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.   | |
| void | comm_timer_callback (int ATTR_UNUSED(fd), short event, void *arg) | 
| 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.   | |
| void | comm_signal_callback (int sig, short event, void *arg) | 
| This routine is published for checks and tests, and is only used internally.   | |
| 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.   | |
This file contains event notification functions.
| struct comm_base * comm_base_create | ( | int | sigs | ) | 
Create a new comm base.
| sigs | if true it attempts to create a default loop for signal handling. | 
References internal_base::base, comm_base::eb, internal_base::now, internal_base::secs, ub_comm_base_now(), ub_default_event_base(), ub_get_event_sys(), VERB_ALGO, and verbose().
| struct comm_base * comm_base_create_event | ( | struct ub_event_base * | base | ) | 
Create comm base that uses the given ub_event_base (underlying pluggable event mechanism pointer).
| base | underlying pluggable event base. | 
References internal_base::base, comm_base::eb, and ub_comm_base_now().
Referenced by libworker_setup().
| 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 internal_base::base, comm_base::eb, log_err(), internal_base::slow_accept, internal_base::slow_accept_enabled, ub_event_base_free(), ub_event_del(), and ub_event_free().
| void comm_base_delete_no_base | ( | struct comm_base * | b | ) | 
Delete comm base structure but not the underlying lib event base.
All comm points must have been deleted.
| b | the base to delete. | 
References internal_base::base, comm_base::eb, log_err(), internal_base::slow_accept, internal_base::slow_accept_enabled, ub_event_del(), and ub_event_free().
Referenced by libworker_delete_event().
| void comm_base_timept | ( | struct comm_base * | b, | 
| time_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, and internal_base::secs.
| 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(), and ub_event_base_dispatch().
| 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, log_err(), and ub_event_base_loopexit().
| void comm_base_set_slow_accept_handlers | ( | struct comm_base * | b, | 
| void(*)(void *) | stop_accept, | ||
| void(*)(void *) | start_accept, | ||
| void * | arg | ||
| ) | 
Set the slow_accept mode handlers.
You can not provide these if you do not perform accept() calls.
| b | comm base | 
| stop_accept | function that stops listening to accept fds. | 
| start_accept | function that resumes listening to accept fds. | 
| arg | callback arg to pass to the functions. | 
References comm_base::cb_arg, comm_base::start_accept, and comm_base::stop_accept.
| struct ub_event_base * comm_base_internal | ( | struct comm_base * | b | ) | 
Access internal data structure (for util/tube.c on windows)
| b | comm base | 
References internal_base::base, and comm_base::eb.
| struct ub_event * comm_point_internal | ( | struct comm_point * | c | ) | 
Access internal event structure.
It is for use with ub_winsock_tcp_wouldblock on windows.
| c | comm point. | 
References internal_event::ev, and comm_point::ev.
Referenced by fr_client_send_item_fd().
| int tcp_connect_errno_needs_log | ( | struct sockaddr * | addr, | 
| socklen_t | addrlen | ||
| ) | 
See if errno for tcp connect has to be logged or not.
This uses errno
| addr | apart from checking errno, the addr is checked for ip4mapped and broadcast type, hence passed. | 
| addrlen | length of the addr parameter. | 
References udp_send_errno_needs_log().
Referenced by comm_point_tcp_handle_write().
| int comm_point_send_udp_msg | ( | struct comm_point * | c, | 
| struct sldns_buffer * | packet, | ||
| struct sockaddr * | addr, | ||
| socklen_t | addrlen, | ||
| int | is_connected | ||
| ) | 
Send an udp message over a commpoint.
| c | commpoint to send it from. | 
| packet | what to send. | 
| addr | where to send it to. If NULL, send is performed, for connected sockets, to the connected address. | 
| addrlen | length of addr. | 
| is_connected | if the UDP socket is connect()ed. | 
References internal_event::base, comm_base::eb, comm_point::ev, comm_point::fd, internal_base::last_writewait_log, log_addr(), log_assert, log_err(), log_info(), comm_reply::pktinfo, internal_base::secs, SEND_BLOCKED_MAX_RETRY, SEND_BLOCKED_WAIT_TIMEOUT, sldns_buffer_begin(), sldns_buffer_remaining(), SLOW_LOG_TIME, sock_strerror(), comm_reply::srctype, udp_send_errno_needs_log(), VERB_OPS, and verbose().
Referenced by comm_point_send_reply(), and comm_point_udp_callback().
      
  | 
  static | 
Parses the PROXYv2 header from buf and updates the comm_reply struct.
Returns 1 on success, 0 on failure.
References comm_reply::client_addr, comm_reply::client_addrlen, log_err(), PP2_HEADER_SIZE, pp2_read_header(), sldns_buffer_begin(), sldns_buffer_limit(), sldns_buffer_remaining(), and sldns_buffer_set_limit().
Referenced by comm_point_tcp_handle_read(), comm_point_udp_callback(), and ssl_handle_read().
| 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 internal_event::base, comm_point::buffer, comm_reply::c, comm_point::callback, comm_point::cb_arg, comm_reply::client_addr, comm_reply::client_addrlen, comm_point_send_udp_msg(), comm_point::comm_udp, consume_pp2_header(), comm_point::ev, comm_point::fd, fptr_ok, fptr_whitelist_comm_point(), log_assert, log_err(), MSG_DONTWAIT, NETEVENT_NOERROR, NUM_UDP_PER_SELECT, comm_point::pp2_enabled, comm_reply::remote_addr, comm_reply::remote_addrlen, sldns_buffer_begin(), sldns_buffer_clear(), sldns_buffer_flip(), sldns_buffer_remaining(), sldns_buffer_skip(), comm_reply::srctype, comm_point::type, ub_comm_base_now(), UB_EV_READ, and udp_recv_needs_log().
Referenced by comm_point_create_udp().
| int adjusted_tcp_timeout | ( | struct comm_point * | c | ) | 
For TCP handlers that use c->tcp_timeout_msec, this routine adjusts it with the minimum.
Otherwise, a 0 value advertised without the minimum applied moves to a 0 in comm_point_start_listening and that routine treats it as no timeout, listen forever, which is not wanted.
| c | comm point to use the tcp_timeout_msec of. | 
References TCP_QUERY_TIMEOUT_MINIMUM, and comm_point::tcp_timeout_msec.
Referenced by comm_point_http2_handle_read(), comm_point_http2_handle_write(), comm_point_send_reply(), setup_tcp_handler(), tcp_callback_reader(), tcp_callback_writer(), tcp_req_info_handle_readdone(), tcp_req_info_send_reply(), and tcp_req_info_setup_listen().
| 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::base, internal_base::base, comm_base::cb_arg, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, fd_set_nonblock(), fptr_ok, fptr_whitelist_stop_accept(), internal_base::last_slow_log, log_err(), log_err_addr(), NETEVENT_SLOW_ACCEPT_TIME, internal_base::secs, internal_base::slow_accept, internal_base::slow_accept_enabled, SLOW_LOG_TIME, sock_close(), sock_strerror(), comm_base::stop_accept, comm_point::tcl_addr, tcl_addr_lookup(), tcl_new_connection(), comm_point::tcp_conn_limit, comm_point::type, ub_comm_base_now(), UB_EV_READ, UB_EV_TIMEOUT, ub_event_add(), ub_event_new(), ub_winsock_tcp_wouldblock(), VERB_ALGO, VERB_OPS, verbose(), and verbosity.
Referenced by comm_point_tcp_accept_callback().
      
  | 
  static | 
delete http2 session server.
After closing connection.
References http2_session::c, http2_session::first_stream, comm_point::h2_stream, http2_session::is_drop, http2_stream::next, and http2_session::postpone_drop.
Referenced by comm_point_close(), and comm_point_tcp_accept_callback().
| 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 internal_event::base, comm_point::comm_http, comm_point::comm_local, comm_point_close(), comm_point_http_handle_callback(), comm_point_perform_accept(), comm_point_stop_listening(), comm_point_tcp_handle_callback(), comm_point::comm_raw, comm_point::comm_ssl_shake_read, comm_point::comm_tcp, comm_point::comm_tcp_accept, comm_point::cur_tcp_count, comm_point::ev, comm_point::fd, http2_session_server_delete(), incoming_ssl_fd(), comm_point::is_in_tcp_free, log_assert, log_info(), log_warn(), comm_point::max_tcp_count, comm_reply::remote_addr, comm_point::repinfo, setup_tcp_handler(), comm_point::ssl, comm_point::tcp_free, comm_point::type, ub_comm_base_now(), UB_EV_PERSIST, UB_EV_READ, UB_EV_TIMEOUT, ub_event_free(), and ub_event_new().
Referenced by comm_point_create_tcp().
      
  | 
  static | 
continue ssl handshake
ssl read callback on TCP
References comm_point::buffer, comm_point_listen_for_rw(), comm_point::comm_ssl_shake_none, consume_pp2_header(), internal_event::ev, comm_point::ev, log_crypto_err_io(), log_err(), log_err_addr(), comm_point::pp2_enabled, comm_point::pp2_header_done, PP2_HEADER_SIZE, comm_point::pp2_header_state, pp2_read_header(), pp_lookup_error(), comm_reply::remote_addr, comm_reply::remote_addrlen, comm_point::repinfo, sldns_buffer_at(), sldns_buffer_begin(), sldns_buffer_capacity(), sldns_buffer_clear(), sldns_buffer_current(), sldns_buffer_flip(), sldns_buffer_limit(), sldns_buffer_read_u16_at(), sldns_buffer_remaining(), sldns_buffer_set_limit(), sldns_buffer_skip(), comm_point::ssl, comm_point::ssl_shake_state, comm_point::tcp_byte_count, tcp_callback_reader(), comm_point::tcp_req_info, tcp_req_info_handle_read_close(), UB_EV_READ, ub_winsock_tcp_wouldblock(), VERB_ALGO, VERB_QUERY, verbose(), and verbosity.
Referenced by ssl_handle_it().
      
  | 
  static | 
Handle tcp reading callback.
| fd | file descriptor of socket. | 
| c | comm point to read from into buffer. | 
| short_ok | if true, very short packets are OK (for comm_local). | 
References comm_point::buffer, consume_pp2_header(), internal_event::ev, comm_point::ev, log_assert, log_err(), log_err_addr(), MSG_DONTWAIT, comm_point::pp2_enabled, PP2_HEADER_SIZE, comm_point::pp2_header_state, pp2_read_header(), pp_lookup_error(), comm_reply::remote_addr, comm_reply::remote_addrlen, comm_point::repinfo, sldns_buffer_at(), sldns_buffer_begin(), sldns_buffer_capacity(), sldns_buffer_clear(), sldns_buffer_current(), sldns_buffer_flip(), sldns_buffer_limit(), sldns_buffer_read_u16_at(), sldns_buffer_remaining(), sldns_buffer_set_limit(), sldns_buffer_skip(), sock_strerror(), comm_point::ssl, ssl_handle_it(), comm_point::tcp_byte_count, tcp_callback_reader(), comm_point::tcp_is_reading, comm_point::tcp_req_info, tcp_req_info_handle_read_close(), comm_point::tcp_write_and_read, comm_point::type, UB_EV_READ, ub_winsock_tcp_wouldblock(), VERB_ALGO, VERB_QUERY, verbose(), and verbosity.
Referenced by comm_point_local_handle_callback(), comm_point_tcp_handle_callback(), tcp_more_read_again(), and tcp_req_info_read_again().
      
  | 
  static | 
Handle tcp writing callback.
| fd | file descriptor of socket. | 
| c | comm point to write buffer out of. | 
References comm_point::buffer, error(), internal_event::ev, comm_point::ev, log_assert, log_err_addr(), comm_reply::remote_addr, comm_reply::remote_addrlen, comm_point::repinfo, sldns_buffer_begin(), sldns_buffer_current(), sldns_buffer_limit(), sldns_buffer_remaining(), sldns_buffer_set_position(), sldns_buffer_skip(), sock_strerror(), comm_point::ssl, ssl_handle_it(), comm_point::tcp_byte_count, tcp_callback_writer(), comm_point::tcp_check_nb_connect, tcp_connect_errno_needs_log(), comm_point::tcp_is_reading, comm_point::tcp_write_and_read, comm_point::tcp_write_byte_count, comm_point::tcp_write_pkt, comm_point::tcp_write_pkt_len, comm_point::type, UB_EV_WRITE, ub_winsock_tcp_wouldblock(), VERB_ALGO, verbose(), and verbosity.
Referenced by comm_point_tcp_handle_callback(), tcp_more_write_again(), and tcp_req_info_read_again().
| 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::buffer, comm_point::callback, comm_point::cb_arg, comm_point_tcp_handle_read(), comm_point_tcp_handle_write(), comm_point::comm_tcp, comm_point::ev, comm_point::fd, fptr_ok, fptr_whitelist_comm_point(), log_assert, log_err(), NETEVENT_CLOSED, NETEVENT_TIMEOUT, tcp_req_info::read_again, reclaim_tcp_handler(), sldns_buffer_capacity(), sldns_buffer_new(), comm_point::tcp_do_close, tcp_more_read_again(), comm_point::tcp_more_read_again, tcp_more_write_again(), comm_point::tcp_more_write_again, comm_point::tcp_parent, comm_point::tcp_req_info, tcp_req_info_read_again(), comm_point::type, ub_comm_base_now(), UB_EV_READ, UB_EV_TIMEOUT, UB_EV_WRITE, VERB_QUERY, and verbose().
Referenced by comm_point_create_tcp_handler(), comm_point_create_tcp_out(), and comm_point_tcp_accept_callback().
      
  | 
  static | 
| void http2_stream_add_meshstate | ( | struct http2_stream * | h2_stream, | 
| struct mesh_area * | mesh, | ||
| struct mesh_state * | m | ||
| ) | 
Add mesh state to stream.
To be able to remove mesh reply on stream closure
References http2_stream::mesh, and http2_stream::mesh_state.
| void http2_stream_remove_mesh_state | ( | struct http2_stream * | h2_stream | ) | 
Remove mesh state from stream.
When the mesh state has been removed.
References http2_stream::mesh_state.
      
  | 
  static | 
Handle http reading callback.
| fd | file descriptor of socket. | 
| c | comm point to read from into buffer. | 
References comm_point::buffer, http2_session::c, comm_point_http2_handle_read(), http_chunked_segment(), http_header_done(), comm_point::http_in_chunk_headers, comm_point::http_in_headers, comm_point::http_is_chunked, comm_point::http_min_version, http_moveover_buffer(), http_nonchunk_segment(), http_process_chunk_header(), http_process_initial_header(), http_read_more(), comm_point::http_stored, log_assert, sldns_buffer_flip(), sldns_buffer_limit(), sldns_buffer_position(), sldns_buffer_remaining(), sldns_buffer_set_position(), comm_point::ssl, ssl_http_read_more(), comm_point::ssl_shake_state, comm_point::tcp_is_reading, comm_point::type, and comm_point::use_h2.
Referenced by comm_point_http_handle_callback().
      
  | 
  static | 
Handle http writing callback.
| fd | file descriptor of socket. | 
| c | comm point to write buffer out of. | 
References comm_point::buffer, http2_session::c, comm_point_http2_handle_write(), comm_point_start_listening(), comm_point_stop_listening(), http_check_connect(), comm_point::http_min_version, http_write_more(), log_assert, sldns_buffer_clear(), sldns_buffer_remaining(), comm_point::ssl, ssl_http_write_more(), comm_point::ssl_shake_state, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_do_toggle_rw, comm_point::tcp_is_reading, comm_point::type, and comm_point::use_h2.
Referenced by comm_point_http_handle_callback().
| void comm_point_http_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_point::comm_http, comm_point_http_handle_read(), comm_point_http_handle_write(), comm_point::ev, comm_point::fd, fptr_ok, fptr_whitelist_comm_point(), log_assert, log_err(), NETEVENT_CLOSED, NETEVENT_TIMEOUT, reclaim_http_handler(), comm_point::tcp_do_close, comm_point::type, ub_comm_base_now(), UB_EV_READ, UB_EV_TIMEOUT, UB_EV_WRITE, VERB_QUERY, and verbose().
Referenced by comm_point_create_http_out(), and comm_point_tcp_accept_callback().
| 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_point::comm_local, comm_point_tcp_handle_read(), comm_point::ev, comm_point::fd, fptr_ok, fptr_whitelist_comm_point(), log_assert, log_err(), NETEVENT_CLOSED, comm_point::type, ub_comm_base_now(), and UB_EV_READ.
Referenced by comm_point_create_local().
| struct comm_point * comm_point_create_udp | ( | struct comm_base * | base, | 
| int | fd, | ||
| struct sldns_buffer * | buffer, | ||
| int | pp2_enabled, | ||
| comm_point_callback_type * | callback, | ||
| void * | callback_arg, | ||
| struct unbound_socket * | socket | ||
| ) | 
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. | 
| pp2_enabled | if the comm point will support PROXYv2. | 
| callback | callback function pointer. | 
| callback_arg | will be passed to your callback function. | 
| socket | and opened socket properties will be passed to your callback function. | 
References internal_event::base, internal_base::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point_delete(), comm_point_udp_callback(), comm_point::cur_tcp_count, comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::event_added, comm_point::fd, comm_point::inuse, comm_point::is_in_tcp_free, log_err(), comm_point::max_tcp_count, comm_point::pp2_enabled, comm_point::pp2_header_state, comm_point::socket, 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, comm_point::type, UB_EV_PERSIST, UB_EV_READ, ub_event_add(), and ub_event_new().
Referenced by listen_create(), and outnet_comm_point_for_udp().
| struct comm_point * comm_point_create_doq | ( | struct comm_base * | base, | 
| int | fd, | ||
| struct sldns_buffer * | buffer, | ||
| comm_point_callback_type * | callback, | ||
| void * | callback_arg, | ||
| struct unbound_socket * | socket, | ||
| struct doq_table * | table, | ||
| struct ub_randstate * | rnd, | ||
| const void * | quic_sslctx, | ||
| struct config_file * | cfg | ||
| ) | 
Create an UDP comm point for DoQ.
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. | 
| socket | and opened socket properties will be passed to your callback function. | 
| table | the doq connection table for the host. | 
| rnd | random generator to use. | 
| quic_sslctx | the quic ssl context. | 
| cfg | config file struct. | 
References internal_event::base, internal_base::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point_delete(), comm_point_doq_callback(), comm_point::cur_tcp_count, comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::event_added, comm_point::fd, comm_point::inuse, comm_point::is_in_tcp_free, log_err(), comm_point::max_tcp_count, comm_point::pp2_enabled, comm_point::pp2_header_state, sock_close(), comm_point::socket, 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, comm_point::type, UB_EV_PERSIST, UB_EV_READ, ub_event_add(), and ub_event_new().
Referenced by listen_create().
| struct comm_point * comm_point_create_tcp | ( | struct comm_base * | base, | 
| int | fd, | ||
| int | num, | ||
| int | idle_timeout, | ||
| int | harden_large_queries, | ||
| uint32_t | http_max_streams, | ||
| char * | http_endpoint, | ||
| struct tcl_list * | tcp_conn_limit, | ||
| size_t | bufsize, | ||
| struct sldns_buffer * | spoolbuf, | ||
| enum listen_type | port_type, | ||
| int | pp2_enabled, | ||
| comm_point_callback_type * | callback, | ||
| void * | callback_arg, | ||
| struct unbound_socket * | socket | ||
| ) | 
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. | 
| idle_timeout | TCP idle timeout in ms. | 
| harden_large_queries | whether query size should be limited. | 
| http_max_streams | maximum number of HTTP/2 streams per connection. | 
| http_endpoint | HTTP endpoint to service queries on | 
| tcp_conn_limit | TCP connection limit info. | 
| bufsize | size of buffer to create for handlers. | 
| spoolbuf | shared spool buffer for tcp_req_info structures. or NULL to not create those structures in the tcp handlers. | 
| port_type | the type of port we are creating a TCP listener for. Used to select handler type to use. | 
| pp2_enabled | if the comm point will support PROXYv2. | 
| callback | callback function pointer for TCP handlers. | 
| callback_arg | will be passed to your callback function. | 
| socket | and opened socket properties will be passed to your callback function. | 
References internal_event::base, internal_base::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::cur_tcp_count, comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::event_added, comm_point::fd, comm_point::http_endpoint, comm_point::is_in_tcp_free, listen_type_http, listen_type_ssl, listen_type_tcp, listen_type_tcp_dnscrypt, log_err(), comm_point::max_tcp_count, comm_point::pp2_enabled, comm_point::pp2_header_none, comm_point::pp2_header_state, comm_point::socket, comm_point::tcl_addr, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_conn_limit, 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_keepalive, comm_point::tcp_parent, comm_point::tcp_timeout_msec, comm_point::timeout, comm_point::type, UB_EV_PERSIST, UB_EV_READ, ub_event_add(), and ub_event_new().
Referenced by listen_create().
| struct comm_point * comm_point_create_tcp_out | ( | struct comm_base * | base, | 
| size_t | bufsize, | ||
| comm_point_callback_type * | callback, | ||
| void * | callback_arg | ||
| ) | 
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_event::base, internal_base::base, comm_point::buffer, comm_reply::c, comm_point::callback, comm_point::cb_arg, comm_point_tcp_handle_callback(), comm_point::cur_tcp_count, comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, comm_point::is_in_tcp_free, log_err(), comm_point::max_tcp_count, comm_point::pp2_enabled, comm_point::pp2_header_state, comm_point::repinfo, sldns_buffer_free(), sldns_buffer_new(), comm_point::tcl_addr, comm_point::tcp_byte_count, comm_point::tcp_check_nb_connect, comm_point::tcp_conn_limit, 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_keepalive, comm_point::tcp_parent, TCP_QUERY_TIMEOUT, comm_point::tcp_timeout_msec, comm_point::timeout, comm_point::type, UB_EV_PERSIST, UB_EV_WRITE, and ub_event_new().
Referenced by outnet_comm_point_for_tcp().
| struct comm_point * comm_point_create_http_out | ( | struct comm_base * | base, | 
| size_t | bufsize, | ||
| comm_point_callback_type * | callback, | ||
| void * | callback_arg, | ||
| struct sldns_buffer * | temp | ||
| ) | 
Create an outgoing HTTP 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. | 
| temp | sldns buffer, shared between other http_out commpoints, for temporary data when performing callbacks. | 
References internal_event::base, internal_base::base, comm_point::buffer, comm_reply::c, comm_point::callback, comm_point::cb_arg, comm_point_http_handle_callback(), comm_point::cur_tcp_count, comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::fd, comm_point::http_in_chunk_headers, comm_point::http_in_headers, comm_point::http_is_chunked, comm_point::http_temp, comm_point::is_in_tcp_free, log_err(), comm_point::max_tcp_count, comm_point::pp2_enabled, comm_point::pp2_header_state, comm_point::repinfo, sldns_buffer_free(), sldns_buffer_new(), comm_point::ssl, 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, comm_point::type, UB_EV_PERSIST, UB_EV_WRITE, and ub_event_new().
Referenced by outnet_comm_point_for_http().
| struct comm_point * comm_point_create_local | ( | struct comm_base * | base, | 
| int | fd, | ||
| size_t | bufsize, | ||
| comm_point_callback_type * | callback, | ||
| void * | callback_arg | ||
| ) | 
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_event::base, internal_base::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point_local_handle_callback(), comm_point::cur_tcp_count, comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::event_added, comm_point::fd, comm_point::is_in_tcp_free, log_err(), comm_point::max_tcp_count, comm_point::pp2_enabled, comm_point::pp2_header_state, sldns_buffer_new(), 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, comm_point::type, UB_EV_PERSIST, UB_EV_READ, ub_event_add(), ub_event_free(), and ub_event_new().
| struct comm_point * comm_point_create_raw | ( | struct comm_base * | base, | 
| int | fd, | ||
| int | writing, | ||
| comm_point_callback_type * | callback, | ||
| void * | callback_arg | ||
| ) | 
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_event::base, internal_base::base, comm_point::buffer, comm_point::callback, comm_point::cb_arg, comm_point::cur_tcp_count, comm_point::do_not_close, comm_base::eb, internal_event::ev, comm_point::ev, comm_point::event_added, comm_point::fd, comm_point::is_in_tcp_free, log_err(), comm_point::max_tcp_count, comm_point::pp2_enabled, comm_point::pp2_header_state, 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, comm_point::type, UB_EV_PERSIST, UB_EV_READ, UB_EV_WRITE, ub_event_add(), ub_event_free(), and ub_event_new().
| 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::event_added, comm_point::fd, comm_point::h2_session, http2_session_server_delete(), log_err(), sock_close(), comm_point::tcl_addr, tcl_close_connection(), comm_point::tcp_more_read_again, comm_point::tcp_more_write_again, comm_point::tcp_req_info, tcp_req_info_clear(), comm_point::type, UB_EV_READ, UB_EV_WRITE, ub_event_del(), ub_winsock_tcp_wouldblock(), VERB_ALGO, and verbose().
Referenced by comm_point_delete(), comm_point_tcp_accept_callback(), decommission_pending_tcp(), outnet_tcp_take_into_use(), portcomm_loweruse(), reclaim_http_handler(), 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(), internal_event::ev, comm_point::ev, comm_point::h2_session, http2_session_delete(), comm_point::http_endpoint, comm_point::max_tcp_count, sldns_buffer_free(), comm_point::ssl, comm_point::tcp_handlers, comm_point::tcp_req_info, tcp_req_info_delete(), comm_point::timeout, comm_point::type, and ub_event_free().
Referenced by comm_point_create_doq(), comm_point_create_tcp(), comm_point_create_udp(), and comm_point_delete().
| 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 unbound_socket::addr, unbound_socket::addrlen, adjusted_tcp_timeout(), comm_point::buffer, comm_reply::c, comm_reply::client_addr, comm_reply::client_addrlen, comm_point_drop_reply(), comm_point_send_udp_msg(), comm_point_send_udp_msg_if(), comm_point_start_listening(), comm_point_stop_listening(), comm_point::dtenv, comm_point::h2_session, comm_point::h2_stream, log_assert, comm_reply::remote_addr, comm_reply::remote_addrlen, comm_point::socket, tcp_req_info::spool_buffer, comm_reply::srctype, comm_point::ssl, comm_point::tcp_is_reading, comm_point::tcp_parent, comm_point::tcp_req_info, tcp_req_info_send_reply(), comm_point::type, and comm_point::use_h2.
| 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_reply::c, comm_point::h2_session, tcp_req_info::is_drop, http2_session::is_drop, log_assert, http2_session::postpone_drop, reclaim_http_handler(), reclaim_tcp_handler(), comm_point::tcp_req_info, and comm_point::type.
Referenced by comm_point_send_reply().
| 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::event_added, comm_point::fd, log_err(), ub_event_del(), VERB_ALGO, and verbose().
Referenced by comm_point_http2_handle_read(), comm_point_http2_handle_write(), comm_point_http_handle_write(), comm_point_send_reply(), comm_point_tcp_accept_callback(), tcp_callback_reader(), tcp_callback_writer(), and tcp_req_info_handle_readdone().
| void comm_point_start_listening | ( | struct comm_point * | c, | 
| int | newfd, | ||
| int | msec | ||
| ) | 
Start listening again for input on the comm point.
| c | commpoint to enable again. | 
| newfd | new fd, or -1 to leave fd be. | 
| msec | timeout in milliseconds, or -1 for no (change to the) timeout. So seconds*1000. | 
References internal_event::ev, comm_point::ev, comm_point::event_added, comm_point::fd, log_err(), sock_close(), comm_point::tcp_free, comm_point::tcp_is_reading, comm_point::tcp_write_and_read, comm_point::timeout, comm_point::type, UB_EV_READ, UB_EV_TIMEOUT, UB_EV_WRITE, ub_event_add(), ub_event_add_bits(), ub_event_del(), ub_event_del_bits(), ub_event_set_fd(), VERB_ALGO, and verbose().
Referenced by comm_point_http2_handle_read(), comm_point_http2_handle_write(), comm_point_http_handle_write(), comm_point_send_reply(), outnet_comm_point_for_http(), outnet_comm_point_for_tcp(), reclaim_http_handler(), reclaim_tcp_handler(), setup_tcp_handler(), tcp_callback_reader(), tcp_callback_writer(), and tcp_req_info_handle_readdone().
| 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::event_added, comm_point::fd, log_err(), comm_point::timeout, UB_EV_READ, UB_EV_TIMEOUT, UB_EV_WRITE, ub_event_add(), ub_event_add_bits(), ub_event_del(), ub_event_del_bits(), VERB_ALGO, and verbose().
Referenced by fr_main_perform_printout(), remote_handshake_later(), ssl_handle_read(), ssl_handle_write(), ssl_http_read_more(), ssl_http_write_more(), and tcp_req_info_setup_listen().
| 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, sldns_buffer_capacity(), comm_point::tcp_handlers, comm_point::timeout, and comm_point::type.
Referenced by comm_point_get_mem(), and if_get_mem().
| struct comm_timer * comm_timer_create | ( | struct comm_base * | base, | 
| void(*)(void *) | cb, | ||
| void * | cb_arg | ||
| ) | 
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, comm_timer::cb_arg, comm_base::eb, internal_timer::ev, comm_timer::ev_timer, log_err(), internal_timer::super, UB_EV_TIMEOUT, and ub_event_new().
| void comm_timer_disable | ( | struct comm_timer * | timer | ) | 
disable timer.
Stops callbacks from happening.
| timer | to disable. | 
References internal_timer::enabled, internal_timer::ev, comm_timer::ev_timer, and ub_timer_del().
Referenced by comm_timer_delete(), and comm_timer_set().
| 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_disable(), comm_base::eb, internal_timer::enabled, internal_timer::ev, comm_timer::ev_timer, log_assert, log_err(), and ub_timer_add().
| void comm_timer_delete | ( | struct comm_timer * | timer | ) | 
delete timer.
| timer | to delete. | 
References comm_timer_disable(), internal_timer::ev, comm_timer::ev_timer, and ub_event_free().
| 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 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 | ||
| ) | 
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, comm_signal::ev_signal, and log_err().
| 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, fptr_ok, fptr_whitelist_comm_signal(), ub_comm_base_now(), and UB_EV_SIGNAL.
Referenced by comm_signal_bind().
| int comm_signal_bind | ( | struct comm_signal * | comsig, | 
| int | sig | ||
| ) | 
Bind signal struct to catch a signal.
A single 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, comm_signal::ev_signal, log_assert, log_err(), entry::next, ub_event_free(), ub_signal_add(), and ub_signal_new().
| void comm_signal_delete | ( | struct comm_signal * | comsig | ) | 
Delete the signal communication point.
| comsig | to delete. | 
References internal_signal::ev, comm_signal::ev_signal, internal_signal::next, ub_event_free(), and ub_signal_del().