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