120 #define parse_server_method_error(l) parse_method_error(l, 1)
121 #define parse_client_method_error(l) parse_method_error(l, 0)
124 #define PROTO_ENV_ERROR "ENV-ERROR"
125 #define PROTO_NEG_SUCCESS "VERSION"
126 #define PROTO_NEG_FAIL "VERSION-ERROR no-version"
127 #define PROTO_CMETHOD "CMETHOD"
128 #define PROTO_SMETHOD "SMETHOD"
129 #define PROTO_CMETHOD_ERROR "CMETHOD-ERROR"
130 #define PROTO_SMETHOD_ERROR "SMETHOD-ERROR"
131 #define PROTO_CMETHODS_DONE "CMETHODS DONE"
132 #define PROTO_SMETHODS_DONE "SMETHODS DONE"
133 #define PROTO_PROXY_DONE "PROXY DONE"
134 #define PROTO_PROXY_ERROR "PROXY-ERROR"
135 #define PROTO_LOG "LOG"
136 #define PROTO_STATUS "STATUS"
140 #define PROTO_VERSION_ONE 1
150 const char *
name,
int socks_ver,
151 const char *extra_info_args)
196 if (t->marked_for_removal) {
200 } SMARTLIST_FOREACH_END(t);
222 new_transport = tor_malloc_zero(
sizeof(
transport_t));
225 new_transport->
name = tor_strdup(transport->
name);
227 new_transport->
port = transport->
port;
230 return new_transport;
244 if (!strcmp(transport->name,
name))
246 } SMARTLIST_FOREACH_END(transport);
284 char *new_transport_addrport =
287 log_notice(
LD_GENERAL,
"You tried to add transport '%s' at '%s' "
288 "but there was already a transport marked for deletion at "
289 "'%s'. We deleted the old transport and registered the "
290 "new one.", t->
name, new_transport_addrport,
293 transport_free(t_tmp);
296 log_notice(
LD_GENERAL,
"You tried to add transport '%s' at '%s' "
297 "but the same transport already exists at '%s'. "
298 "Skipping.", t->
name, new_transport_addrport,
339 const char *
name,
int socks_ver))
348 log_notice(
LD_GENERAL,
"Could not add transport %s at %s. Skipping.",
353 log_info(
LD_GENERAL,
"Successfully registered transport %s at %s.",
358 log_info(
LD_GENERAL,
"Successfully registered transport %s at %s.",
384 if (!strcasecmp(
name, transport_name)) {
387 } SMARTLIST_FOREACH_END(
name);
388 } SMARTLIST_FOREACH_END(mp);
413 if (mp->conf_state == PT_PROTO_COMPLETED)
425 char **tmp1=proxy_argv;
426 char **tmp2=mp->argv;
431 while (*tmp1 && *tmp2) {
432 if (strcmp(*tmp1++, *tmp2++))
436 if (!*tmp1 && !*tmp2)
444 static managed_proxy_t *
452 mp->is_server == is_server)
454 } SMARTLIST_FOREACH_END(mp);
482 if (
strcmp_opt(proxy_uri, mp->proxy_uri) != 0)
493 tor_assert(smartlist_len(mp->transports_to_launch) > 0);
494 tor_assert(mp->conf_state == PT_PROTO_COMPLETED);
496 if (smartlist_len(mp->transports_to_launch) != smartlist_len(mp->transports))
503 } SMARTLIST_FOREACH_END(t);
519 tor_assert(mp->conf_state == PT_PROTO_COMPLETED);
531 } SMARTLIST_FOREACH_END(t);
541 mp->proxy_supported = 0;
544 mp->conf_state = PT_PROTO_INFANT;
569 for (
int i = 1; mp->argv[i] != NULL; ++i)
573 log_warn(
LD_CONFIG,
"Managed proxy at '%s' failed at launch.",
579 "Managed proxy at '%s' has spawned with PID '%" PRIu64
"'.",
581 mp->conf_state = PT_PROTO_LAUNCHED;
591 int at_least_a_proxy_config_finished = 0;
594 log_debug(
LD_CONFIG,
"Configuring remaining managed proxies (%d)!",
604 tor_assert(mp->conf_state != PT_PROTO_BROKEN &&
605 mp->conf_state != PT_PROTO_FAILED_LAUNCH);
607 if (mp->was_around_before_config_read) {
611 mp->was_around_before_config_read = 0;
614 log_info(
LD_GENERAL,
"Preparing managed proxy '%s' for restart.",
618 log_info(
LD_GENERAL,
"Nothing changed for managed proxy '%s' after "
619 "HUP: not restarting.", mp->argv[0]);
629 at_least_a_proxy_config_finished = 1;
631 } SMARTLIST_FOREACH_END(mp);
637 if (at_least_a_proxy_config_finished)
649 if (mp->conf_state == PT_PROTO_INFANT) {
651 mp->conf_state = PT_PROTO_FAILED_LAUNCH;
657 tor_assert(mp->conf_state != PT_PROTO_INFANT);
659 return mp->conf_state == PT_PROTO_COMPLETED;
666 tor_assert(mp->conf_state != PT_PROTO_COMPLETED);
670 log_notice(
LD_GENERAL,
"Registered server transport '%s' at '%s'",
673 } SMARTLIST_FOREACH_END(t);
683 tor_assert(mp->conf_state != PT_PROTO_COMPLETED);
690 log_notice(
LD_GENERAL,
"Could not add transport %s. Skipping.", t->name);
691 transport_free(transport_tmp);
694 log_info(
LD_GENERAL,
"Successfully registered transport %s", t->name);
698 log_info(
LD_GENERAL,
"Successfully registered transport %s", t->name);
700 transport_free(transport_tmp);
703 } SMARTLIST_FOREACH_END(t);
719 int also_terminate_process)
724 smartlist_free(mp->transports);
728 smartlist_free(mp->transports_to_launch);
741 if (also_terminate_process && mp->process) {
798 switch (mp->conf_state) {
799 case PT_PROTO_BROKEN:
802 case PT_PROTO_FAILED_LAUNCH:
805 case PT_PROTO_CONFIGURED:
806 if (mp->proxy_uri && !mp->proxy_supported) {
807 log_warn(
LD_CONFIG,
"Managed proxy '%s' did not configure the "
808 "specified outgoing proxy and will be terminated.",
814 mp->conf_state = PT_PROTO_COMPLETED;
816 case PT_PROTO_INFANT:
817 case PT_PROTO_LAUNCHED:
818 case PT_PROTO_ACCEPTING_METHODS:
819 case PT_PROTO_COMPLETED:
821 log_warn(
LD_CONFIG,
"Unexpected state '%d' of managed proxy '%s'.",
822 (
int)mp->conf_state, mp->argv[0]);
834 return (mp->conf_state == PT_PROTO_CONFIGURED ||
835 mp->conf_state == PT_PROTO_BROKEN ||
836 mp->conf_state == PT_PROTO_FAILED_LAUNCH);
845 if (smartlist_len(mp->transports) == 0)
846 log_notice(
LD_GENERAL,
"Managed proxy '%s' was spawned successfully, "
847 "but it didn't launch any pluggable transport listeners!",
850 log_info(
LD_CONFIG,
"%s managed proxy '%s' configuration completed!",
851 mp->is_server ?
"Server" :
"Client",
860 log_info(
LD_GENERAL,
"Got a line from managed proxy '%s': (%s)",
864 if (mp->conf_state != PT_PROTO_LAUNCHED)
870 if (mp->conf_state != PT_PROTO_LAUNCHED)
873 log_warn(
LD_CONFIG,
"Managed proxy could not pick a "
874 "configuration protocol version.");
876 }
else if (!
strcmpstart(line, PROTO_NEG_SUCCESS)) {
877 if (mp->conf_state != PT_PROTO_LAUNCHED)
884 mp->conf_state = PT_PROTO_ACCEPTING_METHODS;
886 }
else if (!
strcmpstart(line, PROTO_CMETHODS_DONE)) {
887 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
892 mp->conf_state = PT_PROTO_CONFIGURED;
894 }
else if (!
strcmpstart(line, PROTO_SMETHODS_DONE)) {
895 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
900 mp->conf_state = PT_PROTO_CONFIGURED;
902 }
else if (!
strcmpstart(line, PROTO_CMETHOD_ERROR)) {
903 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
906 parse_client_method_error(line);
908 }
else if (!
strcmpstart(line, PROTO_SMETHOD_ERROR)) {
909 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
912 parse_server_method_error(line);
915 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
923 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
931 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
935 mp->proxy_supported = 1;
940 }
else if (!
strcmpstart(line, PROTO_PROXY_ERROR)) {
941 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
959 log_notice(
LD_GENERAL,
"Unknown line received by managed proxy (%s).", line);
963 mp->conf_state = PT_PROTO_BROKEN;
964 log_warn(
LD_CONFIG,
"Managed proxy at '%s' failed the configuration protocol"
965 " and will be destroyed.", mp->argv[0]);
975 log_notice(
LD_CONFIG,
"Managed proxy sent us an %s without an error "
978 log_warn(
LD_CONFIG,
"Managed proxy couldn't understand the "
979 "pluggable transport environment variables. (%s)",
988 if (strlen(line) < (strlen(PROTO_NEG_SUCCESS) + 2)) {
989 log_warn(
LD_CONFIG,
"Managed proxy sent us malformed %s line.",
994 if (strcmp(
"1", line+strlen(PROTO_NEG_SUCCESS)+1)) {
995 log_warn(
LD_CONFIG,
"Managed proxy tried to negotiate on version '%s'. "
996 "We only support version '1'", line+strlen(PROTO_NEG_SUCCESS)+1);
1010 const char* error = is_server ?
1011 PROTO_SMETHOD_ERROR : PROTO_CMETHOD_ERROR;
1015 if (strlen(line) < (strlen(error) + 2))
1016 log_warn(
LD_CONFIG,
"Managed proxy sent us an %s without an error "
1019 log_warn(
LD_CONFIG,
"%s managed proxy encountered a method error. (%s)",
1020 is_server ?
"Server" :
"Client",
1021 line+strlen(error)+1);
1030 managed_proxy_t *mp,
1036 char *transport_name=NULL;
1037 char *args_string=NULL;
1038 char *addrport=NULL;
1039 int socks_ver=PROXY_NONE;
1043 const char *method_str = is_smethod ? PROTO_SMETHOD : PROTO_CMETHOD;
1044 const int min_args_count = is_smethod ? 3 : 4;
1051 SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, -1);
1052 if (smartlist_len(items) < min_args_count) {
1053 log_warn(
LD_CONFIG,
"Managed proxy sent us a %s line "
1054 "with too few arguments.", method_str);
1058 tor_assert(!strcmp(smartlist_get(items, item_index),method_str));
1061 transport_name = smartlist_get(items,item_index);
1064 log_warn(
LD_CONFIG,
"Transport name is not a C identifier (%s).",
1071 const char *socks_ver_str = smartlist_get(items,item_index);
1074 if (!strcmp(socks_ver_str,
"socks4")) {
1075 socks_ver = PROXY_SOCKS4;
1076 }
else if (!strcmp(socks_ver_str,
"socks5")) {
1077 socks_ver = PROXY_SOCKS5;
1079 log_warn(
LD_CONFIG,
"Client managed proxy sent us a proxy protocol "
1080 "we don't recognize. (%s)", socks_ver_str);
1085 addrport = smartlist_get(items, item_index);
1088 log_warn(
LD_CONFIG,
"Error parsing transport address '%s'", addrport);
1094 "Transport address '%s' has no port.", addrport);
1099 log_warn(
LD_CONFIG,
"Error parsing transport address '%s'", address);
1104 if (is_smethod && smartlist_len(items) > min_args_count) {
1107 char *options_string = smartlist_get(items, item_index);
1108 log_debug(
LD_CONFIG,
"Got options_string: %s", options_string);
1110 args_string = options_string+strlen(
"ARGS:");
1111 log_debug(
LD_CONFIG,
"Got ARGS: %s", args_string);
1116 socks_ver, args_string);
1122 log_info(
LD_CONFIG,
"Server transport %s at %s:%d.",
1123 transport_name, address, (
int)port);
1125 log_info(
LD_CONFIG,
"Transport %s at %s:%d with SOCKS %d. "
1126 "Attached to managed proxy.",
1127 transport_name, address, (
int)port, socks_ver);
1138 smartlist_free(items);
1169 if (strlen(line) < (strlen(PROTO_PROXY_ERROR) + 2))
1170 log_notice(
LD_CONFIG,
"Managed proxy sent us an %s without an error "
1171 "message.", PROTO_PROXY_ERROR);
1173 log_warn(
LD_CONFIG,
"Managed proxy failed to configure the "
1174 "pluggable transport's outgoing proxy. (%s)",
1175 line+strlen(PROTO_PROXY_ERROR)+1);
1186 char *log_message = NULL;
1188 if (strlen(line) < (strlen(PROTO_LOG) + 1)) {
1189 log_warn(
LD_PT,
"Managed proxy sent us a %s line "
1190 "with missing argument.", PROTO_LOG);
1194 const char *data = line + strlen(PROTO_LOG) + 1;
1198 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote an invalid LOG message: %s",
1208 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a LOG line without "
1209 "MESSAGE: %s", mp->argv[0],
escaped(data));
1215 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a LOG line without "
1216 "SEVERITY: %s", mp->argv[0],
escaped(data));
1222 if (log_severity == -1) {
1223 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a LOG line with an "
1224 "invalid severity level: %s",
1225 mp->argv[0], severity->value);
1229 tor_log(log_severity,
LD_PT,
"Managed proxy \"%s\": %s",
1230 mp->argv[0], message->value);
1240 config_free_lines(values);
1252 char *status_message = NULL;
1254 if (strlen(line) < (strlen(PROTO_STATUS) + 1)) {
1255 log_warn(
LD_PT,
"Managed proxy sent us a %s line "
1256 "with missing argument.", PROTO_STATUS);
1260 const char *data = line + strlen(PROTO_STATUS) + 1;
1265 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote an invalid "
1266 "STATUS message: %s", mp->argv[0],
escaped(data));
1275 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a STATUS line without "
1276 "TRANSPORT: %s", mp->argv[0],
escaped(data));
1289 config_free_lines(values);
1299 char *options_string = NULL;
1311 if (!options_tmp_sl)
1319 transport, escaped_opts);
1321 } SMARTLIST_FOREACH_END(options);
1324 smartlist_free(options_tmp_sl);
1325 } SMARTLIST_FOREACH_END(transport);
1327 if (smartlist_len(string_sl)) {
1332 smartlist_free(string_sl);
1334 return options_string;
1344 char *bindaddr_result = NULL;
1345 char *bindaddr_tmp = NULL;
1356 } SMARTLIST_FOREACH_END(t);
1361 smartlist_free(string_tmp);
1363 return bindaddr_result;
1384 char *state_tmp = get_datadir_fname(
"pt_state/");
1392 char *transports_to_launch =
1397 "TOR_PT_SERVER_TRANSPORTS=%s" :
1398 "TOR_PT_CLIENT_TRANSPORTS=%s",
1399 transports_to_launch);
1404 if (mp->is_server) {
1421 char *server_transport_options =
1423 if (server_transport_options) {
1425 server_transport_options);
1426 tor_free(server_transport_options);
1438 char *ext_or_addrport_tmp =
1442 if (ext_or_addrport_tmp) {
1444 ext_or_addrport_tmp);
1446 if (cookie_file_loc) {
1462 if (mp->proxy_uri) {
1486 "TOR_PT_OUTBOUND_BIND_ADDRESS_V4=%s",
1497 "TOR_PT_OUTBOUND_BIND_ADDRESS_V6=[%s]",
1506 } SMARTLIST_FOREACH_END(env_var);
1508 smartlist_free(envs);
1510 return merged_env_vars;
1521 char **proxy_argv,
int is_server)
1523 managed_proxy_t *mp = tor_malloc_zero(
sizeof(managed_proxy_t));
1524 mp->conf_state = PT_PROTO_INFANT;
1525 mp->is_server = is_server;
1526 mp->argv = proxy_argv;
1557 char **proxy_argv,
int is_server))
1559 managed_proxy_t *mp=NULL;
1562 if (!proxy_argv || !proxy_argv[0]) {
1572 if (mp->was_around_before_config_read) {
1578 if (mp->marked_for_removal) {
1579 mp->marked_for_removal = 0;
1590 } SMARTLIST_FOREACH_END(transport);
1625 if (mp->conf_state != PT_PROTO_COMPLETED) {
1632 tor_assert(mp->conf_state == PT_PROTO_COMPLETED);
1636 mp->marked_for_removal = 1;
1637 mp->was_around_before_config_read = 1;
1640 } SMARTLIST_FOREACH_END(mp);
1660 if (!mp->is_server || mp->conf_state != PT_PROTO_COMPLETED)
1669 } SMARTLIST_FOREACH_END(mp);
1682 char *the_string = NULL;
1692 if ((!mp->is_server) || (mp->conf_state != PT_PROTO_COMPLETED))
1698 char *transport_args = NULL;
1699 const char *addrport = NULL;
1709 RELAY_FIND_ADDR_NO_FLAG,
1713 RELAY_FIND_ADDR_NO_FLAG, &addr);
1716 log_err(
LD_PT,
"Unable to find address for transport %s", t->name);
1726 if (t->extra_info_args)
1727 tor_asprintf(&transport_args,
" %s", t->extra_info_args);
1730 "transport %s %s%s",
1732 transport_args ? transport_args :
"");
1734 } SMARTLIST_FOREACH_END(t);
1736 } SMARTLIST_FOREACH_END(mp);
1738 if (smartlist_len(string_chunks) == 0) {
1739 smartlist_free(string_chunks);
1747 smartlist_free(string_chunks);
1761 char *escaped_string = NULL;
1762 char *new_string = NULL;
1772 if (!escaped_string)
1776 } SMARTLIST_FOREACH_END(s);
1782 smartlist_free(sl_tmp);
1814 if (mp->marked_for_removal) {
1818 } SMARTLIST_FOREACH_END(mp);
1852 char *new_string = NULL;
1853 char *new_cp = NULL;
1854 size_t length, new_length;
1858 length = strlen(
string);
1861 return tor_strdup(
"");
1864 if (length > (SIZE_MAX - 1)/2)
1868 new_length = (length * 2) + 1;
1870 new_string = new_cp = tor_malloc(new_length);
1873 if (strchr(chars_to_escape, *
string))
1876 *new_cp++ = *
string++;
1923 if (BUG(mp == NULL))
1927 "Managed proxy at '%s' reported via standard error: %s",
1941 "Pluggable Transport process terminated with status code %" PRIu64,
1958 if (! strcmp(severity,
"debug"))
1961 if (! strcmp(severity,
"info"))
1964 if (! strcmp(severity,
"notice"))
1967 if (! strcmp(severity,
"warning"))
1970 if (! strcmp(severity,
"error"))
1996 tor_assert_unreached();
void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src)
const char * fmt_addrport(const tor_addr_t *addr, uint16_t port)
const char * tor_addr_to_str(char *dest, const tor_addr_t *addr, size_t len, int decorate)
int tor_addr_parse(tor_addr_t *addr, const char *src)
char * tor_addr_to_str_dup(const tor_addr_t *addr)
int tor_addr_port_split(int severity, const char *addrport, char **address_out, uint16_t *port_out)
int tor_addr_is_null(const tor_addr_t *addr)
#define tor_addr_eq(a, b)
const smartlist_t * get_socks_args_by_bridge_addrport(const tor_addr_t *addr, uint16_t port)
Header file for circuitbuild.c.
Header file for circuitbuild.c.
char * get_first_listener_addrport_string(int listener_type)
const or_options_t * get_options(void)
Header file for config.c.
void config_line_prepend(config_line_t **lst, const char *key, const char *val)
const config_line_t * config_line_find(const config_line_t *lines, const char *key)
Header file for connection.c.
#define CONN_TYPE_OR_LISTENER
#define CONN_TYPE_EXT_OR_LISTENER
Header file for connection_or.c.
void control_event_pt_status(const char *status)
void control_event_pt_log(const char *log)
void control_event_transport_launched(const char *mode, const char *transport_name, tor_addr_t *addr, uint16_t port)
Header file for control_events.c.
struct smartlist_t * get_current_process_environment_variables(void)
void set_environment_variable_in_smartlist(struct smartlist_t *env_vars, const char *new_var, void(*free_old)(void *), int free_p)
const char * escaped(const char *s)
char * get_ext_or_auth_cookie_file_name(void)
config_line_t * kvline_parse(const char *line, unsigned flags)
char * kvline_encode(const config_line_t *line, unsigned flags)
void tor_log(int severity, log_domain_mask_t domain, const char *format,...)
void tor_free_(void *mem)
Master header file for Tor-specific functionality.
int tor_asprintf(char **strp, const char *fmt,...)
void process_set_stderr_read_callback(process_t *process, process_read_callback_t callback)
void process_set_data(process_t *process, void *data)
void process_append_argument(process_t *process, const char *argument)
void process_set_exit_callback(process_t *process, process_exit_callback_t callback)
void * process_get_data(const process_t *process)
process_t * process_new(const char *command)
void process_reset_environment(process_t *process, const smartlist_t *env)
void process_set_stdout_read_callback(process_t *process, process_read_callback_t callback)
bool process_terminate(process_t *process)
process_status_t process_exec(process_t *process)
process_pid_t process_get_pid(process_t *process)
bool relay_find_addr_to_publish(const or_options_t *options, int family, int flags, tor_addr_t *addr_out)
Header file for relay_find_addr.c.
void mark_my_descriptor_dirty(const char *reason)
Header file for router.c.
void smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern,...)
char * smartlist_join_strings(smartlist_t *sl, const char *join, int terminate, size_t *len_out)
int smartlist_contains_string(const smartlist_t *sl, const char *element)
void smartlist_add_all(smartlist_t *s1, const smartlist_t *s2)
smartlist_t * smartlist_new(void)
void smartlist_add_strdup(struct smartlist_t *sl, const char *string)
void smartlist_add(smartlist_t *sl, void *element)
void smartlist_clear(smartlist_t *sl)
void smartlist_remove(smartlist_t *sl, const void *element)
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
#define SMARTLIST_FOREACH(sl, type, var, cmd)
#define SMARTLIST_DEL_CURRENT(sl, var)
int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep, int flags, int max)
void save_transport_to_state(const char *transport, const tor_addr_t *addr, uint16_t port)
char * get_stored_bindaddr_for_server_transport(const char *transport)
tor_addr_t Socks4ProxyAddr
tor_addr_t HTTPSProxyAddr
struct config_line_t * ExtORPort_lines
char * Socks5ProxyUsername
char * Socks5ProxyPassword
tor_addr_t Socks5ProxyAddr
tor_addr_t OutboundBindAddresses[OUTBOUND_ADDR_MAX][2]
char * HTTPSProxyAuthenticator
unsigned marked_for_removal
#define MOCK_IMPL(rv, funcname, arglist)
smartlist_t * pt_get_options_for_server_transport(const char *transport)
Header for feature/relay/transport_config.c.
#define PROTO_VERSION_ONE
static int launch_managed_proxy(managed_proxy_t *mp)
static char * get_bindaddr_for_server_proxy(const managed_proxy_t *mp)
char * pt_get_socks_args_for_proxy_addrport(const tor_addr_t *addr, uint16_t port)
int pt_proxies_configuration_pending(void)
int transport_add_from_config(const tor_addr_t *addr, uint16_t port, const char *name, int socks_ver)
static int managed_proxy_has_argv(const managed_proxy_t *mp, char **proxy_argv)
static void register_client_proxy(const managed_proxy_t *mp)
static void handle_methods_done(const managed_proxy_t *mp)
STATIC managed_proxy_t * managed_proxy_create(const smartlist_t *with_transport_list, char **proxy_argv, int is_server)
static void register_proxy(const managed_proxy_t *mp)
bool managed_proxy_has_transport(const char *transport_name)
static void parse_method_error(const char *line, int is_server_method)
static int unconfigured_proxies_n
char * pt_stringify_socks_args(const smartlist_t *socks_args)
STATIC const tor_addr_t * managed_proxy_outbound_address(const or_options_t *options, sa_family_t family)
void pt_configure_remaining_proxies(void)
STATIC void parse_proxy_error(const char *line)
STATIC void managed_proxy_destroy(managed_proxy_t *mp, int also_terminate_process)
void sweep_proxy_list(void)
static void clear_transport_list(void)
STATIC void parse_log_line(const char *line, managed_proxy_t *mp)
smartlist_t * get_transport_proxy_ports(void)
void mark_transport_list(void)
STATIC char * get_pt_proxy_uri(void)
static int proxy_needs_restart(const managed_proxy_t *mp)
char * tor_escape_str_for_pt_args(const char *string, const char *chars_to_escape)
static void proxy_prepare_for_restart(managed_proxy_t *mp)
STATIC int managed_proxy_severity_parse(const char *severity)
STATIC int parse_cmethod_line(const char *line, managed_proxy_t *mp)
static void handle_finished_proxy(managed_proxy_t *mp)
char * pt_get_extra_info_descriptor_string(void)
static int transport_add(transport_t *t)
STATIC void parse_status_line(const char *line, managed_proxy_t *mp)
static smartlist_t * transport_list
STATIC transport_t * transport_new(const tor_addr_t *addr, uint16_t port, const char *name, int socks_ver, const char *extra_info_args)
static void register_server_proxy(const managed_proxy_t *mp)
STATIC void managed_proxy_stderr_callback(process_t *process, const char *line, size_t size)
static void add_transport_to_proxy(const char *transport, managed_proxy_t *mp)
STATIC void managed_proxy_stdout_callback(process_t *process, const char *line, size_t size)
transport_t * transport_get_by_name(const char *name)
STATIC int parse_version(const char *line, managed_proxy_t *mp)
static smartlist_t * create_managed_proxy_environment(const managed_proxy_t *mp)
void sweep_transport_list(void)
static void assert_unconfigured_count_ok(void)
void transport_free_(transport_t *transport)
STATIC void parse_env_error(const char *line)
void pt_prepare_proxy_list_for_config_read(void)
static int check_if_restarts_needed
static transport_t * transport_copy(const transport_t *transport)
void pt_kickstart_proxy(const smartlist_t *with_transport_list, char **proxy_argv, int is_server)
STATIC int parse_smethod_line(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 transport_resolve_conflicts(const transport_t *t)
STATIC char * get_transport_options_for_server_proxy(const managed_proxy_t *mp)
static managed_proxy_t * get_managed_proxy_by_argv_and_type(char **proxy_argv, int is_server)
STATIC int configure_proxy(managed_proxy_t *mp)
STATIC void free_execve_args(char **arg)
STATIC bool managed_proxy_exit_callback(process_t *process, process_exit_code_t exit_code)
static int proxy_configuration_finished(const managed_proxy_t *mp)
static smartlist_t * managed_proxy_list
STATIC void handle_proxy_line(const char *line, managed_proxy_t *mp)
Headers for transports.c.
int strcmpstart(const char *s1, const char *s2)
int strcmp_opt(const char *s1, const char *s2)
int string_is_C_identifier(const char *string)