connection_edge.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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-2011, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file connection_edge.h
  8. * \brief Header file for connection_edge.c.
  9. **/
  10. #ifndef _TOR_CONNECTION_EDGE_H
  11. #define _TOR_CONNECTION_EDGE_H
  12. #define connection_mark_unattached_ap(conn, endreason) \
  13. _connection_mark_unattached_ap((conn), (endreason), __LINE__, _SHORT_FILE_)
  14. void _connection_mark_unattached_ap(edge_connection_t *conn, int endreason,
  15. int line, const char *file);
  16. int connection_edge_reached_eof(edge_connection_t *conn);
  17. int connection_edge_process_inbuf(edge_connection_t *conn,
  18. int package_partial);
  19. int connection_edge_destroy(circid_t circ_id, edge_connection_t *conn);
  20. int connection_edge_end(edge_connection_t *conn, uint8_t reason);
  21. int connection_edge_end_errno(edge_connection_t *conn);
  22. int connection_edge_flushed_some(edge_connection_t *conn);
  23. int connection_edge_finished_flushing(edge_connection_t *conn);
  24. int connection_edge_finished_connecting(edge_connection_t *conn);
  25. int connection_ap_handshake_send_begin(edge_connection_t *ap_conn);
  26. int connection_ap_handshake_send_resolve(edge_connection_t *ap_conn);
  27. edge_connection_t *connection_ap_make_link(connection_t *partner,
  28. char *address, uint16_t port,
  29. const char *digest,
  30. int use_begindir, int want_onehop);
  31. void connection_ap_handshake_socks_reply(edge_connection_t *conn, char *reply,
  32. size_t replylen,
  33. int endreason);
  34. void connection_ap_handshake_socks_resolved(edge_connection_t *conn,
  35. int answer_type,
  36. size_t answer_len,
  37. const uint8_t *answer,
  38. int ttl,
  39. time_t expires);
  40. int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
  41. int connection_exit_begin_resolve(cell_t *cell, or_circuit_t *circ);
  42. void connection_exit_connect(edge_connection_t *conn);
  43. int connection_edge_is_rendezvous_stream(edge_connection_t *conn);
  44. int connection_ap_can_use_exit(edge_connection_t *conn,
  45. const node_t *exit);
  46. void connection_ap_expire_beginning(void);
  47. void connection_ap_attach_pending(void);
  48. void connection_ap_fail_onehop(const char *failed_digest,
  49. cpath_build_state_t *build_state);
  50. void circuit_discard_optional_exit_enclaves(extend_info_t *info);
  51. int connection_ap_detach_retriable(edge_connection_t *conn,
  52. origin_circuit_t *circ,
  53. int reason);
  54. int connection_ap_process_transparent(edge_connection_t *conn);
  55. int address_is_invalid_destination(const char *address, int client);
  56. void addressmap_init(void);
  57. void addressmap_clear_excluded_trackexithosts(const or_options_t *options);
  58. void addressmap_clear_invalid_automaps(const or_options_t *options);
  59. void addressmap_clean(time_t now);
  60. void addressmap_clear_configured(void);
  61. void addressmap_clear_transient(void);
  62. void addressmap_free_all(void);
  63. int addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out);
  64. int addressmap_have_mapping(const char *address, int update_timeout);
  65. void addressmap_register(const char *address, char *new_address,
  66. time_t expires, addressmap_entry_source_t source);
  67. int parse_virtual_addr_network(const char *val, int validate_only,
  68. char **msg);
  69. int client_dns_incr_failures(const char *address);
  70. void client_dns_clear_failures(const char *address);
  71. void client_dns_set_addressmap(const char *address, uint32_t val,
  72. const char *exitname, int ttl);
  73. const char *addressmap_register_virtual_address(int type, char *new_address);
  74. void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
  75. time_t max_expires, int want_expiry);
  76. int connection_ap_rewrite_and_attach_if_allowed(edge_connection_t *conn,
  77. origin_circuit_t *circ,
  78. crypt_path_t *cpath);
  79. int connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
  80. origin_circuit_t *circ,
  81. crypt_path_t *cpath);
  82. /** Possible return values for parse_extended_hostname. */
  83. typedef enum hostname_type_t {
  84. NORMAL_HOSTNAME, ONION_HOSTNAME, EXIT_HOSTNAME, BAD_HOSTNAME
  85. } hostname_type_t;
  86. hostname_type_t parse_extended_hostname(char *address, int allowdotexit);
  87. #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
  88. int get_pf_socket(void);
  89. #endif
  90. #endif