main.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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-2011, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file main.h
  8. * \brief Header file for main.c.
  9. **/
  10. #ifndef _TOR_MAIN_H
  11. #define _TOR_MAIN_H
  12. extern int can_complete_circuit;
  13. int connection_add(connection_t *conn);
  14. int connection_remove(connection_t *conn);
  15. void connection_unregister_events(connection_t *conn);
  16. int connection_in_array(connection_t *conn);
  17. void add_connection_to_closeable_list(connection_t *conn);
  18. int connection_is_on_closeable_list(connection_t *conn);
  19. smartlist_t *get_connection_array(void);
  20. /** Bitmask for events that we can turn on and off with
  21. * connection_watch_events. */
  22. typedef enum watchable_events {
  23. READ_EVENT=0x02, /**< We want to know when a connection is readable */
  24. WRITE_EVENT=0x04 /**< We want to know when a connection is writable */
  25. } watchable_events_t;
  26. void connection_watch_events(connection_t *conn, watchable_events_t events);
  27. int connection_is_reading(connection_t *conn);
  28. void connection_stop_reading(connection_t *conn);
  29. void connection_start_reading(connection_t *conn);
  30. int connection_is_writing(connection_t *conn);
  31. void connection_stop_writing(connection_t *conn);
  32. void connection_start_writing(connection_t *conn);
  33. void connection_stop_reading_from_linked_conn(connection_t *conn);
  34. void directory_all_unreachable(time_t now);
  35. void directory_info_has_arrived(time_t now, int from_cache);
  36. void ip_address_changed(int at_interface);
  37. void dns_servers_relaunch_checks(void);
  38. void handle_signals(int is_parent);
  39. void process_signal(uintptr_t sig);
  40. int try_locking(or_options_t *options, int err_if_locked);
  41. int have_lockfile(void);
  42. void release_lockfile(void);
  43. void tor_cleanup(void);
  44. void tor_free_all(int postfork);
  45. int tor_main(int argc, char *argv[]);
  46. #ifdef MAIN_PRIVATE
  47. int do_main_loop(void);
  48. int do_list_fingerprint(void);
  49. void do_hash_password(void);
  50. int tor_init(int argc, char **argv);
  51. #endif
  52. #endif