diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-12-01 08:09:48 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-12-01 08:09:48 +0000 |
commit | d8ad247dfdea0705de2990af68026cdf6da22430 (patch) | |
tree | 91be989c484e6ae0857cfe08f4e295a919921771 /src/common/tortls.c | |
parent | 1789f94668f8da029d18efb51bc3d0652488f706 (diff) | |
download | tor-d8ad247dfdea0705de2990af68026cdf6da22430.tar.gz tor-d8ad247dfdea0705de2990af68026cdf6da22430.zip |
r15088@tombo: nickm | 2007-11-30 23:47:29 -0500
Add support to get a callback invoked when the client renegotiate a connection. Also, make clients renegotiate. (not enabled yet, until they detect that the server acted like a v2 server)
svn:r12623
Diffstat (limited to 'src/common/tortls.c')
-rw-r--r-- | src/common/tortls.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c index 8949c3b0d4..8c2ee932af 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -70,6 +70,8 @@ struct tor_tls_t { * time. */ unsigned long last_write_count; unsigned long last_read_count; + void (*negotiated_callback)(tor_tls_t *tls, void *arg); + void *callback_arg; }; static void tor_tls_context_decref(tor_tls_context_t *ctx); @@ -606,6 +608,16 @@ tor_tls_new(int sock, int isServer) return result; } +/**DOCDOC*/ +void +tor_tls_set_renegotiate_callback(tor_tls_t *tls, + void (*cb)(tor_tls_t *, void *arg), + void *arg) +{ + tls->negotiated_callback = cb; + tls->callback_arg = arg; +} + /** Return whether this tls initiated the connect (client) or * received it (server). */ int @@ -624,6 +636,7 @@ tor_tls_free(tor_tls_t *tls) tor_assert(tls && tls->ssl); SSL_free(tls->ssl); tls->ssl = NULL; + tls->negotiated_callback = NULL; if (tls->context) tor_tls_context_decref(tls->context); tor_free(tls); @@ -648,7 +661,8 @@ tor_tls_read(tor_tls_t *tls, char *cp, size_t len) tls->hadCert = 1; /* New certificate! */ log_info(LD_NET, "Got a TLS renegotiation."); - /* XXXX020 call some kind of 'there was a renegotiation' callback. */ + if (tls->negotiated_callback) + tls->negotiated_callback(tls, tls->callback_arg); } #endif return r; |