edge_connection_st.h 3.0 KB

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