summaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-01-15 21:13:37 +0000
committerNick Mathewson <nickm@torproject.org>2007-01-15 21:13:37 +0000
commitead35ef9440a4d20a559441b2c6779954d3c02d5 (patch)
tree6d991739d5cda23ccd4c3d36bb4c8945a0bb3fb7 /src/or/or.h
parent299730e0b684f7a910a45d94528701a84dc591a6 (diff)
downloadtor-ead35ef9440a4d20a559441b2c6779954d3c02d5.tar.gz
tor-ead35ef9440a4d20a559441b2c6779954d3c02d5.zip
r11957@Kushana: nickm | 2007-01-15 15:25:57 -0500
Patch from Mike Perry: Track reasons for OR connection failure; display them in control events. Needs review and revision. svn:r9354
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/or/or.h b/src/or/or.h
index d63f4603ac..bbbe720682 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -476,6 +476,16 @@ typedef enum {
#define RELAY_COMMAND_RENDEZVOUS_ESTABLISHED 39
#define RELAY_COMMAND_INTRODUCE_ACK 40
+/* Reasons why an OR connection is closed */
+#define END_OR_CONN_REASON_DONE 1
+#define END_OR_CONN_REASON_TCP_REFUSED 2
+#define END_OR_CONN_REASON_OR_IDENTITY 3
+#define END_OR_CONN_REASON_TLS_CONNRESET 4 /* tls connection reset by peer */
+#define END_OR_CONN_REASON_TLS_TIMEOUT 5
+#define END_OR_CONN_REASON_TLS_NO_ROUTE 6 /* no route to host/net */
+#define END_OR_CONN_REASON_TLS_IO_ERROR 7 /* tls read/write error */
+#define END_OR_CONN_REASON_TLS_MISC 8
+
/* Reasons why we (or a remote OR) might close a stream. See tor-spec.txt for
* documentation of these. */
#define END_STREAM_REASON_MISC 1
@@ -723,6 +733,7 @@ typedef struct or_connection_t {
char *nickname; /**< Nickname of OR on other side (if any). */
tor_tls_t *tls; /**< TLS connection state */
+ int tls_error; /**< Last tor_tls error code */
time_t timestamp_lastempty; /**< When was the outbuf last completely empty?*/
@@ -837,7 +848,7 @@ typedef struct control_connection_t {
} control_connection_t;
/** Cast a connection_t subtype pointer to a connection_t **/
-#define TO_CONN(c) &(((c)->_base))
+#define TO_CONN(c) (&(((c)->_base)))
/** Helper macro: Given a pointer to to._base, of type from*, return &to. */
#define DOWNCAST(to, ptr) \
(to*) (((char*)(ptr)) - STRUCT_OFFSET(to, _base))
@@ -2150,6 +2161,7 @@ void connection_or_write_cell_to_buf(const cell_t *cell,
or_connection_t *conn);
int connection_or_send_destroy(uint16_t circ_id, or_connection_t *conn,
int reason);
+int connection_or_count_pending_circs(or_connection_t *or_conn);
/********************************* control.c ***************************/
@@ -2216,8 +2228,9 @@ int control_event_circuit_status(origin_circuit_t *circ,
int control_event_stream_status(edge_connection_t *conn,
stream_status_event_t e,
int reason);
+int control_tls_error_to_reason(int e);
int control_event_or_conn_status(or_connection_t *conn,
- or_conn_status_event_t e);
+ or_conn_status_event_t e, int reason);
int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written);
void control_event_logmsg(int severity, unsigned int domain, const char *msg);
int control_event_descriptors_changed(smartlist_t *routers);