Tor  0.4.7.0-alpha-dev
Macros | Functions | Variables
transports.c File Reference

Pluggable Transports related code. More...

#include "core/or/or.h"
#include "feature/client/bridges.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "core/or/circuitbuild.h"
#include "feature/client/transports.h"
#include "feature/relay/router.h"
#include "feature/relay/relay_find_addr.h"
#include "feature/relay/transport_config.h"
#include "app/config/statefile.h"
#include "core/or/connection_or.h"
#include "feature/relay/ext_orport.h"
#include "feature/control/control_events.h"
#include "lib/encoding/confline.h"
#include "lib/encoding/kvline.h"
#include "lib/process/process.h"
#include "lib/process/env.h"

Go to the source code of this file.

Macros

#define PT_PRIVATE
 
#define parse_server_method_error(l)   parse_method_error(l, 1)
 
#define parse_client_method_error(l)   parse_method_error(l, 0)
 
#define PROTO_ENV_ERROR   "ENV-ERROR"
 
#define PROTO_NEG_SUCCESS   "VERSION"
 
#define PROTO_NEG_FAIL   "VERSION-ERROR no-version"
 
#define PROTO_CMETHOD   "CMETHOD"
 
#define PROTO_SMETHOD   "SMETHOD"
 
#define PROTO_CMETHOD_ERROR   "CMETHOD-ERROR"
 
#define PROTO_SMETHOD_ERROR   "SMETHOD-ERROR"
 
#define PROTO_CMETHODS_DONE   "CMETHODS DONE"
 
#define PROTO_SMETHODS_DONE   "SMETHODS DONE"
 
#define PROTO_PROXY_DONE   "PROXY DONE"
 
#define PROTO_PROXY_ERROR   "PROXY-ERROR"
 
#define PROTO_LOG   "LOG"
 
#define PROTO_STATUS   "STATUS"
 
#define PROTO_VERSION_ONE   1
 

Functions

static smartlist_tcreate_managed_proxy_environment (const managed_proxy_t *mp)
 
static int proxy_configuration_finished (const managed_proxy_t *mp)
 
static void handle_finished_proxy (managed_proxy_t *mp)
 
static void parse_method_error (const char *line, int is_server_method)
 
STATIC transport_ttransport_new (const tor_addr_t *addr, uint16_t port, const char *name, int socks_ver, const char *extra_info_args)
 
void transport_free_ (transport_t *transport)
 
void mark_transport_list (void)
 
void sweep_transport_list (void)
 
static void clear_transport_list (void)
 
static transport_ttransport_copy (const transport_t *transport)
 
transport_ttransport_get_by_name (const char *name)
 
static int transport_resolve_conflicts (const transport_t *t)
 
static int transport_add (transport_t *t)
 
int transport_add_from_config (const tor_addr_t *addr, uint16_t port, const char *name, int socks_ver)
 
bool managed_proxy_has_transport (const char *transport_name)
 
int pt_proxies_configuration_pending (void)
 
static void assert_unconfigured_count_ok (void)
 
static int managed_proxy_has_argv (const managed_proxy_t *mp, char **proxy_argv)
 
static managed_proxy_t * get_managed_proxy_by_argv_and_type (char **proxy_argv, int is_server)
 
static void add_transport_to_proxy (const char *transport, managed_proxy_t *mp)
 
static int proxy_needs_restart (const managed_proxy_t *mp)
 
static void proxy_prepare_for_restart (managed_proxy_t *mp)
 
static int launch_managed_proxy (managed_proxy_t *mp)
 
void pt_configure_remaining_proxies (void)
 
STATIC int configure_proxy (managed_proxy_t *mp)
 
static void register_server_proxy (const managed_proxy_t *mp)
 
static void register_client_proxy (const managed_proxy_t *mp)
 
static void register_proxy (const managed_proxy_t *mp)
 
STATIC void managed_proxy_destroy (managed_proxy_t *mp, int also_terminate_process)
 
STATIC char * get_pt_proxy_uri (void)
 
static void handle_methods_done (const managed_proxy_t *mp)
 
STATIC void handle_proxy_line (const char *line, managed_proxy_t *mp)
 
STATIC void parse_env_error (const char *line)
 
STATIC int parse_version (const char *line, managed_proxy_t *mp)
 
static int parse_method_line_helper (const char *line, managed_proxy_t *mp, int is_smethod)
 
STATIC int parse_smethod_line (const char *line, managed_proxy_t *mp)
 
STATIC int parse_cmethod_line (const char *line, managed_proxy_t *mp)
 
STATIC void parse_proxy_error (const char *line)
 
STATIC void parse_log_line (const char *line, managed_proxy_t *mp)
 
STATIC void parse_status_line (const char *line, managed_proxy_t *mp)
 
STATIC char * get_transport_options_for_server_proxy (const managed_proxy_t *mp)
 
static char * get_bindaddr_for_server_proxy (const managed_proxy_t *mp)
 
STATIC managed_proxy_t * managed_proxy_create (const smartlist_t *with_transport_list, char **proxy_argv, int is_server)
 
void pt_kickstart_proxy (const smartlist_t *with_transport_list, char **proxy_argv, int is_server)
 
STATIC void free_execve_args (char **arg)
 
void pt_prepare_proxy_list_for_config_read (void)
 
smartlist_tget_transport_proxy_ports (void)
 
char * pt_get_extra_info_descriptor_string (void)
 
char * pt_stringify_socks_args (const smartlist_t *socks_args)
 
char * pt_get_socks_args_for_proxy_addrport (const tor_addr_t *addr, uint16_t port)
 
void sweep_proxy_list (void)
 
void pt_free_all (void)
 
char * tor_escape_str_for_pt_args (const char *string, const char *chars_to_escape)
 
STATIC void managed_proxy_stdout_callback (process_t *process, const char *line, size_t size)
 
STATIC void managed_proxy_stderr_callback (process_t *process, const char *line, size_t size)
 
STATIC bool managed_proxy_exit_callback (process_t *process, process_exit_code_t exit_code)
 
STATIC int managed_proxy_severity_parse (const char *severity)
 
STATIC const tor_addr_tmanaged_proxy_outbound_address (const or_options_t *options, sa_family_t family)
 

Variables

static smartlist_ttransport_list = NULL
 
static smartlist_tmanaged_proxy_list = NULL
 
static int unconfigured_proxies_n = 0
 
static int check_if_restarts_needed = 0
 

Detailed Description

Pluggable Transports related code.

Each managed proxy is represented by a managed_proxy_t. Each managed proxy can support multiple transports. Each managed proxy gets configured through a multistep process.

managed_proxy_list contains all the managed proxies this tor instance is supporting. In the managed_proxy_list there are unconfigured_proxies_n managed proxies that are still unconfigured.

In every run_scheduled_event() tick, we attempt to launch and then configure the unconfigured managed proxies, using the configuration protocol defined in the 180_pluggable_transport.txt proposal. A managed proxy might need several ticks to get fully configured.

When a managed proxy is fully configured, we register all its transports to the circuitbuild.c subsystem. At that point the transports are owned by the circuitbuild.c subsystem.

When a managed proxy fails to follow the 180 configuration protocol, it gets marked as broken and gets destroyed.

In a little more detail:

While we are serially parsing torrc, we store all the transports that a proxy should spawn in its transports_to_launch element.

When we finish reading the torrc, we spawn the managed proxy and expect {S,C}METHOD lines from its output. We add transports described by METHOD lines to its transports element, as transport_t structs.

When the managed proxy stops spitting METHOD lines (signified by a '{S,C}METHODS DONE' message) we pass copies of its transports to the bridge subsystem. We keep copies of the 'transport_t's on the managed proxy to be able to associate the proxy with its transports, and we pass copies to the bridge subsystem so that transports can be associated with bridges. [ XXX We should try see whether the two copies are really needed and maybe cut it into a single copy of the 'transport_t' shared between the managed proxy and the bridge subsystem. Preliminary analysis shows that both copies are needed with the current code logic, because of race conditions that can cause dangling pointers. ]

In even more detail, this is what happens when a config read (like a SIGHUP or a SETCONF) occurs:

We immediately destroy all unconfigured proxies (We shouldn't have unconfigured proxies in the first place, except when the config read happens immediately after tor is launched.).

We mark all managed proxies and transports to signify that they must be removed if they don't contribute by the new torrc (we mark using the marked_for_removal element). We also mark all managed proxies to signify that they might need to be restarted so that they end up supporting all the transports the new torrc wants them to support (we mark using the was_around_before_config_read element). We also clear their transports_to_launch list so that we can put there the transports we need to launch according to the new torrc.

We then start parsing torrc again.

Every time we encounter a transport line using a managed proxy that was around before the config read, we cleanse that proxy from the removal mark. We also toggle the check_if_restarts_needed flag, so that on the next pt_configure_remaining_proxies tick, we investigate whether we need to restart the proxy so that it also spawns the new transports. If the post-config-read transports_to_launch list is identical to the pre-config-read one, it means that no changes were introduced to this proxy during the config read and no restart has to take place.

During the post-config-read torrc parsing, we unmark all transports spawned by managed proxies that we find in our torrc. We do that so that if we don't need to restart a managed proxy, we can continue using its old transports normally. If we end up restarting the proxy, we destroy and unregister all old transports from the circuitbuild.c subsystem.

Definition in file transports.c.

Macro Definition Documentation

◆ PROTO_ENV_ERROR

#define PROTO_ENV_ERROR   "ENV-ERROR"

Managed proxy protocol strings

Definition at line 124 of file transports.c.

◆ PROTO_VERSION_ONE

#define PROTO_VERSION_ONE   1

The first and only supported - at the moment - configuration protocol version.

Definition at line 140 of file transports.c.

Function Documentation

◆ add_transport_to_proxy()

static void add_transport_to_proxy ( const char *  transport,
managed_proxy_t *  mp 
)
static

Add transport to managed proxy mp.

Definition at line 461 of file transports.c.

◆ assert_unconfigured_count_ok()

static void assert_unconfigured_count_ok ( void  )
static

Assert that the unconfigured_proxies_n value correctly matches the number of proxies in a state other than PT_PROTO_COMPLETE.

Definition at line 404 of file transports.c.

Referenced by pt_prepare_proxy_list_for_config_read(), and sweep_proxy_list().

◆ clear_transport_list()

static void clear_transport_list ( void  )
static

Initialize the pluggable transports list to empty, creating it if needed.

Definition at line 206 of file transports.c.

Referenced by pt_free_all().

◆ configure_proxy()

STATIC int configure_proxy ( managed_proxy_t *  mp)

Attempt to continue configuring managed proxy mp. Return 1 if the transport configuration finished, and return 0 otherwise (if we still have more configuring to do for this proxy).

Definition at line 646 of file transports.c.

◆ create_managed_proxy_environment()

static smartlist_t * create_managed_proxy_environment ( const managed_proxy_t *  mp)
static

Return a newly allocated process_environment_t * for mp's process.

Definition at line 1369 of file transports.c.

Referenced by launch_managed_proxy().

◆ free_execve_args()

STATIC void free_execve_args ( char **  arg)

Frees the array of pointers in arg used as arguments to execve(2).

Definition at line 1602 of file transports.c.

◆ get_bindaddr_for_server_proxy()

static char* get_bindaddr_for_server_proxy ( const managed_proxy_t *  mp)
static

Return the string that tor should place in TOR_PT_SERVER_BINDADDR while configuring the server managed proxy in mp. The string is stored in the heap, and it's the responsibility of the caller to deallocate it after its use.

Definition at line 1342 of file transports.c.

◆ get_managed_proxy_by_argv_and_type()

static managed_proxy_t* get_managed_proxy_by_argv_and_type ( char **  proxy_argv,
int  is_server 
)
static

Return a managed proxy with the same argv as proxy_argv. If no such managed proxy exists, return NULL.

Definition at line 445 of file transports.c.

Referenced by pt_kickstart_proxy().

◆ get_pt_proxy_uri()

STATIC char* get_pt_proxy_uri ( void  )

Convert the tor proxy options to a URI suitable for TOR_PT_PROXY. Return a newly allocated string containing the URI, or NULL if no proxy is set.

Definition at line 756 of file transports.c.

Referenced by proxy_needs_restart().

◆ get_transport_options_for_server_proxy()

STATIC char* get_transport_options_for_server_proxy ( const managed_proxy_t *  mp)

Return a newly allocated string that tor should place in TOR_PT_SERVER_TRANSPORT_OPTIONS while configuring the server manged proxy in mp. Return NULL if no such options are found.

Loop over the transports of the proxy. If we have options for any of them, format them appropriately and place them in our smartlist. Finally, join our smartlist to get the final string.

Loop over the options of this transport, escape them, and place them in the smartlist.

Definition at line 1297 of file transports.c.

◆ get_transport_proxy_ports()

smartlist_t* get_transport_proxy_ports ( void  )

Return a smartlist containing the ports where our pluggable transports are listening.

XXX assume that external proxy ports have been forwarded manually

Definition at line 1650 of file transports.c.

◆ handle_finished_proxy()

static void handle_finished_proxy ( managed_proxy_t *  mp)
static

Handle a configured or broken managed proxy mp.

Definition at line 796 of file transports.c.

Referenced by configure_proxy(), and managed_proxy_stdout_callback().

◆ handle_methods_done()

static void handle_methods_done ( const managed_proxy_t *  mp)
static

This function is called when a proxy sends an {S,C}METHODS DONE message.

Definition at line 841 of file transports.c.

◆ handle_proxy_line()

STATIC void handle_proxy_line ( const char *  line,
managed_proxy_t *  mp 
)

Handle a configuration protocol line received from a managed proxy mp.

Definition at line 858 of file transports.c.

Referenced by managed_proxy_stdout_callback().

◆ launch_managed_proxy()

static int launch_managed_proxy ( managed_proxy_t *  mp)
static

Launch managed proxy mp.

Definition at line 550 of file transports.c.

Referenced by configure_proxy().

◆ managed_proxy_create()

STATIC managed_proxy_t* managed_proxy_create ( const smartlist_t with_transport_list,
char **  proxy_argv,
int  is_server 
)

Create and return a new managed proxy for transport using proxy_argv. Also, add it to the global managed proxy list. If is_server is true, it's a server managed proxy. Takes ownership of proxy_argv.

Requires that proxy_argv have at least one element.

Definition at line 1520 of file transports.c.

Referenced by pt_kickstart_proxy().

◆ managed_proxy_destroy()

STATIC void managed_proxy_destroy ( managed_proxy_t *  mp,
int  also_terminate_process 
)

Free memory allocated by managed proxy mp.

Definition at line 718 of file transports.c.

Referenced by handle_finished_proxy(), pt_prepare_proxy_list_for_config_read(), and sweep_proxy_list().

◆ managed_proxy_exit_callback()

STATIC bool managed_proxy_exit_callback ( process_t process,
process_exit_code_t  exit_code 
)

Callback function that is called when our PT process terminates. The process exit code can be found in exit_code and our process can be found in process. Returns true iff we want the process subsystem to free our process_t handle for us.

Definition at line 1936 of file transports.c.

Referenced by launch_managed_proxy().

◆ managed_proxy_has_argv()

static int managed_proxy_has_argv ( const managed_proxy_t *  mp,
char **  proxy_argv 
)
static

Return true if mp has the same argv as proxy_argv

Definition at line 423 of file transports.c.

Referenced by get_managed_proxy_by_argv_and_type().

◆ managed_proxy_has_transport()

bool managed_proxy_has_transport ( const char *  transport_name)

Return true iff we have a managed_proxy_t in the global list is for the given transport name.

Definition at line 374 of file transports.c.

◆ managed_proxy_outbound_address()

STATIC const tor_addr_t* managed_proxy_outbound_address ( const or_options_t options,
sa_family_t  family 
)

Return the outbound address from the given family. Returns NULL if the user haven't specified a specific outbound address in either OutboundBindAddress or OutboundBindAddressPT.

Definition at line 1980 of file transports.c.

◆ managed_proxy_severity_parse()

STATIC int managed_proxy_severity_parse ( const char *  severity)

Returns a valid integer log severity level from severity that is compatible with Tor's logging functions. Returns -1 on error.

Definition at line 1953 of file transports.c.

◆ managed_proxy_stderr_callback()

STATIC void managed_proxy_stderr_callback ( process_t process,
const char *  line,
size_t  size 
)

Callback function that is called when our PT process have data on its stderr. Our process can be found in process, the data can be found in line and the length of our line is given in size.

Definition at line 1912 of file transports.c.

Referenced by launch_managed_proxy().

◆ managed_proxy_stdout_callback()

STATIC void managed_proxy_stdout_callback ( process_t process,
const char *  line,
size_t  size 
)

Callback function that is called when our PT process have data on its stdout. Our process can be found in process, the data can be found in line and the length of our line is given in size.

Definition at line 1888 of file transports.c.

Referenced by launch_managed_proxy().

◆ mark_transport_list()

void mark_transport_list ( void  )

Mark every entry of the transport list to be removed on our next call to sweep_transport_list unless it has first been un-marked.

Definition at line 180 of file transports.c.

◆ parse_cmethod_line()

STATIC int parse_cmethod_line ( const char *  line,
managed_proxy_t *  mp 
)

Parses a CMETHOD line, and if well-formed it registers the new transport in mp.

Definition at line 1156 of file transports.c.

◆ parse_env_error()

STATIC void parse_env_error ( const char *  line)

Parses an ENV-ERROR line and warns the user accordingly.

Definition at line 970 of file transports.c.

◆ parse_log_line()

STATIC void parse_log_line ( const char *  line,
managed_proxy_t *  mp 
)

Parses a LOG line and emit log events accordingly.

Definition at line 1180 of file transports.c.

◆ parse_method_error()

static void parse_method_error ( const char *  line,
int  is_server 
)
static

Parses {C,S}METHOD-ERROR line and warns the user accordingly. If is_server it is an SMETHOD-ERROR, otherwise it is a CMETHOD-ERROR.

Definition at line 1008 of file transports.c.

◆ parse_method_line_helper()

static int parse_method_line_helper ( const char *  line,
managed_proxy_t *  mp,
int  is_smethod 
)
static

A helper for parse_{c,s}method_line(), bootstraps its functionalities. If is_smethod is true then the the line to parse is a SMETHOD line otherwise it is a CMETHOD line

Check for the proxy method sent to us in CMETHOD line.

Check for options in the SMETHOD line.

Logs info about line parsing success for client or server

Definition at line 1029 of file transports.c.

Referenced by parse_cmethod_line(), and parse_smethod_line().

◆ parse_proxy_error()

STATIC void parse_proxy_error ( const char *  line)

Parses an PROXY-ERROR line and warns the user accordingly.

Definition at line 1165 of file transports.c.

◆ parse_smethod_line()

STATIC int parse_smethod_line ( const char *  line,
managed_proxy_t *  mp 
)

Parses an SMETHOD line and if well-formed it registers the new transport in mp.

Definition at line 1146 of file transports.c.

◆ parse_status_line()

STATIC void parse_status_line ( const char *  line,
managed_proxy_t *  mp 
)

Parses a STATUS line and emit control events accordingly.

Definition at line 1246 of file transports.c.

◆ parse_version()

STATIC int parse_version ( const char *  line,
managed_proxy_t *  mp 
)

Handles a VERSION line. Updates the configuration protocol version in mp.

Definition at line 986 of file transports.c.

◆ proxy_configuration_finished()

static int proxy_configuration_finished ( const managed_proxy_t *  mp)
inlinestatic

Return true if the configuration of the managed proxy mp is finished.

Definition at line 832 of file transports.c.

Referenced by managed_proxy_stdout_callback().

◆ proxy_needs_restart()

static int proxy_needs_restart ( const managed_proxy_t *  mp)
static

Called when a SIGHUP occurs. Returns true if managed proxy mp needs to be restarted after the SIGHUP, based on the new torrc.

Definition at line 472 of file transports.c.

◆ proxy_prepare_for_restart()

static void proxy_prepare_for_restart ( managed_proxy_t *  mp)
static

Managed proxy mp must be restarted. Do all the necessary preparations and then flag its state so that it will be relaunched in the next tick.

Definition at line 515 of file transports.c.

◆ pt_configure_remaining_proxies()

void pt_configure_remaining_proxies ( void  )

Check if any of the managed proxies we are currently trying to configure has anything new to say.

Definition at line 589 of file transports.c.

◆ pt_free_all()

void pt_free_all ( void  )

Release all storage held by the pluggable transports subsystem.

Definition at line 1824 of file transports.c.

◆ pt_get_extra_info_descriptor_string()

char* pt_get_extra_info_descriptor_string ( void  )

Return the pluggable transport string that we should display in our extra-info descriptor. If we shouldn't display such a string, or we have nothing to display, return NULL. The string is allocated on the heap and it's the responsibility of the caller to free it.

Definition at line 1680 of file transports.c.

Referenced by extrainfo_dump_to_string_stats_helper().

◆ pt_get_socks_args_for_proxy_addrport()

char* pt_get_socks_args_for_proxy_addrport ( const tor_addr_t addr,
uint16_t  port 
)

Return a string of the SOCKS arguments that we should pass to the pluggable transports proxy in addr:port according to 180_pluggable_transport.txt. The string is allocated on the heap and it's the responsibility of the caller to free it after use.

Definition at line 1792 of file transports.c.

◆ pt_kickstart_proxy()

void pt_kickstart_proxy ( const smartlist_t with_transport_list,
char **  proxy_argv,
int  is_server 
)

Register proxy with proxy_argv, supporting transports in transport_list, to the managed proxy subsystem. If is_server is true, then the proxy is a server proxy.

Takes ownership of proxy_argv.

Requires that proxy_argv be a NULL-terminated array of command-line elements, containing at least one element.

Definition at line 1557 of file transports.c.

◆ pt_prepare_proxy_list_for_config_read()

void pt_prepare_proxy_list_for_config_read ( void  )

Tor will read its config. Prepare the managed proxy list so that proxies not used in the new config will shutdown, and proxies that need to spawn different transports will do so.

Definition at line 1617 of file transports.c.

◆ pt_proxies_configuration_pending()

int pt_proxies_configuration_pending ( void  )

Return true if there are still unconfigured managed proxies, or proxies that need restarting.

Definition at line 396 of file transports.c.

Referenced by fetch_bridge_descriptors().

◆ pt_stringify_socks_args()

char* pt_stringify_socks_args ( const smartlist_t socks_args)

Stringify the SOCKS arguments in socks_args according to 180_pluggable_transport.txt. The string is allocated on the heap and it's the responsibility of the caller to free it after use.

Definition at line 1756 of file transports.c.

Referenced by pt_get_socks_args_for_proxy_addrport().

◆ register_client_proxy()

static void register_client_proxy ( const managed_proxy_t *  mp)
static

Register all the transports supported by client managed proxy mp to the bridge subsystem.

Definition at line 679 of file transports.c.

Referenced by register_proxy().

◆ register_proxy()

static void register_proxy ( const managed_proxy_t *  mp)
inlinestatic

Register the transports of managed proxy mp.

Definition at line 708 of file transports.c.

◆ register_server_proxy()

static void register_server_proxy ( const managed_proxy_t *  mp)
static

Register server managed proxy mp transports to state

Definition at line 664 of file transports.c.

Referenced by register_proxy().

◆ sweep_proxy_list()

void sweep_proxy_list ( void  )

The tor config was read. Destroy all managed proxies that were marked by a previous call to prepare_proxy_list_for_config_read() and are not used by the new config.

Definition at line 1808 of file transports.c.

◆ sweep_transport_list()

void sweep_transport_list ( void  )

Remove every entry of the transport list that was marked with mark_transport_list if it has not subsequently been un-marked.

Definition at line 191 of file transports.c.

◆ tor_escape_str_for_pt_args()

char* tor_escape_str_for_pt_args ( const char *  string,
const char *  chars_to_escape 
)

Return a newly allocated string equal to string, except that every character in chars_to_escape is preceded by a backslash.

Definition at line 1850 of file transports.c.

Referenced by get_transport_options_for_server_proxy().

◆ transport_add()

static int transport_add ( transport_t t)
static

Add transport t to the internal list of pluggable transports. Returns 0 if the transport was added correctly, 1 if the same transport was already registered (in this case the caller must free the transport) and -1 if there was an error.

Definition at line 316 of file transports.c.

Referenced by register_client_proxy(), and transport_add_from_config().

◆ transport_add_from_config()

int transport_add_from_config ( const tor_addr_t addr,
uint16_t  port,
const char *  name,
int  socks_ver 
)

Remember a new pluggable transport proxy at addr:port. name is set to the name of the protocol this proxy uses. socks_ver is set to the SOCKS version of the proxy.

Definition at line 339 of file transports.c.

◆ transport_copy()

static transport_t* transport_copy ( const transport_t transport)
static

Return a deep copy of transport.

Definition at line 216 of file transports.c.

Referenced by register_client_proxy().

◆ transport_free_()

void transport_free_ ( transport_t transport)

Free the pluggable transport struct transport.

Definition at line 167 of file transports.c.

◆ transport_get_by_name()

transport_t* transport_get_by_name ( const char *  name)

Returns the transport in our transport list that has the name name. Else returns NULL.

Definition at line 236 of file transports.c.

Referenced by bridge_has_invalid_transport(), get_transport_by_bridge_addrport(), proxy_prepare_for_restart(), pt_kickstart_proxy(), and transport_resolve_conflicts().

◆ transport_new()

STATIC transport_t* transport_new ( const tor_addr_t addr,
uint16_t  port,
const char *  name,
int  socks_ver,
const char *  extra_info_args 
)

Returns a transport_t struct for a transport proxy supporting the protocol name listening at addr:port using SOCKS version socks_ver.

Definition at line 149 of file transports.c.

Referenced by transport_add_from_config().

◆ transport_resolve_conflicts()

static int transport_resolve_conflicts ( const transport_t t)
static

Resolve any conflicts that the insertion of transport t might cause. Return 0 if t is OK and should be registered, 1 if there is a transport identical to t already registered and -1 if t cannot be added due to conflicts.

Definition at line 257 of file transports.c.

Referenced by transport_add().

Variable Documentation

◆ check_if_restarts_needed

int check_if_restarts_needed = 0
static

Boolean: True iff we might need to restart some proxies.

Definition at line 369 of file transports.c.

Referenced by pt_kickstart_proxy(), and pt_proxies_configuration_pending().

◆ managed_proxy_list

smartlist_t* managed_proxy_list = NULL
static

◆ transport_list

smartlist_t* transport_list = NULL
static

A list of pluggable transports found in torrc.

Definition at line 143 of file transports.c.

Referenced by clear_transport_list(), mark_transport_list(), pt_free_all(), pt_parse_transport_line(), sweep_transport_list(), transport_add(), and transport_get_by_name().

◆ unconfigured_proxies_n

int unconfigured_proxies_n = 0
static

Number of still unconfigured proxies.

Definition at line 367 of file transports.c.

Referenced by assert_unconfigured_count_ok(), pt_prepare_proxy_list_for_config_read(), and pt_proxies_configuration_pending().