transports.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright (c) 2003-2004, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2011, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. /**
  6. * \file transports.h
  7. * \brief Headers for transports.c
  8. **/
  9. #ifndef TOR_TRANSPORTS_H
  10. #define TOR_TRANSPORTS_H
  11. int pt_managed_launch_proxy(const char *method,
  12. char **proxy_argv, int is_server);
  13. #define pt_managed_launch_client_proxy(m, pa) \
  14. pt_managed_launch_proxy(m, pa, 0)
  15. #define pt_managed_launch_server_proxy(m, pa) \
  16. pt_managed_launch_proxy(m, pa, 1)
  17. void pt_configure_remaining_proxies(void);
  18. int pt_proxies_configuration_pending(void);
  19. void pt_free_all(void);
  20. #ifdef PT_PRIVATE
  21. /** State of the managed proxy configuration protocol. */
  22. enum pt_proto_state {
  23. PT_PROTO_INFANT, /* was just born */
  24. PT_PROTO_ACCEPTING_METHODS, /* accepting methods */
  25. PT_PROTO_CONFIGURED, /* configured successfully */
  26. PT_PROTO_COMPLETED, /* configure and registered its transports */
  27. PT_PROTO_BROKEN
  28. };
  29. /** Structure containing information of a managed proxy. */
  30. typedef struct {
  31. enum pt_proto_state conf_state; /* the current configuration state */
  32. int conf_protocol; /* the configuration protocol version used */
  33. FILE *stdout; /* a stream to its stdout
  34. (closed in managed_proxy_destroy()) */
  35. smartlist_t *transports; /* list of transports this proxy spawns */
  36. } managed_proxy_t;
  37. int parse_cmethod_line(char *line, managed_proxy_t *mp);
  38. int parse_smethod_line(char *line, managed_proxy_t *mp);
  39. int parse_version(char *line, managed_proxy_t *mp);
  40. void parse_env_error(char *line);
  41. void handle_proxy_line(char *line, managed_proxy_t *mp);
  42. #endif
  43. #endif