aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-01-13 01:19:02 +0000
committerNick Mathewson <nickm@torproject.org>2004-01-13 01:19:02 +0000
commit793c65e60fa0cf4be6cde6b6011d12291e92a969 (patch)
tree00307fb04c747a5f21466f4d1a06ba50ce195a75 /src/common
parent20aca03df26d3594ad4d90fb0183a6f87f6d67b6 (diff)
downloadtor-793c65e60fa0cf4be6cde6b6011d12291e92a969.tar
tor-793c65e60fa0cf4be6cde6b6011d12291e92a969.tar.gz
Note discrepency between N bytes transmitted over TLS and actual bandwidth use; add 2 functions to help resolve.
svn:r986
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tortls.c13
-rw-r--r--src/common/tortls.h3
2 files changed, 15 insertions, 1 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 89009ea13..e604247bb 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -52,7 +52,6 @@ static int tls_library_is_initialized = 0;
#define _TOR_TLS_SYSCALL -6
#define _TOR_TLS_ZERORETURN -5
-
/* These functions are declared in crypto.c but not exported. */
EVP_PKEY *_crypto_pk_env_get_evp_pkey(crypto_pk_env_t *env);
crypto_pk_env_t *_crypto_new_pk_env_rsa(RSA *rsa);
@@ -571,3 +570,15 @@ tor_tls_get_pending_bytes(tor_tls *tls)
assert(tls);
return SSL_pending(tls->ssl);
}
+
+/* Return the number of bytes read across the underlying socket. */
+unsigned long tor_tls_get_n_bytes_read(tor_tls *tls)
+{
+ assert(tls);
+ return BIO_number_read(SSL_get_rbio(tls->ssl));
+}
+unsigned long tor_tls_get_n_bytes_written(tor_tls *tls)
+{
+ assert(tls);
+ return BIO_number_written(SSL_get_wbio(tls->ssl));
+}
diff --git a/src/common/tortls.h b/src/common/tortls.h
index fdfa16192..14dd3dda4 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -29,4 +29,7 @@ int tor_tls_handshake(tor_tls *tls);
int tor_tls_shutdown(tor_tls *tls);
int tor_tls_get_pending_bytes(tor_tls *tls);
+unsigned long tor_tls_get_n_bytes_read(tor_tls *tls);
+unsigned long tor_tls_get_n_bytes_written(tor_tls *tls);
+
#endif