[or-cvs] Note discrepency between N bytes transmitted over TLS and a...

Nick Mathewson nickm at seul.org
Tue Jan 13 01:19:09 UTC 2004


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv2673/src/common

Modified Files:
	tortls.c tortls.h 
Log Message:
Note discrepency between N bytes transmitted over TLS and actual bandwidth use; add 2 functions to help resolve.

Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- tortls.c	17 Dec 2003 21:14:13 -0000	1.33
+++ tortls.c	13 Jan 2004 01:19:02 -0000	1.34
@@ -52,7 +52,6 @@
 #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 @@
   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));
+}

Index: tortls.h
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- tortls.h	19 Oct 2003 00:46:51 -0000	1.9
+++ tortls.h	13 Jan 2004 01:19:02 -0000	1.10
@@ -29,4 +29,7 @@
 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



More information about the tor-commits mailing list