Back to index

tor  0.2.3.19-rc
main.h
Go to the documentation of this file.
00001 /* Copyright (c) 2001 Matej Pfajfar.
00002  * Copyright (c) 2001-2004, Roger Dingledine.
00003  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
00004  * Copyright (c) 2007-2012, The Tor Project, Inc. */
00005 /* See LICENSE for licensing information */
00006 
00012 #ifndef _TOR_MAIN_H
00013 #define _TOR_MAIN_H
00014 
00015 extern int can_complete_circuit;
00016 
00017 int connection_add_impl(connection_t *conn, int is_connecting);
00018 #define connection_add(conn) connection_add_impl((conn), 0)
00019 #define connection_add_connecting(conn) connection_add_impl((conn), 1)
00020 int connection_remove(connection_t *conn);
00021 void connection_unregister_events(connection_t *conn);
00022 int connection_in_array(connection_t *conn);
00023 void add_connection_to_closeable_list(connection_t *conn);
00024 int connection_is_on_closeable_list(connection_t *conn);
00025 
00026 smartlist_t *get_connection_array(void);
00027 uint64_t get_bytes_read(void);
00028 uint64_t get_bytes_written(void);
00029 
00032 typedef enum watchable_events {
00033   /* Yes, it is intentional that these match Libevent's EV_READ and EV_WRITE */
00034   READ_EVENT=0x02, 
00035   WRITE_EVENT=0x04 
00036 } watchable_events_t;
00037 void connection_watch_events(connection_t *conn, watchable_events_t events);
00038 int connection_is_reading(connection_t *conn);
00039 void connection_stop_reading(connection_t *conn);
00040 void connection_start_reading(connection_t *conn);
00041 
00042 int connection_is_writing(connection_t *conn);
00043 void connection_stop_writing(connection_t *conn);
00044 void connection_start_writing(connection_t *conn);
00045 
00046 void connection_stop_reading_from_linked_conn(connection_t *conn);
00047 
00048 void directory_all_unreachable(time_t now);
00049 void directory_info_has_arrived(time_t now, int from_cache);
00050 
00051 void ip_address_changed(int at_interface);
00052 void dns_servers_relaunch_checks(void);
00053 
00054 long get_uptime(void);
00055 unsigned get_signewnym_epoch(void);
00056 
00057 void handle_signals(int is_parent);
00058 void process_signal(uintptr_t sig);
00059 
00060 int try_locking(const or_options_t *options, int err_if_locked);
00061 int have_lockfile(void);
00062 void release_lockfile(void);
00063 
00064 void tor_cleanup(void);
00065 void tor_free_all(int postfork);
00066 
00067 int tor_main(int argc, char *argv[]);
00068 
00069 #ifdef MAIN_PRIVATE
00070 int do_main_loop(void);
00071 int do_list_fingerprint(void);
00072 void do_hash_password(void);
00073 int tor_init(int argc, char **argv);
00074 #endif
00075 
00076 #endif
00077