changeset 1164:a9119cc75e11

Document the ShareExchanger.sendData method.
author Martin Geisler <mg@cs.au.dk>
date Wed, 15 Apr 2009 00:15:48 +0200
parents 65cce3c355a0
children facf3b6060db
files viff/runtime.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/viff/runtime.py	Wed Apr 15 00:07:07 2009 +0200
+++ b/viff/runtime.py	Wed Apr 15 00:15:48 2009 +0200
@@ -322,6 +322,21 @@
                 deq.append(data)
 
     def sendData(self, program_counter, data_type, data):
+        """Send data to the peer.
+
+        The *program_counter* is a tuple of unsigned integers, the
+        *data_type* is an unsigned byte and *data* is a string.
+
+        The data is encoded as follows::
+
+          +---------+-----------+-----------+--------+--------------+
+          | pc_size | data_size | data_type |   pc   |     data     |
+          +---------+-----------+-----------+--------+--------------+
+            2 bytes   2 bytes     1 byte      varies      varies
+
+        The program counter takes up 4 * ``pc_size`` bytes, the data
+        takes up ``data_size`` bytes.
+        """
         pc_size = len(program_counter)
         data_size = len(data)
         fmt = "!HHB%dI%ds" % (pc_size, data_size)