Back to index

tor  0.2.3.18-rc
connection_or.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_OR_H
00013 #define _TOR_CONNECTION_OR_H
00014 
00015 void connection_or_remove_from_identity_map(or_connection_t *conn);
00016 void connection_or_clear_identity_map(void);
00017 void clear_broken_connection_map(int disable);
00018 or_connection_t *connection_or_get_for_extend(const char *digest,
00019                                               const tor_addr_t *target_addr,
00020                                               const char **msg_out,
00021                                               int *launch_out);
00022 void connection_or_set_bad_connections(const char *digest, int force);
00023 
00024 int connection_or_reached_eof(or_connection_t *conn);
00025 int connection_or_process_inbuf(or_connection_t *conn);
00026 int connection_or_flushed_some(or_connection_t *conn);
00027 int connection_or_finished_flushing(or_connection_t *conn);
00028 int connection_or_finished_connecting(or_connection_t *conn);
00029 void connection_or_about_to_close(or_connection_t *conn);
00030 int connection_or_digest_is_known_relay(const char *id_digest);
00031 void connection_or_update_token_buckets(smartlist_t *conns,
00032                                         const or_options_t *options);
00033 
00034 void connection_or_connect_failed(or_connection_t *conn,
00035                                   int reason, const char *msg);
00036 or_connection_t *connection_or_connect(const tor_addr_t *addr, uint16_t port,
00037                                        const char *id_digest);
00038 
00039 void connection_or_report_broken_states(int severity, int domain);
00040 
00041 int connection_tls_start_handshake(or_connection_t *conn, int receiving);
00042 int connection_tls_continue_handshake(or_connection_t *conn);
00043 
00044 int connection_init_or_handshake_state(or_connection_t *conn,
00045                                        int started_here);
00046 void connection_or_init_conn_from_address(or_connection_t *conn,
00047                                           const tor_addr_t *addr,
00048                                           uint16_t port,
00049                                           const char *id_digest,
00050                                           int started_here);
00051 int connection_or_client_learned_peer_id(or_connection_t *conn,
00052                                          const uint8_t *peer_id);
00053 void connection_or_set_circid_type(or_connection_t *conn,
00054                                    crypto_pk_t *identity_rcvd);
00055 void or_handshake_state_free(or_handshake_state_t *state);
00056 void or_handshake_state_record_cell(or_handshake_state_t *state,
00057                                     const cell_t *cell,
00058                                     int incoming);
00059 void or_handshake_state_record_var_cell(or_handshake_state_t *state,
00060                                         const var_cell_t *cell,
00061                                         int incoming);
00062 
00063 int connection_or_set_state_open(or_connection_t *conn);
00064 void connection_or_write_cell_to_buf(const cell_t *cell,
00065                                      or_connection_t *conn);
00066 void connection_or_write_var_cell_to_buf(const var_cell_t *cell,
00067                                          or_connection_t *conn);
00068 int connection_or_send_destroy(circid_t circ_id, or_connection_t *conn,
00069                                int reason);
00070 int connection_or_send_versions(or_connection_t *conn, int v3_plus);
00071 int connection_or_send_netinfo(or_connection_t *conn);
00072 int connection_or_send_certs_cell(or_connection_t *conn);
00073 int connection_or_send_auth_challenge_cell(or_connection_t *conn);
00074 int connection_or_compute_authenticate_cell_body(or_connection_t *conn,
00075                                                  uint8_t *out, size_t outlen,
00076                                                  crypto_pk_t *signing_key,
00077                                                  int server);
00078 int connection_or_send_authenticate_cell(or_connection_t *conn, int type);
00079 
00080 int is_or_protocol_version_known(uint16_t version);
00081 
00082 void cell_pack(packed_cell_t *dest, const cell_t *src);
00083 void var_cell_pack_header(const var_cell_t *cell, char *hdr_out);
00084 var_cell_t *var_cell_new(uint16_t payload_len);
00085 void var_cell_free(var_cell_t *cell);
00086 
00087 #endif
00088