Tor  0.4.6.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-2020, 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) */
edge_connection_t::stream_id
streamid_t stream_id
Definition: edge_connection_st.h:47
edge_connection_t::cpath_layer
struct crypt_path_t * cpath_layer
Definition: edge_connection_st.h:35
edge_connection_t::address_ttl
uint32_t address_ttl
Definition: edge_connection_st.h:42
edge_connection_t::edge_has_sent_end
unsigned int edge_has_sent_end
Definition: edge_connection_st.h:64
edge_connection_t::edge_blocked_on_circ
unsigned int edge_blocked_on_circ
Definition: edge_connection_st.h:70
edge_connection_t::n_read
uint32_t n_read
Definition: edge_connection_st.h:54
edge_connection_t::end_reason
uint16_t end_reason
Definition: edge_connection_st.h:51
crypt_path_t
Definition: crypt_path_st.h:47
edge_connection_t::is_reverse_dns_lookup
unsigned int is_reverse_dns_lookup
Definition: edge_connection_st.h:62
edge_connection_t::package_window
int package_window
Definition: edge_connection_st.h:26
circuit_t
Definition: circuit_st.h:61
edge_connection_t::deliver_window
int deliver_window
Definition: edge_connection_st.h:28
edge_connection_t::is_dns_request
unsigned int is_dns_request
Definition: edge_connection_st.h:60
connection_t
Definition: connection_st.h:45
edge_connection_t::on_circuit
struct circuit_t * on_circuit
Definition: edge_connection_st.h:30
connection_st.h
Base connection structure.
edge_connection_t
Definition: edge_connection_st.h:21
streamid_t
uint16_t streamid_t
Definition: or.h:491
edge_connection_t::n_written
uint32_t n_written
Definition: edge_connection_st.h:57
hs_ident_edge_conn_t
Definition: hs_ident.h:103
edge_connection_t::dirreq_id
uint64_t dirreq_id
Definition: edge_connection_st.h:75
edge_connection_t::next_stream
struct edge_connection_t * next_stream
Definition: edge_connection_st.h:24
or.h
Master header file for Tor-specific functionality.