changeset 1219:8a5eb6550111

Constants used in communication is refactored to a new file.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 06 Oct 2009 10:04:36 +0200
parents c43b0e520aba
children 5a815629d825
files viff/active.py viff/constants.py viff/paillier.py viff/runtime.py viff/test/test_runtime.py
diffstat 5 files changed, 32 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/viff/active.py	Tue Oct 06 10:04:20 2009 +0200
+++ b/viff/active.py	Tue Oct 06 10:04:36 2009 +0200
@@ -28,7 +28,7 @@
 from viff.matrix import Matrix, hyper
 from viff.passive import PassiveRuntime
 from viff.runtime import Share, preprocess, gather_shares
-from viff.runtime import ECHO, READY, SEND
+from viff.constants import ECHO, READY, SEND
 
 
 class BrachaBroadcastMixin:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/viff/constants.py	Tue Oct 06 10:04:36 2009 +0200
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright 2009 VIFF Development Team.
+#
+# This file is part of VIFF, the Virtual Ideal Functionality Framework.
+#
+# VIFF is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License (LGPL) as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# VIFF is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with VIFF. If not, see <http://www.gnu.org/licenses/>.
+
+__docformat__ = "restructuredtext"
+
+# Constants used for communication.
+SHARE    = 0
+ECHO     = 1
+READY    = 2
+SEND     = 3
+PAILLIER = 4
--- a/viff/paillier.py	Tue Oct 06 10:04:20 2009 +0200
+++ b/viff/paillier.py	Tue Oct 06 10:04:36 2009 +0200
@@ -28,7 +28,7 @@
 import gmpy
 
 from viff.runtime import Runtime, Share, gather_shares
-from viff.runtime import PAILLIER
+from viff.constants import PAILLIER
 from viff.util import rand, find_random_prime
 
 def L(u, n):
--- a/viff/runtime.py	Tue Oct 06 10:04:20 2009 +0200
+++ b/viff/runtime.py	Tue Oct 06 10:04:36 2009 +0200
@@ -41,6 +41,7 @@
 
 from viff.field import GF256, FieldElement
 from viff.util import wrapper, rand, deep_wait, track_memory_usage, begin, end
+from viff.constants import SHARE
 import viff.reactor
 
 from twisted.internet import reactor
@@ -51,13 +52,6 @@
 from twisted.internet.protocol import ReconnectingClientFactory, ServerFactory
 from twisted.protocols.basic import Int16StringReceiver
 
-# Constants used by ShareExchanger.
-SHARE    = 0
-ECHO     = 1
-READY    = 2
-SEND     = 3
-PAILLIER = 4
-
 
 class Share(Deferred):
     """A shared number.
--- a/viff/test/test_runtime.py	Tue Oct 06 10:04:20 2009 +0200
+++ b/viff/test/test_runtime.py	Tue Oct 06 10:04:36 2009 +0200
@@ -30,7 +30,8 @@
 from twisted.internet.defer import gatherResults, Deferred, DeferredList
 
 from viff.field import GF256
-from viff.runtime import Share, SHARE
+from viff.runtime import Share
+from viff.constants import SHARE
 from viff.comparison import Toft05Runtime
 from viff.test.util import RuntimeTestCase, BinaryOperatorTestCase, protocol