Re: [dtn-interest] new i-d on sdnvs
"Gerardo Izquierdo" <gcadalso@gmail.com> Tue, 25 April 2006 08:46 UTC
Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.190]) by webbie.berkeley.intel-research.net (8.11.6/8.11.6) with ESMTP id k3P8kNg09405 for <dtn-interest@mailman.dtnrg.org>; Tue, 25 Apr 2006 01:46:23 -0700
Received: by nproxy.gmail.com with SMTP id o63so904513nfa for <dtn-interest@mailman.dtnrg.org>; Tue, 25 Apr 2006 01:46:21 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=J9fdnjWkVdjsjgMfo68cN+gPBdCAvmdkyRG0iNTVG1NTFejZ1ZL7nE+WRI6ZgZIztrSarqgNibiuhjlbG1ovQAcRdtUzt5xBVylK+5+aBBMSRpXPJJuq/vJJBVzZkWlLO3EVxheMAY0HYRnky35fxRStn79Y6TnjQ3hhbUNtsqY=
Received: by 10.49.38.10 with SMTP id q10mr3446320nfj; Tue, 25 Apr 2006 01:46:21 -0700 (PDT)
Received: by 10.48.241.16 with HTTP; Tue, 25 Apr 2006 01:46:21 -0700 (PDT)
Message-ID: <cbdb04b70604250146y45f73ebfvf4cd0192453cd944@mail.gmail.com>
Date: Tue, 25 Apr 2006 10:46:21 +0200
From: Gerardo Izquierdo <gcadalso@gmail.com>
To: dtn-interest@mailman.dtnrg.org
Subject: Re: [dtn-interest] new i-d on sdnvs
In-Reply-To: <20060424155711.GA499@grc.nasa.gov>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_Part_30255_8221008.1145954781606"
References: <20060421130251.GC28431@grc.nasa.gov> <cbdb04b70604240828p7af7b0efw3bf4e70e9750758d@mail.gmail.com> <20060424155711.GA499@grc.nasa.gov>
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/>
Hi Wesley I've been working a bit more with the code and found why it works even if it returns the null string. Problem is that an empty null-terminated string consist in just an 0x00 wich can be read as an SNDV of value 0. Perhaps we can have troubles in systems wich encodes the string in a different way. In fact, the length of the string encoding a SNDV with it's 7 final bits equal to 0 will be different in lenguajes using null-terminated strings (length -1) That is not a problem itself, but we should be aware in order to avoid problems when we convert null-terminated strings to non null-terminated strings. By example in Borland Pascal lets be Cstring a null-terminated string and PString a Pascal style string, then if Cstring contains an SNDV you should code the conversion carefully Pstring := StrPas(Cstring); {Built-in function to convert between null-terminated strings and Pascal-style strings} if ord(Pstring[Length(Pstring)])>127 {if the high-order bit of the last byte is 1} then Pstring := Pstring + chr(0); {then append a 0x00} Also, if using null-terminated-strings, when constructing the headers, it's possible to have problems with an extra byte to 0x00 Please if anyone thinks this subject is too much specific for the list, feel free in sending me a direct-email. (And yes, I program mainly in Pascal, and yes, I'm a fossil 8-D ) Gerardo On 4/24/06, Wesley Eddy <weddy@grc.nasa.gov> wrote: > > 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 > > >
- Re: [dtn-interest] new i-d on sdnvs Gerardo Izquierdo
- Re: [dtn-interest] new i-d on sdnvs Wesley Eddy
- Re: [dtn-interest] new i-d on sdnvs Gerardo Izquierdo
- Re: [dtn-interest] new i-d on sdnvs Wesley Eddy
- Re: [dtn-interest] new i-d on sdnvs Scott Burleigh
- Re: [dtn-interest] new i-d on sdnvs Stephen Farrell
- Re: [dtn-interest] new i-d on sdnvs Scott Burleigh
- Re: [dtn-interest] new i-d on sdnvs Wesley Eddy
- Re: [dtn-interest] new i-d on sdnvs Scott Burleigh
- Re: [dtn-interest] new i-d on sdnvs Wesley Eddy
- Re: [dtn-interest] new i-d on sdnvs Stephen Farrell
- Re: [dtn-interest] new i-d on sdnvs Wesley Eddy
- RE: [dtn-interest] new i-d on sdnvs Scott, Keith L.
- [dtn-interest] new i-d on sdnvs Wesley Eddy