viff

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 diff
     1.1 --- a/viff/runtime.py	Wed Apr 15 00:07:07 2009 +0200
     1.2 +++ b/viff/runtime.py	Wed Apr 15 00:15:48 2009 +0200
     1.3 @@ -322,6 +322,21 @@
     1.4                  deq.append(data)
     1.5  
     1.6      def sendData(self, program_counter, data_type, data):
     1.7 +        """Send data to the peer.
     1.8 +
     1.9 +        The *program_counter* is a tuple of unsigned integers, the
    1.10 +        *data_type* is an unsigned byte and *data* is a string.
    1.11 +
    1.12 +        The data is encoded as follows::
    1.13 +
    1.14 +          +---------+-----------+-----------+--------+--------------+
    1.15 +          | pc_size | data_size | data_type |   pc   |     data     |
    1.16 +          +---------+-----------+-----------+--------+--------------+
    1.17 +            2 bytes   2 bytes     1 byte      varies      varies
    1.18 +
    1.19 +        The program counter takes up 4 * ``pc_size`` bytes, the data
    1.20 +        takes up ``data_size`` bytes.
    1.21 +        """
    1.22          pc_size = len(program_counter)
    1.23          data_size = len(data)
    1.24          fmt = "!HHB%dI%ds" % (pc_size, data_size)