Re: [dtn-interest] new i-d on sdnvs

Wesley Eddy <weddy@grc.nasa.gov> Mon, 24 April 2006 15:59 UTC

Received: from mx2.grc.nasa.gov (mx2.grc.nasa.gov [128.156.11.69]) by webbie.berkeley.intel-research.net (8.11.6/8.11.6) with ESMTP id k3OFx9g03047 for <dtn-interest@mailman.dtnrg.org>; Mon, 24 Apr 2006 08:59:09 -0700
Received: from lombok-fi.grc.nasa.gov (seraph1.grc.nasa.gov [128.156.10.10]) by mx2.grc.nasa.gov (Postfix) with ESMTP id B4DAEC22E for <dtn-interest@mailman.dtnrg.org>; Mon, 24 Apr 2006 11:59:03 -0400 (EDT)
Received: from apataki.grc.nasa.gov (apataki.grc.nasa.gov [139.88.112.35]) by lombok-fi.grc.nasa.gov (NASA GRC TCPD 8.13.6/8.13.6) with ESMTP id k3OFx2SA003977; Mon, 24 Apr 2006 11:59:02 -0400 (EDT)
Received: from localhost (localhost [127.0.0.1]) by apataki.grc.nasa.gov (NASA GRC TCPD 8.13.6/8.13.1) with ESMTP id k3OFx2NV007892; Mon, 24 Apr 2006 11:59:02 -0400 (EDT)
Received: from apataki.grc.nasa.gov ([127.0.0.1]) by localhost (apataki.grc.nasa.gov [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05086-16; Mon, 24 Apr 2006 11:58:59 -0400 (EDT)
Received: from drpepper.grc.nasa.gov (gr2134391.grc.nasa.gov [139.88.44.123]) by apataki.grc.nasa.gov (NASA GRC TCPD 8.13.6/8.13.1) with ESMTP id k3OFwsgm007813; Mon, 24 Apr 2006 11:58:54 -0400 (EDT)
Received: by drpepper.grc.nasa.gov (Postfix, from userid 501) id E1D2C4FC33; Mon, 24 Apr 2006 11:57:11 -0400 (EDT)
Date: Mon, 24 Apr 2006 11:57:11 -0400
From: Wesley Eddy <weddy@grc.nasa.gov>
To: Gerardo Izquierdo <gcadalso@gmail.com>
Cc: dtn-interest@mailman.dtnrg.org
Subject: Re: [dtn-interest] new i-d on sdnvs
Message-ID: <20060424155711.GA499@grc.nasa.gov>
Reply-To: weddy@grc.nasa.gov
References: <20060421130251.GC28431@grc.nasa.gov> <cbdb04b70604240828p7af7b0efw3bf4e70e9750758d@mail.gmail.com>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe"
Content-Disposition: inline
In-Reply-To: <cbdb04b70604240828p7af7b0efw3bf4e70e9750758d@mail.gmail.com>
User-Agent: Mutt/1.5.5.1i
Sender: dtn-interest-admin@mailman.dtnrg.org
Errors-To: dtn-interest-admin@mailman.dtnrg.org
X-BeenThere: dtn-interest@mailman.dtnrg.org
X-Mailman-Version: 2.0.13
Precedence: bulk
List-Unsubscribe: <http://mailman.dtnrg.org/mailman/listinfo/dtn-interest>, <mailto:dtn-interest-request@mailman.dtnrg.org?subject=unsubscribe>
List-Id: Delay Tolerant Networking Interest List <dtn-interest.mailman.dtnrg.org>
List-Post: <mailto:dtn-interest@mailman.dtnrg.org>
List-Help: <mailto:dtn-interest-request@mailman.dtnrg.org?subject=help>
List-Subscribe: <http://mailman.dtnrg.org/mailman/listinfo/dtn-interest>, <mailto:dtn-interest-request@mailman.dtnrg.org?subject=subscribe>
List-Archive: <http://mailman.dtnrg.org/pipermail/dtn-interest/>

On Mon, Apr 24, 2006 at 05:28:43PM +0200, Gerardo Izquierdo wrote:
> I think the python Source Code about SNDV is  a bit incorrect

You're right, thanks.  I think maybe the draft should state that the code
is just for demonstration purposes, and that (for example) the C++ SDNV
code in the DTN2 implementation should more similar to what people actually
use in production.  That said, it is also important the the code be correct
in this document.
 
> sdnv_encode does not encode well the value 0 (0x00), it returns an empty
> string
> 
> I haven't never programmed in python, but I think we should add a line just
> before the
> return r
> 
> 
> if type(n) == type(1) and n = 0:
>    r = chr (0x00)
>

Instead of doing this, I changed the looping construct to always execute
at least once:
    done = False
    while not done:
      # encode lowest 7 bits from n
      newbits = n & 0x7F
      n = n>>7
      r = chr(newbits + flag) + r
      if flag == 0:
        flag = 0x80
      if n == 0:
        done = True


> also, there is no reference to the optional parameter slen in sdnv_decode
> but in the parameter declaration.

The line:
    elif i == len(s)-1:
should be:
    elif i == len(s)-1 or i > slen:

These will be fixed in the next update.  Thanks.

-Wes

-- 
Wesley M. Eddy
Verizon Federal Network Systems