Back to index

tor  0.2.3.19-rc
connection_edge.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_CONNECTION_EDGE_H
00013 #define _TOR_CONNECTION_EDGE_H
00014 
00015 #define connection_mark_unattached_ap(conn, endreason) \
00016   _connection_mark_unattached_ap((conn), (endreason), __LINE__, _SHORT_FILE_)
00017 
00018 void _connection_mark_unattached_ap(entry_connection_t *conn, int endreason,
00019                                     int line, const char *file);
00020 int connection_edge_reached_eof(edge_connection_t *conn);
00021 int connection_edge_process_inbuf(edge_connection_t *conn,
00022                                   int package_partial);
00023 int connection_edge_destroy(circid_t circ_id, edge_connection_t *conn);
00024 int connection_edge_end(edge_connection_t *conn, uint8_t reason);
00025 int connection_edge_end_errno(edge_connection_t *conn);
00026 int connection_edge_flushed_some(edge_connection_t *conn);
00027 int connection_edge_finished_flushing(edge_connection_t *conn);
00028 int connection_edge_finished_connecting(edge_connection_t *conn);
00029 
00030 void connection_ap_about_to_close(entry_connection_t *edge_conn);
00031 void connection_exit_about_to_close(edge_connection_t *edge_conn);
00032 
00033 int connection_ap_handshake_send_begin(entry_connection_t *ap_conn);
00034 int connection_ap_handshake_send_resolve(entry_connection_t *ap_conn);
00035 
00036 entry_connection_t  *connection_ap_make_link(connection_t *partner,
00037                                             char *address, uint16_t port,
00038                                             const char *digest,
00039                                             int session_group,
00040                                             int isolation_flags,
00041                                             int use_begindir, int want_onehop);
00042 void connection_ap_handshake_socks_reply(entry_connection_t *conn, char *reply,
00043                                          size_t replylen,
00044                                          int endreason);
00045 void connection_ap_handshake_socks_resolved(entry_connection_t *conn,
00046                                             int answer_type,
00047                                             size_t answer_len,
00048                                             const uint8_t *answer,
00049                                             int ttl,
00050                                             time_t expires);
00051 
00052 int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
00053 int connection_exit_begin_resolve(cell_t *cell, or_circuit_t *circ);
00054 void connection_exit_connect(edge_connection_t *conn);
00055 int connection_edge_is_rendezvous_stream(edge_connection_t *conn);
00056 int connection_ap_can_use_exit(const entry_connection_t *conn,
00057                                const node_t *exit);
00058 void connection_ap_expire_beginning(void);
00059 void connection_ap_attach_pending(void);
00060 void connection_ap_fail_onehop(const char *failed_digest,
00061                                cpath_build_state_t *build_state);
00062 void circuit_discard_optional_exit_enclaves(extend_info_t *info);
00063 int connection_ap_detach_retriable(entry_connection_t *conn,
00064                                    origin_circuit_t *circ,
00065                                    int reason);
00066 int connection_ap_process_transparent(entry_connection_t *conn);
00067 
00068 int address_is_invalid_destination(const char *address, int client);
00069 
00070 void addressmap_init(void);
00071 void addressmap_clear_excluded_trackexithosts(const or_options_t *options);
00072 void addressmap_clear_invalid_automaps(const or_options_t *options);
00073 void addressmap_clean(time_t now);
00074 void addressmap_clear_configured(void);
00075 void addressmap_clear_transient(void);
00076 void addressmap_free_all(void);
00077 int addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out,
00078                        addressmap_entry_source_t *exit_source_out);
00079 int addressmap_have_mapping(const char *address, int update_timeout);
00080 
00081 void addressmap_register(const char *address, char *new_address,
00082                          time_t expires, addressmap_entry_source_t source,
00083                          const int address_wildcard,
00084                          const int new_address_wildcard);
00085 int parse_virtual_addr_network(const char *val, int validate_only,
00086                                char **msg);
00087 int client_dns_incr_failures(const char *address);
00088 void client_dns_clear_failures(const char *address);
00089 void client_dns_set_addressmap(const char *address, uint32_t val,
00090                                const char *exitname, int ttl);
00091 const char *addressmap_register_virtual_address(int type, char *new_address);
00092 void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
00093                              time_t max_expires, int want_expiry);
00094 int connection_ap_rewrite_and_attach_if_allowed(entry_connection_t *conn,
00095                                                 origin_circuit_t *circ,
00096                                                 crypt_path_t *cpath);
00097 int connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
00098                                                origin_circuit_t *circ,
00099                                                crypt_path_t *cpath);
00100 
00102 typedef enum hostname_type_t {
00103   NORMAL_HOSTNAME, ONION_HOSTNAME, EXIT_HOSTNAME, BAD_HOSTNAME
00104 } hostname_type_t;
00105 hostname_type_t parse_extended_hostname(char *address);
00106 
00107 #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
00108 int get_pf_socket(void);
00109 #endif
00110 
00111 int connection_edge_compatible_with_circuit(const entry_connection_t *conn,
00112                                             const origin_circuit_t *circ);
00113 int connection_edge_update_circuit_isolation(const entry_connection_t *conn,
00114                                              origin_circuit_t *circ,
00115                                              int dry_run);
00116 void circuit_clear_isolation(origin_circuit_t *circ);
00117 
00118 #endif
00119