control.h 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Copyright (c) 2001 Matej Pfajfar.
  2. * Copyright (c) 2001-2004, Roger Dingledine.
  3. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  4. * Copyright (c) 2007-2012, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file control.h
  8. * \brief Header file for control.c.
  9. **/
  10. #ifndef _TOR_CONTROL_H
  11. #define _TOR_CONTROL_H
  12. void control_update_global_event_mask(void);
  13. void control_adjust_event_log_severity(void);
  14. void control_ports_write_to_file(void);
  15. /** Log information about the connection <b>conn</b>, protecting it as with
  16. * CONN_LOG_PROTECT. Example:
  17. *
  18. * LOG_FN_CONN(conn, (LOG_DEBUG, "Socket %d wants to write", conn->s));
  19. **/
  20. #define LOG_FN_CONN(conn, args) \
  21. CONN_LOG_PROTECT(conn, log_fn args)
  22. int connection_control_finished_flushing(control_connection_t *conn);
  23. int connection_control_reached_eof(control_connection_t *conn);
  24. void connection_control_closed(control_connection_t *conn);
  25. int connection_control_process_inbuf(control_connection_t *conn);
  26. #define EVENT_AUTHDIR_NEWDESCS 0x000D
  27. #define EVENT_NS 0x000F
  28. int control_event_is_interesting(int event);
  29. int control_event_circuit_status(origin_circuit_t *circ,
  30. circuit_status_event_t e, int reason);
  31. int control_event_circuit_purpose_changed(origin_circuit_t *circ,
  32. int old_purpose);
  33. int control_event_circuit_cannibalized(origin_circuit_t *circ,
  34. int old_purpose,
  35. const struct timeval *old_tv_created);
  36. int control_event_stream_status(entry_connection_t *conn,
  37. stream_status_event_t e,
  38. int reason);
  39. int control_event_or_conn_status(or_connection_t *conn,
  40. or_conn_status_event_t e, int reason);
  41. int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written);
  42. int control_event_stream_bandwidth(edge_connection_t *edge_conn);
  43. int control_event_stream_bandwidth_used(void);
  44. void control_event_logmsg(int severity, uint32_t domain, const char *msg);
  45. int control_event_descriptors_changed(smartlist_t *routers);
  46. int control_event_address_mapped(const char *from, const char *to,
  47. time_t expires, const char *error);
  48. int control_event_or_authdir_new_descriptor(const char *action,
  49. const char *desc,
  50. size_t desclen,
  51. const char *msg);
  52. int control_event_my_descriptor_changed(void);
  53. int control_event_networkstatus_changed(smartlist_t *statuses);
  54. int control_event_newconsensus(const networkstatus_t *consensus);
  55. int control_event_networkstatus_changed_single(const routerstatus_t *rs);
  56. int control_event_general_status(int severity, const char *format, ...)
  57. CHECK_PRINTF(2,3);
  58. int control_event_client_status(int severity, const char *format, ...)
  59. CHECK_PRINTF(2,3);
  60. int control_event_server_status(int severity, const char *format, ...)
  61. CHECK_PRINTF(2,3);
  62. int control_event_guard(const char *nickname, const char *digest,
  63. const char *status);
  64. int control_event_conf_changed(smartlist_t *elements);
  65. int control_event_buildtimeout_set(const circuit_build_times_t *cbt,
  66. buildtimeout_set_event_t type);
  67. int control_event_signal(uintptr_t signal);
  68. int init_cookie_authentication(int enabled);
  69. smartlist_t *decode_hashed_passwords(config_line_t *passwords);
  70. void disable_control_logging(void);
  71. void enable_control_logging(void);
  72. void monitor_owning_controller_process(const char *process_spec);
  73. void control_event_bootstrap(bootstrap_status_t status, int progress);
  74. void control_event_bootstrap_problem(const char *warn, int reason);
  75. void control_event_clients_seen(const char *controller_str);
  76. #ifdef CONTROL_PRIVATE
  77. /* Used only by control.c and test.c */
  78. size_t write_escaped_data(const char *data, size_t len, char **out);
  79. size_t read_escaped_data(const char *data, size_t len, char **out);
  80. #endif
  81. #endif