One document matched: draft-ietf-core-block-00.xml


<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<!-- Fix: This -nn, date below -->
<rfc ipr="trust200902" docName="draft-ietf-core-block-00"
     category="std" >

<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes" ?>

  <front>
    <title abbrev="CoAP-block">
      Blockwise transfers in CoAP
    </title>
    
   <author initials="Z" surname="Shelby" fullname="Zach Shelby" role="editor">
          <organization>
             Sensinode
          </organization>
          <address>
            <postal>
             <street>Kidekuja 2</street>
             <city>Vuokatti</city>
             <code>88600</code>
             <country>FINLAND</country>
            </postal>
            <phone>+358407796297</phone>
            <email>zach@sensinode.com</email>
    </address>
   </author>

    <author initials="C" surname="Bormann" fullname="Carsten Bormann">
      <organization>Universität Bremen TZI</organization>
      <address>
        <postal>
          <street>Postfach 330440</street>
          <city>Bremen</city>
          <code>D-28359</code>
          <country>Germany</country>
        </postal>
        <phone>+49-421-218-63921</phone>
        <facsimile>+49-421-218-7000</facsimile>
        <email>cabo@tzi.org</email>
      </address>
    </author>

    <date year="2010"/>

    <area>General</area>
    <workgroup>CoRE Working Group</workgroup>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <t>
        CoAP is a RESTful transfer protocol for constrained nodes and networks.
        CoAP is based on datagram transport, which limits the maximum size of
        resource representations that can be transferred without too
        much fragmentation. The Block option provides a minimal way to transfer larger representations in a block-wise fashion.
      </t>
    </abstract>
  </front>

  <middle>


<section anchor="problems" title="Introduction">

<t>The CoRE WG is tasked with standardizing an
Application Protocol for Constrained Networks/Nodes, CoAP.
This protocol is intended to provide RESTful <xref target="REST"/> services not
unlike HTTP <xref target="RFC2616"/>,
while reducing the complexity of implementation as well as the size of
packets exchanged in order to make these services useful in a highly
constrained network of themselves highly constrained nodes.</t>

<t>This objective requires restraint in a number of sometimes conflicting ways:</t>

<t><list style='symbols'>
  <t>reducing implementation complexity in order to minimize code size,</t>
  <t>reducing message sizes in order to minimize the number of fragments
needed for each message (in turn to maximize the probability of
delivery of the message), the amount of transmission power needed
and the loading of the limited-bandwidth channel,</t>
  <t>reducing requirements on the environment such as stable storage,
good sources of randomness or user interaction capabilities.</t>
</list></t>

<t>CoAP is based on datagram transports such as UDP, which limit the
maximum size of resource representations that can be transferred
without creating unreasonable levels of fragmentation.
The Block option provides a minimal way to transfer larger
resource representations in a block-wise fashion.</t>

<t>In this document, the key words “MUST”, “MUST NOT”, “REQUIRED”,
“SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”,
and “OPTIONAL” are to be interpreted as described in BCP 14
<xref target="RFC2119"/> and indicate requirement levels for compliant CoAP
implementations.</t>

</section>
<section anchor="block-wise-transfers" title="Block-wise transfers">

<t>Not all resource representations will fit into a single link layer
packet of a constrained network.  Using fragmentation (either at the
adaptation layer or at the IP layer) to enable the transport of larger
representations is possible up to the maximum size of the underlying
datagram protocol (such as UDP),
but the fragmentation/reassembly process loads the lower layers
with conversation state that is better managed in the application
layer.</t>

<t>This specification proposes an option to enable <spanx style='emph'>block-wise</spanx> access to
resource representations.  The overriding objective is to avoid
creating conversation state at the server for block-wise GET requests.
(It is impossible to fully avoid creating conversation state for
POST/PUT, if the creation/replacement of resources is to be atomic;
where that property is not needed, there is no need to create server
conversation state in this case, either.)</t>

<t>Implementation of the Block option is intended to be optional.
However, when it is present in a CoAP message, it MUST be processed;
therefore it is identified as a critical option.</t>

<t>The size of the blocks should not be fixed by the protocol.  On the
other hand, implementation should be as simple as possible.  The Block
option therefore supports a small range of power-of-two block sizes, from 2^4
(16) to 2^11 (2048) bytes.  One of these eight values can be encoded
in three bits (0 for 2^4 to 7 for 2^11 bytes), the <spanx style='verb'>SZX</spanx> (size
exponent); the actual block size is then <spanx style='verb'>1 << (SZX + 4)</spanx>.</t>

<section anchor="block-option" title="The Block Option">

<t>When a representation is larger than can be comfortably transferred in
a single UDP datagram, the Block option can be used to indicate a
block-wise transfer.  Block is a 1-, 2- or 3-byte integer, the four least
significant bits of which indicate the size and whether the current
block-wise transfer is the last block being transferred (M or “more”
bit).  The value divided by sixteen is the number of the block
currently being transferred, starting from zero, i.e., the current
transfer is about the <spanx style='verb'>size</spanx> bytes starting at <spanx style='verb'>block number << (SZX +
4)</spanx>.  The default value of
the Block Option is zero, indicating that the current block is the first
(block number 0) and only (M bit not set) block of the transfer;
however, there is no explicit size implied by this default value.</t>

<figure title="Block option" anchor="block"><artwork><![CDATA[
        0
        0 1 2 3 4 5 6 7
       +-+-+-+-+-+-+-+-+
       |  NUM  |M| SZX |
       +-+-+-+-+-+-+-+-+

        0                   1
        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |          NUM          |M| SZX |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

        0                   1                   2
        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                   NUM                 |M| SZX |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>

<t>(Note that the option with the last 4 bits masked out, shifted to the
left by the value of SZX, gives the byte position of the block.)</t>

     <t hangText="Option Fields:">
       <list style="hanging">
         <t hangText="NUM:">
         Block Number. The block number is a variable 4-20 bit unsigned integer indicating the block number being requested or provided. Block number 0 indicates the first block of a representation.  
         </t>
         <t hangText="M:">
         More Flag. This flag indicates if this block is the last in a representation when set. When not set it indicates that there are one or more blocks available. When the block option is used to retrieve a specific block number the M bit MUST be sent as zero and ignored on reception.
         </t>
         <t hangText="SZX:">
         Block Size. The block size indicates the size of a block to the power of two. Thus block size = 2^(SZX + 4). Thus the minimum block size is 16 and the maximum is 2048.
         </t>                  
       </list>
     </t>


<t>The Block option is used in one of three roles:</t>

<t><list style='symbols'>
  <t>In the request for a GET, the Block option gives the block number requested and suggests a block size (block number 0) or echoes the block size of
previous blocks received (block numbers other than 0).</t>
  <t>In the response for a GET or in the request for a PUT or POST, the
Block option
describes what block number is contained in the payload, and whether
further blocks are part of that body (M bit).  If the M bit is set,
the size of the payload body in bytes MUST indeed be the power of
two given by the block size.  All blocks for a REST transaction MUST use
the same block size, except for the last block (M bit not set).</t>
  <t>In the response for a PUT or POST, the Block option indicates what
block number is
being acknowledged.  In this case, the M bit is set to indicate that
this response does not carry the final response to the request; this
can occur when the M bit was set in the request and the server
implements PUT/POST atomically (i.e., acts only upon reception of the last
block).</t>
</list></t>

</section>
<section anchor="block-usage" title="Using the Block Option">

<t>Using the Block option, a single REST operation can be split into
multiple CoAP message transactions.  Each of these message
transactions uses their own CoAP transaction ID.</t>

<t>When a GET is answered with a response carrying a Block option with
the M bit set, the requestor may retrieve additional blocks of the
resource representation by sending
requests with a Block option giving the block number desired.  In such
a Block option, the M bit MUST be sent as zero and ignored on
reception.</t>

<t>To influence the block size used in response to a GET request, the
requestor uses the Block option, giving the desired size, a block
number of zero and an M bit of zero.  A server SHOULD use the block
size indicated or a smaller size.  Any further block-wise requests for
blocks beyond the first one MUST indicate the same block size that was
already used in the
response for the first one.</t>

<t>If the Block option is used by the requestor, all GET requests in a
single transaction (except for the last one with the M bit not set)
MUST ultimately use the same size.  The server SHOULD use the block
size indicated in the request option or a smaller size, but the
requestor MUST take note of the actual block size used in the response
it receives
to its initial GET and proceed to use it in subsequent GETs; the
server behavior MUST ensure that this client behavior results in the
same block size for all responses in a sequence (except for the last
one with the M bit not set).</t>

<t>Block-wise transfers can be used to GET resources the representations of
which are entirely static (not changing over time at all, such as in a
schema describing a device), or for dynamically changing resources.
In the latter case, the Block option SHOULD be used in conjunction
with the Etag option, to ensure that the blocks being reassembled are
from the same version of the representation.
When reassembling the representation from the blocks being exchanged,
the reassembler MUST compare Etag options.  If the Etag options do not
match in a GET transfer, the requestor has the option of attempting to
retrieve fresh values for the blocks it retrieved first.  To minimize
the resulting inefficiency, the server MAY cache the current value of
a representation for an ongoing sequence of requests, but there is no
requirement for the server to establish any state.  The client MAY
facilitate identifying the sequence by using the Token option.</t>

<t>In a PUT or POST transfer, the Block option refers to the body in the
request, i.e., there is no way to perform a block-wise retrieval of
the body of the response.  Servers that do need to supply large bodies
in response to PUT/POST SHOULD therefore be employing redirects.</t>

<t>In a PUT or POST transfer that is intended to be implemented in an
atomic fashion at the server, the actual creation/replacement takes
place at the time a block with the M bit unset is received.  If not
all previous blocks are available at the server at this time, the
transfer fails and error code 4__ (TBD) MUST be returned.  The error
code 4__ can also be returned at any time by a server that does not
currently have the resources to store blocks for a block-wise PUT or
POST transfer that it would intend to implement in an atomic fashion.</t>

<t>If multiple concurrently proceeding block-wise PUT or POST operations
are possible, the requestor SHOULD use the Token option to clearly separate the different sequences.
In this case, when reassembling the representation from the blocks
being exchanged to enable atomic processing, the reassembler MUST
compare any Token options present (taking an absent Token option
to default to the empty Token).
If atomic processing is not desired, there is no need to check the
Token option.</t>

<t><list style='hanging'>
  <t hangText='In summary, this specification:'>
  Adds a Block Option that can be used for block-wise transfers.</t>
  <t hangText='Benefits:'>
  Transfers larger than can be accommodated in constrained-network
link-layer packets can be performed in smaller blocks.</t>
  <t>No hard-to-manage conversation state is created at the adaptation
layer or IP layer for fragmentation.</t>
  <t>The transfer of each block is acknowledged, enabling retransmission
if required.</t>
  <t>Both sides have a say in the block size that actually will be used.</t>
  <t hangText='TBD:'>
  Give examples with detailed message flows for a block-wise GET, PUT
and POST.</t>
</list></t>

</section>
</section>
<section anchor="iana-considerations" title="IANA Considerations">

<t>This draft adds the following option number to Table 2 of
<xref target="I-D.ietf-core-coap"/>:</t>

<texttable>
      <ttcol align='right'>Type</ttcol>
      <ttcol align='left'>C/E</ttcol>
      <ttcol align='left'>Name</ttcol>
      <ttcol align='left'>Data type</ttcol>
      <ttcol align='left'>Length</ttcol>
      <ttcol align='left'>Default</ttcol>
      
      <c>13</c>
      <c>C</c>
      <c>Block</c>
      <c>Unsigned Integer</c>
      <c>1-3 B</c>
      <c>0 (see <xref target="block-option"/>)</c>
</texttable>

</section>
<section anchor="security-considerations" title="Security Considerations">

<t>TBD.
(Weigh the security implications of application layer block-wise
transfer against those of adaptation-layer or IP-layer fragmentation.)</t>

<section anchor="mitigating-amplification-attacks" title="Mitigating Amplification Attacks">

<t>TBD.
(This section discusses how CoAP nodes could become implicated in DoS
attacks by using the amplifying properties of the protocol, as well as
mitigations for this threat.)</t>

<t>A CoAP server can reduce the amount of amplification it provides to an
attacker by offering large resource representations only in relatively
small blocks.  E.g., for a 1000 byte resource, a 10-byte request might
result in an 80-byte response (with a 64-byte block) instead of a
1016-byte response, considerably reducing the amplification provided.</t>

</section>
</section>

<!--
<section anchor="contributors" title="Contributors">

<t>Carsten Bormann (Universität Bremen TZI) is the original author of draft-bormann-coap-block, and the main technical contributor to the document.</t>

</section>
-->



<section anchor="acknowledgements" title="Acknowledgements">

<t>Of course, much of the content of this draft is the result of
discussions with the <xref target="I-D.ietf-core-coap"/> authors.
Tokens were suggested by Gilman Tolle and refined by Klaus Hartke.</t>

</section>

</middle>

<back>

  <references title='Normative References'>



<reference anchor='RFC2119'>

<front>
<title abbrev='RFC Key Words'>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='Scott Bradner'>
<organization>Harvard University</organization>
<address>
<postal>
<street>1350 Mass. Ave.</street>
<street>Cambridge</street>
<street>MA 02138</street></postal>
<phone>- +1 617 495 3864</phone>
<email>sob@harvard.edu</email></address></author>
<date year='1997' month='March' />
<area>General</area>
<keyword>keyword</keyword>
<abstract>
<t>
   In many standards track documents several words are used to signify
   the requirements in the specification.  These words are often
   capitalized.  This document defines these words as they should be
   interpreted in IETF documents.  Authors who follow these guidelines
   should incorporate this phrase near the beginning of their document:

<list>
<t>
      The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
      NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and
      "OPTIONAL" in this document are to be interpreted as described in
      RFC 2119.
</t></list></t>
<t>
   Note that the force of these words is modified by the requirement
   level of the document in which they are used.
</t></abstract></front>

<seriesInfo name='BCP' value='14' />
<seriesInfo name='RFC' value='2119' />
<format type='TXT' octets='4723' target='http://www.rfc-editor.org/rfc/rfc2119.txt' />
<format type='HTML' octets='17491' target='http://xml.resource.org/public/rfc/html/rfc2119.html' />
<format type='XML' octets='5777' target='http://xml.resource.org/public/rfc/xml/rfc2119.xml' />
</reference>



<reference anchor='RFC2616'>

<front>
<title abbrev='HTTP/1.1'>Hypertext Transfer Protocol -- HTTP/1.1</title>
<author initials='R.' surname='Fielding' fullname='Roy T. Fielding'>
<organization abbrev='UC Irvine'>Department of Information and Computer Science</organization>
<address>
<postal>
<street>University of California, Irvine</street>
<city>Irvine</city>
<region>CA</region>
<code>92697-3425</code></postal>
<facsimile>+1(949)824-1715</facsimile>
<email>fielding@ics.uci.edu</email></address></author>
<author initials='J.' surname='Gettys' fullname='James Gettys'>
<organization abbrev='Compaq/W3C'>World Wide Web Consortium</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>545 Technology Square</street>
<city>Cambridge</city>
<region>MA</region>
<code>02139</code></postal>
<facsimile>+1(617)258-8682</facsimile>
<email>jg@w3.org</email></address></author>
<author initials='J.' surname='Mogul' fullname='Jeffrey C. Mogul'>
<organization abbrev='Compaq'>Compaq Computer Corporation</organization>
<address>
<postal>
<street>Western Research Laboratory</street>
<street>250 University Avenue</street>
<city>Palo Alto</city>
<region>CA</region>
<code>94305</code></postal>
<email>mogul@wrl.dec.com</email></address></author>
<author initials='H.' surname='Frystyk' fullname='Henrik Frystyk Nielsen'>
<organization abbrev='W3C/MIT'>World Wide Web Consortium</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>545 Technology Square</street>
<city>Cambridge</city>
<region>MA</region>
<code>02139</code></postal>
<facsimile>+1(617)258-8682</facsimile>
<email>frystyk@w3.org</email></address></author>
<author initials='L.' surname='Masinter' fullname='Larry Masinter'>
<organization abbrev='Xerox'>Xerox Corporation</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>3333 Coyote Hill Road</street>
<city>Palo Alto</city>
<region>CA</region>
<code>94034</code></postal>
<email>masinter@parc.xerox.com</email></address></author>
<author initials='P.' surname='Leach' fullname='Paul J. Leach'>
<organization abbrev='Microsoft'>Microsoft Corporation</organization>
<address>
<postal>
<street>1 Microsoft Way</street>
<city>Redmond</city>
<region>WA</region>
<code>98052</code></postal>
<email>paulle@microsoft.com</email></address></author>
<author initials='T.' surname='Berners-Lee' fullname='Tim Berners-Lee'>
<organization abbrev='W3C/MIT'>World Wide Web Consortium</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>545 Technology Square</street>
<city>Cambridge</city>
<region>MA</region>
<code>02139</code></postal>
<facsimile>+1(617)258-8682</facsimile>
<email>timbl@w3.org</email></address></author>
<date year='1999' month='June' />
<abstract>
<t>
   The Hypertext Transfer Protocol (HTTP) is an application-level
   protocol for distributed, collaborative, hypermedia information
   systems. It is a generic, stateless, protocol which can be used for
   many tasks beyond its use for hypertext, such as name servers and
   distributed object management systems, through extension of its
   request methods, error codes and headers . A feature of HTTP is
   the typing and negotiation of data representation, allowing systems
   to be built independently of the data being transferred.
</t>
<t>
   HTTP has been in use by the World-Wide Web global information
   initiative since 1990. This specification defines the protocol
   referred to as "HTTP/1.1", and is an update to RFC 2068 .
</t></abstract></front>

<seriesInfo name='RFC' value='2616' />
<format type='TXT' octets='422317' target='http://www.rfc-editor.org/rfc/rfc2616.txt' />
<format type='PS' octets='5529857' target='http://www.rfc-editor.org/rfc/rfc2616.ps' />
<format type='PDF' octets='550558' target='http://www.rfc-editor.org/rfc/rfc2616.pdf' />
<format type='HTML' octets='636125' target='http://xml.resource.org/public/rfc/html/rfc2616.html' />
<format type='XML' octets='493420' target='http://xml.resource.org/public/rfc/xml/rfc2616.xml' />
</reference>



<reference anchor='I-D.ietf-core-coap'>
<front>
<title>Constrained Application Protocol (CoAP)</title>

<author initials='Z' surname='Shelby' fullname='Zach Shelby'>
    <organization />
</author>

<author initials='B' surname='Frank' fullname='Brian Frank'>
    <organization />
</author>

<author initials='D' surname='Sturek' fullname='Don Sturek'>
    <organization />
</author>

<date month='September' day='27' year='2010' />

<abstract><t>This document specifies the Constrained Application Protocol (CoAP), a specialized web transfer protocol for use with constrained networks and nodes for machine-to-machine applications such as smart energy and building automation.  These constrained nodes often have 8-bit microcontrollers with small amounts of ROM and RAM, while networks such as 6LoWPAN often have high packet error rates and a typical throughput of 10s of kbit/s.  CoAP provides a method/response interaction model between application end-points, supports built-in resource discovery, and includes key web concepts such as URIs and content-types.  CoAP easily translates to HTTP for integration with the web while meeting specialized requirements such as multicast support, very low overhead and simplicity for constrained environments.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-core-coap-02' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-core-coap-02.txt' />
</reference>


  </references>

  <references title='Informative References'>


<reference anchor="REST">
    <front>
        <title>Architectural Styles and the Design of Network-based Software Architectures</title>

        <author initials="R" surname="Fielding" fullname="Roy Fielding">
            <organization>University of California, Irvine</organization>

    </author>

        <date year="2000" />

  </front>

</reference>

</references>


</back>
</rfc>


PAFTECH AB 2003-20262026-04-23 03:22:13