< draft-irtf-dtnrg-sdnv-02.txt   draft-irtf-dtnrg-sdnv-03.txt >
Network Working Group W. Eddy Network Working Group W. Eddy
Internet-Draft Verizon Internet-Draft Verizon
Intended status: Informational May 22, 2009 Intended status: Informational August 18, 2009
Expires: November 23, 2009 Expires: February 19, 2010
Using Self-Delimiting Numeric Values in Protocols Using Self-Delimiting Numeric Values in Protocols
draft-irtf-dtnrg-sdnv-02 draft-irtf-dtnrg-sdnv-03
Status of this Memo Status of this Memo
This Internet-Draft is submitted to IETF in full conformance with the This Internet-Draft is submitted to IETF in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that Task Force (IETF), its areas, and its working groups. Note that
other groups may also distribute working documents as Internet- other groups may also distribute working documents as Internet-
Drafts. Drafts.
skipping to change at page 1, line 32 skipping to change at page 1, line 32
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt. http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
This Internet-Draft will expire on November 23, 2009. This Internet-Draft will expire on February 19, 2010.
Copyright Notice Copyright Notice
Copyright (c) 2009 IETF Trust and the persons identified as the Copyright (c) 2009 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents in effect on the date of Provisions Relating to IETF Documents in effect on the date of
publication of this document (http://trustee.ietf.org/license-info). publication of this document (http://trustee.ietf.org/license-info).
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
skipping to change at page 8, line 42 skipping to change at page 8, line 42
again. Repeat Recursion Step. again. Repeat Recursion Step.
This encoding algorithm can easily be seen to have time complexity of This encoding algorithm can easily be seen to have time complexity of
O(log_2 n), since it takes a number of steps equal to ceil(n/7), and O(log_2 n), since it takes a number of steps equal to ceil(n/7), and
no additional space beyond the size of the result (8/7 log_2 n) is no additional space beyond the size of the result (8/7 log_2 n) is
required. One aspect of this algorithm is that it assumes strings required. One aspect of this algorithm is that it assumes strings
can be efficiently appended to new bytes. One way to implement this can be efficiently appended to new bytes. One way to implement this
is to allocate a buffer for the expected length of the result and is to allocate a buffer for the expected length of the result and
fill that buffer one byte at a time from the right end. fill that buffer one byte at a time from the right end.
If, for some reason, an implementation requires an encoded SDNV to be
some specific length (possibly related to a machine word), any
leftmost zero-padding included needs to properly set the high-order
bit in each byte of padding.
3.2. Decoding Algorithm 3.2. Decoding Algorithm
Decoding SNDVs is a more difficult operation than encoding them, due Decoding SNDVs is a more difficult operation than encoding them, due
to the fact that no bound on the resulting value is known until the to the fact that no bound on the resulting value is known until the
SDNV is parsed, at which point the value itself is already known. SDNV is parsed, at which point the value itself is already known.
This means that if space is allocated for decoding the value of an This means that if space is allocated for decoding the value of an
SDNV into, it is never known whether this space will be overflowed SDNV into, it is never known whether this space will be overflowed
until it is 7 bits away from happening. until it is 7 bits away from happening.
(Initial Step) Set the result to 0. Set a pointer to the beginning (Initial Step) Set the result to 0. Set a pointer to the beginning
skipping to change at page 10, line 5 skipping to change at page 9, line 25
This decoding algorithm takes no more additional space than what is This decoding algorithm takes no more additional space than what is
required for the result (7/8 the length of the SDNV) and the pointer. required for the result (7/8 the length of the SDNV) and the pointer.
The complication is that before the result can be left-shifted in the The complication is that before the result can be left-shifted in the
Recursion Step, an implementation needs to first make sure that this Recursion Step, an implementation needs to first make sure that this
won't cause any bits to be lost, and re-allocate a larger piece of won't cause any bits to be lost, and re-allocate a larger piece of
memory for the result, if required. The pure time complexity is the memory for the result, if required. The pure time complexity is the
same as for the encoding algorithm given, but if re-allocation is same as for the encoding algorithm given, but if re-allocation is
needed due to the inability to predict the size of the result, in needed due to the inability to predict the size of the result, in
reality decoding may be slower. reality decoding may be slower.
These decoding steps include removal of any leftmost zero-padding
that might be used by an encoder to create encodings of a certain
length.
4. Comparison to Alternatives 4. Comparison to Alternatives
This section compares three alternative ways of implementing the This section compares three alternative ways of implementing the
concept of SDNVs: (1) the TLV scheme commonly used in the Internet concept of SDNVs: (1) the TLV scheme commonly used in the Internet
family, and many other families of protocols, (2) the old style of family, and many other families of protocols, (2) the old style of
SDNVs (both the SDNV-8 and SDNV-16) defined in an early stage of SDNVs (both the SDNV-8 and SDNV-16) defined in an early stage of
LTP's development [BRF04], and (3) the current SDNV format. LTP's development [BRF04], and (3) the current SDNV format.
The TLV method uses two fixed-length fields to hold the Type" and The TLV method uses two fixed-length fields to hold the Type" and
Length elements that then imply the syntax and semantics of the Length elements that then imply the syntax and semantics of the
 End of changes. 5 change blocks. 
4 lines changed or deleted 13 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/