diff options
author | Andrea Shepard <andrea@torproject.org> | 2012-10-09 14:16:51 -0700 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2012-10-09 23:19:53 -0700 |
commit | bddfb9ffa85a0fe73545fb231a0847c4101758c1 (patch) | |
tree | 381d051786cadc514732cf93f73f52dbdb1cc003 /src/or/channeltls.h | |
parent | f00b44ef8c82eb52fad19fd2218f485f1c5aceca (diff) | |
download | tor-bddfb9ffa85a0fe73545fb231a0847c4101758c1.tar.gz tor-bddfb9ffa85a0fe73545fb231a0847c4101758c1.zip |
Add magic number for type-checking channel casts
Diffstat (limited to 'src/or/channeltls.h')
-rw-r--r-- | src/or/channeltls.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/channeltls.h b/src/or/channeltls.h index b38e12adcc..ca2fc88940 100644 --- a/src/or/channeltls.h +++ b/src/or/channeltls.h @@ -12,8 +12,10 @@ #include "or.h" #include "channel.h" -#define BASE_CHAN_TO_TLS(c) ((channel_tls_t *)(c)) -#define TLS_CHAN_TO_BASE(c) ((channel_t *)(c)) +#define BASE_CHAN_TO_TLS(c) (channel_tls_from_base((c))) +#define TLS_CHAN_TO_BASE(c) (channel_tls_to_base((c))) + +#define TLS_CHAN_MAGIC 0x8a192427U #ifdef _TOR_CHANNEL_INTERNAL @@ -32,6 +34,11 @@ channel_listener_t * channel_tls_get_listener(void); channel_listener_t * channel_tls_start_listener(void); channel_t * channel_tls_handle_incoming(or_connection_t *orconn); +/* Casts */ + +channel_t * channel_tls_to_base(channel_tls_t *tlschan); +channel_tls_t * channel_tls_from_base(channel_t *chan); + /* Things for connection_or.c to call back into */ ssize_t channel_tls_flush_some_cells(channel_tls_t *chan, ssize_t num_cells); int channel_tls_more_to_flush(channel_tls_t *chan); |