2011-07-13 19:00:28 +02:00
|
|
|
/* Copyright (c) 2003-2004, Roger Dingledine
|
|
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
|
|
|
* Copyright (c) 2007-2011, The Tor Project, Inc. */
|
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
/**
|
2011-07-18 02:33:31 +02:00
|
|
|
* \file transports.h
|
|
|
|
* \brief Headers for transports.c
|
2011-07-13 19:00:28 +02:00
|
|
|
**/
|
|
|
|
|
2011-07-18 02:33:31 +02:00
|
|
|
#ifndef TOR_TRANSPORTS_H
|
|
|
|
#define TOR_TRANSPORTS_H
|
2011-07-13 19:00:28 +02:00
|
|
|
|
2011-08-15 17:26:03 +02:00
|
|
|
void pt_kickstart_proxy(const char *method, char **proxy_argv,
|
2011-08-12 21:33:05 +02:00
|
|
|
int is_server);
|
2011-07-13 19:00:28 +02:00
|
|
|
|
2011-08-12 21:33:05 +02:00
|
|
|
#define pt_kickstart_client_proxy(m, pa) \
|
|
|
|
pt_kickstart_proxy(m, pa, 0)
|
|
|
|
#define pt_kickstart_server_proxy(m, pa) \
|
|
|
|
pt_kickstart_proxy(m, pa, 1)
|
2011-07-13 19:00:28 +02:00
|
|
|
|
|
|
|
void pt_configure_remaining_proxies(void);
|
|
|
|
|
|
|
|
int pt_proxies_configuration_pending(void);
|
|
|
|
|
|
|
|
void pt_free_all(void);
|
|
|
|
|
|
|
|
#ifdef PT_PRIVATE
|
|
|
|
/** State of the managed proxy configuration protocol. */
|
|
|
|
enum pt_proto_state {
|
|
|
|
PT_PROTO_INFANT, /* was just born */
|
2011-08-12 21:33:05 +02:00
|
|
|
PT_PROTO_LAUNCHED, /* was just launched */
|
2011-07-13 19:00:28 +02:00
|
|
|
PT_PROTO_ACCEPTING_METHODS, /* accepting methods */
|
|
|
|
PT_PROTO_CONFIGURED, /* configured successfully */
|
|
|
|
PT_PROTO_COMPLETED, /* configure and registered its transports */
|
|
|
|
PT_PROTO_BROKEN
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Structure containing information of a managed proxy. */
|
|
|
|
typedef struct {
|
|
|
|
enum pt_proto_state conf_state; /* the current configuration state */
|
2011-08-12 21:33:05 +02:00
|
|
|
char **argv; /* the cli arguments of this proxy */
|
2011-07-13 19:00:28 +02:00
|
|
|
int conf_protocol; /* the configuration protocol version used */
|
|
|
|
|
2011-08-07 18:05:40 +02:00
|
|
|
int is_server; /* is it a server proxy? */
|
|
|
|
|
2011-07-13 19:00:28 +02:00
|
|
|
FILE *stdout; /* a stream to its stdout
|
|
|
|
(closed in managed_proxy_destroy()) */
|
|
|
|
|
2011-08-12 21:33:05 +02:00
|
|
|
smartlist_t *transports_to_launch; /* transports to-be-launched by this proxy */
|
|
|
|
smartlist_t *transports; /* list of transport_t this proxy spawned */
|
2011-07-13 19:00:28 +02:00
|
|
|
} managed_proxy_t;
|
|
|
|
|
2011-08-15 17:26:03 +02:00
|
|
|
int parse_cmethod_line(const char *line, managed_proxy_t *mp);
|
|
|
|
int parse_smethod_line(const char *line, managed_proxy_t *mp);
|
2011-07-13 19:00:28 +02:00
|
|
|
|
2011-08-15 17:26:03 +02:00
|
|
|
int parse_version(const char *line, managed_proxy_t *mp);
|
|
|
|
void parse_env_error(const char *line);
|
|
|
|
void handle_proxy_line(const char *line, managed_proxy_t *mp);
|
2011-07-13 19:00:28 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|