2010-07-22 10:50:34 +02:00
|
|
|
/* Copyright (c) 2001 Matej Pfajfar.
|
|
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
2012-06-05 02:58:17 +02:00
|
|
|
* Copyright (c) 2007-2012, The Tor Project, Inc. */
|
2010-07-22 10:50:34 +02:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file connection_or.h
|
|
|
|
* \brief Header file for connection_or.c.
|
|
|
|
**/
|
|
|
|
|
2012-10-12 18:13:10 +02:00
|
|
|
#ifndef TOR_CONNECTION_OR_H
|
|
|
|
#define TOR_CONNECTION_OR_H
|
2010-07-22 10:50:34 +02:00
|
|
|
|
|
|
|
void connection_or_remove_from_identity_map(or_connection_t *conn);
|
|
|
|
void connection_or_clear_identity_map(void);
|
2011-07-11 22:10:24 +02:00
|
|
|
void clear_broken_connection_map(int disable);
|
2010-07-22 10:50:34 +02:00
|
|
|
or_connection_t *connection_or_get_for_extend(const char *digest,
|
|
|
|
const tor_addr_t *target_addr,
|
|
|
|
const char **msg_out,
|
|
|
|
int *launch_out);
|
2010-09-29 04:32:38 +02:00
|
|
|
void connection_or_set_bad_connections(const char *digest, int force);
|
2010-07-22 10:50:34 +02:00
|
|
|
|
2012-10-16 19:41:55 +02:00
|
|
|
void connection_or_block_renegotiation(or_connection_t *conn);
|
2010-07-22 10:50:34 +02:00
|
|
|
int connection_or_reached_eof(or_connection_t *conn);
|
|
|
|
int connection_or_process_inbuf(or_connection_t *conn);
|
|
|
|
int connection_or_flushed_some(or_connection_t *conn);
|
|
|
|
int connection_or_finished_flushing(or_connection_t *conn);
|
|
|
|
int connection_or_finished_connecting(or_connection_t *conn);
|
2011-06-22 19:57:19 +02:00
|
|
|
void connection_or_about_to_close(or_connection_t *conn);
|
2010-07-22 10:50:34 +02:00
|
|
|
int connection_or_digest_is_known_relay(const char *id_digest);
|
2010-08-15 10:01:42 +02:00
|
|
|
void connection_or_update_token_buckets(smartlist_t *conns,
|
2011-06-14 19:01:38 +02:00
|
|
|
const or_options_t *options);
|
2010-07-22 10:50:34 +02:00
|
|
|
|
|
|
|
void connection_or_connect_failed(or_connection_t *conn,
|
|
|
|
int reason, const char *msg);
|
2012-08-01 13:18:42 +02:00
|
|
|
void connection_or_notify_error(or_connection_t *conn,
|
|
|
|
int reason, const char *msg);
|
2010-07-22 10:50:34 +02:00
|
|
|
or_connection_t *connection_or_connect(const tor_addr_t *addr, uint16_t port,
|
2012-08-01 13:18:42 +02:00
|
|
|
const char *id_digest,
|
|
|
|
channel_tls_t *chan);
|
|
|
|
|
|
|
|
void connection_or_close_normally(or_connection_t *orconn, int flush);
|
|
|
|
void connection_or_close_for_error(or_connection_t *orconn, int flush);
|
2010-07-22 10:50:34 +02:00
|
|
|
|
2011-06-22 21:29:30 +02:00
|
|
|
void connection_or_report_broken_states(int severity, int domain);
|
|
|
|
|
2010-07-22 10:50:34 +02:00
|
|
|
int connection_tls_start_handshake(or_connection_t *conn, int receiving);
|
|
|
|
int connection_tls_continue_handshake(or_connection_t *conn);
|
|
|
|
|
2011-10-11 17:30:01 +02:00
|
|
|
int connection_init_or_handshake_state(or_connection_t *conn,
|
|
|
|
int started_here);
|
2011-09-27 19:15:36 +02:00
|
|
|
void connection_or_init_conn_from_address(or_connection_t *conn,
|
2011-10-11 17:30:01 +02:00
|
|
|
const tor_addr_t *addr,
|
|
|
|
uint16_t port,
|
2011-09-27 19:15:36 +02:00
|
|
|
const char *id_digest,
|
|
|
|
int started_here);
|
|
|
|
int connection_or_client_learned_peer_id(or_connection_t *conn,
|
|
|
|
const uint8_t *peer_id);
|
2012-08-01 13:18:42 +02:00
|
|
|
time_t connection_or_client_used(or_connection_t *conn);
|
|
|
|
int connection_or_get_num_circuits(or_connection_t *conn);
|
2010-07-22 10:50:34 +02:00
|
|
|
void or_handshake_state_free(or_handshake_state_t *state);
|
2011-09-17 00:32:11 +02:00
|
|
|
void or_handshake_state_record_cell(or_handshake_state_t *state,
|
|
|
|
const cell_t *cell,
|
|
|
|
int incoming);
|
|
|
|
void or_handshake_state_record_var_cell(or_handshake_state_t *state,
|
|
|
|
const var_cell_t *cell,
|
|
|
|
int incoming);
|
|
|
|
|
2010-07-22 10:50:34 +02:00
|
|
|
int connection_or_set_state_open(or_connection_t *conn);
|
|
|
|
void connection_or_write_cell_to_buf(const cell_t *cell,
|
|
|
|
or_connection_t *conn);
|
|
|
|
void connection_or_write_var_cell_to_buf(const var_cell_t *cell,
|
|
|
|
or_connection_t *conn);
|
2011-09-27 19:15:36 +02:00
|
|
|
int connection_or_send_versions(or_connection_t *conn, int v3_plus);
|
2010-07-22 10:50:34 +02:00
|
|
|
int connection_or_send_netinfo(or_connection_t *conn);
|
2011-10-31 09:33:38 +01:00
|
|
|
int connection_or_send_certs_cell(or_connection_t *conn);
|
2011-09-13 17:38:38 +02:00
|
|
|
int connection_or_send_auth_challenge_cell(or_connection_t *conn);
|
2011-09-14 20:44:42 +02:00
|
|
|
int connection_or_compute_authenticate_cell_body(or_connection_t *conn,
|
|
|
|
uint8_t *out, size_t outlen,
|
2012-01-18 21:53:30 +01:00
|
|
|
crypto_pk_t *signing_key,
|
2011-09-14 20:44:42 +02:00
|
|
|
int server);
|
2011-09-27 19:15:36 +02:00
|
|
|
int connection_or_send_authenticate_cell(or_connection_t *conn, int type);
|
2011-09-13 17:38:38 +02:00
|
|
|
|
2010-07-22 10:50:34 +02:00
|
|
|
int is_or_protocol_version_known(uint16_t version);
|
|
|
|
|
|
|
|
void cell_pack(packed_cell_t *dest, const cell_t *src);
|
|
|
|
void var_cell_pack_header(const var_cell_t *cell, char *hdr_out);
|
|
|
|
var_cell_t *var_cell_new(uint16_t payload_len);
|
|
|
|
void var_cell_free(var_cell_t *cell);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|