connection_or.h 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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-2012, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file connection_or.h
  8. * \brief Header file for connection_or.c.
  9. **/
  10. #ifndef _TOR_CONNECTION_OR_H
  11. #define _TOR_CONNECTION_OR_H
  12. void connection_or_remove_from_identity_map(or_connection_t *conn);
  13. void connection_or_clear_identity_map(void);
  14. void clear_broken_connection_map(int disable);
  15. or_connection_t *connection_or_get_for_extend(const char *digest,
  16. const tor_addr_t *target_addr,
  17. const char **msg_out,
  18. int *launch_out);
  19. void connection_or_set_bad_connections(const char *digest, int force);
  20. int connection_or_reached_eof(or_connection_t *conn);
  21. int connection_or_process_inbuf(or_connection_t *conn);
  22. int connection_or_flushed_some(or_connection_t *conn);
  23. int connection_or_finished_flushing(or_connection_t *conn);
  24. int connection_or_finished_connecting(or_connection_t *conn);
  25. void connection_or_about_to_close(or_connection_t *conn);
  26. int connection_or_digest_is_known_relay(const char *id_digest);
  27. void connection_or_update_token_buckets(smartlist_t *conns,
  28. const or_options_t *options);
  29. void connection_or_connect_failed(or_connection_t *conn,
  30. int reason, const char *msg);
  31. or_connection_t *connection_or_connect(const tor_addr_t *addr, uint16_t port,
  32. const char *id_digest);
  33. void connection_or_report_broken_states(int severity, int domain);
  34. int connection_tls_start_handshake(or_connection_t *conn, int receiving);
  35. int connection_tls_continue_handshake(or_connection_t *conn);
  36. int connection_init_or_handshake_state(or_connection_t *conn,
  37. int started_here);
  38. void connection_or_init_conn_from_address(or_connection_t *conn,
  39. const tor_addr_t *addr,
  40. uint16_t port,
  41. const char *id_digest,
  42. int started_here);
  43. int connection_or_client_learned_peer_id(or_connection_t *conn,
  44. const uint8_t *peer_id);
  45. void connection_or_set_circid_type(or_connection_t *conn,
  46. crypto_pk_t *identity_rcvd);
  47. void or_handshake_state_free(or_handshake_state_t *state);
  48. void or_handshake_state_record_cell(or_handshake_state_t *state,
  49. const cell_t *cell,
  50. int incoming);
  51. void or_handshake_state_record_var_cell(or_handshake_state_t *state,
  52. const var_cell_t *cell,
  53. int incoming);
  54. int connection_or_set_state_open(or_connection_t *conn);
  55. void connection_or_write_cell_to_buf(const cell_t *cell,
  56. or_connection_t *conn);
  57. void connection_or_write_var_cell_to_buf(const var_cell_t *cell,
  58. or_connection_t *conn);
  59. int connection_or_send_destroy(circid_t circ_id, or_connection_t *conn,
  60. int reason);
  61. int connection_or_send_versions(or_connection_t *conn, int v3_plus);
  62. int connection_or_send_netinfo(or_connection_t *conn);
  63. int connection_or_send_certs_cell(or_connection_t *conn);
  64. int connection_or_send_auth_challenge_cell(or_connection_t *conn);
  65. int connection_or_compute_authenticate_cell_body(or_connection_t *conn,
  66. uint8_t *out, size_t outlen,
  67. crypto_pk_t *signing_key,
  68. int server);
  69. int connection_or_send_authenticate_cell(or_connection_t *conn, int type);
  70. int is_or_protocol_version_known(uint16_t version);
  71. void cell_pack(packed_cell_t *dest, const cell_t *src);
  72. void var_cell_pack_header(const var_cell_t *cell, char *hdr_out);
  73. var_cell_t *var_cell_new(uint16_t payload_len);
  74. void var_cell_free(var_cell_t *cell);
  75. #endif