summaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2012-10-09 00:51:33 -0700
committerAndrea Shepard <andrea@torproject.org>2012-10-09 23:19:53 -0700
commit3f4b95b1a32787464b5877c7d21474801d4b944c (patch)
tree59e85b1f8a9cb3d12e0d4e6af416ac97657d0d6f /src/or/or.h
parent6391f963fb1ff9988d048397cd054b65ff5a52ff (diff)
downloadtor-3f4b95b1a32787464b5877c7d21474801d4b944c.tar.gz
tor-3f4b95b1a32787464b5877c7d21474801d4b944c.zip
Split channel_t into channel_t and channel_listener_t; get rid of that big union
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h65
1 files changed, 53 insertions, 12 deletions
diff --git a/src/or/or.h b/src/or/or.h
index 4d2ab21d7d..5987eefd88 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -883,6 +883,10 @@ typedef uint16_t streamid_t;
typedef struct channel_s channel_t;
+/* channel_listener_t typedef; struct channel_listener_s is in channel.h */
+
+typedef struct channel_listener_s channel_listener_t;
+
/* channel states for channel_t */
typedef enum {
@@ -892,21 +896,10 @@ typedef enum {
* Permitted transitions from:
* - CHANNEL_STATE_CLOSING
* Permitted transitions to:
- * - CHANNEL_STATE_LISTENING
* - CHANNEL_STATE_OPENING
*/
CHANNEL_STATE_CLOSED = 0,
/*
- * Listening state - channel is listening for incoming connections
- *
- * Permitted transitions from:
- * - CHANNEL_STATE_CLOSED
- * Permitted transitions to:
- * - CHANNEL_STATE_CLOSING
- * - CHANNEL_STATE_ERROR
- */
- CHANNEL_STATE_LISTENING,
- /*
* Opening state - channel is trying to connect
*
* Permitted transitions from:
@@ -957,7 +950,6 @@ typedef enum {
*
* Permitted transitions from:
* - CHANNEL_STATE_CLOSING
- * - CHANNEL_STATE_LISTENING
* - CHANNEL_STATE_MAINT
* - CHANNEL_STATE_OPENING
* - CHANNEL_STATE_OPEN
@@ -971,6 +963,55 @@ typedef enum {
CHANNEL_STATE_LAST
} channel_state_t;
+/* channel listener states for channel_listener_t */
+
+typedef enum {
+ /*
+ * Closed state - channel listener is inactive
+ *
+ * Permitted transitions from:
+ * - CHANNEL_LISTENER_STATE_CLOSING
+ * Permitted transitions to:
+ * - CHANNEL_LISTENER_STATE_LISTENING
+ */
+ CHANNEL_LISTENER_STATE_CLOSED = 0,
+ /*
+ * Listening state - channel listener is listening for incoming
+ * connections
+ *
+ * Permitted transitions from:
+ * - CHANNEL_LISTENER_STATE_CLOSED
+ * Permitted transitions to:
+ * - CHANNEL_LISTENER_STATE_CLOSING
+ * - CHANNEL_LISTENER_STATE_ERROR
+ */
+ CHANNEL_LISTENER_STATE_LISTENING,
+ /*
+ * Closing state - channel listener is shutting down
+ *
+ * Permitted transitions from:
+ * - CHANNEL_LISTENER_STATE_LISTENING
+ * Permitted transitions to:
+ * - CHANNEL_LISTENER_STATE_CLOSED,
+ * - CHANNEL_LISTENER_STATE_ERROR
+ */
+ CHANNEL_LISTENER_STATE_CLOSING,
+ /*
+ * Error state - channel listener has experienced a permanent error
+ *
+ * Permitted transitions from:
+ * - CHANNEL_STATE_CLOSING
+ * - CHANNEL_STATE_LISTENING
+ * Permitted transitions to:
+ * - None
+ */
+ CHANNEL_LISTENER_STATE_ERROR,
+ /*
+ * Placeholder for maximum state value
+ */
+ CHANNEL_LISTENER_STATE_LAST
+} channel_listener_state_t;
+
/* TLS channel stuff */
typedef struct channel_tls_s channel_tls_t;