mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Implement the TRANSPORT_LAUNCHED control port event.
This commit is contained in:
parent
2452302354
commit
6dd462e8bc
@ -82,7 +82,8 @@
|
|||||||
#define EVENT_BUILDTIMEOUT_SET 0x0017
|
#define EVENT_BUILDTIMEOUT_SET 0x0017
|
||||||
#define EVENT_SIGNAL 0x0018
|
#define EVENT_SIGNAL 0x0018
|
||||||
#define EVENT_CONF_CHANGED 0x0019
|
#define EVENT_CONF_CHANGED 0x0019
|
||||||
#define EVENT_MAX_ 0x0019
|
#define EVENT_TRANSPORT_LAUNCHED 0x0020
|
||||||
|
#define EVENT_MAX_ 0x0020
|
||||||
/* If EVENT_MAX_ ever hits 0x0020, we need to make the mask wider. */
|
/* If EVENT_MAX_ ever hits 0x0020, we need to make the mask wider. */
|
||||||
|
|
||||||
/** Bitfield: The bit 1<<e is set if <b>any</b> open control
|
/** Bitfield: The bit 1<<e is set if <b>any</b> open control
|
||||||
@ -958,6 +959,7 @@ static const struct control_event_t control_event_table[] = {
|
|||||||
{ EVENT_BUILDTIMEOUT_SET, "BUILDTIMEOUT_SET" },
|
{ EVENT_BUILDTIMEOUT_SET, "BUILDTIMEOUT_SET" },
|
||||||
{ EVENT_SIGNAL, "SIGNAL" },
|
{ EVENT_SIGNAL, "SIGNAL" },
|
||||||
{ EVENT_CONF_CHANGED, "CONF_CHANGED"},
|
{ EVENT_CONF_CHANGED, "CONF_CHANGED"},
|
||||||
|
{ EVENT_TRANSPORT_LAUNCHED, "TRANSPORT_LAUNCHED" },
|
||||||
{ 0, NULL },
|
{ 0, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4737,6 +4739,21 @@ control_event_clients_seen(const char *controller_str)
|
|||||||
"650 CLIENTS_SEEN %s\r\n", controller_str);
|
"650 CLIENTS_SEEN %s\r\n", controller_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A new pluggable transport called <b>transport_name</b> was
|
||||||
|
* launched on <b>addr</b>:<b>port</b>. <b>mode</b> 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
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
control_event_transport_launched(const char *mode, const char *transport_name,
|
||||||
|
tor_addr_t *addr, uint16_t port)
|
||||||
|
{
|
||||||
|
send_control_event(EVENT_TRANSPORT_LAUNCHED, ALL_FORMATS,
|
||||||
|
"650 TRANSPORT_LAUNCHED %s %s %s %u\r\n",
|
||||||
|
mode, transport_name, fmt_addr(addr), port);
|
||||||
|
}
|
||||||
|
|
||||||
/** Free any leftover allocated memory of the control.c subsystem. */
|
/** Free any leftover allocated memory of the control.c subsystem. */
|
||||||
void
|
void
|
||||||
control_free_all(void)
|
control_free_all(void)
|
||||||
|
@ -89,6 +89,10 @@ MOCK_DECL(void, control_event_bootstrap_problem,(const char *warn,
|
|||||||
int reason));
|
int reason));
|
||||||
|
|
||||||
void control_event_clients_seen(const char *controller_str);
|
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_free_all(void);
|
void control_free_all(void);
|
||||||
|
|
||||||
#ifdef CONTROL_PRIVATE
|
#ifdef CONTROL_PRIVATE
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
#include "entrynodes.h"
|
#include "entrynodes.h"
|
||||||
#include "connection_or.h"
|
#include "connection_or.h"
|
||||||
#include "ext_orport.h"
|
#include "ext_orport.h"
|
||||||
|
#include "control.h"
|
||||||
|
|
||||||
static process_environment_t *
|
static process_environment_t *
|
||||||
create_managed_proxy_environment(const managed_proxy_t *mp);
|
create_managed_proxy_environment(const managed_proxy_t *mp);
|
||||||
@ -659,6 +660,7 @@ register_server_proxy(const managed_proxy_t *mp)
|
|||||||
save_transport_to_state(t->name, &t->addr, t->port);
|
save_transport_to_state(t->name, &t->addr, t->port);
|
||||||
log_notice(LD_GENERAL, "Registered server transport '%s' at '%s'",
|
log_notice(LD_GENERAL, "Registered server transport '%s' at '%s'",
|
||||||
t->name, fmt_addrport(&t->addr, t->port));
|
t->name, fmt_addrport(&t->addr, t->port));
|
||||||
|
control_event_transport_launched("server", t->name, &t->addr, t->port);
|
||||||
} SMARTLIST_FOREACH_END(t);
|
} SMARTLIST_FOREACH_END(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,9 +683,11 @@ register_client_proxy(const managed_proxy_t *mp)
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
log_info(LD_GENERAL, "Successfully registered transport %s", t->name);
|
log_info(LD_GENERAL, "Successfully registered transport %s", t->name);
|
||||||
|
control_event_transport_launched("client", t->name, &t->addr, t->port);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
log_info(LD_GENERAL, "Successfully registered transport %s", t->name);
|
log_info(LD_GENERAL, "Successfully registered transport %s", t->name);
|
||||||
|
control_event_transport_launched("client", t->name, &t->addr, t->port);
|
||||||
transport_free(transport_tmp);
|
transport_free(transport_tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user