Macros | Functions
control.h File Reference

Go to the source code of this file.


#define LOG_FN_CONN(conn, args)   CONN_LOG_PROTECT(conn, log_fn args)
#define CC_LOCAL_FD_IS_OWNER   (1u<<0)


control_connection_tTO_CONTROL_CONN (connection_t *)
void control_ports_write_to_file (void)
int control_connection_add_local_fd (tor_socket_t sock, unsigned flags)
int connection_control_finished_flushing (control_connection_t *conn)
int connection_control_reached_eof (control_connection_t *conn)
void connection_control_closed (control_connection_t *conn)
int connection_control_process_inbuf (control_connection_t *conn)
void disable_control_logging (void)
void enable_control_logging (void)
void monitor_owning_controller_process (const char *process_spec)
const char * rend_auth_type_to_string (rend_auth_type_t auth_type)
void control_free_all (void)

Detailed Description

Header file for control.c.

Definition in file control.h.

Macro Definition Documentation



State for a control connection: Waiting for authentication; speaking protocol v1.

Definition at line 22 of file control.h.

Referenced by connection_control_process_inbuf().



State for a control connection: Authenticated and accepting v1 commands.

Definition at line 19 of file control.h.

Referenced by connection_control_process_inbuf(), connection_state_is_open(), and is_valid_initial_command().


#define LOG_FN_CONN (   conn,
)    CONN_LOG_PROTECT(conn, log_fn args)

Log information about the connection conn, protecting it as with CONN_LOG_PROTECT. Example:

LOG_FN_CONN(conn, (LOG_DEBUG, "Socket %d wants to write", conn->s));

Definition at line 32 of file control.h.

Referenced by conn_write_callback().

Function Documentation

◆ connection_control_closed()

void connection_control_closed ( control_connection_t conn)

◆ connection_control_finished_flushing()

int connection_control_finished_flushing ( control_connection_t conn)

Called when conn has no more bytes left on its outbuf.

Definition at line 180 of file control.c.

References tor_assert().

Referenced by connection_finished_flushing().

◆ connection_control_process_inbuf()

int connection_control_process_inbuf ( control_connection_t conn)

Called when data has arrived on a v1 control connection: Try to fetch commands from conn->inbuf, and execute them.

Definition at line 307 of file control.c.

References CONTROL_CONN_STATE_NEEDAUTH, CONTROL_CONN_STATE_OPEN, control_connection_t::incoming_cmd, connection_t::state, and tor_assert().

Referenced by connection_process_inbuf().

◆ connection_control_reached_eof()

int connection_control_reached_eof ( control_connection_t conn)

Called when conn has gotten its socket closed.

Definition at line 188 of file control.c.

References tor_assert().

Referenced by connection_reached_eof().

◆ control_connection_add_local_fd()

int control_connection_add_local_fd ( tor_socket_t  sock,
unsigned  flags 

Create and add a new controller connection on sock. If CC_LOCAL_FD_IS_OWNER is set in flags, this Tor process should exit when the connection closes. If CC_LOCAL_FD_IS_AUTHENTICATED is set, then the connection does not need to authenticate.

Definition at line 78 of file control.c.

◆ control_free_all()

void control_free_all ( void  )

Free any leftover allocated memory of the control.c subsystem.

Definition at line 540 of file control.c.

◆ control_ports_write_to_file()

void control_ports_write_to_file ( void  )

Write all of the open control ports to ControlPortWriteToFile

Definition at line 117 of file control.c.

References CONN_TYPE_CONTROL_LISTENER, or_options_t::ControlPortWriteToFile, smartlist_add_asprintf(), and SMARTLIST_FOREACH_BEGIN.

◆ disable_control_logging()

void disable_control_logging ( void  )

Called when we are sending a log message to the controllers: suspend sending further log messages to the controllers until we're done. Used by CONN_LOG_PROTECT.

Definition at line 1273 of file control_events.c.

References disable_log_messages.

◆ enable_control_logging()

void enable_control_logging ( void  )

We're done sending a log message to the controllers: re-enable controller logging. Used by CONN_LOG_PROTECT.

Definition at line 1281 of file control_events.c.

References disable_log_messages, and tor_assert().

◆ monitor_owning_controller_process()

void monitor_owning_controller_process ( const char *  process_spec)

Set process_spec as Tor's owning controller process. Exit on failure.

Definition at line 491 of file control.c.

References owning_controller_process_monitor, owning_controller_process_spec, and tor_assert().

◆ rend_auth_type_to_string()

const char* rend_auth_type_to_string ( rend_auth_type_t  auth_type)

Convert rendezvous auth type to string for HS_DESC control events

Definition at line 1841 of file control_events.c.


control_connection_t* TO_CONTROL_CONN ( connection_t c)

Convert a connection_t* to an control_connection_t*; assert if the cast is invalid.

Definition at line 66 of file control.c.

References DOWNCAST, connection_t::magic, and tor_assert().

Referenced by connection_finished_flushing(), connection_free_all(), connection_process_inbuf(), and connection_reached_eof().