1 /* Copyright (c) 2003-2004, Roger Dingledine
2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3 * Copyright (c) 2007-2012, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
8 * \brief Headers for transports.c
11 #ifndef TOR_TRANSPORTS_H
12 #define TOR_TRANSPORTS_H
14 void pt_kickstart_proxy(const smartlist_t
*transport_list
, char **proxy_argv
,
17 #define pt_kickstart_client_proxy(tl, pa) \
18 pt_kickstart_proxy(tl, pa, 0)
19 #define pt_kickstart_server_proxy(tl, pa) \
20 pt_kickstart_proxy(tl, pa, 1)
22 void pt_configure_remaining_proxies(void);
24 int pt_proxies_configuration_pending(void);
26 void pt_free_all(void);
28 void pt_prepare_proxy_list_for_config_read(void);
29 void sweep_proxy_list(void);
32 /** State of the managed proxy configuration protocol. */
34 PT_PROTO_INFANT
, /* was just born */
35 PT_PROTO_LAUNCHED
, /* was just launched */
36 PT_PROTO_ACCEPTING_METHODS
, /* accepting methods */
37 PT_PROTO_CONFIGURED
, /* configured successfully */
38 PT_PROTO_COMPLETED
, /* configure and registered its transports */
39 PT_PROTO_BROKEN
, /* broke during the protocol */
40 PT_PROTO_FAILED_LAUNCH
/* failed while launching */
43 /** Structure containing information of a managed proxy. */
45 enum pt_proto_state conf_state
; /* the current configuration state */
46 char **argv
; /* the cli arguments of this proxy */
47 int conf_protocol
; /* the configuration protocol version used */
49 int is_server
; /* is it a server proxy? */
51 /* A pointer to the process handle of this managed proxy. */
52 process_handle_t
*process_handle
;
54 int pid
; /* The Process ID this managed proxy is using. */
56 /** Boolean: We are re-parsing our config, and we are going to
57 * remove this managed proxy if we don't find it any transport
58 * plugins that use it. */
59 unsigned int marked_for_removal
: 1;
61 /** Boolean: We got a SIGHUP while this proxy was running. We use
62 * this flag to signify that this proxy might need to be restarted
63 * so that it can listen for other transports according to the new
65 unsigned int got_hup
: 1;
67 /* transports to-be-launched by this proxy */
68 smartlist_t
*transports_to_launch
;
70 /* The 'transports' list contains all the transports this proxy has
73 Before a managed_proxy_t reaches the PT_PROTO_COMPLETED phase,
74 this smartlist contains a 'transport_t' for every transport it
77 When the managed_proxy_t reaches the PT_PROTO_COMPLETED phase, it
78 registers all its transports to the circuitbuild.c subsystem. At
79 that point the 'transport_t's are owned by the circuitbuild.c
82 To avoid carrying dangling 'transport_t's in this smartlist,
83 right before the managed_proxy_t reaches the PT_PROTO_COMPLETED
84 phase we replace all 'transport_t's with strings of their
88 When (conf_state != PT_PROTO_COMPLETED) this list carries
90 When (conf_state == PT_PROTO_COMPLETED) this list carries
93 smartlist_t
*transports
;
96 int parse_cmethod_line(const char *line
, managed_proxy_t
*mp
);
97 int parse_smethod_line(const char *line
, managed_proxy_t
*mp
);
99 int parse_version(const char *line
, managed_proxy_t
*mp
);
100 void parse_env_error(const char *line
);
101 void handle_proxy_line(const char *line
, managed_proxy_t
*mp
);