[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Add functions to check # of bytes actually sent across ...



Update of /home/minion/cvsroot/src/minion/src
In directory moria.mit.edu:/tmp/cvs-serv29050/src

Modified Files:
	tls.c 
Log Message:
Add functions to check # of bytes actually sent across TCP socket

Index: tls.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/tls.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- tls.c	28 Nov 2003 04:14:05 -0000	1.31
+++ tls.c	17 Jan 2004 04:22:44 -0000	1.32
@@ -612,7 +612,6 @@
         return NULL;
 }
 
-
 static char mm_TLSSock_verify_cert_and_get_identity_pk__doc__[] =
   "verify_cert_and_get_identity_pk()\n\n"
   "Check whether all of the following conditions hold:\n"
@@ -740,6 +739,33 @@
         return Py_None;
 }
 
+static char mm_TLSSock_get_num_bytes_raw__doc__[] = 
+"tlssock.get_num_bytes_raw()\n\n"
+"DOCDOC";
+
+static PyObject*
+mm_TLSSock_get_num_bytes_raw(PyObject *self, PyObject* args, PyObject *kwargs)
+{
+        SSL *ssl;
+        long r, w;
+        PyObject *tup;
+        assert(mm_TLSSock_Check(self));
+        FAIL_IF_ARGS();
+        ssl = ((mm_TLSSock*)self)->ssl;
+        r = (long) BIO_number_read(SSL_get_rbio(ssl));
+        w = (long) BIO_number_written(SSL_get_wbio(ssl));
+
+        if (!(tup = PyTuple_New(2))) {
+                PyErr_NoMemory();
+                return NULL;
+        }
+        PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(r));
+        PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(w));
+
+        return tup;
+}
+
+
 #if 0
 static char mm_TLSSock_get_num_renegotiations__doc__[] =
 "tlssock.get_num_renegotiations()\n\n";
@@ -771,6 +797,7 @@
         METHOD(mm_TLSSock, fileno),
         METHOD(mm_TLSSock, do_handshake),
         METHOD(mm_TLSSock, renegotiate),
+        METHOD(mm_TLSSock, get_num_bytes_raw),
 #if 0
         METHOD(mm_TLSSock, get_num_renegotiations),
 #endif