[Nym3-commit] r114 - in trunk: . nym3

nym3-devel@lists.noreply.org nym3-devel@lists.noreply.org
Wed, 18 Aug 2004 22:57:26 +0200


Author: jr
Date: 2004-08-18 22:57:25 +0200 (Wed, 18 Aug 2004)
New Revision: 114

Removed:
   trunk/COPYING
   trunk/Client/
   trunk/Common.py
   trunk/Crypto.py
   trunk/Mail.py
   trunk/Message.py
   trunk/README
   trunk/Server/
   trunk/TODO
   trunk/doc/
Modified:
   trunk/nym3/Message.py
Log:
delete what is not in nym3


Deleted: trunk/COPYING
===================================================================
--- trunk/COPYING	2004-08-18 20:53:38 UTC (rev 113)
+++ trunk/COPYING	2004-08-18 20:57:25 UTC (rev 114)
@@ -1,340 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program 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 General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.

Deleted: trunk/Common.py
===================================================================
--- trunk/Common.py	2004-08-18 20:53:38 UTC (rev 113)
+++ trunk/Common.py	2004-08-18 20:57:25 UTC (rev 114)
@@ -1,14 +0,0 @@
-# $Id$
-
-#constants
-surbLength = 2104
-sigLength = 256
-seqNoLength = 20
-midLength = 20
-
-userPolicy = ["SendMsgAfter", "SendSummaryAfter", "EncryptSummaryAfter",
-              "MaxSURBsPerDay", "HoldSURBs", "HoldUntilAck",
-              "ShutdownPhrase"] 
-
-lifeCycle = { 'nothing-sent' : 0, 'synopsis-sent' : 1,
-              'sent-in-full' : 2, 'deleted' : 3 }

Deleted: trunk/Crypto.py
===================================================================
--- trunk/Crypto.py	2004-08-18 20:53:38 UTC (rev 113)
+++ trunk/Crypto.py	2004-08-18 20:57:25 UTC (rev 114)
@@ -1,22 +0,0 @@
-import random
-from mixminion.Packet import compressData, OAEP_OVERHEAD
-import mixminion.Crypto as _cr
-
-def nym_encrypt(data, key):
-    n = nbBits(_cr.pk_get_modulus(key)) / 8
-    assert n == 128 or n == 256
-    dataC = compressData(data)
-    paddingLen = len(dataC) - (len(dataC) / 128) * 128
-    if paddingLen != 0:
-        paddingLen = 128 - paddingLen
-    dataP = dataC + '0'*paddingLen
-    k = ""
-    for i in range(0, 20):
-        k = k + chr(random.randint(0, 255))
-    K = _cr.Keyset(k)
-    dataE = _cr.lioness_encrypt(dataP, K.getLionessKeys(""))
-    #42 : taille du padding introduit par OAEP
-    #20 : taille de k
-    rsaLen = n - OAEP_OVERHEAD - 20
-    rsaPart = pk_encrypt(k + dataE[0:rsaLen],key)
-    return rsaPart + dataEnc[rsaLen:]

Deleted: trunk/Mail.py
===================================================================
--- trunk/Mail.py	2004-08-18 20:53:38 UTC (rev 113)
+++ trunk/Mail.py	2004-08-18 20:57:25 UTC (rev 114)
@@ -1,102 +0,0 @@
-# $Id$
-
-import re
-import os
-import tempfile
-import random
-import base64
-import string
-import Common
-import Config
-
-slen = 180
-midLen = Common.midLength
-random.seed(None)
-oldestMid = chr(0) * midLen
-
-
-def synopsize(msg):
-    vheaders = [ 'Cc', 'From', 'Date', 'In-Reply-To', 'Sender',
-		 'Message-Id', 'References', 'Return-Path', 'Subject',
-		 'To', 'X-Anonymous', 'X-Spam-Level']
-    a = re.search("""\n\n""", msg)
-    if a:
-	headers = msg[0 : a.start(0)]
-	body = msg[a.start(0) + 1: a.start(0) + slen]
-    else:
-	headers = msg
-	body = ''
-    res = ''
-    for i in vheaders:
-	a = re.search('^(' + i + ':.*)$', headers, re.M)
-	if a:
-	    res = res + a.group(1)[0:80] + "\n" # TODO : append?
-	
-    return res + 'X-Octets: ' + repr(len(msg)) + "\n" + body
-
-def myWrite(f, m):
-    def aux(m, l):
-        w = os.write(f,m)
-        aux(m[w:], l-w)
-    aux(m, len(m))
-
-def tmpFileMsg(body):
-    """write body in a temp file name and return a file name of this file
-    """
-    (fd, fname) = tempfile.mkstemp()
-    myWrite(f,body)
-    os.close(fd)
-    return fname
-	
-    
-
-def bf(l):
-    """take a list of index and generate a bitfield
-    the k-bit is set to 1 if k is in l
-    the bitfield is a 2 octets big endian string
-    """
-    t=[0,0]
-    for k in [x for x in l if x<16 and x >=0]:
-        (q,r)=divmod(k,8)
-        t[q] = t[q] | (1 << r)
-    return chr(t[0])+chr(t[1])
-
-def b2s(c):
-    """return a string of length 2 representing the byte c in hex"""
-    i = ord(c)
-    (q, r) = divmod(i, 16)
-    return hex(q)[2:] + hex(r)[2:]
-
-def relay(nym,rt,ri,body):
-    """relay the e-mail in body according to the routing type rt
-    and the routing info ri for the nymholder of nym"""
-    b = 'From: ' + nym + '@' + Config.serverName + "\n" + body
-    fname = tmpFileMsg(b) #TODO we can avoid the tempfile with some fd manipultation : exec mixminion, write b in its stdin
-    ec = os.system("mixminion -t 0x" + b2s(rt[1]) + b2s(rt[0]) + ":" + ri + " -i " + fname)
-    os.unlink(fname)
-    return ec
-                   
-def genMid(length = midLen):
-    ret = oldestMid
-    while ret == oldestMid:
-	res = ""
-	for i in range(0, length): res = res + chr(random.randint(0, 255))
-	ret = res
-    return ret
-
-def mid2filename(mid):
-    res = base64.encodestring(mid)
-    res = res.replace('/', '_')
-    res = string.strip(res)
-    return res
-
-def filename2mid(mid):
-    res = mid
-    res = res.replace('_', '/')
-    res = base64.decodestring(mid)
-    return res
-
-if __name__ == '__main__':
-    import sys
-    print synopsize(sys.stdin.read())
-    print "And now, a random encoded mid: " + mid2filename(genMid(20))

Deleted: trunk/Message.py
===================================================================
--- trunk/Message.py	2004-08-18 20:53:38 UTC (rev 113)
+++ trunk/Message.py	2004-08-18 20:57:25 UTC (rev 114)
@@ -1,1095 +0,0 @@
-# $Id$
-
-import types
-import Common
-
-class ParseError(Exception):
-	"""ParseError : error raised if anything goes wrong during parsing"""
-	def __init__(self, value):
-		self.value = value
-
-	def __str__(self):
-		return repr(self.value)
-
-class BadArgument(Exception):
-	"""BadArgument : error raised if a function is given an irrelevant argument"""
-	def __init__(self, value):
-		self.value = value
-
-	def __str__(self):
-		return repr(self.value)
-
-def strToIntBE(s):
-	"""return the Int coded by the string s with the big endian convention"""
-	def aux(s, ac):
-		if(s == ""):
-			return ac
-		else:
-			return aux(s[1:], 256 * ac + ord(s[0]))
-	return aux(s, 0)
-
-def intToStrBE(n,mod):
-	"""return a string coding the n modulo 256^mod in big endian"""
-	def aux(n, ac, mod):
-		if(mod == 0):
-			return ac
-		else:
-			return aux(n / 256, chr(n % 256) + ac, mod - 1)
-	return aux(n, "", mod)
-
-def nbBits(n):
-	"""return the number of bits of a strictly positive integer,
-	0 otherwise"""
-	res = 0
-	p = 1
-	while(n >= p):
-		p = 2 * p
-		res = res + 1
-	return res
-
-def isMidList(l,n):
-	"""true if l is a list of strings of length n"""
-	def isMid(e):
-		if( len(e) == n and type(e) == types.StringType):
-			return True
-		else:
-			return False
-	lb = map(isMid, l)
-	return (reduce(lambda x, y: x and y, lb))
-
-surbLength = Common.surbLength
-sigLength = Common.sigLength
-seqNoLength = Common.seqNoLength
-midLength = Common.midLength
-
-class StrReader:
-	"""wraps a string and gives method to read it chunk by chunk"""
-	def __init__(self, s):
-	    """initialize by wrapping a string"""
-	    self.s = s
-	    self.a = 0
-	    self.b = 0
-	    
-	def isEnd(self):
-		"""True if we have read the whole string"""
-		return (b == len(s))
-
-	def next(self, n):
-		"""return the next n characters"""
-		if n < 0:
-			raise BadArgument("StrReader.next : n < 0")
-		if self.b + n > len(self.s):
-			raise IndexError("StrReader.next : n too long")
-		self.a = self.b
-		self.b = self.b + n
-		return self.s[self.a:self.b]
-
-	def readHeader(self):
-		"""Read next header from the string"""
-		h = Header()
-		h.fromStrReader(self)
-		return h
-
-	def readCommandCToS(self):
-		"""Read next CommandCToS from string"""
-		try:
-			ct = ord(self.next(1))
-			cs = strToIntBE(self.next(3))
-			if (ct == 0):
-				a = Create()
-			elif (ct == 1):
-				a = Create2()
-			elif (ct == 2):
-				a = Surb()
-			elif (ct == 3):
-				a = Newpk()
-			elif (ct == 4):
-				a = Relay()
-			elif (ct == 5):
-				a = Get()
-			elif (ct == 6):
-				a = Summarize()
-			elif (ct == 7):
-				a = Delete()
-			elif (ct == 8):
-				a = Policy()
-			else:
-				raise ParseError("Undefined Command Type")
-			a.fromStrReader(self, cs)
-			return a
-		except IndexError: #is it really necessary? is it not considered in the various fromStrReader ?
-			raise ParseError("Bad Formed Command")
-
-	def readCommandCToSList(self):
-		"""Read a list of CommandSToC from string, until
-		the string is completely read"""
-		l = []
-		while (not self.isEnd()):
-			l.append(self.readCommandCToS)
-		return l
-
-	def readCommandSToC(self):
-		"""Read next CommandSToC from string"""
-		try:
-			ct = ord(self.next(1))
-			cs = strToIntBE(self.next(3))
-			if (ct == 0):
-				a = Created()
-			elif (ct == 1):
-				a = Status()
-			elif (ct == 2):
-				a = Summary()
-			elif (ct == 3):
-				a = Msg()
-			elif (ct == 4):
-				a = Dropped()
-			elif (ct == 5):
-				a = Error()
-			else:
-				raise ParseError("Undefined Command Type")
-			a.fromStrReader(self, cs)
-			return a
-		except IndexError: #is it really necessary? is it not considered in the various fromStrReader ?
-			#it should, if not consider it a bug
-			raise ParseError("Bad Formed Command")
-
-	def readCommandSToCList(self):
-		"""Read a list of CommandSToC from string, until
-		the string is completely read"""
-		l = []
-		while (not self.isEnd()):
-			l.append(self.readCommandSToC)
-		return l
-
-	def readNym(self, start, cs):
-		"""Read a Nym length + a nym
-		Raise ParseError if it takes more characters from the string that previously advertised"""
-		nl = ord(self.next(1))
-		if(self.b + nl - start > cs):
-			raise ParseError("Bad Formed Command")
-		return self.next(nl)
-
-	def readNymList(self, start, cs):
-		"""Read a list of (Nym length + a nym)
-		Raise ParseError if it takes more characters from the string that previously advertised"""
-		try:
-			l = []
-			while(self.b < start + cs):
-				l.append(self.readNym(start, cs))
-			return l
-		except ParseError: #is it really necessary?
-			raise
-
-	def readMid(self, length, start, cs):
-		"""Read a str of len = length
-		Raise ParseError if it takes more characters from the string that previously advertised, in that case, doesn't read the StrReader"""
-		if(self.b + length - start > cs):
-			raise ParseError("Bad Formed Command")
-		return self.next(length)
-
-	def readMidList(self, length, start, cs):
-		"""Read a list of str of len length
-		Raise ParseError if it takes more characters from the string that previously advertised"""
-		try:
-			l = []
-			while(self.b < start + cs):
-				l.append(self.readMid(length, start, cs))
-			return l
-		except ParseError: #is it really necessary?
-			raise
-	
-class Header:
-	"""Header Object
-	sig : signature
-	nl : nym length
-	nym : nym
-	seqNo : sequence number which identifies the message
-	length : header length"""
-	def __init__(self):
-		"""Build a Header empty object"""
-		pass
-
-	def fromData(self, nym, seqNo, sig = ""):
-		"""Fill a Header Object from a nym and sequence number and sig if provided
-		sig : signature
-		nl : nym length
-		nym : nym
-		seqNo : sequence number which identifies the message
-		length : header length"""
-		if(len(seqNo) != seqNoLength):
-			raise BadArgument("Buildheader.__init__ : seqNo length doesn't match seqNoLength")  
-		if(sig == ""):
-			self.sig = chr(0) * sigLength
-		else:
-			if(len(sig) != sigLength):
-				raise BadArgument("Buildheader.__init__ : sig length doesn't match sigLength")	
-		self.nl = len(nym)
-		self.nym = nym
-		self.seqNo = seqNo
-		#self.length = sigLength + 1 + self.nl + seqNoLength
-
-	def __str__(self):
-		"""Give the string of the header that would be sent in a control message"""
-		return self.sig + chr(self.nl) + self.nym + self.seqNo
-
-	def fromStrReader(self,sr):
-		"""Fill a Header from a StrReader 
-		"""
-		try:
-			self.sig = sr.next(sigLength)
-			self.nl = ord(sr.next(1))
-			self.nym = sr.next(nl)
-			self.seqNo = sr.next(seqNoLength)
-		except IndexError:
-			raise ParseError("Header too short")
-
-
-## class ReadHeader(Header):
-##     def __init__(self,sr):
-##	   """builds a header from a StrReader 
-##	   sig : signature
-##	   nl : nym length
-##	   nym : nym
-##	   seqNo : sequence number which identifies the message
-##	   length : header length"""
-##	   try:
-##	       self.sig = sr.next(sigLength)
-##	       self.nl = ord(sr.next(1))
-##	       self.nym = sr.next(nl)
-##	       self.seqNo = sr.next(seqNoLength)
-##	       self.length = sr.b
-##	   except IndexError:
-##	       raise ParseError("Parse Error : Header too short")
-	
-## class BuiltHeader(Header):
-##     def __init__(self,nym,seqNo):
-##	   """Builds a header from a nym and and sequence number
-##	   sig : signature
-##	   nl : nym length
-##	   nym : nym
-##	   seqNo : sequence number which identifies the message
-##	   length : header length"""
-##	   if(len(seqNo) != seqNoLength):
-##	       raise BadArgument("Buildheader.__init__ : seqNo length doesn't match seqNoLength")  
-##	   self.sig = chr(0) * sigLength
-##	   self.nl = len(nym)
-##	   self.nym = nym
-##	   self.seqNo = seqNo
-##	   self.length = sigLength + 1 + self.nl + seqNoLength
-
-class CommandCToS:
-	"""CommandCToS astract class
-	the CommandCToS derive from this class"""
-	pass
-
-class Create(CommandCToS):
-	"""Create command
-	self.list : list of nym (liste de str)
-	self.pw : proof of work"""
-	def __init__(self):
-		"""Build a Create empty object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 0
-
-	def fromData(self, l, pw = ""):
-		"""Fill a Create Object from a list of nyms and a proof of work"""
-		if(len(l) > 255):
-			raise BadArgument("Create.fromData : len(l) too big")
-		for i in range(len(l)):
-			if(len(l[i]) > 255):
-				raise BadArgument("Create.fromData : nym too long")
-		self.list = l
-		self.pw = pw
-		#if len(pw) isn't too big, we are sure that the command size is small enough because of the size and the number of nyms 
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Create command from a StrReader
-		raise ParseError if it is malformed"""
-		start = sr.b
-		try:
-			nNym = ord(sr.next(1))
-			self.pw = "" #what is a proof of work?
-			self.list = sr.readNymList(start, cs)
-		except (ParseError, IndexError):
-			raise ParseError("Bad Formed Command : Create")
-		#nNym is redundant, we use it to make sure the message is well formed
-		if(nNym != len(self.list)):
-		   raise ParseError("Bad Formed Command : Create")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = chr(len(self.list)) + self.pw
-		for i in range(len(self.list)):
-			s = s + chr(len(self.list[i])) + self.list[i]
-		assert len(s) < pow(256, 3)
-		return chr(0) + intToStrBE(len(s), 3) + s
-		
-class Create2(CommandCToS):
-	"""Create2 command
-	self.cr : challenge response (str)"""
-	def __init__(self):
-		"""Build a Create2 empty object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 1
-
-	def fromData(self, cr):
-		"""Fill Create2 from a string containing the response to a challenge"""
-		self.cr = cr
-		#if cr is small enough we are sure that the command size is small enough
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Create2 command from a StrReader
-		raise ParseError if it is malformed"""
-		try:
-			self.cr = sr.next(cs)
-		except IndexError:
-			raise ParseError("Bad Formed Command : Create2")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = self.cr
-		assert len(s) < pow(256, 3)
-		return chr(1) + intToStrBE(len(s), 3) + s
-	
-class Surb(CommandCToS):
-	"""Surb command
-	self.surbs : set of surbs (str)"""
-	def __init__(self):
-		"""Build a Surb empty object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 2
-
-	def fromData(self, s):
-		"""Fill a Surb Object from a string containing Surbs"""
-		if(len(s) % surbLength != 0):
-			raise BadArgument("Surb.fromData : surbs have not a valid size")
-		if len(s) >= pow(256, 3):
-			raise BadArgument("Surb.fromData : command body too long")
-		self.surbs = s
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Surb Object from a StrReader
-		raise ParseError if it is malformed"""
-		if(cs % surbLength != 0):
-			raise ParseError("Bad Formed Command : Surb")
-		try:
-			self.surbs = sr.next(cs)
-		except IndexError:
-			raise ParseError("Bad Formed Command : Surb")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = self.surbs
-		assert len(s) < pow(256, 3)
-		return chr(2) + intToStrBE(len(s), 3) + s
-	
-class Newpk(CommandCToS):
-	"""Newpk command
-	self.kid : identity key RSA modulus BE encoded (str)
-	self.kenc : encryption key RSA modulus BE  encoded (str)
-	self.idf : number of bits of kid is 1024*idf
-	self.encf : number of bits of kid is 1024*encf"""
-	
-	def __init__(self):
-		"""Build a Newpk empty object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 3
-
-	def fromData(self, sid, senc):
-		"""Fill a Newpk Object from 2 modulus (int)"""
-		id_l = nbBits(sid)
-		id_l2 = nbBits(senc)
-		if( ((id_l != 1024) and (id_l != 2048)) or ( (id_l2 != 1024) and (id_l2 != 2048))):
-			raise BadArgument("Newpk.fromData : sid or senc as not a valid size")
-		self.idf = id_l / 1024
-		self.encf = id_l2 / 1024
-		self.kid = sid
-		self.kenc = senc
-		#command body is small enough
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Newpk Object from a StrReader
-		raise ParseError if it is malformed"""
-		try:
-			id_l = strToIntBE(sr.next(2))
-			if((id_l != 128) and (id_l != 256)):
-				raise ParseError("Bad Formed Command : Newpk")
-			id_l2 = cs-2 - id_l
-			if((id_l2 != 128) and (id_l2 != 256)):
-				raise ParseError("Bad Formed Command : Newpk")
-
-			self.kid = strToIntBE(sr.next(id_l))
-			self.kenc = strToIntBE(sr.next(id_l2))
-			self.idf = id_l / 128
-			self.encf = id_l2 / 128
-		except IndexError:
-			raise ParseError("Bad Formed Command : Newpk")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		#TODO check assuming len(kid)=128 or 256
-
-		s=intToStrBE(128 * self.idf, 2) + intToStrBE(self.kid, 128*self.idf) + intToStrBE(self.kenc, 128*self.encf)
-		if(len(s)>=pow(256,3)): #should not be possible, otherwise bug
-			raise BadArgument("Newpk.__str__ : command body too long")
-		return chr(3)+intToStrBE(len(s),3)+s
-	
-class Relay(CommandCToS):
-	"""Relay command
-	self.rs : routing info size (int)
-	self.rt : routing type (str of length 2)
-	self.ri : routing info (str)
-	self.body : body of the message (str)"""
-	def __init__(self):
-		"""Build a Relay empty object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 4
-
-	def fromData(self, rt, ri, body):
-		"""Fill a Relay Object from a 3 strings : routing type(2 octets) routing info and body"""
-		if len(rt) != 2:
-			raise BadArgument("Relay.fromData : RT size isn't 2 bytes")
-		self.rt = rt
-		self.rs = len(ri)
-		if self.rs >= 256 * 256:
-			raise BadArgument("Relay.fromData : RS size isn't 2 bytes")
-		self.ri = ri
-		self.body = body
-		if(4 + self.rs + len(body) >= pow(256, 3)):
-			raise BadArgument("Relay.fromData : Command body too long")
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Relay Object from a StrReader
-		raise ParseError if it is malformed"""
-		try:
-			self.rs = strToIntBE(sr.next(2))
-			self.rt = sr.next(2)
-			self.ri = sr.next(self.rs)
-			self.body = sr.next(cs - 4 - self.rs)
-		except (BadArgument, IndexError):
-			raise ParseError("Bad Formed Command : Relay")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = intToStrBE(self.rs, 2) + self.rt + self.ri + self.body
-		assert len(s) < pow(256, 3)
-		return chr(4) + intToStrBE(len(s), 3) + s
-	
-class Get(CommandCToS):
-	"""Get command
-	self.l : list of mid (list of str of len midLength)"""
-	def __init__(self):
-		"""Build a Get empty object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 5
-
-	def fromData(self, li):
-		"""Fill a Get Object from a list of message id (=string of len 20)"""
-		#check that each element of the list has 20 bytes
-		if not isMidList(li, midLength):
-			raise BadArgument("Get.fromData : li is not a list of message id")
-		self.l = li
-		if midLength * len(self.l) >= 256 ** 3:
-			raise BadArgument("Get.fromData : Command body too long")
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Get Object from a StrReader
-		raise ParseError if it is malformed"""
-		start = sr.b
-		try:
-			self.l = sr.readMidList(midLength, start, cs)
-		except (ParseError, IndexError):
-			raise ParseError("Bad Formed Command : Get")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = ""
-		for i in range(len(self.l)):
-			s = s + self.l[i]
-		assert len(s) < pow(256, 3)
-		return chr(5) + intToStrBE(len(s), 3) + s
-	
-class Summarize(CommandCToS):
-	"""Summarize command
-	self.num : maximum number of synopsis to retrieve (int)
-	self.after : mid older than the synopsese retrieved"""
-	def __init__(self):
-		"""Build a Summarize empty object"""
-		pass
-		
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 6
-
-	def fromData(self, n, m):
-		"""Fill a Summarize Object from the max number of synopsis to retrieve (int)  and the message id of a message older than the messages we want the synopsis from (string of len 20)
-		the int is considered modulo 256^2"""
-		n_mod = n % (256 * 256)
-		self.num = n_mod
-		if len(m) != midLength: # or m is not a str
-			raise BadArgument(" Summarize.fromData : m is not a valid message ID")
-		self.after = m
-		#command body is small enough
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Summarize Object from a StrReader
-		raise ParseError if it is malformed"""
-		if cs != 2 + midLength:
-			raise ParseError("Bad Formed Command : Summarize")
-		try:
-			self.num = strToIntBE(sr.next(2))
-			self.after = sr.next(midLength)
-		except IndexError:
-			raise ParseError("Bad Formed Command : Summarize")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = intToStrBE(self.num, 2) + self.after
-		assert len(s) < pow(256, 3)
-		return chr(6) + intToStrBE(len(s), 3) + s
-	
-class Delete(CommandCToS):
-	"""Delete command
-	self.l : list of mid (list of str of len midLength)"""
-	def __init__(self):
-		"""Build a Delete empty object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 7
-
-	def fromData(self, li):
-		"""Fill a Delete Object from a list of message ID (string of length midLength"""
-		#check that each element of the list has 20 bytes
-		if not isMidList(li, midLength):
-		     raise BadArgument("Delete.fromData : li is not a list of message id")
-		if midLength * len(li) >= pow(256, 3):
-		    raise BadArgument("Delete.fromData : Command body too long")
-		self.l = li
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Delete Object from a StrReader
-		raise ParseError if it is malformed"""
-		start = sr.b
-		try:
-		    self.l = sr.readMidList(midLength, start, cs)
-		except (ParseError, IndexError):
-		    raise ParseError("Bad Formed Command : Delete")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = ""
-		for i in range(len(self.l)):
-			s = s + self.l[i]
-		assert len(s) < pow(256, 3)
-		return chr(7) + intToStrBE(len(s), 3) + s
-	
-class Policy(CommandCToS):
-	"""Policy command
-	self.opt : option name (str)
-	self.val : option value (str)"""
-	def __init__(self):
-		"""Build a Policy empty object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 8
-
-	def fromData(self, opt, val):
-		"""Fill a Policy Object from 1 str : the option name
-		and its value (either a str or a int depending on the option
-		"""
-		if len(opt) > 255:
-			raise BadArgument("Policy.fromData : Option name length too big")
-		if opt in Common.userPolicy:
-			self.opt = opt
-		if opt == "SendMsgAfter":
-			if val > pow(256, 2):
-				raise BadArgument("Policy.fromData : Option value too long")
-			self.val = val
-		elif (opt == "SendSummaryAfter"):
-			if val > pow(256, 2):
-				raise BadArgument("Policy.fromData : Option value too long")
-			self.val = val
-		elif (opt == "EncryptSummaryAfter"):
-			if val > pow(256, 2):
-				raise BadArgument("Policy.fromData : Option value too long")
-			self.val = val
-		elif (opt == "MaxSURBsPerDay"):
-			if val > pow(256, 2):
-				raise BadArgument("Policy.fromData : Option value too long")
-			self.val = val
-		elif (opt == "HoldSURBs"):
-			if val > pow(256, 2):
-				raise BadArgument("Policy.fromData : Option value too long")
-			self.val = val
-		elif (opt == "HoldUntilAck"):
-			if val in [ 'never', 'quota', 'always' ]:
-				self.val = val
-		elif (opt == "ShutdownPhrase"):
-			if len(val) + 1 + len(opt) > pow(256, 3):
-				raise BadArgument("Policy.fromData : Option value too long")
-			self.val = val
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Policy Object from a StrReader
-		raise ParseError if it is malformed"""
-		try:
-			le = ord(sr.next(1))
-			self.opt = sr.next(le)
-			inter = sr.next(cs - 1 - le)
-			if(self.opt == "SendMsgAfter"):
-				if len(inter) != 2:
-					raise ParseError("Bad Formed Command : Policy")
-				self.val = strToIntBE(inter)
-			elif (self.opt == "SendSummaryAfter"):
-				if len(inter) != 2:
-					raise ParseError("Bad Formed Command : Policy")
-				self.val = strToIntBE(inter)
-			elif (self.opt == "EncryptSummaryAfter"):
-				if len(inter) != 2:
-					raise ParseError("Bad Formed Command : Policy")
-				self.val = strToIntBE(inter)
-			elif (self.opt == "MaxSURBsPerDay"):
-				if len(inter) != 2:
-					raise ParseError("Bad Formed Command : Policy")
-				self.val = strToIntBE(inter)
-			elif (self.opt == "HoldSURBs"):
-				if len(inter) != 2:
-					raise ParseError("Bad Formed Command : Policy")
-				self.val = strToIntBE(inter)
-			elif (self.opt == "HoldUntilAck"):
-				if inter in [ 'never', 'quota', 'always']:
-					self.val = inter
-			elif (self.opt == "ShutdownPhrase"):
-				self.val = inter
-		except (IndexError, BadArgument):
-			raise ParseError("Bad Formed Command : Policy")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = chr(len(self.opt)) + self.opt
-		if self.opt in Common.userPolicy[:5]:
-			s = s + intToStrBE(self.val, 2)
-		if self.opt in Common.userPolicy[5:]:
-			s = s + self.val
-		assert len(s) < pow(256, 3)
-		return chr(8) + intToStrBE(len(s), 3) + s
-		
-	
-class CommandSToC:
-	"""CommandSToC astract class
-	the CommandSToC derive from this class"""
-	pass
-
-class Created(CommandSToC):
-	"""command Created
-	self.nym : nym of the created account (str)
-	self.challenge : challenge (str)"""
-	def __init__(self):
-		"""Build a empty Created object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 0
-
-	def fromData(self, nym, ch):
-		"""Fill a Created Object from a nym(str) and a challenge(str)"""
-		if len(nym) > 255:
-			raise BadArgument("Created.fromData : nym too long")
-		if 1 + len(nym) + len(ch) >= pow(256, 3):
-			raise BadArgument("Created.fromData : challenge too long")
-		self.nym = nym
-		self.challenge = ch
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Created Object from a StrReader
-		raise ParseError if it is malformed"""
-		start = sr.b
-		try:
-			self.nym = sr.readNym(start, cs)
-			self.challenge = sr.next(cs + start - sr.b)
-		except (IndexError, ParseError, BadArgument):
-			raise ParseError("Bad Formed Command : Created")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = chr(len(self.nym)) + self.nym + self.challenge
-		assert len(s) < pow(256, 3)
-		return chr(0) + intToStrBE(len(s), 3) + s
-
-class Status(CommandSToC):
-	"""command Status
-	self.nMsg : number of email waiting (int)
-	self.nSurb : number of surbs left (int)
-	self.quota : maximum storage on nymserver in byte (int)
-	self.used : used storage in byte (int)
-	self.acks : list of seqno (list of (str of length seqNoLength))"""
-	def __init__(self):
-		"""Build a empty Status object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 1
-
-	def fromData(self, nM, nS, q, u, l):
-		"""Fill a Status Object from a number of message(int), a number of surbs(int), a quota(int), a used(int) and a sequence of seqno(list of (str of size seqNoLength)"""
-		#TODO replace the error by the taking of the maximal value?
-		if nM >= pow(256, 4):
-			raise BadArgument("Status.fromData : number of waiting e-mail too large")
-		if nM >= pow(256, 2):
-			raise BadArgument("Status.fromData : number of available surbs too large")
-		if q >= pow(256, 4):
-			raise BadArgument("Status.fromData : quota too large")
-		if u >= pow(256, 4):
-			raise BadArgument("Status.fromData : used space too large")
-		if not isMidList(l, seqNoLength):
-			raise BadArgument("Status.fromData : l is not a list of Sequence Number")
-		if 14 + seqNoLength * len(l) >= pow(256, 3):
-		# 14 ? Why not 17 or 42 ? avoid numeric litterals
-		# where possible FIXME
-			raise BadArgument("Status.fromData : l is too long")
-		self.nMsg = nM
-		self.nSurb = nS
-		self.quota = q
-		self.used = u
-		self.acks = l
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Status Object from a StrReader
-		raise ParseError if it is malformed"""
-		try:
-			start = sr.b
-			self.nMsg = strToIntBE(sr.next(4))
-			self.nSurb = strToIntBE(sr.next(2))
-			self.quota = strToIntBE(sr.next(4))
-			self.used = strToIntBE(sr.next(4))
-			self.acks = sr.readMidList(seqNoLength, start, cs)
-		except (IndexError, ParseError):
-			raise ParseError("Bad Formed Command : Status")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = intToStrBE(self.nMsg, 4) + intToStrBE(self.nSurb, 2) +\
-		    intToStrBE(self.quota, 4) + intToStrBE(self.used, 4)
-		for i in range(len(self.acks)):
-			s = s + self.acks[i]
-		assert len(s) < pow(256, 3)
-		return chr(1) + intToStrBE(len(s), 3) + s
-
-class Summary(CommandSToC):
-	"""command Summary
-	self.bf : bit field indicating which one of the synopsis as a mail
-	self.synSet : Encrypted synopses set
-	"""
-	def __init__(self):
-		"""Build a empty Summary object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 2
-
-	def fromData(self, bf, ess):
-		"""Fill a Object from bit field (str of len 2) and an encrypted set of synopses(str)"""
-		if len(bf) != 2:
-			raise BadArgument("Summary.fromData : bit field has not the good size, and size DOES matter")
-		if 2 + len(ess) >= pow(256, 3):
-			raise BadArgument("Summary.fromData : Encrypted set of synopses too long")
-		self.bf = bf
-		self.synSet = ess
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Object from a StrReader
-		raise ParseError if it is malformed"""
-		try:
-			self.bf = sr.next(2)
-			self.synSet = sr.next(cs - 2)
-		except IndexError:
-			ParseError("Bad Formed Command : Summary")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = self.bf + self.synSet
-		assert len(s) < pow(256, 3)
-		return chr(2) + intToStrBE(len(s), 3) + s
-
-class Msg(CommandSToC):
-	"""command Msg
-	self.mid : message ID (str of length midLength)
-	self.msg : encrypted email (str)
-	"""
-	def __init__(self):
-		"""Build a empty Msg object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 3
-
-	def fromData(self, mid, msg):
-		"""Fill a Msg Object from a Mid (str of length midLength) and an encrypted msg (str)"""
-		if len(mid) != midLength:
-			raise BadArgument("Msg.fromData : mid has not the good length")
-		if midLength + len(msg) >= pow(256, 3):
-			raise BadArgument("Msg.fromData : msg too long")
-		self.mid = mid
-		self.msg = msg
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Msg Object from a StrReader
-		raise ParseError if it is malformed"""
-		try:
-			start = sr.b
-			self.mid = sr.readMid(midLength, start, cs)
-			self.msg = sr.next(cs - midLength)
-		except (IndexError, ParseError):
-			raise ParseError("Bad Formed Command : Msg")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = self.mid + self.msg
-		assert len(s) < pow(256, 3)
-		return chr(3) + intToStrBE(len(s), 3) + s
-
-class Dropped(CommandSToC):
-	"""command Dropped
-	self.list : list of mid (list of (str of size midLength))
-	"""
-	def __init__(self):
-		"""Build a empty Dropped object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 4
-
-	def fromData(self, l):
-		"""Fill a Dropped Object from a list of mid"""
-		if( not isMidList(l, midLength)):
-			raise BadArgument("Dropped.fromData : l is not a list of message id")
-		if midLength * len(l) >= pow(256, 3):
-			raise BadArgument("Dropped.fromData : Command body too long")
-		self.list = l
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Dropped Object from a StrReader
-		raise ParseError if it is malformed"""
-		start = sr.b
-		try:
-			self.list = sr.readMidList(midLength, start, cs)
-		except (ParseError, IndexError):
-			raise ParseError("Bad Formed Command : Dropped")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = ""
-		for i in range(len(self.list)):
-			s = s + self.list[i]
-		assert len(s) < pow(256, 3)
-		return chr(4) + intToStrBE(len(s), 3) + s
-
-class Error(CommandSToC):
-	"""command Error
-	self.nonce : nonce from client message (str of size seqNo)
-	self.error : english langage error description (str)
-	"""
-	def __init__(self):
-		"""Build a empty Error object"""
-		pass
-
-	def ct(self):
-		"""return a int for the code of the command"""
-		return 5
-
-	def fromData(self, seqNo, error):
-		"""Fill a Object from a seqno (str of len seqNoLength) and an error message(str)"""
-		if len(seqNo) != seqNoLength:
-			raise BadArgument("Error.fromData : seqNo has not the good length")
-		if seqNoLength + len(error) >= pow(256, 3):
-			raise BadArgument("Error.fromData : msg too long")
-		self.nonce = seqNo
-		self.error = error
-
-	def fromStrReader(self, sr, cs):
-		"""Fill a Object from a StrReader
-		raise ParseError if it is malformed"""
-		try:
-			start = sr.b
-			self.mid = sr.readMid(seqNoLength, start, cs)
-			self.msg = sr.next(cs - seqNoLength)
-		except (IndexError, ParseError):
-			raise ParseError("Bad Formed Command : Error")
-
-	def __str__(self):
-		"""Give the string of the Command that would be sent in a control message"""
-		s = self.nonce + self.error
-		assert len(s) < pow(256, 3)
-		return chr(5) + intToStrBE(len(s), 3) + s
-
-def buildMessage(comList):
-	"""Turn a list of Command into a sendable message
-	"""
-	s = ""
-	for c in comList:
-		s = s + str(c)
-	
-	return s
-
-if (__name__ == '__main__'):
-	import Mail
-	l = []
-	for i in range(3):
-		l.append(Mail.genMid(length = 20))
-	H = Header()
-	H.fromData("JR", "01234567890123456789")
-	print H
-	del H
-	print "test Create"
-	C = Create()
-	C.fromData(["Lolo_", "Marsux", "Azatoth_", "Keeh"])
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-	print "test Create2"
-	C = Create2()
-	C.fromData("azertyuiop42")
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-	print "test Surb"
-	C = Surb()
-	C.fromData("-" * 2104)
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-	print "test Newpk"
-	C = Newpk()
-	C.fromData(166043335247949820064815071273366034639989291753710681801054469261751398297628983820646212658964492977698778059504084070552574143058521756622243987832034798616497725850572149696353832190479836330444809381945631021624844072571174471185526330192208148191737102653794442385041774144222636560699168166510090606307L,166043335247949820064815071273366034639989291753710681801054469261751398297628983820646212658964492977698778059504084070552574143058521756622243987832034798616497725850572149696353832190479836330444809381945631021624844072571174471185526330192208148191737102653794442385041774144222636560699168166510090606307L)
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-	print "test Relay"
-	C = Relay()
-	C.fromData("ab", "too lazy to make real ones here", "this is the body of the email. It sholud contain some kind of header, but for testing the parser, who cares?")
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-	print "test Get"
-	C = Get()
-	C.fromData(l)
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-	print "test Summarize"
-	C = Summarize()
-	C.fromData(10, l[0])
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-	print "test Delete"
-	C = Delete()
-	C.fromData(l)
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-	print "test Policy"
-	C = Policy()
-	C.fromData("HoldUntilAck", "never")
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandCToS()
-	s2 = str(D)
-	assert s1 == s2
-
-	print "test Created"
-	C = Created()
-	C.fromData("Marsux", "what is the answer to universe life and everything")
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandSToC()
-	s2 = str(D)
-	assert s1 == s2
-
-	print "test Status"
-	C = Status()
-	C.fromData(5, 10, 424242, 212121, l)
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandSToC()
-	s2 = str(D)
-	assert s1 == s2
-
-	print "test Summary"
-	C = Summary()
-	C.fromData("ab","this should be an encrypted set of synopses")
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandSToC()
-	s2 = str(D)
-	assert s1 == s2
-
-	print "test Msg"
-	C = Msg()
-	C.fromData(l[0], "Say something stupid, like, I am wearing female's underwear")
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandSToC()
-	s2 = str(D)
-	assert s1 == s2
-
-	print "test Dropped"
-	C = Dropped()
-	C.fromData(l)
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandSToC()
-	s2 = str(D)
-	assert s1 == s2
-
-	print "test Error"
-	C = Msg()
-	C.fromData(l[0], "Help! Help! I am being repressed!")
-	s1 = str(C)
-	S = StrReader(s1)
-	D = S.readCommandSToC()
-	s2 = str(D)
-	assert s1 == s2

Deleted: trunk/README
===================================================================
--- trunk/README	2004-08-18 20:53:38 UTC (rev 113)
+++ trunk/README	2004-08-18 20:57:25 UTC (rev 114)
@@ -1,20 +0,0 @@
-$Id$
-
-Nym3 is a type III nymserver written in OCaml. For more information on
-anonymity see
-
-	http://www.mixminion.net/
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program 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 General Public License for more details.
-
-The GNU General Public License is included in the file COPYING.
-Additionally if you find this software useful, we wouldn't mind if you
-sent us one pound of marzipan.

Deleted: trunk/TODO
===================================================================
--- trunk/TODO	2004-08-18 20:53:38 UTC (rev 113)
+++ trunk/TODO	2004-08-18 20:57:25 UTC (rev 114)
@@ -1,33 +0,0 @@
- $Id$
-
-Legend:
-        - Not done
-        * Top priority
-        . Partially done
-        o Done
-        D Deferred
-        X Abandoned
-
-Notes:
- - In case something brake, remember it's emag's fault.
- - Use clean_surbs after sending something through mixminion
- 
-Message.py:
- - add the print method which prints the content of a command object in a user
-   friendly form
- - do further testing once we start using the commands in the client/server
- . test the parser
- o add the __str__ method which outputs the message ready to be
-   sent
- o add the CommandSToC 
- - delete expired surbs.
- - periodically scans for emails that need to be relayed.
-
-JR:
- o look at the crypto module of mixminion
- o what is the format of the keys
- o implement encrypt a mail, a set of synopses
- - implement sign a control message
- o figure what the routing type and info (cf Command relay) are
- X check the size of an ASN.1 encoded key 
- X get a life :)

Modified: trunk/nym3/Message.py
===================================================================
--- trunk/nym3/Message.py	2004-08-18 20:53:38 UTC (rev 113)
+++ trunk/nym3/Message.py	2004-08-18 20:57:25 UTC (rev 114)
@@ -1,7 +1,7 @@
 # $Id$
 
 import types
-import Common
+import nym3.Common
 
 class ParseError(Exception):
 	"""ParseError : error raised if anything goes wrong during parsing"""