tor  0.4.0.0-alpha-dev
Data Structures | Macros | Typedefs | Functions
transports.h File Reference
#include "lib/process/process.h"

Go to the source code of this file.

Data Structures

struct  transport_t
 

Macros

#define transport_free(tr)   FREE_AND_NULL(transport_t, transport_free_, (tr))
 
#define pt_kickstart_client_proxy(tl, pa)   pt_kickstart_proxy(tl, pa, 0)
 
#define pt_kickstart_server_proxy(tl, pa)   pt_kickstart_proxy(tl, pa, 1)
 

Typedefs

typedef struct transport_t transport_t
 

Functions

void mark_transport_list (void)
 
void sweep_transport_list (void)
 
 MOCK_DECL (int, transport_add_from_config,(const tor_addr_t *addr, uint16_t port, const char *name, int socks_ver))
 
void transport_free_ (transport_t *transport)
 
 MOCK_DECL (transport_t *, transport_get_by_name,(const char *name))
 
 MOCK_DECL (void, pt_kickstart_proxy,(const smartlist_t *transport_list, char **proxy_argv, int is_server))
 
void pt_configure_remaining_proxies (void)
 
int pt_proxies_configuration_pending (void)
 
char * pt_get_extra_info_descriptor_string (void)
 
void pt_free_all (void)
 
void pt_prepare_proxy_list_for_config_read (void)
 
void sweep_proxy_list (void)
 
smartlist_tget_transport_proxy_ports (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)
 
char * tor_escape_str_for_pt_args (const char *string, const char *chars_to_escape)
 

Detailed Description

Headers for transports.c.

Definition in file transports.h.

Typedef Documentation

◆ transport_t

typedef struct transport_t transport_t

Represents a pluggable transport used by a bridge.

Function Documentation

◆ 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 1586 of file transports.c.

References managed_proxy_list, smartlist_add_asprintf(), SMARTLIST_FOREACH, SMARTLIST_FOREACH_BEGIN, and tor_assert().

Referenced by get_list_of_ports_to_forward().

◆ 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 177 of file transports.c.

References transport_t::marked_for_removal, SMARTLIST_FOREACH, and transport_list.

◆ 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 564 of file transports.c.

◆ pt_free_all()

void pt_free_all ( void  )

Release all storage held by the pluggable transports subsystem.

Definition at line 1751 of file transports.c.

References clear_transport_list(), and transport_list.

◆ 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 1616 of file transports.c.

References fmt_addrport(), managed_proxy_list, smartlist_add_asprintf(), SMARTLIST_FOREACH_BEGIN, tor_addr_from_ipv4h, tor_addr_is_null(), tor_asprintf(), tor_assert(), and tor_free.

◆ 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 1719 of file transports.c.

References get_socks_args_by_bridge_addrport(), and pt_stringify_socks_args().

◆ 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 1553 of file transports.c.

References assert_unconfigured_count_ok(), managed_proxy_destroy(), managed_proxy_list, smartlist_clear(), SMARTLIST_DEL_CURRENT, SMARTLIST_FOREACH, SMARTLIST_FOREACH_BEGIN, tor_assert(), tor_free, and unconfigured_proxies_n.

◆ 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 371 of file transports.c.

References check_if_restarts_needed, and unconfigured_proxies_n.

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 1683 of file transports.c.

References tor_assert().

Referenced by pt_get_socks_args_for_proxy_addrport().

◆ 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 1735 of file transports.c.

References assert_unconfigured_count_ok(), managed_proxy_destroy(), managed_proxy_list, SMARTLIST_DEL_CURRENT, and SMARTLIST_FOREACH_BEGIN.

◆ 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 188 of file transports.c.

References SMARTLIST_DEL_CURRENT, SMARTLIST_FOREACH_BEGIN, and transport_list.

◆ 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 1777 of file transports.c.

References tor_assert().

Referenced by get_transport_options_for_server_proxy().

◆ transport_free_()

void transport_free_ ( transport_t transport)

Free the pluggable transport struct transport.

Definition at line 164 of file transports.c.

References transport_t::extra_info_args, transport_t::name, and tor_free.