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 */
9 * \brief Header file for main.c.
15 extern int can_complete_circuit
;
17 int connection_add(connection_t
*conn
);
18 int connection_remove(connection_t
*conn
);
19 void connection_unregister_events(connection_t
*conn
);
20 int connection_in_array(connection_t
*conn
);
21 void add_connection_to_closeable_list(connection_t
*conn
);
22 int connection_is_on_closeable_list(connection_t
*conn
);
24 smartlist_t
*get_connection_array(void);
26 /** Bitmask for events that we can turn on and off with
27 * connection_watch_events. */
28 typedef enum watchable_events
{
29 READ_EVENT
=0x02, /**< We want to know when a connection is readable */
30 WRITE_EVENT
=0x04 /**< We want to know when a connection is writable */
32 void connection_watch_events(connection_t
*conn
, watchable_events_t events
);
33 int connection_is_reading(connection_t
*conn
);
34 void connection_stop_reading(connection_t
*conn
);
35 void connection_start_reading(connection_t
*conn
);
37 int connection_is_writing(connection_t
*conn
);
38 void connection_stop_writing(connection_t
*conn
);
39 void connection_start_writing(connection_t
*conn
);
41 void connection_stop_reading_from_linked_conn(connection_t
*conn
);
43 void directory_all_unreachable(time_t now
);
44 void directory_info_has_arrived(time_t now
, int from_cache
);
46 void ip_address_changed(int at_interface
);
47 void dns_servers_relaunch_checks(void);
49 void handle_signals(int is_parent
);
50 void process_signal(uintptr_t sig
);
52 int try_locking(or_options_t
*options
, int err_if_locked
);
53 int have_lockfile(void);
54 void release_lockfile(void);
56 void tor_cleanup(void);
57 void tor_free_all(int postfork
);
59 int tor_main(int argc
, char *argv
[]);
62 int do_main_loop(void);
63 int do_list_fingerprint(void);
64 void do_hash_password(void);
65 int tor_init(int argc
, char **argv
);