connection_or.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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-2016, 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. void connection_or_block_renegotiation(or_connection_t *conn);
  21. int connection_or_reached_eof(or_connection_t *conn);
  22. int connection_or_process_inbuf(or_connection_t *conn);
  23. ssize_t connection_or_num_cells_writeable(or_connection_t *conn);
  24. int connection_or_flushed_some(or_connection_t *conn);
  25. int connection_or_finished_flushing(or_connection_t *conn);
  26. int connection_or_finished_connecting(or_connection_t *conn);
  27. void connection_or_about_to_close(or_connection_t *conn);
  28. int connection_or_digest_is_known_relay(const char *id_digest);
  29. void connection_or_update_token_buckets(smartlist_t *conns,
  30. const or_options_t *options);
  31. void connection_or_connect_failed(or_connection_t *conn,
  32. int reason, const char *msg);
  33. void connection_or_notify_error(or_connection_t *conn,
  34. int reason, const char *msg);
  35. MOCK_DECL(or_connection_t *,
  36. connection_or_connect,
  37. (const tor_addr_t *addr, uint16_t port,
  38. const char *id_digest,
  39. const ed25519_public_key_t *ed_id,
  40. channel_tls_t *chan));
  41. void connection_or_close_normally(or_connection_t *orconn, int flush);
  42. MOCK_DECL(void,connection_or_close_for_error,
  43. (or_connection_t *orconn, int flush));
  44. void connection_or_report_broken_states(int severity, int domain);
  45. MOCK_DECL(int,connection_tls_start_handshake,(or_connection_t *conn,
  46. int receiving));
  47. int connection_tls_continue_handshake(or_connection_t *conn);
  48. void connection_or_set_canonical(or_connection_t *or_conn,
  49. int is_canonical);
  50. int connection_init_or_handshake_state(or_connection_t *conn,
  51. int started_here);
  52. void connection_or_init_conn_from_address(or_connection_t *conn,
  53. const tor_addr_t *addr,
  54. uint16_t port,
  55. const char *rsa_id_digest,
  56. const ed25519_public_key_t *ed_id,
  57. int started_here);
  58. int connection_or_client_learned_peer_id(or_connection_t *conn,
  59. const uint8_t *rsa_peer_id,
  60. const ed25519_public_key_t *ed_peer_id);
  61. time_t connection_or_client_used(or_connection_t *conn);
  62. MOCK_DECL(int, connection_or_get_num_circuits, (or_connection_t *conn));
  63. void or_handshake_state_free(or_handshake_state_t *state);
  64. void or_handshake_state_record_cell(or_connection_t *conn,
  65. or_handshake_state_t *state,
  66. const cell_t *cell,
  67. int incoming);
  68. void or_handshake_state_record_var_cell(or_connection_t *conn,
  69. or_handshake_state_t *state,
  70. const var_cell_t *cell,
  71. int incoming);
  72. int connection_or_set_state_open(or_connection_t *conn);
  73. void connection_or_write_cell_to_buf(const cell_t *cell,
  74. or_connection_t *conn);
  75. MOCK_DECL(void,connection_or_write_var_cell_to_buf,(const var_cell_t *cell,
  76. or_connection_t *conn));
  77. int connection_or_send_versions(or_connection_t *conn, int v3_plus);
  78. MOCK_DECL(int,connection_or_send_netinfo,(or_connection_t *conn));
  79. int connection_or_send_certs_cell(or_connection_t *conn);
  80. int connection_or_send_auth_challenge_cell(or_connection_t *conn);
  81. int authchallenge_type_is_supported(uint16_t challenge_type);
  82. int authchallenge_type_is_better(uint16_t challenge_type_a,
  83. uint16_t challenge_type_b);
  84. var_cell_t *connection_or_compute_authenticate_cell_body(or_connection_t *conn,
  85. const int authtype,
  86. crypto_pk_t *signing_key,
  87. const ed25519_keypair_t *ed_signing_key,
  88. int server);
  89. MOCK_DECL(int,connection_or_send_authenticate_cell,
  90. (or_connection_t *conn, int type));
  91. int is_or_protocol_version_known(uint16_t version);
  92. void cell_pack(packed_cell_t *dest, const cell_t *src, int wide_circ_ids);
  93. int var_cell_pack_header(const var_cell_t *cell, char *hdr_out,
  94. int wide_circ_ids);
  95. var_cell_t *var_cell_new(uint16_t payload_len);
  96. var_cell_t *var_cell_copy(const var_cell_t *src);
  97. void var_cell_free(var_cell_t *cell);
  98. /* DOCDOC */
  99. #define MIN_LINK_PROTO_FOR_WIDE_CIRC_IDS 4
  100. #endif