121#define parse_server_method_error(l) parse_method_error(l, 1)
122#define parse_client_method_error(l) parse_method_error(l, 0)
125#define PROTO_ENV_ERROR "ENV-ERROR"
126#define PROTO_NEG_SUCCESS "VERSION"
127#define PROTO_NEG_FAIL "VERSION-ERROR no-version"
128#define PROTO_CMETHOD "CMETHOD"
129#define PROTO_SMETHOD "SMETHOD"
130#define PROTO_CMETHOD_ERROR "CMETHOD-ERROR"
131#define PROTO_SMETHOD_ERROR "SMETHOD-ERROR"
132#define PROTO_CMETHODS_DONE "CMETHODS DONE"
133#define PROTO_SMETHODS_DONE "SMETHODS DONE"
134#define PROTO_PROXY_DONE "PROXY DONE"
135#define PROTO_PROXY_ERROR "PROXY-ERROR"
136#define PROTO_LOG "LOG"
137#define PROTO_STATUS "STATUS"
141#define PROTO_VERSION_ONE 1
151 const char *
name,
int socks_ver,
152 const char *extra_info_args)
197 if (t->marked_for_removal) {
201 } SMARTLIST_FOREACH_END(t);
223 new_transport = tor_malloc_zero(
sizeof(
transport_t));
226 new_transport->
name = tor_strdup(transport->
name);
228 new_transport->
port = transport->
port;
231 return new_transport;
245 if (!strcmp(transport->name,
name))
247 } SMARTLIST_FOREACH_END(transport);
285 char *new_transport_addrport =
288 log_notice(
LD_GENERAL,
"You tried to add transport '%s' at '%s' "
289 "but there was already a transport marked for deletion at "
290 "'%s'. We deleted the old transport and registered the "
291 "new one.", t->
name, new_transport_addrport,
294 transport_free(t_tmp);
297 log_notice(
LD_GENERAL,
"You tried to add transport '%s' at '%s' "
298 "but the same transport already exists at '%s'. "
299 "Skipping.", t->
name, new_transport_addrport,
340 const char *
name,
int socks_ver))
349 log_notice(
LD_GENERAL,
"Could not add transport %s at %s. Skipping.",
354 log_info(
LD_GENERAL,
"Successfully registered transport %s at %s.",
359 log_info(
LD_GENERAL,
"Successfully registered transport %s at %s.",
385 if (!strcasecmp(
name, transport_name)) {
388 } SMARTLIST_FOREACH_END(
name);
389 } SMARTLIST_FOREACH_END(mp);
414 if (mp->conf_state == PT_PROTO_COMPLETED)
426 char **tmp1=proxy_argv;
427 char **tmp2=mp->argv;
432 while (*tmp1 && *tmp2) {
433 if (strcmp(*tmp1++, *tmp2++))
437 if (!*tmp1 && !*tmp2)
445static managed_proxy_t *
453 mp->is_server == is_server)
455 } SMARTLIST_FOREACH_END(mp);
483 if (
strcmp_opt(proxy_uri, mp->proxy_uri) != 0)
494 tor_assert(smartlist_len(mp->transports_to_launch) > 0);
495 tor_assert(mp->conf_state == PT_PROTO_COMPLETED);
497 if (smartlist_len(mp->transports_to_launch) != smartlist_len(mp->transports))
504 } SMARTLIST_FOREACH_END(t);
520 tor_assert(mp->conf_state == PT_PROTO_COMPLETED);
534 } SMARTLIST_FOREACH_END(t);
544 mp->proxy_supported = 0;
574 for (
int i = 1; mp->argv[i] != NULL; ++i)
578 log_warn(
LD_CONFIG,
"Managed proxy at '%s' failed at launch.",
584 "Managed proxy at '%s' has spawned with PID '%" PRIu64
"'.",
596 int at_least_a_proxy_config_finished = 0;
599 log_debug(
LD_CONFIG,
"Configuring remaining managed proxies (%d)!",
609 tor_assert(mp->conf_state != PT_PROTO_BROKEN &&
610 mp->conf_state != PT_PROTO_FAILED_LAUNCH);
612 if (mp->was_around_before_config_read) {
616 mp->was_around_before_config_read = 0;
619 log_info(
LD_GENERAL,
"Preparing managed proxy '%s' for restart.",
623 log_info(
LD_GENERAL,
"Nothing changed for managed proxy '%s' after "
624 "HUP: not restarting.", mp->argv[0]);
634 at_least_a_proxy_config_finished = 1;
636 } SMARTLIST_FOREACH_END(mp);
642 if (at_least_a_proxy_config_finished)
654 if (mp->conf_state == PT_PROTO_INFANT) {
662 tor_assert(mp->conf_state != PT_PROTO_INFANT);
664 return mp->conf_state == PT_PROTO_COMPLETED;
671 tor_assert(mp->conf_state != PT_PROTO_COMPLETED);
675 log_notice(
LD_GENERAL,
"Registered server transport '%s' at '%s'",
678 } SMARTLIST_FOREACH_END(t);
688 tor_assert(mp->conf_state != PT_PROTO_COMPLETED);
695 log_notice(
LD_GENERAL,
"Could not add transport %s. Skipping.", t->name);
696 transport_free(transport_tmp);
699 log_info(
LD_GENERAL,
"Successfully registered transport %s", t->name);
703 log_info(
LD_GENERAL,
"Successfully registered transport %s", t->name);
705 transport_free(transport_tmp);
708 } SMARTLIST_FOREACH_END(t);
724 int also_terminate_process)
729 smartlist_free(mp->transports);
733 smartlist_free(mp->transports_to_launch);
750 if (also_terminate_process && mp->process) {
807 switch (mp->conf_state) {
808 case PT_PROTO_BROKEN:
811 case PT_PROTO_FAILED_LAUNCH:
814 case PT_PROTO_CONFIGURED:
815 if (mp->proxy_uri && !mp->proxy_supported) {
816 log_warn(
LD_CONFIG,
"Managed proxy '%s' did not configure the "
817 "specified outgoing proxy and will be terminated.",
829 case PT_PROTO_INFANT:
830 case PT_PROTO_LAUNCHED:
831 case PT_PROTO_ACCEPTING_METHODS:
832 case PT_PROTO_COMPLETED:
834 log_warn(
LD_CONFIG,
"Unexpected state '%d' of managed proxy '%s'.",
835 (
int)mp->conf_state, mp->argv[0]);
847 return (mp->conf_state == PT_PROTO_CONFIGURED ||
848 mp->conf_state == PT_PROTO_BROKEN ||
849 mp->conf_state == PT_PROTO_FAILED_LAUNCH);
858 if (smartlist_len(mp->transports) == 0)
859 log_warn(
LD_GENERAL,
"Managed proxy '%s' was spawned successfully, "
860 "but it didn't launch any pluggable transport listeners!",
863 log_info(
LD_CONFIG,
"%s managed proxy '%s' configuration completed!",
864 mp->is_server ?
"Server" :
"Client",
873 log_info(
LD_PT,
"Got a line from managed proxy '%s': (%s)",
877 if (mp->conf_state != PT_PROTO_LAUNCHED)
883 if (mp->conf_state != PT_PROTO_LAUNCHED)
886 log_warn(
LD_CONFIG,
"Managed proxy could not pick a "
887 "configuration protocol version.");
889 }
else if (!
strcmpstart(line, PROTO_NEG_SUCCESS)) {
890 if (mp->conf_state != PT_PROTO_LAUNCHED)
899 }
else if (!
strcmpstart(line, PROTO_CMETHODS_DONE)) {
900 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
907 }
else if (!
strcmpstart(line, PROTO_SMETHODS_DONE)) {
908 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
915 }
else if (!
strcmpstart(line, PROTO_CMETHOD_ERROR)) {
916 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
926 parse_client_method_error(line);
928 }
else if (!
strcmpstart(line, PROTO_SMETHOD_ERROR)) {
929 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
933 parse_server_method_error(line);
936 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
944 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
952 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
956 mp->proxy_supported = 1;
961 }
else if (!
strcmpstart(line, PROTO_PROXY_ERROR)) {
962 if (mp->conf_state != PT_PROTO_ACCEPTING_METHODS)
980 log_notice(
LD_GENERAL,
"Unknown line received by managed proxy (%s).", line);
985 log_warn(
LD_CONFIG,
"Managed proxy at '%s' failed the configuration protocol"
986 " and will be destroyed.", mp->argv[0]);
996 log_notice(
LD_CONFIG,
"Managed proxy sent us an %s without an error "
999 log_warn(
LD_CONFIG,
"Managed proxy couldn't understand the "
1000 "pluggable transport environment variables. (%s)",
1009 if (strlen(line) < (strlen(PROTO_NEG_SUCCESS) + 2)) {
1010 log_warn(
LD_CONFIG,
"Managed proxy sent us malformed %s line.",
1015 if (strcmp(
"1", line+strlen(PROTO_NEG_SUCCESS)+1)) {
1016 log_warn(
LD_CONFIG,
"Managed proxy tried to negotiate on version '%s'. "
1017 "We only support version '1'", line+strlen(PROTO_NEG_SUCCESS)+1);
1031 const char* error = is_server ?
1032 PROTO_SMETHOD_ERROR : PROTO_CMETHOD_ERROR;
1036 if (strlen(line) < (strlen(error) + 2))
1037 log_warn(
LD_CONFIG,
"Managed proxy sent us an %s without an error "
1040 log_warn(
LD_CONFIG,
"%s managed proxy encountered a method error. (%s)",
1041 is_server ?
"Server" :
"Client",
1042 line+strlen(error)+1);
1051 managed_proxy_t *mp,
1057 char *transport_name=NULL;
1058 char *args_string=NULL;
1059 char *addrport=NULL;
1060 int socks_ver=PROXY_NONE;
1064 const char *method_str = is_smethod ? PROTO_SMETHOD : PROTO_CMETHOD;
1065 const int min_args_count = is_smethod ? 3 : 4;
1072 SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, -1);
1073 if (smartlist_len(items) < min_args_count) {
1074 log_warn(
LD_CONFIG,
"Managed proxy sent us a %s line "
1075 "with too few arguments.", method_str);
1079 tor_assert(!strcmp(smartlist_get(items, item_index),method_str));
1082 transport_name = smartlist_get(items,item_index);
1085 log_warn(
LD_CONFIG,
"Transport name is not a C identifier (%s).",
1092 const char *socks_ver_str = smartlist_get(items,item_index);
1095 if (!strcmp(socks_ver_str,
"socks4")) {
1096 socks_ver = PROXY_SOCKS4;
1097 }
else if (!strcmp(socks_ver_str,
"socks5")) {
1098 socks_ver = PROXY_SOCKS5;
1100 log_warn(
LD_CONFIG,
"Client managed proxy sent us a proxy protocol "
1101 "we don't recognize. (%s)", socks_ver_str);
1106 addrport = smartlist_get(items, item_index);
1109 log_warn(
LD_CONFIG,
"Error parsing transport address '%s'", addrport);
1115 "Transport address '%s' has no port.", addrport);
1120 log_warn(
LD_CONFIG,
"Error parsing transport address '%s'", address);
1125 if (is_smethod && smartlist_len(items) > min_args_count) {
1128 char *options_string = smartlist_get(items, item_index);
1129 log_debug(
LD_CONFIG,
"Got options_string: %s", options_string);
1131 args_string = options_string+strlen(
"ARGS:");
1132 log_debug(
LD_CONFIG,
"Got ARGS: %s", args_string);
1137 socks_ver, args_string);
1143 log_info(
LD_CONFIG,
"Server transport %s at %s:%d.",
1144 transport_name, address, (
int)port);
1146 log_info(
LD_CONFIG,
"Transport %s at %s:%d with SOCKS %d. "
1147 "Attached to managed proxy.",
1148 transport_name, address, (
int)port, socks_ver);
1159 smartlist_free(items);
1190 if (strlen(line) < (strlen(PROTO_PROXY_ERROR) + 2))
1191 log_notice(
LD_CONFIG,
"Managed proxy sent us an %s without an error "
1192 "message.", PROTO_PROXY_ERROR);
1194 log_warn(
LD_CONFIG,
"Managed proxy failed to configure the "
1195 "pluggable transport's outgoing proxy. (%s)",
1196 line+strlen(PROTO_PROXY_ERROR)+1);
1207 char *log_message = NULL;
1209 if (strlen(line) < (strlen(PROTO_LOG) + 1)) {
1210 log_warn(
LD_PT,
"Managed proxy sent us a %s line "
1211 "with missing argument.", PROTO_LOG);
1215 const char *data = line + strlen(PROTO_LOG) + 1;
1219 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote an invalid LOG message: %s",
1229 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a LOG line without "
1230 "MESSAGE: %s", mp->argv[0],
escaped(data));
1236 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a LOG line without "
1237 "SEVERITY: %s", mp->argv[0],
escaped(data));
1243 if (log_severity == -1) {
1244 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a LOG line with an "
1245 "invalid severity level: %s",
1246 mp->argv[0], severity->value);
1250 tor_log(log_severity,
LD_PT,
"Managed proxy \"%s\": %s",
1251 mp->argv[0], message->value);
1261 config_free_lines(values);
1273 char *status_message = NULL;
1275 if (strlen(line) < (strlen(PROTO_STATUS) + 1)) {
1276 log_warn(
LD_PT,
"Managed proxy sent us a %s line "
1277 "with missing argument.", PROTO_STATUS);
1281 const char *data = line + strlen(PROTO_STATUS) + 1;
1286 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote an invalid "
1287 "STATUS message: %s", mp->argv[0],
escaped(data));
1292 handle_status_message(values, mp);
1303 config_free_lines(values);
1309 managed_proxy_t *mp)
1312 log_warn(
LD_PT,
"Managed proxy \"%s\" has multiple TYPE key which "
1313 "is not allowed.", mp->argv[0]);
1319 if (message_type == NULL) {
1320 log_debug(
LD_PT,
"Managed proxy \"%s\" wrote a STATUS line without "
1321 "a defined message TYPE", mp->argv[0]);
1326 if (! strcasecmp(message_type->value,
"version")) {
1331 if (version == NULL) {
1332 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a STATUS TYPE=version line "
1333 "with a missing VERSION field", mp->argv[0]);
1337 if (implementation == NULL) {
1338 log_warn(
LD_PT,
"Managed proxy \"%s\" wrote a STATUS TYPE=version line "
1339 "with a missing IMPLEMENTATION field", mp->argv[0]);
1344 mp->version = tor_strdup(version->value);
1347 mp->implementation = tor_strdup(implementation->value);
1359 char *options_string = NULL;
1371 if (!options_tmp_sl)
1379 transport, escaped_opts);
1381 } SMARTLIST_FOREACH_END(options);
1384 smartlist_free(options_tmp_sl);
1385 } SMARTLIST_FOREACH_END(transport);
1387 if (smartlist_len(string_sl)) {
1392 smartlist_free(string_sl);
1394 return options_string;
1404 char *bindaddr_result = NULL;
1405 char *bindaddr_tmp = NULL;
1416 } SMARTLIST_FOREACH_END(t);
1421 smartlist_free(string_tmp);
1423 return bindaddr_result;
1444 char *state_tmp = get_datadir_fname(
"pt_state/");
1452 char *transports_to_launch =
1457 "TOR_PT_SERVER_TRANSPORTS=%s" :
1458 "TOR_PT_CLIENT_TRANSPORTS=%s",
1459 transports_to_launch);
1464 if (mp->is_server) {
1481 char *server_transport_options =
1483 if (server_transport_options) {
1485 server_transport_options);
1486 tor_free(server_transport_options);
1498 char *ext_or_addrport_tmp =
1502 if (ext_or_addrport_tmp) {
1504 ext_or_addrport_tmp);
1506 if (cookie_file_loc) {
1522 if (mp->proxy_uri) {
1546 "TOR_PT_OUTBOUND_BIND_ADDRESS_V4=%s",
1557 "TOR_PT_OUTBOUND_BIND_ADDRESS_V6=[%s]",
1566 } SMARTLIST_FOREACH_END(env_var);
1568 smartlist_free(envs);
1570 return merged_env_vars;
1581 char **proxy_argv,
int is_server)
1583 managed_proxy_t *mp = tor_malloc_zero(
sizeof(managed_proxy_t));
1585 mp->is_server = is_server;
1586 mp->argv = proxy_argv;
1619 char **proxy_argv,
int is_server))
1621 managed_proxy_t *mp=NULL;
1624 if (!proxy_argv || !proxy_argv[0]) {
1634 if (mp->was_around_before_config_read) {
1640 if (mp->marked_for_removal) {
1641 mp->marked_for_removal = 0;
1652 } SMARTLIST_FOREACH_END(transport);
1687 if (mp->conf_state != PT_PROTO_COMPLETED) {
1694 tor_assert(mp->conf_state == PT_PROTO_COMPLETED);
1698 mp->marked_for_removal = 1;
1699 mp->was_around_before_config_read = 1;
1702 } SMARTLIST_FOREACH_END(mp);
1722 if (!mp->is_server || mp->conf_state != PT_PROTO_COMPLETED)
1731 } SMARTLIST_FOREACH_END(mp);
1744 char *the_string = NULL;
1754 if ((!mp->is_server) || (mp->conf_state != PT_PROTO_COMPLETED))
1760 char *transport_args = NULL;
1761 const char *addrport = NULL;
1771 RELAY_FIND_ADDR_NO_FLAG,
1775 RELAY_FIND_ADDR_NO_FLAG, &addr);
1778 log_err(
LD_PT,
"Unable to find address for transport %s", t->name);
1788 if (t->extra_info_args)
1789 tor_asprintf(&transport_args,
" %s", t->extra_info_args);
1792 "transport %s %s%s",
1794 transport_args ? transport_args :
"");
1797 } SMARTLIST_FOREACH_END(t);
1801 char *version = NULL;
1807 if (mp->implementation) {
1808 tor_asprintf(&impl,
" implementation=%s", mp->implementation);
1813 version ? version:
"", impl ? impl:
"");
1817 } SMARTLIST_FOREACH_END(mp);
1819 if (smartlist_len(string_chunks) == 0) {
1820 smartlist_free(string_chunks);
1828 smartlist_free(string_chunks);
1842 char *escaped_string = NULL;
1843 char *new_string = NULL;
1853 if (!escaped_string)
1857 } SMARTLIST_FOREACH_END(s);
1863 smartlist_free(sl_tmp);
1895 if (mp->marked_for_removal) {
1899 } SMARTLIST_FOREACH_END(mp);
1933 char *new_string = NULL;
1934 char *new_cp = NULL;
1935 size_t length, new_length;
1939 length = strlen(
string);
1942 return tor_strdup(
"");
1945 if (length > (SIZE_MAX - 1)/2)
1949 new_length = (length * 2) + 1;
1951 new_string = new_cp = tor_malloc(new_length);
1954 if (strchr(chars_to_escape, *
string))
1957 *new_cp++ = *
string++;
2004 if (BUG(mp == NULL))
2008 "Managed proxy at '%s' reported via standard error: %s",
2022 const char *
name = mp ? mp->argv[0] :
"N/A";
2025 "Managed proxy \"%s\" process terminated with status code %" PRIu64,
2054 if (! strcmp(severity,
"debug"))
2057 if (! strcmp(severity,
"info"))
2060 if (! strcmp(severity,
"notice"))
2063 if (! strcmp(severity,
"warning"))
2066 if (! strcmp(severity,
"error"))
2092 tor_assert_unreached();
2116managed_proxy_state_to_string(
enum pt_proto_state state)
2119 case PT_PROTO_INFANT:
2121 case PT_PROTO_LAUNCHED:
2123 case PT_PROTO_ACCEPTING_METHODS:
2124 return "Accepting methods";
2125 case PT_PROTO_CONFIGURED:
2126 return "Configured";
2127 case PT_PROTO_COMPLETED:
2129 case PT_PROTO_BROKEN:
2131 case PT_PROTO_FAILED_LAUNCH:
2132 return "Failed to launch";
2136 tor_assert_unreached();
2146 if (mp->conf_state == new_state)
2151 managed_proxy_state_to_string(mp->conf_state),
2152 managed_proxy_state_to_string(new_state));
2154 mp->conf_state = new_state;
void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src)
int tor_addr_parse(tor_addr_t *addr, const char *src)
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)
char * tor_addr_to_str_dup(const tor_addr_t *addr)
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)
#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)
int config_count_key(const config_line_t *a, const char *key)
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)
char * kvline_encode(const config_line_t *line, unsigned flags)
config_line_t * kvline_parse(const char *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)
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_t * process_new(const char *command)
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,...)
int smartlist_contains_string(const smartlist_t *sl, const char *element)
char * smartlist_join_strings(smartlist_t *sl, const char *join, int terminate, size_t *len_out)
void smartlist_add_all(smartlist_t *s1, const smartlist_t *s2)
void smartlist_add_strdup(struct smartlist_t *sl, const char *string)
smartlist_t * smartlist_new(void)
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)
char * get_stored_bindaddr_for_server_transport(const char *transport)
void save_transport_to_state(const char *transport, const tor_addr_t *addr, uint16_t port)
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 managed_proxy_t * get_managed_proxy_by_argv_and_type(char **proxy_argv, int is_server)
static int launch_managed_proxy(managed_proxy_t *mp)
static transport_t * transport_copy(const transport_t *transport)
STATIC char * get_transport_options_for_server_proxy(const managed_proxy_t *mp)
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 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
STATIC char * get_pt_proxy_uri(void)
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)
STATIC transport_t * transport_new(const tor_addr_t *addr, uint16_t port, const char *name, int socks_ver, const char *extra_info_args)
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)
char * pt_get_socks_args_for_proxy_addrport(const tor_addr_t *addr, uint16_t port)
STATIC void parse_log_line(const char *line, managed_proxy_t *mp)
STATIC managed_proxy_t * managed_proxy_create(const smartlist_t *with_transport_list, char **proxy_argv, int is_server)
void mark_transport_list(void)
static int proxy_needs_restart(const managed_proxy_t *mp)
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)
static int transport_add(transport_t *t)
STATIC void parse_status_line(const char *line, managed_proxy_t *mp)
static smartlist_t * transport_list
transport_t * transport_get_by_name(const char *name)
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)
STATIC void managed_proxy_set_state(managed_proxy_t *mp, enum pt_proto_state new_state)
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)
static char * get_bindaddr_for_server_proxy(const managed_proxy_t *mp)
void transport_free_(transport_t *transport)
STATIC void parse_env_error(const char *line)
void pt_prepare_proxy_list_for_config_read(void)
smartlist_t * get_transport_proxy_ports(void)
static int check_if_restarts_needed
char * tor_escape_str_for_pt_args(const char *string, const char *chars_to_escape)
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 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)
char * pt_get_extra_info_descriptor_string(void)
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)