unbound 0.1
dt_io_thread Struct Reference

IO thread that reads from the queues and writes them. More...

#include <dtstream.h>

Data Fields

int threadnum
 the thread number for the dtio thread, must be first to cast thread arg to int* in checklock code.
void * event_base
 event base, for event handling
lock_basic_type io_list_lock
 lock on io_list and io_list_iter
struct dt_io_list_item * io_list
 list of queues that is registered to get written
struct dt_io_list_item * io_list_iter
 iterator point in the io_list, to pick from them in a round-robin fashion, instead of only from the first when busy.
ub_thread_type tid
 thread id, of the io thread
int started
 if the io processing has started
void * ssl_ctx
 ssl context for the io thread, for tls connections.
int tls_use_sni
 if SNI will be used for TLS connections.
int fd
 file descriptor that the thread writes to
void * event
 event structure that the thread uses
int event_added
 the event is added
int event_added_is_write
 event added is a write event
int check_nb_connect
 check for nonblocking connect errors on fd
void * ssl
 ssl for current connection, type SSL*
int ssl_handshake_done
 true if the handshake for SSL is done, 0 if not
int ssl_brief_read
 true if briefly the SSL wants a read event, 0 if not.
int ssl_brief_write
 true if SSL_read is waiting for a write event.
void * cur_msg
 the buffer that currently getting written, or NULL if no (partial) message written now
size_t cur_msg_len
 length of the current message
size_t cur_msg_done
 number of bytes written for the current message
size_t cur_msg_len_done
 number of bytes of the length that have been written, for the current message length that precedes the frame
lock_basic_type wakeup_timer_lock
 lock on wakeup_timer_enabled
int wakeup_timer_enabled
 if wakeup timer is enabled in some thread
int commandpipe [2]
 command pipe that stops the pipe if closed.
void * command_event
 the event to listen to the commandpipe
int want_to_exit
 the io thread wants to exit
void * stop_flush_event
 in stop flush, this is nonNULL and references the stop_ev
void * reconnect_timer
 the timer event for connection retries
int reconnect_is_added
 if the reconnect timer is added to the event base
int reconnect_timeout
 the current reconnection timeout, it is increased with exponential backoff, in msec
int upstream_is_unix
 If the log server is connected to over unix domain sockets, eg.
int upstream_is_tcp
 if the log server is connected to over TCP.
int upstream_is_tls
 if the log server is connected to over TLS.
int is_bidirectional
 Perform bidirectional Frame Streams handshake before sending messages.
int ready_frame_sent
 Set if the READY control frame has been sent.
int accept_frame_received
 Set if valid ACCEPT frame is received.
struct dt_frame_read_buf read_frame
 (partially) read frame
char * socket_path
 the file path for unix socket (or NULL)
char * ip_str
 the ip address and port number (or NULL)
char * tls_server_name
 is the TLS upstream authenticated by name, if nonNULL, we use the same cert bundle as used by other TLS streams.
int use_client_certs
 are client certificates in use
char * client_key_file
 client cert files: the .key file
char * client_cert_file
 client cert files: the .pem file

Detailed Description

IO thread that reads from the queues and writes them.

Field Documentation

◆ threadnum

int dt_io_thread::threadnum

the thread number for the dtio thread, must be first to cast thread arg to int* in checklock code.

Referenced by dnstap_io(), and dt_io_thread_start().

◆ event_base

◆ io_list_lock

lock_basic_type dt_io_thread::io_list_lock

◆ io_list

struct dt_io_list_item* dt_io_thread::io_list

list of queues that is registered to get written

Referenced by dt_io_thread_create(), dt_io_thread_delete(), dt_io_thread_register_queue(), dt_io_thread_unregister_queue(), and dtio_find_msg().

◆ io_list_iter

struct dt_io_list_item* dt_io_thread::io_list_iter

iterator point in the io_list, to pick from them in a round-robin fashion, instead of only from the first when busy.

if NULL it means start at the start of the list.

Referenced by dt_io_thread_create(), dt_io_thread_register_queue(), dt_io_thread_unregister_queue(), and dtio_find_msg().

◆ tid

ub_thread_type dt_io_thread::tid

thread id, of the io thread

Referenced by dt_io_thread_start(), and dt_io_thread_stop().

◆ started

int dt_io_thread::started

if the io processing has started

Referenced by dt_io_thread_start(), dt_io_thread_stop(), and dtio_wakeup().

◆ ssl_ctx

void* dt_io_thread::ssl_ctx

ssl context for the io thread, for tls connections.

type SSL_CTX*

Referenced by dt_io_thread_apply_cfg(), dt_io_thread_delete(), and dtio_setup_ssl().

◆ tls_use_sni

int dt_io_thread::tls_use_sni

if SNI will be used for TLS connections.

Referenced by dt_io_thread_apply_cfg(), and dtio_setup_ssl().

◆ fd

◆ event

◆ event_added

int dt_io_thread::event_added

◆ event_added_is_write

int dt_io_thread::event_added_is_write

◆ check_nb_connect

int dt_io_thread::check_nb_connect

check for nonblocking connect errors on fd

Referenced by dtio_check_nb_connect(), dtio_control_stop_flush(), dtio_open_output(), and dtio_output_cb().

◆ ssl

◆ ssl_handshake_done

int dt_io_thread::ssl_handshake_done

true if the handshake for SSL is done, 0 if not

Referenced by dtio_control_stop_flush(), dtio_output_cb(), and dtio_setup_ssl().

◆ ssl_brief_read

int dt_io_thread::ssl_brief_read

true if briefly the SSL wants a read event, 0 if not.

This happens during negotiation, we then do not want to write, but wait for a read event.

Referenced by dtio_output_cb(), and dtio_setup_ssl().

◆ ssl_brief_write

int dt_io_thread::ssl_brief_write

true if SSL_read is waiting for a write event.

Set back to 0 after single write event is handled.

Referenced by dtio_output_cb().

◆ cur_msg

void* dt_io_thread::cur_msg

the buffer that currently getting written, or NULL if no (partial) message written now

Referenced by dtio_close_output(), dtio_control_ready_send(), dtio_control_start_send(), dtio_cur_msg_free(), dtio_find_in_queue(), dtio_output_cb(), and dtio_write_more_of_data().

◆ cur_msg_len

◆ cur_msg_done

size_t dt_io_thread::cur_msg_done

◆ cur_msg_len_done

size_t dt_io_thread::cur_msg_len_done

number of bytes of the length that have been written, for the current message length that precedes the frame

Referenced by dtio_control_ready_send(), dtio_control_start_send(), dtio_cur_msg_free(), dtio_find_in_queue(), dtio_write_more(), and dtio_write_more_of_len().

◆ wakeup_timer_lock

lock_basic_type dt_io_thread::wakeup_timer_lock

◆ wakeup_timer_enabled

int dt_io_thread::wakeup_timer_enabled

if wakeup timer is enabled in some thread

Referenced by dt_io_thread_create(), dt_msg_queue_start_timer(), dtio_sleep(), and mq_wakeup_cb().

◆ commandpipe

int dt_io_thread::commandpipe[2]

command pipe that stops the pipe if closed.

Used to quit the program. [0] is read, [1] is written to.

Referenced by dt_io_thread_start(), dt_io_thread_stop(), dtio_desetup(), dtio_setup_cmd(), and dtio_wakeup().

◆ command_event

void* dt_io_thread::command_event

the event to listen to the commandpipe

Referenced by dtio_desetup(), and dtio_setup_cmd().

◆ want_to_exit

int dt_io_thread::want_to_exit

◆ stop_flush_event

void* dt_io_thread::stop_flush_event

in stop flush, this is nonNULL and references the stop_ev

Referenced by dtio_check_nb_connect(), dtio_control_stop_flush(), dtio_write_buf(), and receive_bytes().

◆ reconnect_timer

void* dt_io_thread::reconnect_timer

the timer event for connection retries

Referenced by dtio_desetup(), dtio_reconnect_del(), dtio_reconnect_enable_timeout(), and dtio_setup_reconnect().

◆ reconnect_is_added

int dt_io_thread::reconnect_is_added

if the reconnect timer is added to the event base

Referenced by dtio_reconnect_del(), dtio_reconnect_enable(), dtio_reconnect_enable_timeout(), and dtio_reconnect_timeout_cb().

◆ reconnect_timeout

int dt_io_thread::reconnect_timeout

the current reconnection timeout, it is increased with exponential backoff, in msec

Referenced by dtio_open_output_local(), dtio_open_output_tcp(), dtio_reconnect_clear(), dtio_reconnect_enable(), dtio_reconnect_handshake(), dtio_reconnect_slow(), and receive_bytes().

◆ upstream_is_unix

int dt_io_thread::upstream_is_unix

If the log server is connected to over unix domain sockets, eg.

a file is named that is created to log onto.

Referenced by dt_io_thread_apply_cfg(), and dtio_open_output().

◆ upstream_is_tcp

int dt_io_thread::upstream_is_tcp

if the log server is connected to over TCP.

The ip address and port are used

Referenced by dt_io_thread_apply_cfg(), and dtio_open_output().

◆ upstream_is_tls

int dt_io_thread::upstream_is_tls

if the log server is connected to over TLS.

ip address, port, and client certificates can be used for authentication.

Referenced by dt_io_thread_apply_cfg(), and dtio_open_output().

◆ is_bidirectional

int dt_io_thread::is_bidirectional

Perform bidirectional Frame Streams handshake before sending messages.

Referenced by dt_io_thread_apply_cfg(), dtio_cmd_cb(), dtio_open_output(), dtio_output_cb(), and dtio_reconnect_timeout_cb().

◆ ready_frame_sent

int dt_io_thread::ready_frame_sent

Set if the READY control frame has been sent.

Referenced by dtio_close_output(), dtio_output_cb(), dtio_read_accept_frame(), and dtio_reconnect_timeout_cb().

◆ accept_frame_received

int dt_io_thread::accept_frame_received

Set if valid ACCEPT frame is received.

Referenced by dtio_close_output(), dtio_cmd_cb(), dtio_output_cb(), dtio_read_accept_frame(), and dtio_reconnect_timeout_cb().

◆ read_frame

struct dt_frame_read_buf dt_io_thread::read_frame

(partially) read frame

Referenced by dtio_close_output(), and dtio_read_accept_frame().

◆ socket_path

char* dt_io_thread::socket_path

◆ ip_str

char* dt_io_thread::ip_str

the ip address and port number (or NULL)

Referenced by dt_io_thread_apply_cfg(), dt_io_thread_delete(), dtio_check_nb_connect(), dtio_open_output_tcp(), and receive_bytes().

◆ tls_server_name

char* dt_io_thread::tls_server_name

is the TLS upstream authenticated by name, if nonNULL, we use the same cert bundle as used by other TLS streams.

Referenced by dt_io_thread_apply_cfg(), dt_io_thread_delete(), and dtio_setup_ssl().

◆ use_client_certs

int dt_io_thread::use_client_certs

are client certificates in use

Referenced by dt_io_thread_apply_cfg().

◆ client_key_file

char* dt_io_thread::client_key_file

client cert files: the .key file

Referenced by dt_io_thread_apply_cfg(), and dt_io_thread_delete().

◆ client_cert_file

char* dt_io_thread::client_cert_file

client cert files: the .pem file

Referenced by dt_io_thread_apply_cfg(), and dt_io_thread_delete().


The documentation for this struct was generated from the following file: