edge_connection_st.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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-2017, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef EDGE_CONNECTION_ST_H
  7. #define EDGE_CONNECTION_ST_H
  8. #include "or.h"
  9. /** Subtype of connection_t for an "edge connection" -- that is, an entry (ap)
  10. * connection, or an exit. */
  11. struct edge_connection_t {
  12. connection_t base_;
  13. struct edge_connection_t *next_stream; /**< Points to the next stream at this
  14. * edge, if any */
  15. int package_window; /**< How many more relay cells can I send into the
  16. * circuit? */
  17. int deliver_window; /**< How many more relay cells can end at me? */
  18. struct circuit_t *on_circuit; /**< The circuit (if any) that this edge
  19. * connection is using. */
  20. /** A pointer to which node in the circ this conn exits at. Set for AP
  21. * connections and for hidden service exit connections. */
  22. struct crypt_path_t *cpath_layer;
  23. /** What rendezvous service are we querying for (if an AP) or providing (if
  24. * an exit)? */
  25. rend_data_t *rend_data;
  26. /* Hidden service connection identifier for edge connections. Used by the HS
  27. * client-side code to identify client SOCKS connections and by the
  28. * service-side code to match HS circuits with their streams. */
  29. struct hs_ident_edge_conn_t *hs_ident;
  30. uint32_t address_ttl; /**< TTL for address-to-addr mapping on exit
  31. * connection. Exit connections only. */
  32. uint32_t begincell_flags; /** Flags sent or received in the BEGIN cell
  33. * for this connection */
  34. streamid_t stream_id; /**< The stream ID used for this edge connection on its
  35. * circuit */
  36. /** The reason why this connection is closing; passed to the controller. */
  37. uint16_t end_reason;
  38. /** Bytes read since last call to control_event_stream_bandwidth_used() */
  39. uint32_t n_read;
  40. /** Bytes written since last call to control_event_stream_bandwidth_used() */
  41. uint32_t n_written;
  42. /** True iff this connection is for a DNS request only. */
  43. unsigned int is_dns_request:1;
  44. /** True iff this connection is for a PTR DNS request. (exit only) */
  45. unsigned int is_reverse_dns_lookup:1;
  46. unsigned int edge_has_sent_end:1; /**< For debugging; only used on edge
  47. * connections. Set once we've set the stream end,
  48. * and check in connection_about_to_close_connection().
  49. */
  50. /** True iff we've blocked reading until the circuit has fewer queued
  51. * cells. */
  52. unsigned int edge_blocked_on_circ:1;
  53. /** Unique ID for directory requests; this used to be in connection_t, but
  54. * that's going away and being used on channels instead. We still tag
  55. * edge connections with dirreq_id from circuits, so it's copied here. */
  56. uint64_t dirreq_id;
  57. };
  58. #endif