tor  0.4.1.0-alpha-dev
Macros | Typedefs | Enumerations | Functions
control.h File Reference
#include "core/or/ocirc_event.h"
#include "core/or/orconn_event.h"

Go to the source code of this file.

Macros

#define CONTROL_CONN_STATE_MIN_   1
 
#define CONTROL_CONN_STATE_OPEN   1
 
#define CONTROL_CONN_STATE_NEEDAUTH   2
 
#define CONTROL_CONN_STATE_MAX_   2
 
#define REMAP_STREAM_SOURCE_CACHE   1
 
#define REMAP_STREAM_SOURCE_EXIT   2
 
#define LOG_FN_CONN(conn, args)   CONN_LOG_PROTECT(conn, log_fn args)
 
#define CC_LOCAL_FD_IS_OWNER   (1u<<0)
 
#define CC_LOCAL_FD_IS_AUTHENTICATED   (1u<<1)
 
#define EVENT_NS   0x000F
 

Typedefs

typedef enum circuit_status_minor_event_t circuit_status_minor_event_t
 
typedef enum stream_status_event_t stream_status_event_t
 
typedef enum buildtimeout_set_event_t buildtimeout_set_event_t
 

Enumerations

enum  circuit_status_minor_event_t { CIRC_MINOR_EVENT_PURPOSE_CHANGED, CIRC_MINOR_EVENT_CANNIBALIZED }
 
enum  stream_status_event_t {
  STREAM_EVENT_SENT_CONNECT = 0, STREAM_EVENT_SENT_RESOLVE = 1, STREAM_EVENT_SUCCEEDED = 2, STREAM_EVENT_FAILED = 3,
  STREAM_EVENT_CLOSED = 4, STREAM_EVENT_NEW = 5, STREAM_EVENT_NEW_RESOLVE = 6, STREAM_EVENT_FAILED_RETRIABLE = 7,
  STREAM_EVENT_REMAP = 8
}
 
enum  buildtimeout_set_event_t {
  BUILDTIMEOUT_SET_EVENT_COMPUTED = 0, BUILDTIMEOUT_SET_EVENT_RESET = 1, BUILDTIMEOUT_SET_EVENT_SUSPENDED = 2, BUILDTIMEOUT_SET_EVENT_DISCARD = 3,
  BUILDTIMEOUT_SET_EVENT_RESUME = 4
}
 
enum  bootstrap_status_t {
  BOOTSTRAP_STATUS_UNDEF =-1, BOOTSTRAP_STATUS_STARTING =0, BOOTSTRAP_STATUS_CONN_PT =1, BOOTSTRAP_STATUS_CONN_DONE_PT =2,
  BOOTSTRAP_STATUS_CONN_PROXY =3, BOOTSTRAP_STATUS_CONN_DONE_PROXY =4, BOOTSTRAP_STATUS_CONN =5, BOOTSTRAP_STATUS_CONN_DONE =10,
  BOOTSTRAP_STATUS_HANDSHAKE =14, BOOTSTRAP_STATUS_HANDSHAKE_DONE =15, BOOTSTRAP_STATUS_ONEHOP_CREATE =20, BOOTSTRAP_STATUS_REQUESTING_STATUS =25,
  BOOTSTRAP_STATUS_LOADING_STATUS =30, BOOTSTRAP_STATUS_LOADING_KEYS =40, BOOTSTRAP_STATUS_REQUESTING_DESCRIPTORS =45, BOOTSTRAP_STATUS_LOADING_DESCRIPTORS =50,
  BOOTSTRAP_STATUS_ENOUGH_DIRINFO =75, BOOTSTRAP_STATUS_AP_CONN_PT =76, BOOTSTRAP_STATUS_AP_CONN_DONE_PT =77, BOOTSTRAP_STATUS_AP_CONN_PROXY =78,
  BOOTSTRAP_STATUS_AP_CONN_DONE_PROXY =79, BOOTSTRAP_STATUS_AP_CONN =80, BOOTSTRAP_STATUS_AP_CONN_DONE =85, BOOTSTRAP_STATUS_AP_HANDSHAKE =89,
  BOOTSTRAP_STATUS_AP_HANDSHAKE_DONE =90, BOOTSTRAP_STATUS_CIRCUIT_CREATE =95, BOOTSTRAP_STATUS_DONE =100
}
 

Functions

control_connection_tTO_CONTROL_CONN (connection_t *)
 
void control_initialize_event_queue (void)
 
void control_update_global_event_mask (void)
 
void control_adjust_event_log_severity (void)
 
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)
 
int control_event_is_interesting (int event)
 
void control_per_second_events (void)
 
int control_any_per_second_event_enabled (void)
 
int control_event_circuit_status (origin_circuit_t *circ, circuit_status_event_t e, int reason)
 
int control_event_circuit_purpose_changed (origin_circuit_t *circ, int old_purpose)
 
int control_event_circuit_cannibalized (origin_circuit_t *circ, int old_purpose, const struct timeval *old_tv_created)
 
int control_event_stream_status (entry_connection_t *conn, stream_status_event_t e, int reason)
 
int control_event_or_conn_status (or_connection_t *conn, or_conn_status_event_t e, int reason)
 
int control_event_bandwidth_used (uint32_t n_read, uint32_t n_written)
 
int control_event_stream_bandwidth (edge_connection_t *edge_conn)
 
int control_event_stream_bandwidth_used (void)
 
int control_event_circ_bandwidth_used (void)
 
int control_event_circ_bandwidth_used_for_circ (origin_circuit_t *ocirc)
 
int control_event_conn_bandwidth (connection_t *conn)
 
int control_event_conn_bandwidth_used (void)
 
int control_event_circuit_cell_stats (void)
 
void control_event_logmsg (int severity, uint32_t domain, const char *msg)
 
void control_event_logmsg_pending (void)
 
int control_event_descriptors_changed (smartlist_t *routers)
 
int control_event_address_mapped (const char *from, const char *to, time_t expires, const char *error, const int cached)
 
int control_event_my_descriptor_changed (void)
 
int control_event_network_liveness_update (int liveness)
 
int control_event_networkstatus_changed (smartlist_t *statuses)
 
int control_event_newconsensus (const networkstatus_t *consensus)
 
int control_event_networkstatus_changed_single (const routerstatus_t *rs)
 
int control_event_general_status (int severity, const char *format,...) CHECK_PRINTF(2
 
int int control_event_client_status (int severity, const char *format,...) CHECK_PRINTF(2
 
int int int control_event_server_status (int severity, const char *format,...) CHECK_PRINTF(2
 
int int int int control_event_general_error (const char *format,...) CHECK_PRINTF(1
 
int int int int int control_event_client_error (const char *format,...) CHECK_PRINTF(1
 
int int int int int int control_event_server_error (const char *format,...) CHECK_PRINTF(1
 
int int int int int int int control_event_guard (const char *nickname, const char *digest, const char *status)
 
int control_event_conf_changed (const smartlist_t *elements)
 
int control_event_buildtimeout_set (buildtimeout_set_event_t type, const char *args)
 
int control_event_signal (uintptr_t signal)
 
int init_control_cookie_authentication (int enabled)
 
char * get_controller_cookie_file_name (void)
 
smartlist_tdecode_hashed_passwords (struct config_line_t *passwords)
 
void disable_control_logging (void)
 
void enable_control_logging (void)
 
void monitor_owning_controller_process (const char *process_spec)
 
void control_event_bootstrap (bootstrap_status_t status, int progress)
 
 MOCK_DECL (void, control_event_bootstrap_prob_or,(const char *warn, int reason, or_connection_t *or_conn))
 
void control_event_boot_dir (bootstrap_status_t status, int progress)
 
void control_event_boot_first_orconn (void)
 
void control_event_bootstrap_problem (const char *warn, const char *reason, const connection_t *conn, int dowarn)
 
char * control_event_boot_last_msg (void)
 
void control_event_bootstrap_reset (void)
 
void control_event_clients_seen (const char *controller_str)
 
void control_event_transport_launched (const char *mode, const char *transport_name, tor_addr_t *addr, uint16_t port)
 
void control_event_pt_log (const char *log)
 
void control_event_pt_status (const char *status)
 
const char * rend_auth_type_to_string (rend_auth_type_t auth_type)
 
 MOCK_DECL (const char *, node_describe_longname_by_id,(const char *id_digest))
 
void control_event_hs_descriptor_requested (const char *onion_address, rend_auth_type_t auth_type, const char *id_digest, const char *desc_id, const char *hsdir_index)
 
void control_event_hs_descriptor_created (const char *onion_address, const char *desc_id, int replica)
 
void control_event_hs_descriptor_upload (const char *onion_address, const char *desc_id, const char *hs_dir, const char *hsdir_index)
 
void control_event_hs_descriptor_upload_end (const char *action, const char *onion_address, const char *hs_dir, const char *reason)
 
void control_event_hs_descriptor_uploaded (const char *hs_dir, const char *onion_address)
 
void control_event_hsv2_descriptor_failed (const rend_data_t *rend_data, const char *id_digest, const char *reason)
 
void control_event_hsv2_descriptor_received (const char *onion_address, const rend_data_t *rend_data, const char *id_digest)
 
void control_event_hsv3_descriptor_failed (const char *onion_address, const char *desc_id, const char *hsdir_id_digest, const char *reason)
 
void control_event_hsv3_descriptor_received (const char *onion_address, const char *desc_id, const char *hsdir_id_digest)
 
void control_event_hs_descriptor_upload_failed (const char *hs_dir, const char *onion_address, const char *reason)
 
void control_event_hs_descriptor_content (const char *onion_address, const char *desc_id, const char *hsdir_fp, const char *content)
 
void control_free_all (void)
 

Detailed Description

Header file for control.c.

Definition in file control.h.

Macro Definition Documentation

◆ CONTROL_CONN_STATE_NEEDAUTH

#define CONTROL_CONN_STATE_NEEDAUTH   2

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

Definition at line 100 of file control.h.

Referenced by connection_control_process_inbuf().

◆ CONTROL_CONN_STATE_OPEN

#define CONTROL_CONN_STATE_OPEN   1

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

Definition at line 97 of file control.h.

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

◆ LOG_FN_CONN

#define LOG_FN_CONN (   conn,
  args 
)    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 122 of file control.h.

Referenced by conn_write_callback().

◆ REMAP_STREAM_SOURCE_CACHE

#define REMAP_STREAM_SOURCE_CACHE   1

Reason for remapping an AP connection's address: we have a cached answer.

Definition at line 105 of file control.h.

◆ REMAP_STREAM_SOURCE_EXIT

#define REMAP_STREAM_SOURCE_EXIT   2

Reason for remapping an AP connection's address: the exit node told us an answer.

Definition at line 108 of file control.h.

Typedef Documentation

◆ buildtimeout_set_event_t

Used to indicate the type of a buildtime event

◆ circuit_status_minor_event_t

Used to indicate the type of a CIRC_MINOR event passed to the controller. The various types are defined in control-spec.txt .

◆ stream_status_event_t

Used to indicate the type of a stream event passed to the controller. The various types are defined in control-spec.txt

Enumeration Type Documentation

◆ bootstrap_status_t

Enum describing various stages of bootstrapping, for use with controller bootstrap status events. The values range from 0 to 100.

Definition at line 51 of file control.h.

◆ buildtimeout_set_event_t

Used to indicate the type of a buildtime event

Definition at line 41 of file control.h.

◆ circuit_status_minor_event_t

Used to indicate the type of a CIRC_MINOR event passed to the controller. The various types are defined in control-spec.txt .

Definition at line 19 of file control.h.

◆ stream_status_event_t

Used to indicate the type of a stream event passed to the controller. The various types are defined in control-spec.txt

Definition at line 28 of file control.h.

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 5268 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 5395 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 5276 of file control.c.

References tor_assert().

Referenced by connection_reached_eof().

◆ control_adjust_event_log_severity()

void control_adjust_event_log_severity ( void  )

Adjust the log severities that result in control_event_logmsg being called to match the severity of log messages that any controllers are interested in.

Definition at line 376 of file control.c.

References change_callback_log_severity(), control_event_logmsg(), EVENT_IS_INTERESTING, event_to_log_severity(), and LOG_ERR.

Referenced by control_update_global_event_mask().

◆ control_any_per_second_event_enabled()

int control_any_per_second_event_enabled ( void  )

Return true if any event that needs to fire once a second is enabled.

Definition at line 420 of file control.c.

References ANY_EVENT_IS_INTERESTING.

Referenced by control_per_second_events(), and control_update_global_event_mask().

◆ 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 682 of file control.c.

◆ control_event_address_mapped()

int control_event_address_mapped ( const char *  from,
const char *  to,
time_t  expires,
const char *  error,
const int  cached 
)

Called when an address mapping on from from changes to to. expires values less than 3 are special; see connection_edge.c. If error is non-NULL, it is an error code describing the failure mode of the mapping.

Definition at line 6506 of file control.c.

References EVENT_IS_INTERESTING.

◆ control_event_bandwidth_used()

int control_event_bandwidth_used ( uint32_t  n_read,
uint32_t  n_written 
)

A second or more has elapsed: tell any interested control connections how much bandwidth we used.

Definition at line 6333 of file control.c.

Referenced by control_per_second_events().

◆ control_event_boot_dir()

void control_event_boot_dir ( bootstrap_status_t  status,
int  progress 
)

Defer directory info bootstrap events until we have successfully completed our first connection to a router.

Definition at line 228 of file control_bootstrap.c.

◆ control_event_boot_first_orconn()

void control_event_boot_first_orconn ( void  )

Set a flag to allow reporting of directory bootstrap progress. (Code that reports completion of an OR_CONN calls this.) Also, report directory progress so far.

Definition at line 249 of file control_bootstrap.c.

References bootstrap_dir_phase, bootstrap_dir_progress, bootstrap_first_orconn, and control_event_bootstrap().

◆ control_event_boot_last_msg()

char* control_event_boot_last_msg ( void  )

Return a copy of the last sent bootstrap message.

Definition at line 366 of file control_bootstrap.c.

◆ control_event_bootstrap()

void control_event_bootstrap ( bootstrap_status_t  status,
int  progress 
)

Called when Tor has made progress at bootstrapping its directory information and initial circuits.

status is the new status, that is, what task we will be doing next. progress is zero if we just started this task, else it represents progress on the task.

Definition at line 182 of file control_bootstrap.c.

Referenced by bto_cevent_anyconn(), bto_cevent_apconn(), and control_event_boot_first_orconn().

◆ control_event_bootstrap_problem()

void control_event_bootstrap_problem ( const char *  warn,
const char *  reason,
const connection_t conn,
int  dowarn 
)

Called when Tor has failed to make bootstrapping progress in a way that indicates a problem. warn gives a human-readable hint as to why, and reason provides a controller-facing short tag. conn is the connection that caused this problem and can be NULL if a connection cannot be easily identified.

Definition at line 262 of file control_bootstrap.c.

◆ control_event_bootstrap_reset()

void control_event_bootstrap_reset ( void  )

Reset bootstrap tracking state.

Definition at line 373 of file control_bootstrap.c.

References bootstrap_percent.

◆ control_event_buildtimeout_set()

int control_event_buildtimeout_set ( buildtimeout_set_event_t  type,
const char *  args 
)

Called when we compute a new circuitbuildtimeout

Definition at line 6639 of file control.c.

◆ control_event_circ_bandwidth_used()

int control_event_circ_bandwidth_used ( void  )

A second or more has elapsed: tell any interested control connections how much bandwidth origin circuits have used.

Definition at line 6076 of file control.c.

References CIRCUIT_IS_ORIGIN, control_event_circ_bandwidth_used_for_circ(), EVENT_IS_INTERESTING, SMARTLIST_FOREACH_BEGIN, and TO_ORIGIN_CIRCUIT().

Referenced by control_per_second_events().

◆ control_event_circ_bandwidth_used_for_circ()

int control_event_circ_bandwidth_used_for_circ ( origin_circuit_t ocirc)

Emit a CIRC_BW event line for a specific circuit.

This function sets the values it emits to 0, and does not emit an event if there is no new data to report since the last call.

Therefore, it may be called at any frequency.

Definition at line 6101 of file control.c.

Referenced by control_event_circ_bandwidth_used().

◆ control_event_circuit_cannibalized()

int control_event_circuit_cannibalized ( origin_circuit_t circ,
int  old_purpose,
const struct timeval old_tv_created 
)

circ has changed its purpose from old_purpose, and its created-time from old_tv_created: tell any interested controllers.

Definition at line 5783 of file control.c.

References control_event_circuit_status_minor().

◆ control_event_circuit_cell_stats()

int control_event_circuit_cell_stats ( void  )

A second or more has elapsed: tell any interested control connection how many cells have been processed for a given circuit.

Definition at line 6297 of file control.c.

References EVENT_IS_INTERESTING.

Referenced by control_per_second_events().

◆ control_event_circuit_purpose_changed()

int control_event_circuit_purpose_changed ( origin_circuit_t circ,
int  old_purpose 
)

circ has changed its purpose from old_purpose: tell any interested controllers.

Definition at line 5769 of file control.c.

References control_event_circuit_status_minor().

◆ control_event_circuit_status()

int control_event_circuit_status ( origin_circuit_t circ,
circuit_status_event_t  tp,
int  reason_code 
)

Something major has happened to circuit circ: tell any interested control connections.

Definition at line 5639 of file control.c.

◆ control_event_clients_seen()

void control_event_clients_seen ( const char *  controller_str)

We just generated a new summary of which countries we've seen clients from recently. Send a copy to the controller in case it wants to display it for the user.

Definition at line 7032 of file control.c.

References send_control_event().

◆ control_event_conf_changed()

int control_event_conf_changed ( const smartlist_t elements)

Called when a configuration option changes. This is generally triggered by SETCONF requests and RELOAD/SIGHUP signals. The elements is a smartlist_t containing (key, value, ...) pairs in sequence. value can be NULL.

Definition at line 6895 of file control.c.

References EVENT_IS_INTERESTING.

◆ control_event_conn_bandwidth()

int control_event_conn_bandwidth ( connection_t conn)

Print out CONN_BW event for a single OR/DIR/EXIT conn and reset bandwidth counters.

Definition at line 6144 of file control.c.

References CONN_TYPE_DIR, CONN_TYPE_EXIT, CONN_TYPE_OR, EVENT_IS_INTERESTING, connection_t::global_identifier, connection_t::n_read_conn_bw, connection_t::n_written_conn_bw, send_control_event(), and connection_t::type.

Referenced by control_event_conn_bandwidth_used().

◆ control_event_conn_bandwidth_used()

int control_event_conn_bandwidth_used ( void  )

A second or more has elapsed: tell any interested control connections how much bandwidth connections have used.

Definition at line 6179 of file control.c.

References control_event_conn_bandwidth(), EVENT_IS_INTERESTING, and SMARTLIST_FOREACH.

Referenced by control_per_second_events().

◆ control_event_descriptors_changed()

int control_event_descriptors_changed ( smartlist_t routers)

Called whenever we receive new router descriptors: tell any interested control connections. routers is a list of routerinfo_t's.

Definition at line 6474 of file control.c.

References EVENT_IS_INTERESTING, and SMARTLIST_FOREACH.

Referenced by routerlist_descriptors_added().

◆ control_event_guard()

int int int int int int int control_event_guard ( const char *  nickname,
const char *  digest,
const char *  status 
)

Called when the status of an entry guard with the given nickname and identity digest has changed to status: tells any controllers that care.

Definition at line 6868 of file control.c.

◆ control_event_hs_descriptor_content()

void control_event_hs_descriptor_content ( const char *  onion_address,
const char *  desc_id,
const char *  hsdir_id_digest,
const char *  content 
)

Send HS_DESC_CONTENT event after completion of a successful fetch from hs directory. If hsdir_id_digest is NULL, it is replaced by "UNKNOWN". If content is NULL, it is replaced by an empty string. The onion_address or desc_id set to NULL will not trigger the control event.

Definition at line 7485 of file control.c.

◆ control_event_hs_descriptor_created()

void control_event_hs_descriptor_created ( const char *  onion_address,
const char *  desc_id,
int  replica 
)

send HS_DESC CREATED event when a local service generates a descriptor.

onion_address is service address. desc_id is the descriptor ID. replica is the the descriptor replica number. If it is negative, it is ignored.

Definition at line 7221 of file control.c.

◆ control_event_hs_descriptor_requested()

void control_event_hs_descriptor_requested ( const char *  onion_address,
rend_auth_type_t  auth_type,
const char *  id_digest,
const char *  desc_id,
const char *  hsdir_index 
)

send HS_DESC requested event.

rend_query is used to fetch requested onion address and auth type. hs_dir is the description of contacting hs directory. desc_id_base32 is the ID of requested hs descriptor. hsdir_index is the HSDir fetch index value for v3, an hex string.

Definition at line 7143 of file control.c.

◆ control_event_hs_descriptor_upload()

void control_event_hs_descriptor_upload ( const char *  onion_address,
const char *  id_digest,
const char *  desc_id,
const char *  hsdir_index 
)

send HS_DESC upload event.

onion_address is service address. hs_dir is the description of contacting hs directory. desc_id is the ID of requested hs descriptor.

Definition at line 7249 of file control.c.

◆ control_event_hs_descriptor_upload_end()

void control_event_hs_descriptor_upload_end ( const char *  action,
const char *  onion_address,
const char *  id_digest,
const char *  reason 
)

send HS_DESC event after got response from hs directory.

NOTE: this is an internal function used by following functions: control_event_hs_descriptor_uploaded control_event_hs_descriptor_upload_failed

So do not call this function directly.

Definition at line 7323 of file control.c.

◆ control_event_hs_descriptor_upload_failed()

void control_event_hs_descriptor_upload_failed ( const char *  id_digest,
const char *  onion_address,
const char *  reason 
)

Send HS_DESC event to inform controller upload of hidden service descriptor identified by id_digest failed. If reason is not NULL, add it to REASON= field.

Definition at line 7522 of file control.c.

◆ control_event_hs_descriptor_uploaded()

void control_event_hs_descriptor_uploaded ( const char *  id_digest,
const char *  onion_address 
)

send HS_DESC UPLOADED event

called when we successfully uploaded a hidden service descriptor.

Definition at line 7408 of file control.c.

◆ control_event_hsv2_descriptor_failed()

void control_event_hsv2_descriptor_failed ( const rend_data_t rend_data,
const char *  hsdir_id_digest,
const char *  reason 
)

Send HS_DESC event to inform controller that query rend_data failed to retrieve hidden service descriptor from directory identified by id_digest. If NULL, "UNKNOWN" is used. If reason is not NULL, add it to REASON= field.

Definition at line 7425 of file control.c.

◆ control_event_hsv2_descriptor_received()

void control_event_hsv2_descriptor_received ( const char *  onion_address,
const rend_data_t rend_data,
const char *  hsdir_id_digest 
)

send HS_DESC RECEIVED event

called when we successfully received a hidden service descriptor.

Definition at line 7353 of file control.c.

◆ control_event_hsv3_descriptor_failed()

void control_event_hsv3_descriptor_failed ( const char *  onion_address,
const char *  desc_id,
const char *  hsdir_id_digest,
const char *  reason 
)

Send HS_DESC event to inform controller that the query to onion_address failed to retrieve hidden service descriptor desc_id from directory identified by hsdir_id_digest. If NULL, "UNKNOWN" is used. If reason is not NULL, add it to REASON= field.

Definition at line 7459 of file control.c.

◆ control_event_is_interesting()

int control_event_is_interesting ( int  event)

Return true iff the event with code c is being sent to any current control connection. This is useful if the amount of work needed to prepare to call the appropriate control_event_...() function is high.

Definition at line 413 of file control.c.

References EVENT_IS_INTERESTING.

Referenced by control_event_newconsensus(), control_event_signal(), and notify_control_networkstatus_changed().

◆ control_event_logmsg()

void control_event_logmsg ( int  severity,
uint32_t  domain,
const char *  msg 
)

We got a log message: tell any interested control connections.

Definition at line 6401 of file control.c.

References control_event_general_status(), disable_log_messages, esc_for_log(), EVENT_IS_INTERESTING, in_main_thread(), LD_BUG, LOG_NOTICE, log_severity_to_event(), and tor_free.

Referenced by control_adjust_event_log_severity().

◆ control_event_logmsg_pending()

void control_event_logmsg_pending ( void  )

Logging callback: called when there is a queued pending log callback.

Definition at line 6456 of file control.c.

References flush_queued_events_event, in_main_thread(), mainloop_event_activate(), and tor_assert().

◆ control_event_my_descriptor_changed()

int control_event_my_descriptor_changed ( void  )

Our own router descriptor has changed; tell any controllers that care.

Definition at line 6735 of file control.c.

References send_control_event().

◆ control_event_network_liveness_update()

int control_event_network_liveness_update ( int  liveness)

The network liveness has changed; this is called from circuitstats.c whenever we receive a cell, or when timeout expires and we assume the network is down.

Definition at line 6555 of file control.c.

◆ control_event_networkstatus_changed()

int control_event_networkstatus_changed ( smartlist_t statuses)

Called when the routerstatus_ts statuses have changed: sends an NS event to any controller that cares.

Definition at line 6621 of file control.c.

References control_event_networkstatus_changed_helper().

◆ control_event_networkstatus_changed_single()

int control_event_networkstatus_changed_single ( const routerstatus_t rs)

Called when a single local_routerstatus_t has changed: Sends an NS event to any controller that cares.

Definition at line 6717 of file control.c.

References EVENT_IS_INTERESTING.

Referenced by mark_all_dirservers_up().

◆ control_event_newconsensus()

int control_event_newconsensus ( const networkstatus_t consensus)

Called when we get a new consensus networkstatus. Sends a NEWCONSENSUS event consisting of an NS-style line for each relay in the consensus.

Definition at line 6629 of file control.c.

References control_event_is_interesting(), control_event_networkstatus_changed_helper(), and networkstatus_t::routerstatus_list.

Referenced by notify_control_networkstatus_changed().

◆ control_event_or_conn_status()

int control_event_or_conn_status ( or_connection_t conn,
or_conn_status_event_t  tp,
int  reason 
)

Called when the status of an OR connection conn changes: tell any interested control connections. tp is the new status for the connection. If conn has just closed or failed, then reason may be the reason why.

Definition at line 5966 of file control.c.

◆ control_event_pt_log()

void control_event_pt_log ( const char *  log)

A pluggable transport called pt_name has emitted a log message found in message at severity log level.

Definition at line 7056 of file control.c.

References send_control_event().

◆ control_event_pt_status()

void control_event_pt_status ( const char *  status)

A pluggable transport has emitted a STATUS message found in status.

Definition at line 7066 of file control.c.

◆ control_event_signal()

int control_event_signal ( uintptr_t  signal_num)

Called when a signal has been processed from signal_callback

Definition at line 6677 of file control.c.

References control_event_is_interesting().

◆ control_event_stream_bandwidth()

int control_event_stream_bandwidth ( edge_connection_t edge_conn)

Print out STREAM_BW event for a single conn

Definition at line 6014 of file control.c.

◆ control_event_stream_bandwidth_used()

int control_event_stream_bandwidth_used ( void  )

A second or more has elapsed: tell any interested control connections how much bandwidth streams have used.

Definition at line 6040 of file control.c.

References EVENT_IS_INTERESTING.

Referenced by control_per_second_events().

◆ control_event_stream_status()

int control_event_stream_status ( entry_connection_t conn,
stream_status_event_t  tp,
int  reason_code 
)

Something has happened to the stream associated with AP connection conn: tell any interested control connections.

Definition at line 5819 of file control.c.

Referenced by connection_ap_detach_retriable(), and remap_event_helper().

◆ control_event_transport_launched()

void control_event_transport_launched ( const char *  mode,
const char *  transport_name,
tor_addr_t addr,
uint16_t  port 
)

A new pluggable transport called transport_name was launched on addr:port. mode is either "server" or "client" depending on the mode of the pluggable transport. "650" SP "TRANSPORT_LAUNCHED" SP Mode SP Name SP Address SP Port

Definition at line 7045 of file control.c.

References fmt_addr, and send_control_event().

◆ control_free_all()

void control_free_all ( void  )

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

Definition at line 7535 of file control.c.

◆ control_per_second_events()

void control_per_second_events ( void  )

◆ control_ports_write_to_file()

void control_ports_write_to_file ( void  )

Write all of the open control ports to ControlPortWriteToFile

Definition at line 744 of file control.c.

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

◆ control_update_global_event_mask()

void control_update_global_event_mask ( void  )

Set global_event_mask* to the bitwise OR of each live control connection's event_mask field.

Definition at line 320 of file control.c.

References CONN_TYPE_CONTROL, control_adjust_event_log_severity(), control_any_per_second_event_enabled(), global_event_mask, SMARTLIST_FOREACH, and STATE_IS_OPEN.

Referenced by connection_control_closed(), and connection_free_all().

◆ decode_hashed_passwords()

smartlist_t* decode_hashed_passwords ( config_line_t passwords)

Decode the hashed, base64'd passwords stored in passwords. Return a smartlist of acceptable passwords (unterminated strings of length S2K_RFC2440_SPECIFIER_LEN+DIGEST_LEN) on success, or NULL on failure.

Definition at line 1411 of file control.c.

References base16_decode(), base64_decode(), DIGEST_LEN, S2K_RFC2440_SPECIFIER_LEN, smartlist_add(), strcmpstart(), and tor_assert().

◆ 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 6385 of file control.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 6393 of file control.c.

References disable_log_messages, and tor_assert().

◆ get_controller_cookie_file_name()

char* get_controller_cookie_file_name ( void  )

Helper: Return a newly allocated string containing a path to the file where we store our authentication cookie.

Definition at line 6926 of file control.c.

References or_options_t::CookieAuthFile.

Referenced by tor_cleanup().

◆ 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 6981 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 7076 of file control.c.

◆ TO_CONTROL_CONN()

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 266 of file control.c.

References DOWNCAST, and tor_assert().

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