One document matched: draft-ietf-p2psip-reload-00.xml


<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<!-- $Id: draft-ietf-p2psip-reload.xml 3086 2008-07-14 14:45:58Z fluffy $ -->
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>

<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc iprnotified="no" ?>
<?rfc strict="no" ?>
<?rfc compact="yes" ?>
<?rfc sortrefs="no" ?>
<?rfc colonspace="yes" ?>
<?rfc rfcedstyle="no" ?> <!-- Don't change this. It breaks stuff -->
<?rfc tocdepth="4"?>

<rfc category="std" docName="draft-ietf-p2psip-reload-00" ipr="full3978">
  <front>
    <title abbrev="RELOAD">REsource LOcation And Discovery (RELOAD)</title>

    <author fullname="Cullen Jennings" initials="C." surname="Jennings">
      <organization>Cisco</organization>

      <address>
        <postal>
          <street>170 West Tasman Drive</street>

          <street>MS: SJC-21/2</street>

          <city>San Jose</city>

          <region>CA</region>

          <code>95134</code>

          <country>USA</country>
        </postal>

        <phone>+1 408 421-9990</phone>

        <email>fluffy@cisco.com</email>
      </address>
    </author>

    <author fullname="Bruce B. Lowekamp" initials="B. B." surname="Lowekamp">
      <organization>SIPeerior Technologies</organization>

      <address>
        <postal>
          <street>3000 Easter Circle</street>

          <city>Williamsburg</city>

          <region>VA</region>

          <code>23188</code>

          <country>USA</country>
        </postal>

        <phone>+1 757 565 0101</phone>

        <email>lowekamp@sipeerior.com</email>
      </address>
    </author>

    <author fullname="Eric Rescorla" initials="E.K." surname="Rescorla">
      <organization>Network Resonance</organization>

      <address>
        <postal>
          <street>2064 Edgewood Drive</street>

          <city>Palo Alto</city>

          <region>CA</region>

          <code>94303</code>

          <country>USA</country>
        </postal>

        <phone>+1 650 320-8549</phone>

        <email>ekr@networkresonance.com</email>
      </address>
    </author>

    <author fullname="Salman A. Baset" initials="S.A." surname="Baset">
      <organization>Columbia University</organization>

      <address>
        <postal>
          <street>1214 Amsterdam Avenue</street>

          <city>New York</city>

          <region>NY</region>

          <country>USA</country>
        </postal>

        <email>salman@cs.columbia.edu</email>
      </address>
    </author>

    <author fullname="Henning Schulzrinne" initials="H.G."
            surname="Schulzrinne">
      <organization>Columbia University</organization>

      <address>
        <postal>
          <street>1214 Amsterdam Avenue</street>

          <city>New York</city>

          <region>NY</region>

          <country>USA</country>
        </postal>

        <email>hgs@cs.columbia.edu</email>
      </address>
    </author>

    <date day="11" month="July" year="2008" />

    <area>RAI</area>

    <workgroup>P2PSIP</workgroup>

    <abstract>
      <t>This document defines REsource LOcation And Discovery (RELOAD), a
      peer-to-peer (P2P) signaling protocol for use on the Internet. A P2P
      signaling protocol provides its clients with an abstract storage and
      messaging service between a set of cooperating peers that form the
      overlay network. RELOAD is designed to support a P2P Session Initiation
      Protocol (P2PSIP) network, but can be utilized by other applications
      with similar requirements by defining new usages that specify the kinds
      of data that must be stored for a particular application. RELOAD defines
      a security model based on a certificate enrollment service that provides
      unique identities. NAT traversal is a fundamental service of the
      protocol. RELOAD also allows access from "client" nodes which do not
      need to route traffic or store data for others.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <!-- TODO EKR: compare this against the glossary so that each
      term is introduced -->

      <t>This document defines REsource LOcation And Discovery (RELOAD), a
      peer-to-peer (P2P) signaling protocol for use on the Internet. It
      provides a generic, self-organizing overlay network service, allowing
      nodes to efficiently route messages to other nodes and to efficiently
      store and retrieve data in the overlay. RELOAD provides several features
      that are critical for a successful P2P protocol for the Internet:</t>

      <t><list style="hanging">
          <t></t>

          <t hangText="Security Framework:">A P2P network will often be
          established among a set of peers that do not trust each other.
          RELOAD leverages a central enrollment server to provide credentials
          for each peer which can then be used to authenticate each operation.
          This greatly reduces the possible attack surface.</t>

          <t></t>

          <t hangText="Usage Model:">RELOAD is designed to support a variety
          of applications, including P2P multimedia communications with the
          Session Initiation Protocol <xref
          target="I-D.ietf-p2psip-concepts"></xref>. RELOAD allows the
          definition of new application usages, each of which can define its
          own data types, along with the rules for their use. This allows
          RELOAD to be used with new applications through a simple
          documentation process that supplies the details for each
          application.</t>

          <t></t>

          <t hangText="NAT Traversal:">RELOAD is designed to function in
          environments where many if not most of the nodes are behind NATs or
          firewalls. Operations for NAT traversal are part of the base design,
          including using ICE to establish new RELOAD or application protocol
          connections as well as tunneling application protocols across the
          overlay.</t>

          <t></t>

          <t hangText="High Performance Routing:">The very nature of overlay
          algorithms introduces a requirement that peers participating in the
          P2P network route requests on behalf of other peers in the network.
          This introduces a load on those other peers, in the form of
          bandwidth and processing power. RELOAD has been defined with a
          simple, lightweight forwarding header, thus minimizing the amount of
          effort required by intermediate peers.</t>

          <t></t>

          <t hangText="Pluggable overlay Algorithms:">RELOAD has been designed
          with an abstract interface to the overlay layer to simplify
          implementing a variety of structured (DHT) and unstructured overlay
          algorithms. This specification also defines how RELOAD is used with
          Chord, which is mandatory to implement. Specifying a default "must
          implement" overlay algorithm will allow interoperability, while the
          extensibility allows selection of overlay algorithms optimized for a
          particular application.</t>
        </list></t>

      <t>These properties were designed specifically to meet the requirements
      for a P2P protocol to support SIP, and this document defines a SIP Usage
      of RELOAD. However, RELOAD is not limited to usage by SIP and could
      serve as a tool for supporting other P2P applications with similar
      needs. RELOAD is also based on the concepts introduced in <xref
      target="I-D.ietf-p2psip-concepts"></xref>.</t>

      <section title="Basic Setting">
        <t>In this section, we provide a brief overview of the operational
        setting for RELOAD. See the concepts document for more details. A
        RELOAD Overlay Instance consists of a set of nodes arranged in a
        partly connected graph. Each node in the overlay is assigned a numeric
        Node-ID which, together with the specific overlay algorithm in use,
        determines its position in the graph and the set of nodes it connects
        to. The figure below shows a trivial example which isn't drawn from
        any particular overlay algorithm, but was chosen for convenience of
        representation.</t>

        <figure>
          <artwork><![CDATA[
          +--------+              +--------+              +--------+ 
          | Node 10|--------------| Node 20|--------------| Node 30|
          +--------+              +--------+              +--------+ 
              |                       |                       |
              |                       |                       |
          +--------+              +--------+              +--------+ 
          | Node 40|--------------| Node 50|--------------| Node 60|
          +--------+              +--------+              +--------+ 
              |                       |                       |
              |                       |                       |
          +--------+              +--------+              +--------+ 
          | Node 70|--------------| Node 80|--------------| Node 90|
          +--------+              +--------+              +--------+ 
                                      |
                                      |
                                  +--------+
                                  | Node 85|
                                  |(Client)|
                                  +--------+
              ]]></artwork>
        </figure>

        <t>Because the graph is not fully connected, when a node wants to send
        a message to another node, it may need to route it through the
        network. For instance, Node 10 can talk directly to nodes 20 and 40,
        but not to Node 70. In order to send a message to Node 70, it would
        first send it to Node 40 with instructions to pass it along to Node
        70. Different overlay algorithms will have different connectivity
        graphs, but the general idea behind all of them is to allow any node
        in the graph to efficiently reach every other node within a small
        number of hops.</t>

        <t>The RELOAD network is not only a messaging network. It is also a
        storage network. Records are stored under numeric addresses which
        occupy the same space as node identifiers. Nodes are responsible for
        storing the data associated with some set of addresses as determined
        by their Node-Id. For instance, we might say that every node is
        responsible for storing any data value which has an address less than
        or equal to its own Node-Id, but greater than the next lowest Node-Id.
        Thus, Node-20 would be responsible for storing values 11-20.</t>

        <t>RELOAD also supports clients. These are nodes which have Node-Ids
        but do not participate in routing or storage. For instance, in the
        figure above Node 85 is a client. It can route to the rest of the
        RELOAD network via Node 80, but no other node will route through it
        and Node 90 is still responsible for all addresses between 81-90. We
        refer to non-client nodes as peers.</t>

        <t>Other applications (for instance, SIP) can be defined on top of
        RELOAD and use these two basic RELOAD services to provide their own
        services.</t>
      </section>

      <section title="Architecture">
        <t>Architecturally RELOAD is divided into several layers, as shown in
        the following figure:</t>

        <figure>
          <artwork><![CDATA[
                 Application

            +-------+  +-------+               
            | SIP   |  | XMPP  |  ...                
            | Usage |  | Usage |              
            +-------+  +-------+
          -------------------------------------- Message Routing API
            +------------------+   +---------+
            |                  |<->| Storage |
            |                  |   +---------+
            |      Routing     |        ^
            |       Layer      |        v
            |                  |   +---------+
            |                  |<->|Topology |
            |                  |   | Plugin  |
            +------------------+   +---------+
                      ^                 ^
                      v                 |
            +------------------+ <------+
            |    Forwarding    |
            |       Layer      | 
            +------------------+
          -------------------------------------- Transport API
             +-------+  +------+                              
             |TLS    |  |DTLS  |  ...                       
             +-------+  +------+  
              ]]></artwork>
        </figure>

        <t>The major components of RELOAD are:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="Usage Layer:">Each application defines a RELOAD
            usage; a set of data kinds and behaviors which describe how to use
            the services provided by RELOAD. These usages all talk to RELOAD
            through a common Message Routing API.</t>

            <t></t>

            <t hangText="Routing Layer:">The Routing Layer is responsible for
            routing messages through the overlay. It also manages request
            state for the usages and forwards Store and Fetch operations to
            the Storage component. It talks directly to the Topology Plugin,
            which is responsible for implementing the specific topology
            defined by the overlay algorithm being used.</t>

            <t></t>

            <t hangText="Storage:">The Storage component is responsible for
            processing messages relating to the storage and retrieval of data.
            It talks directly to the Topology Plugin and the routing layer in
            order to send and receive messages and manage data replication and
            migration.</t>

            <t></t>

            <t hangText="Topology Plugin:">The Topology Plugin is responsible
            for implementing the specific overlay algorithm being used. It
            talks directly to the Routing Layer to send and receive overlay
            management messages, to the Storage component to manage data
            replication, and directly to the Forwarding Layer to control
            hop-by-hop message forwarding.</t>

            <t></t>

            <t hangText="Forwarding Layer:">The Forwarding Layer provides
            packet forwarding services between nodes. It also handles setting
            up connections across NATs using ICE.</t>
          </list></t>

        <section title="Usage Layer">
          <t>The top layer, called the Usage Layer, has application
          usages---such as the SIP Location Usage---that use the abstract
          Message Routing API provided by RELOAD. The goal of this layer is to
          implement application-specific usages of the generic overlay
          services provided by RELOAD. The usage defines how a specific
          application maps its data into something that can be stored in the
          overlay, where to store the data, how to secure the data, and
          finally how applications can retrieve and use the data.</t>

          <t>The architecture diagram shows both a SIP usage and an XMPP
          usage. A single application may require multiple usages, for example
          a SIP application may also require a voicemail usage. A usage may
          define multiple kinds of data that are stored in the overlay and may
          also rely on kinds originally defined by other usages.</t>

          <t>This draft also defines a Diagnostics Usage, which can be used to
          obtain diagnostic information about a peer in the overlay. The
          Diagnostics Usage is interesting both to administrators monitoring
          the overlay as well as to some overlay algorithms that base their
          decisions on capabilities and current load of nodes in the
          overlay.</t>
        </section>

        <section title="Routing Layer">
          <t>The Routing Layer provides a generic message routing service for
          the overlay. Each peer is identified by its location in the overlay
          as determined by its Node-ID. A component which is a client of the
          Routing Layer can perform two basic functions:</t>

          <t><list style="symbols">
              <t>Send a message to a given peer, specified by Node-Id or
              Resource-Id.</t>

              <t>Receive messages that other peers sent to a Node-Id or
              Resource-Id for which this peer is responsible.</t>
            </list></t>

          <t>All usages are clients of the Routing Layer and use RELOAD's
          services by sending and receiving messages from peers. For instance,
          when a usage wants to store data, it does so by sending Store
          requests. Note that the Storage component and the Topology Plugin
          are themselves clients of the Routing Layer, because they need to
          send and receive messages from other peers.</t>

          <t>The Routing Layer provides a fairly generic interface that allows
          the topology plugin control the overlay and resource operations and
          messages. Since each overlay algorithm is defined and functions
          differently, we generically refer to the table of other peers that
          the overlay algorithm maintains and uses to route requests
          (neighbors) as a Routing Table. The Routing Layer component makes
          queries to the overlay algorithm to determine the next hop, then
          encodes and sends the message itself. Similarly, the overlay
          algorithm issues periodic update requests through the logic
          component to maintain and update its Routing Table.</t>
        </section>

        <section title="Storage">
          <t>One of the major functions of RELOAD is to allow nodes to store
          data in the overlay and to retrieve data stored by other nodes or by
          themselves. The Storage component is responsible for processing data
          storage and retrieval messages. 
	  For instance, the
          Storage component might receive a Store request for a given resource
          from the Routing Layer. It would then store the data value(s) in its
          local data store and sends a response to the Routing Layer for
          delivery to the requesting peer.
	  Typically, these messages will
	  come for other nodes, but depending on the overlay topology,
	  a node might be responsible for storing data for itself as well,
	  especially if the overlay is small.</t>

          <t>The node's Node-ID determines the set of resources which it will
          be responsible for storing. However, the exact mapping between these
          is determined by the overlay algorithm used by the overlay,
          therefore the Storage component always the queries the topology
          plugin to determine where a particular resource should be
          stored.</t>
        </section>

        <section title="Topology Plugin">
          <t>RELOAD is explicitly designed to work with a variety of overlay
          algorithms. In order to facilitate this, the overlay algorithm
          implementation is provided by a Topology Plugin so that each overlay
          can select an appropriate overlay algorithm that relies on the
          common RELOAD core protocols and code.</t>

          <t>The Topology Plugin is responsible for maintaining the overlay
          algorithm Routing Table, which is consulted by the Routing Layer
          before routing a message. When connections are made or broken, the
          Forwarding Layer notifies the Topology Plugin, which adjusts the
          routing table as appropriate. The Topology Plugin will also instruct
          the Forwarding Layer to form new connections as dictated by the
          requirements of the overlay algorithm Topology.</t>

          <t>As peers enter and leave, resources may be stored on different
          peers, so the Topology Plugin also keeps track of which peers are
          responsible for which resources. As peers join and leave, the
          Topology Plugin issues resource migration requests as appropriate,
          in order to ensure that other peers have whatever resources they are
          now responsible for. The Topology Plugin is also responsible for
          providing redundant data storage to protect against loss of
          information in the event of a peer failure and to protect against
          compromised or subversive peers.</t>
        </section>

        <section title="Forwarding Layer">
          <t>The Forwarding Layer is responsible for getting a packet to the
          next peer, as determined by the Routing and Storage Layer. The
          Forwarding Layer establishes and maintains the network connections
          as required by the Topology Plugin. This layer is also responsible
          for setting up connections to other peers through NATs and firewalls
          using ICE, and it can elect to forward traffic using relays for NAT
          and firewall traversal.</t>

          <t>The Forwarding Layer sits on top of transport layer protocols
          which carry the actual traffic. This specification defines how to
          use DTLS and TLS to carry RELOAD messages.</t>
        </section>
      </section>

      <section title="SIP Usage">
        <t>The SIP Usage of RELOAD allows SIP user agents to provide a
        peer-to-peer telephony service without the requirement for permanent
        proxy or registration servers. In such a network, the RELOAD overlay
        itself performs the registration and rendezvous functions ordinarily
        associated with such servers.</t>

	<t></t>

        <t>The SIP Usage involves two basic functions: <list style="hanging">
            <t hangText="Registration: ">SIP UAs can use the RELOAD data
            storage functionality to store a mapping from their AOR to their
            Node-Id in the overlay, and to retrieve the Node-Id of other
            UAs.</t>

            <t hangText="Rendezvous: ">Once a SIP UA has identified the
            Node-Id for an AOR it wishes to call, it can use the RELOAD
            message routing system to set up a direct connection which can be
            used to exchange SIP messages.</t>
          </list></t>

        <t>For instance, Bob could register his Node-Id, "1234", under his
        AOR, "sip:bob@dht.example.com". When Alice wants to call Bob, she
        queries the overlay for "sip:bob@dht.example.com" and gets back
        Node-Id 1234. She then uses the overlay to establish a direct
        connection with Bob and can use that direct connection to perform a
        standard SIP INVITE.</t>
      </section>

      <section title="Security">
        <t>RELOAD's security model is based on each node having one or more
        public key certificates. In general, these certificates will be
        assigned by a central server which also assigns Node-Ids, although
        self-signed certificates can be used in closed networks. These
        credentials can be leveraged to provide communications security for
        RELOAD messages. RELOAD provides communications security at three
        levels:</t>

        <t><list style="hanging">
            <t hangText="Connection Level: ">Connections between peers are
            secured with TLS or DTLS.</t>

            <t hangText="Message Level: ">Each RELOAD message must be
            signed.</t>

            <t hangText="Object Level: ">Stored objects must be signed by the
            storing peer.</t>
          </list></t>

        <t>These three levels of security work together to allow peers to
        verify the origin and correctness of data they receive from other
        peers, even in the face of malicious activity by other peers in the
        overlay. RELOAD also provides access control built on top of these
        communications security features. Because the peer responsible for
        storing a piece of data can validate the signature on the data being
        stored, the responsible peer can determine whether a given operation
        is permitted or not.</t>

        <t>RELOAD also provides a shared secret based admission control
        feature using shared secrets and TLS-PSK. In order to form a TLS
        connection to any node in the overlay, a new node needs to know the
        shared overlay key, thus restricting access to authorized users.</t>
      </section>

      <section title="Structure of This Document">
        <t>The remainder of this document is structured as follows.</t>

        <t><list style="symbols">
            <t>Section 2 provides definitions of terms used in this
            document.</t>

            <t>Section 3 provides an overview of the mechanisms used to
            establish and maintain the overlay.</t>

            <t>Section 4 provides an overview of the mechanism RELOAD provides
            to support other applications.</t>

            <t>Section 5 provides an overview of the SIP usage for RELOAD.</t>

            <t>Section 6 defines the protocol messages that RELOAD uses to
            establish and maintain the overlay.</t>

            <t>Section 7 defines the protocol messages that are used to store
            and retrieve data using RELOAD.</t>

            <t>Sections 8-10 define three Usages of RELOAD that provide
            certificate storage, SIP, and Diagnostics.</t>

            <t>Section 11 defines a specific Topology Plugin using Chord.</t>

            <t>Section 12 defines the mechanisms that new RELOAD nodes use to
            join the overlay for the first time.</t>

            <t>Section 13 provides an extended example.</t>

            <t>Sections 14 and 15 provide Security and IANA
            considerations.</t>
          </list></t>
      </section>
    </section>

    <section title="Terminology">
      <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 <xref
      target="RFC2119">RFC 2119</xref>.</t>

      <t>We use the terminology and definitions from the <xref
      target="I-D.ietf-p2psip-concepts">Concepts and Terminology for Peer to
      Peer SIP</xref> draft extensively in this document. Other terms used in
      this document are defined inline when used and are also defined below
      for reference. Terms which are new to this document (and perhaps should
      be added to the concepts document) are marked with a (*).</t>

      <t><list style="hanging">
          <t></t>

          <t hangText="DHT:">A distributed hash table. A DHT is an abstract
          hash table service realized by storing the contents of the hash
          table across a set of peers.</t>

          <t></t>

          <t hangText="Overlay Algorithm:">An overlay algorithm defines the
          rules for determining which peers in an overlay store a particular
          piece of data and for determining a topology of interconnections
          amongst peers in order to find a piece of data.</t>

          <t></t>

          <t hangText="Overlay Instance:">A specific overlay algorithm and the
          collection of peers that are collaborating to provide read and write
          access to it. There can be any number of overlay instances running
          in an IP network at a time, and each operates in isolation of the
          others.</t>

          <t></t>

          <t hangText="Peer:">A host that is participating in the overlay.
          Peers are responsible for holding some portion of the data that has
          been stored in the overlay and also route messages on behalf of
          other hosts as required by the Overlay Algorithm.</t>

          <t></t>

          <t hangText="Client:">A host that is able to store data in and
          retrieve data from the overlay but which is not participating in
          routing or data storage for the overlay.</t>

          <t></t>

          <t hangText="Node:">We use the term "Node" to refer to a host that
          may be either a Peer or a Client. Because RELOAD uses the same
          protocol for both clients and peers, much of the text applies
          equally to both. Therefore we use "Node" when the text applies to
          both Clients and Peers and the more specific term when the text
          applies only to Clients or only to Peers.</t>

          <t></t>

          <t hangText="Node-ID:">A 128-bit value that uniquely identifies a
          node. Node-IDs 0 and 2^128 - 1 are reserved and are invalid
          Node-IDs. A value of zero is not used in the wire protocol but can
          be used to indicate an invalid node in implementations and APIs. The
          Node-ID of 2^128-1 is used on the wire protocol as a wildcard.
          (*)</t>

          <t></t>

          <t hangText="Resource:">An object or group of objects associated
          with a string identifier see "Resource Name" below.</t>

          <t></t>

          <t hangText="Resource Name:">The (potentially) human readable name
          by which a resource is identified. In unstructured P2P networks, the
          resource name is used directly as a Resource-Id. In structured P2P
          networks the resource name can be mapped into a Resource-ID by using
          the string as the input to hash function. A SIP resource, for
          example, is often identified by its AOR (see Resource Name
          below).(*)</t>

          <t></t>

          <t hangText="Resource-ID:">A value that identifies some resources
          and which is used as a key for storing and retrieving the resource.
          Often this is not human friendly/readable. One way to generate a
          Resource-ID is by applying a mapping function to some other unique
          name (e.g., user name or service name) for the resource. The
          Resource-ID is used by the distributed database algorithm to
          determine the peer or peers that are responsible for storing the
          data for the overlay. In structured P2P networks, resource-IDs are
          generally fixed length and are formed by hashing the resource
          identifier. In unstructured networks, resource identifiers may be
          used directly as resource-IDs and may have variable length.</t>

          <t></t>

          <t hangText="Connection Table:">The set of peers to which a node is
          directly connected. This includes nodes with which Attach
          handshakes have been done but which have not sent any Updates.
          </t>

          <t></t>

          <t hangText="Routing Table:">The set of peers which a node can use
          to route overlay messages. In general, these peers will all be on
          the connection table but not vice versa, because some peers will
          have Attached but not sent updates. Peers may send messages
          directly to peers which are on the connection table but may only
          route messages to other peers through peers which are on the routing
          table. (*)</t>

          <t></t>

          <t hangText="Destination List:">A list of IDs through which a
          message is to be routed. A single Node-ID is a trivial form of
          destination list. (*)</t>

          <t></t>

          <t hangText="Usage:">A usage is an application that wishes to use
          the overlay for some purpose. Each application wishing to use the
          overlay defines a set of data kinds that it wishes to use. The SIP
          usage defines the location, certificate, STUN server and TURN server
          data kinds. (*)</t>
        </list></t>
    </section>

    <section title="Overlay Management Overview">
      <t>The most basic function of RELOAD is as a generic overlay network.
      Nodes need to be able to join the overlay, form connections to other
      nodes, and route messages through the overlay to nodes to which they are
      not directly connected. This section provides an overview of the
      mechanisms that perform these functions.</t>

      <section anchor="sec.overview.security"
               title="Security and Identification">
        <t>Every node in the RELOAD overlay is identified by a 
        Node-ID. The Node-ID is used for three major purposes:</t>

        <t><list style="symbols">
            <t>To address the node itself.</t>

            <t>To determine its position in the overlay topology when the
            overlay is structured.</t>

            <t>To determine the set of resources for which the node is
            responsible.</t>
          </list></t>

        <t>Each node has a certificate <xref target="RFC3280"></xref>
        containing a Node-ID, which is globally unique.</t>

        <t>The certificate serves multiple purposes:</t>

        <t><list style="symbols">
            <t>It entitles the user to store data at specific locations in the
            Overlay Instance. Each data kind defines the specific rules for
            determining which certificates can access each resource-ID/kind-id
            pair. For instance, some kinds might allow anyone to write at a
            given location, whereas others might restrict writes to the owner
            of a single certificate.</t>

            <t>It entitles the user to operate a node that has a Node-ID found
            in the certificate. When the node forms a connection to another
            peer, it can use this certificate so that a node connecting to it
            knows it is connected to the correct node. In addition, the node
            can sign messages, thus providing integrity and authentication for
            messages which are sent from the node.</t>

            <t>It entitles the user to use the user name found in the
            certificate.</t>
          </list></t>

        <t>If a user has more than one device, typically they would get one
        certificate for each device. This allows each device to act as a
        separate peer.</t>

        <t>RELOAD supports two certificate issuance models. The first is based
        on a central enrollment process which allocates a unique name and
        Node-Id to the node a certificate for a public/private key pair for
        the user. All peers in a particular Overlay Instance have the
        enrollment server as a trust anchor and so can verify any other peer's
        certificate.</t>

        <t>In some settings, a group of users want to set up an overlay
        network but are not concerned about attack by other users in the
        network. For instance, users on a LAN might want to set up a short
        term ad hoc network without going to the trouble of setting up an
        enrollment server. RELOAD supports the use of self-generated and
        self-signed certificates. When self-signed certificates are used, the
        node also generates its own Node-Id and username. The Node-Id is
        computed as a digest of the public key, to prevent Node-Id theft,
        however this model is still subject to a number of known attacks (most
        notably Sybil attacks <xref target="Sybil"></xref>) and can only be
        safely used in closed networks where users are mutually trusting.</t>

        <section anchor="sec-shared-key" title="Shared-Key Security">
          <t>RELOAD also provides an admission control system based on shared
          keys. In this model, the peers all share a single key which is used
          to authenticate the peer-to-peer connections via
          TLS-PSK/TLS-SRP.</t>
        </section>
      </section>

      <section title="Clients">
        <t>RELOAD defines a single protocol that is used both as the peer
        protocol and the client protocol for the overlay. This simplifies
        implementation, particularly for devices that may act in either role,
        and allows clients to inject messages directly into the overlay.</t>

        <t>We use the term "peer" to identify a node in the overlay that
        routes messages for nodes other than those to which it is directly
        connected. Peers typically also have storage responsibilities. We use
        the term "client" to refer to nodes that do not have routing or
        storage responsibilities. When text applies to both peers and clients,
        we will simply refer to such a device as a "node."</t>

        <t>RELOAD's client support allows nodes that are not participating in
        the overlay as peers to utilize the same implementation and to benefit
        from the same security mechanisms as the peers. Clients possess and
        use certificates that authorize the user to store data at its
        locations in the overlay. The Node-ID in the certificate is used to
        identify the particular client as a member of the overlay and to
        authenticate its messages.</t>

        <t>The remainder of this section discusses how RELOAD supports clients
        in terms of routing issues specific to clients, minimum functionality
        requirements for clients, and alternatives for devices not capable of
        meeting those requirements.</t>

        <section title="Client Routing">
          <t>There are two routing options by which a client may be located in
          an overlay.</t>

          <t><list style="symbols">
              <t>Establish a connection to the peer responsible for the
              client's Node-ID in the overlay. Then requests may be sent
              from/to the client using its Node-ID in the same manner as if it
              were a peer, because the responsible peer in the overlay will
              handle the final step of routing to the client.</t>

              <t>Establish a connection with an arbitrary peer in the overlay
              (perhaps based on network proximity or an inability to establish
              a direct connection with the responsible peer). In this case,
              the client will rely on RELOAD's Destination List feature to
              ensure reachability. The client can initiate requests, and any
              node in the overlay that knows the Destination List to its
              current location can reach it, but the client is not directly
              reachable directly using only its Node-ID. The Destination List
              required to reach it must be learnable via other mechanisms,
              such as being stored in the overlay by a usage, if the client is
              to receive incoming requests from other members of the overlay.
             </t>
            </list></t>
        </section>

        <section title="Client Behavior">
          <t>There are a wide variety of reasons a node may act as a client
          rather than as a peer <xref
          target="I-D.pascual-p2psip-clients"></xref>. This section outlines
          some of those scenarios and how the client's behavior changes based
          on its capabilities.</t>

          <section title="Why Not Only Peers?">
            <t>For a number of reasons, a particular node may be forced to act
            as a client even though it is willing to act as a peer. These
            include:</t>

            <t><list style="symbols">
                <t>The node does not have appropriate network
                connectivity---typically because it is behind an overly
                restrictive NAT, or it has a low-bandwidth network
                connection.</t>

                <t>The node may not have sufficient resources, such as
                computing power, storage space, or battery power.</t>

                <t>The overlay algorithm may dictate specific requirements for
                peer selection. These may include participation in the overlay
                to determine trustworthiness, control the number of peers in
                the overlay to reduce overly-long routing paths, or ensure
                minimum application uptime before a node can join as a
                peer.</t>
              </list></t>

            <t>The ultimate criteria for a node to become a peer are
            determined by the overlay algorithm and specific deployment. A
            node acting as a client that has a full implementation of RELOAD
            and the appropriate overlay algorithm is capable of locating its
            responsible peer in the overlay and using CONNECT to establish a
            direct connection to that peer. In that way, it may elect to be
            reachable under either of the routing approaches listed above.
            Particularly for overlay algorithms that elect nodes to serve as
            peers based on trustworthiness or population, the overlay
            algorithm may require such a client to locate itself at a
            particular place in the overlay.</t>
          </section>

          <section title="Minimum Functionality Requirements for Clients">
            <t>A node may act as a client simply because it does not have the
            resources or even an implementation of the topology plugin
            required to acts as a peer in the overlay. In order to exchange
            RELOAD messages with a peer, a client must meet a minimum level of
            functionality. Such a client must:</t>

            <!-- TODO add xrefs to relevant sections-->

            <t><list style="symbols">
                <t>Implement RELOAD's connection-management connections that
                are used to establish the connection with the peer.</t>

                <t>Implement RELOAD's data storage and retrieval methods (with
                client functionality).</t>

                <t>Be able to calculate Resource-IDs used by the overlay.</t>

                <t>Possess security credentials required by the overlay it is
                implementing.</t>
              </list></t>

            <t>A client speaks the same protocol as the peers, knows how to
            calculate Resource-IDs, and signs its requests in the same manner
            as peers. While a client does not necessarily require a full
            implementation of the overlay algorithm, calculating the
            Resource-ID requires an implementation of the appropriate
            algorithm for the overlay.</t>

            <t>RELOAD does not support a separate protocol for clients that do
            not meet these functionality requirements. Any such extension
            would either entail compromises on the features of RELOAD or
            require an entirely new protocol to reimplement the core features
            of RELOAD. Furthermore, for P2PSIP and many other applications, a
            native application-level protocol already exists that is
            sufficient for such a client, as described in the next
            section.</t>
          </section>

          <section title="Clients as Application-Level Agents">
            <t>SIP defines an extensive protocol for registration and security
            between a client and its registrar/proxy server(s). Any SIP device
            can act as a client of a RELOAD-based P2PSIP overlay if it
            contacts a peer that implements the server-side functionality
            required by the SIP protocol. In this case, the peer would be
            acting as if it were the user's peer, and would need the
            appropriate credentials for that user.</t>

            <t>Application-level support for clients is defined by a usage. A
            usage offering support for application-level clients should
            specify how the security of the system is maintained when the data
            is moved between the application and RELOAD layers.</t>
          </section>
        </section>
      </section>

      <section title="Routing">
        <t>This section will discuss the requirements RELOAD's routing
        capabilities must meet, then describe the routing features in the
        protocol, and provide a brief overview of how they are used. The
        section will conclude by discussing some alternative designs and the
        tradeoffs that would be necessary to support them.</t>

        <t>RELOAD's routing capabilities must meet the following
        requirements:</t>

        <t><list style="hanging">
            <t hangText="NAT Traversal: ">RELOAD must support establishing and
            using connections between nodes separated by one or more NATs,
            including locating peers behind NATs for those overlays
            allowing/requiring it.</t>

            <t hangText="Clients: ">RELOAD must support requests from and to
            clients that do not participate in overlay routing.</t>

            <t hangText="Client promotion:">RELOAD must support clients that
            become peers at a later point as determined by the overlay
            algorithm and deployment.</t>

            <t hangText="Low state: ">RELOAD's routing algorithms must not
            require significant state to be stored on intermediate peers.</t>

            <t hangText="Return routability in unstable topologies: ">At some
            points in times, different nodes may have inconsistent information
            about the connectivity of the routing graph. In all cases, the
            response to a request needs to delivered to the node that sent the
            request and not to some other node.</t>
          </list></t>

        <t>To meet these requirements, RELOAD's routing relies on two basic
        mechanisms:</t>

        <t><list style="hanging">
            <t hangText="Via Lists: ">The forwarding header used by all RELOAD
            messages contains both a Via List (built hop-by-hop as the message
            is routed through the overlay) and a Destination List (providing
            source-routing capabilities for requests and return-path routing
            for responses).</t>

            <t hangText="Route_Query: ">The Route_Query method allows a node
            to query a peer for the next hop it will use to route a message.
            This method is useful for diagnostics and for iterative
            routing.</t>
          </list></t>

        <t>The basic routing mechanism used by RELOAD is Symmetric Recursive.
        We will first describe symmetric routing and then discuss its
        advantages in terms of the requirements discussed above.</t>

        <t>Symmetric recursive routing requires a message follow the path
        through the overlay to the destination without returning to the
        originating node: each peer forwards the message closer to its
        destination. The return path of the response is then the same path
        followed in reverse. For example, a message following a route from A
        to Z through B and X:</t>

        <figure>
          <artwork><![CDATA[
A         B         X         Z
-------------------------------

---------->
Dest=Z
          ---------->
          Via=A
          Dest=Z
                    ---------->
                    Via=A, B
                    Dest=Z

              
                    <----------
                   Dest=X, B, A
          <----------
            Dest=B, A
<----------
     Dest=A
              ]]></artwork>
        </figure>

        <t>Note that the preceding Figure does not indicate whether A is a
        client or peer---A forwards its request to B and the response is
        returned to A in the same manner regardless of A's role in the
        overlay.</t>

        <t>This figure shows use of full via-lists by intermediate peers B and
        X. However, if B and/or X are willing to store state, then they may
        elect to truncate the lists, save that information internally (keyed
        by the transaction id), and return the response message along the path
        from which it was received when the response is received. This option
        requires greater state on intermediate peers but saves a small amount
        of bandwidth and reduces the need for modifying the message enroute.
        Selection of this mode of operation is a choice for the individual
        peer---the techniques are mutually interoperable even on a single
        message. The figure below shows B using full via lists but X
        truncating them and saving the state internally.</t>

        <figure>
          <artwork><![CDATA[
A         B         X         Z
-------------------------------

---------->
Dest=Z
          ---------->
          Via=A
          Dest=Z
                    ---------->
                    Dest=Z
              
                    <----------
                         Dest=X
            <----------
            Dest=B, A
<----------
     Dest=A
              ]]></artwork>
        </figure>

        <t>For debugging purposes, a Route Log attribute is available that
        stores information about each peer as the message is forwarded.</t>

        <t>RELOAD also supports a basic Iterative routing mode (where the
        intermediate peers merely return a response indicating the next hop,
        but do not actually forward the message to that next hop themselves).
        Iterative routing is implemented using the Route_Query method, which
        requests this behavior. Note that iterative routing is selected only
        by the initiating node. RELOAD does not support an intermediate peer
        returning a response that it will not recursively route a normal
        request---the willingness to perform that operation is implicit in its
        role as a peer in the overlay.</t>

        <section title="Routing Alternatives">
          <t>Significant discussion has been focused on the selection of a
          routing algorithm for P2PSIP. This section discusses the motivations
          for selection of symmetric recursive routing for RELOAD and
          describes the extensions that would be required to support
          additional routing algorithms.</t>

          <section title="Iterative vs Recursive">
            <t>Iterative routing has a number of advantages. It is easier to
            debug, consumes fewer resources on intermediate peers, and allows
            the querying peer to identify and route around misbehaving peers
            <xref target="stoica-non-transitive-worlds05"></xref>. However, in
            the presence of NATs iterative routing is intolerably expensive
            because a new connection must be established for each hop (using
            ICE) <xref target="bryan-design-hotp2p08"></xref>.</t>

            <t>Iterative routing is supported through the Route_Query mechanism
            and is primarily intended for debugging.  It is also allows the
            querying peer to evaluate the routing decisions made by the peers at
            each hop, consider alternatives, and perhaps detect at what point
            the forwarding path fails.
           </t>
          </section>

          <section title="Symmetric vs Forward response">
            <t>An alternative to the symmetric recursive routing method used
            by RELOAD is Forward-Only routing, where the response is routed to
            the requester as if it is a new message initiating by the
            responder (in the previous example, Z sends the response to A as
            if it were sending a request). Forward-only routing requires no
            state in either the message or intermediate peers.</t>

            <t>The drawback of forward-only routing is that it does not work
            when the overlay is unstable. For example, if A is in the process
            of joining the overlay and is sending a Join request to Z, it is
            not yet reachable via forward routing. Even if it is established
            in the overlay, if network failures produce temporary instability,
            A may not be reachable (and may be trying to stabilize its network
            connectivity via Attach messages).</t>

            <t>Furthermore, forward-only responses are less likely to reach
            the querying peer than symmetric recursive because the forward
            path is more likely to have a failed peer than the request path
            (which was just tested to route the request) <xref
            target="stoica-non-transitive-worlds05"></xref>.</t>

            <t>An extension to RELOAD that supports forward-only routing but
            relies on symmetric responses as a fallback would be possible, but
            due to the complexities of determining when to use forward-only
            and when to fallback to symmetric, we have chosen not to include
            it as an option at this point.</t>
          </section>

          <section title="Direct Response">
            <t>Another routing option is Direct Response routing, in which the
            response is returned directly to the querying node. In the
            previous example, if A encodes its IP address in the request, then
            Z can simply deliver the response directly to A. In the absence of
            NATs or other connectivity issues, this is the optimal routing
            technique.</t>

            <t>The challenge of implementing direct response is the presence
            of NATs. There are a number of complexities that must be
            addressed. In this discussion, we will continue our assumption
            that A issued the request and Z is generating the response.</t>

            <t><list style="symbols">
                <t>The IP address listed by A may be unreachable, either due
                to NAT or firewall rules. Therefore, a direct response
                technique must fallback to symmetric response <xref
                target="stoica-non-transitive-worlds05"></xref>. The
                hop-by-hop ACKs used by RELOAD allow Z to determine when A has
                received the message (and the TLS negotiation will provide
                earlier confirmation that A is reachable), but this fallback
                requires a timeout that will increase the response latency
                whenever A is not reachable from Z.</t>

                <t>Whenever A is behind a NAT it will have multiple candidate
                IP addresses, each of which must be advertised to ensure
                connectivity, therefore Z will need to attempt multiple
                connections to deliver the response.</t>

                <t>One (or all) of A's candidate addresses may route from Z to
                a different device on the Internet. In the worst case these
                nodes may actually be running RELOAD on the same port.
                Therefore, establishing a secure connection to authenticate A
                before delivering the response is absolutely necessary. This
                step diminishes the efficiency of direct response because
                multiple roundtrips are required before the message can be
                delivered.</t>

                <t>If A is behind a NAT and does not have a connection already
                established with Z, there are only two ways the direct
                response will work. The first is that A and Z are both behind
                the same NAT, in which case the NAT is not involved. In the
                more common case, when Z is outside A's NAT, the response will
                only be received if A's NAT implements endpoint-independent
                filtering. As the choice of filtering mode conflates
                application transparency with security <xref
                target="RFC4787"></xref>, and no clear recommendation is
                available, the prevalence of this feature in future devices
                remains unclear.</t>
              </list></t>

            <t>An extension to RELOAD that supports direct response routing
            but relies on symmetric responses as a fallback would be possible,
            but due to the complexities of determining when to use direct
            response and when to fallback to symmetric, and the reduced
            performance for responses to peers behind restrictive NATs, we
            have chosen not to include it as an option at this point.</t>
          </section>

          <section title="Relay Peers">
            <t><xref target="I-D.jiang-p2psip-sep">SEP</xref> has proposed
            implementing a form of direct response by having A identify a
            peer, Q, that will be directly reachable by any other peer. A uses
            Attach to establish a connection with Q and advertises Q's IP
            address in the request sent to Z. Z sends the response to Q, which
            relays it to A. This then reduces the latency to two hops, plus Z
            negotiating a secure connection to Q.</t>

            <t>This technique relies on the relative population of nodes such
            as A that require relay peers and peers such as Q that are capable
            of serving as a relay peer. It also requires nodes to be able to
            identify which category they are in. This identification problem
            has turned out to be hard to solve and is still an open area of
            exploration.</t>

            <t>An extension to RELOAD that supports relay peers is possible,
            but due to the complexities of implementing such an alternative,
            we have not added such a feature to RELOAD at this point.</t>

            <t>A concept similar to relay peers, essentially choosing a relay
            peer at random, has previously been suggested to solve problems of
            pairwise non-transitivity <xref
            target="stoica-non-transitive-worlds05"></xref>, but deterministic
            filtering provided by NATs make random relay peers no more likely
            to work than the responding peer.</t>
          </section>

          <section title="Symmetric Route Stability">
            <t>A common concern about symmetric recursive routing has been
            that one or more peers along the request path may fail before the
            response is received. The significance of this problem essentially
            depends on the response latency of the overlay---an overlay that
            produces slow responses will be vulnerable to churn, whereas
            responses that are delivered very quickly are vulnerable only to
            failures that occur over that small interval.</t>

            <t>The other aspect of this issue is whether the request itself
            can be successfully delivered. Assuming typical connection
            maintenance intervals, the time period between the last
            maintenance and the request being sent will be orders of magnitude
            greater than the delay between the request being forwarded and the
            response being received. Therefore, if the path was stable enough
            to be available to route the request, it is almost certainly going
            to remain available to route the response.</t>

            <t>An overlay that is unstable enough to suffer this type of
            failure frequently is unlikely to be able to support reliable
            functionality regardless of the routing mechanism. However,
            regardless of the stability of the return path, studies show that
            in the event of high churn, iterative routing is a better solution
            to ensure request completion <xref
            target="ng-analytical-churn-ieeep2p06"></xref> <xref
            target="stoica-non-transitive-worlds05"></xref></t>

            <t>Finally, because RELOAD retries the end-to-end request, that
            retry will address the issues of churn that remain.</t>
          </section>
        </section>
      </section>

      <section title="Connectivity Management">
        <t>In order to provide efficient routing, a peer needs to maintain a
        set of direct connections to other peers in the Overlay Instance. Due
        to the presence of NATs, these connections often cannot be formed
        directly. Instead, we use the Attach request to establish a
        connection. Attach uses ICE <xref
        target="I-D.ietf-mmusic-ice-tcp"></xref> to establish the connection.
        It is assumed that the reader is familiar with ICE.</t>

        <t>Say that peer A wishes to form a direct connection to peer B. It
        gathers ICE candidates and packages them up in an Attach request which
        it sends to B through usual overlay routing procedures. B does its own
        candidate gathering and sends back a response with its candidates. A
        and B then do ICE connectivity checks on the candidate pairs. The
        result is a connection between A and B. At this point, A and B can add
        each other to their routing tables and send messages directly between
        themselves without going through other overlay peers.</t>

        <t>There is one special case in which Attach cannot be used: when a
        peer is joining the overlay and is not connected to any peers. In
        order to support this case, some small number of "bootstrap nodes"
        need to be publicly accessible so that new peers can directly connect
        to them. <xref target="secEnrollment"></xref> contains more detail on
        this.</t>

        <t>In general, a peer needs to maintain connections to all of the
        peers near it in the Overlay Instance and to enough other peers to
        have efficient routing (the details depend on the specific overlay).
        If a peer cannot form a connection to some other peer, this isn't
        necessarily a disaster; overlays can route correctly even without
        fully connected links. However, a peer should try to maintain the
        specified link set and if it detects that it has fewer direct
        connections, should form more as required. This also implies that
        peers need to periodically verify that the connected peers are still
        alive and if not try to reform the connection or form an alternate
        one.</t>
      </section>

      <section title="Overlay Algorithm Support">
        <t>The Topology Plugin allows RELOAD to support a variety of overlay
        algorithms. This draft defines a DHT based on Chord <xref
        target="Chord"></xref>, which is mandatory to implement, but the base
        RELOAD protocol is designed to support a variety of overlay
        algorithms.</t>

        <section title="Support for Pluggable Overlay Algorithms">
          <t>RELOAD defines three methods for overlay maintenance: Join,
          Update, and Leave. However, the contents of those messages, when
          they are sent, and their precise semantics are specified by the
          actual overlay algorithm; RELOAD merely provides a framework of
          commonly-needed methods that provides uniformity of notation (and
          ease of debugging) for a variety of overlay algorithms.</t>

          <!--     
          <t>An implementation should provide a suitable interface to
          the topology plugin to allow it full freedom to implement
          whatever routing, maintenance, and resource
          allocation/replication strategies it desires.  Specifying an
          API for this purpose is beyond the scope of this draft, but
          we recommend implementing at least two different overlay
          algorithms to confirm that the interface is sufficiently
          flexible.</t> 
     -->
        </section>

        <section anchor="sec-join-leave-maint"
                 title="Joining, Leaving, and Maintenance Overview">
          <t>When a new peer wishes to join the Overlay Instance, it must have
          a Node-ID that it is allowed to use. It uses the Node-ID in
          the certificate it received from the enrollment server. The details
          of the joining procedure are defined by the overlay algorithm, but
          the general steps for joining an Overlay Instance are:</t>

          <t><list style="symbols">
              <t>Forming connections to some other peers.</t>

              <t>Acquiring the data values this peer is responsible for
              storing.</t>

              <t>Informing the other peers which were previously responsible
              for that data that this peer has taken over responsibility.</t>
            </list></t>

          <t>The first thing the peer needs to do is form a connection to some
          "bootstrap node". Because this is the first connection the peer
          makes, these nodes must have public IP addresses and therefore can
          be connected to directly. Once a peer has connected to one or more
          bootstrap nodes, it can form connections in the usual way by routing
          Attach messages through the overlay to other nodes. Once a peer has
          connected to the overlay for the first time, it can cache the set of
          nodes it has connected to with public IP addresses for use as future
          bootstrap nodes.</t>

          <t>Once the peer has connected to a bootstrap node, it then needs to
          take up its appropriate place in the overlay. This requires two
          major operations:</t>

          <t><list style="symbols">
              <t>Forming connections to other peers in the overlay to populate
              its Routing Table.</t>

              <t>Getting a copy of the data it is now responsible for storing
              and assuming responsibility for that data.</t>
            </list></t>

          <t>The second operation is performed by contacting the Admitting
          Peer (AP), the node which is currently responsible for that section
          of the overlay.</t>

          <t>The details of this operation depend mostly on the overlay
          algorithm involved, but a typical case would be:</t>

          <t><list style="numbers">
              <t>JP (Joining Peer) sends a Join request to AP (Admitting Peer)
              announcing its intention to join.</t>

              <t>AP sends a Join response.</t>

              <t>AP does a sequence of Stores to JP to give it the data it
              will need.</t>

              <t>AP does Updates to JP and to other peers to tell it about its
              own routing table. At this point, both JP and AP consider JP
              responsible for some section of the Overlay Instance.</t>

              <t>JP makes its own connections to the appropriate peers in the
              Overlay Instance.</t>
            </list></t>

          <t>After this process is completed, JP is a full member of the
          Overlay Instance and can process Store/Fetch requests.</t>
	  
	  <t>
	    Note that the first node is a special case. When ordinary
	    nodes cannot form connections to the bootstrap nodes,
	    then they are not part of the overlay. However, the
	    first node in the overlay can obviously not
	    connect to others nodes. In order to support this case,
	    potential first nodes (which must also serve as 
	    bootstrap nodes initially) must somehow be instructed
	    (perhaps by configuration settings)
	    that they are the entire overlay, rather than not
	    part of it.
	  </t>
        </section>
      </section>

      <section title="First-Time Setup">
        <t>Previous sections addressed how RELOAD works once a node has
        connected. This section provides an overview of how users get
        connected to the overlay for the first time. RELOAD is designed so
        that users can start with the name of the overlay they wish to join
        and perhaps a username and password, and leverage that into having a
        working peer with minimal user intervention. This helps avoid the
        problems that have been experienced with conventional SIP clients
        where users are required to manually configure a large number of
        settings.</t>

        <section title="Initial Configuration">
          <t>In the first phase of the process, the user starts out with the
          name of the overlay and uses this to download an initial set of
          overlay configuration parameters. The user does a DNS SRV lookup on
          the overlay name to get the address of a configuration server. It
          can then connect to this server with HTTPS to download a
          configuration document which contains the basic overlay
          configuration parameters as well as a set of bootstrap nodes which
          can be used to join the overlay. <!--  Note that one or more of the peers can serve as
       a configuration server. For instance, the
       first peer to join the overlay might take on that role. --> </t>
        </section>

        <section title="Enrollment">
          <t>If the overlay is using centralized enrollment, then a user needs
          to acquire a certificate before joining the overlay. The certificate
          attests both to the user's name within the overlay and to the
          node-ids which they are permitted to operate. In that case, the
          configuration document will contain the address of an enrollment
          server which can be used to obtain such a certificate. The
          enrollment server may (and probably will) require some sort of
          username and password before issuing the certificate. The enrollment
          server's ability to restrict attackers' access to certificates in
          the overlay is one of the cornerstones of RELOAD's security.</t>
        </section>
      </section>

      <!-- usages are not being covered in the overview section 

      <section title="Diagnostics">
         <t>The Diagnostic Usage allows to retrieve diagnostic and performance
         statistics of nodes in the overlay. This is useful during debugging, 
         deployment, and maintenance of the overlay. Examples of diagnostic 
         information are routing table size, bytes sent and received per second, RTT, and 
         size of the instances stored. In addition, this usage allows to
         retrieve kinds defined by other usages.</t>
         
         <t>The access control of the kinds is defined by the peer and/or by the
         overlay policy. The peer may have a list of users (such as "admin") that 
         it is willing to return the information for and restrict access to users 
         with that name.</t>
         
         <t>During debugging and initial deployment, the diagnostic usage allows
         to retrieve the routing and storage of peers, thereby allowing to 
         verify the routing state of the overlay. In a large deployment, the usage 
         allows the overlay 'admin' to query the state of a few peers and 
         construct a connectivity graph to identify routing inconsistencies. 
         Among the various candidates for a routing table entry, a peer may
         select a node which has the smallest RTT, and the largest uptime.</t>

       </section>
-->

      <!-- EKR: RemoveD: TMI
     
         <section title="Enrollment">
           <t>Before a new user can join the Overlay Instance for the first time, they must
           enroll in the P2P Network for the Overlay Instance they want to join. Enrollment
           will typically be done by contacting a centralized enrollment server.
           Other approaches (for instance static out of band configuration) are
           possible but are outside the scope of this specification. During
           enrollment a new node learns about a particular overlay, sets up a
           names and credentials, and discovers the bootstrap nodes. This would
           typically be done when a new peer joined an overlay for the very first
           time. Bootstrap is the process that happens each time a node boots and
           is how the peer finds an node that can be used to join the
           overlay.</t>

           <t>Before a node can join an overlay, it needs to be provided with a
           name for the overlay. Some examples are "example.com", "example", and
           "example.local". This name is resolved via a DNS SRV lookup for
           service name p2p_enroll and a protocol of tcp. If the TLD for the name
           is .local, then this DNS SRV lookup is done using <xref
           target="I-D.cheshire-dnsext-multicastdns"></xref> and the service name
           p2p_menroll. The intention here is to support ad hoc/local overlays.
           The resulting DNS lookup will provide the address of a enrollment
           server. Once this server is found, HTTPS is used to retrieve a XML
           file that contains the parameters for the overlay. These include
           things such as: what algorithms the overlay uses, overlay parameters,
           what usages are a peer on this overlay is required to support, the
           type of credentials required, addresses of credentials servers, the
           root certificate for the Overlay Instance, information about the overlay algorithm that
           is being used, a P2P-Network-Id that uniquely identifies this ring,
           and any other parameters it may need to connect to the Overlay Instance. The overlay
           also informs the peers what Usages it is required to support to be a
           peer on this P2P Network. It also provides an initial list of
           bootstrap nodes that consists of multiple bootstrap entries that each
           have the IP address and port for contacting a bootstrap peer. Some of
           the address may be multicast addresses. In the case of multicast DNS,
           every peer may also act as an enrollment server.</t>

           <t>If shared-key security (<xref target="sec-shared-key"></xref>) is
           being used, then the peer can proceed directly to bootstrap. If
           certificate-based security (<xref target="sec-cert-security"></xref>
           is being used, the peer MUST contact the credential server to obtain a
           certificate.</t>

           <section title="Certificate Issuance">
             <t>Once the peer has the XML file that identifies if credentials are
             needed, it can contact the credential server. The user establishes
             his identity to the server's satisfaction and provides the server
             with its public key. The centralized server then returns a
             certificate binding the user's user name to his public key. The
             properties of the certificate are discussed in [XREF].
             The amount of authentication
             performed here can vary radically depending on the overlay network being
             joined. Some networks may do no verification at all and some may
             require extensive identity verification (e.g., checking a driver's
             license) before issuing credentials for a given user name. The only
             invariant that the enrollment server needs to ensure is that no two
             users may have the same identity.</t>
           </section>
           <section title="Bootstrap">
             <t>The above steps are only done the first time a peer joins a new
             overlay or when the overlay parameters are close to their expiration
             time (as listed in the configuration document) and need to be
             refreshed. The next step is the bootstrap step which is done every
             time the peer boots.</t>

             <t>Bootstrapping consists of looking at the list of cached nodes and
             bootstraps nodes and sending a RELOAD Ping to them to see if they
             respond. Once a node responds, it can be used to join the overlay.
             After a node has joined, it keeps track of a small number of peers
             to which it could directly connect. Theses are saved as the cached
             nodes and used next time the peer boots. The point of the cached
             nodes is to reduce the load on the bootstrap nodes.</t>
           </section>
         </section>

-->
    </section>

    <section title="Application Support Overview">
      <t>RELOAD is not intended to be used alone, but rather as a substrate
      for other applications. These applications can use RELOAD for a variety
      of purposes:</t>

      <t><list style="symbols">
          <t>To store data in the overlay and retrieve data stored by other
          nodes.</t>

          <t>As a discovery mechanism for services such as TURN.</t>

          <t>To form direct connections which can be used to transmit
          application-level messages.</t>
        </list></t>

      <t>This section provides an overview of these services.</t>

      <section title="Data Storage">
        <t>RELOAD provides operations to Store, Fetch, and Remove data. Each
        location in the Overlay Instance is referenced by a Resource-ID.
        However, each location may contain data elements corresponding to
        multiple kinds (e.g., certificate, SIP registration). Similarly, there
        may be multiple elements of a given kind, as shown below:</t>

        <figure>
          <artwork><![CDATA[
                    +--------------------------------+
                    |            Resource-ID         |
                    |                                |
                    | +------------+  +------------+ | 
                    | |   Kind 1   |  |   Kind 2   | |
                    | |            |  |            | |
                    | | +--------+ |  | +--------+ | |
                    | | | Value  | |  | | Value  | | |
                    | | +--------+ |  | +--------+ | |
                    | |            |  |            | |
                    | | +--------+ |  | +--------+ | |
                    | | | Value  | |  | | Value  | | |
                    | | +--------+ |  | +--------+ | |
                    | |            |  +------------+ |
                    | | +--------+ |                 |
                    | | | Value  | |                 |
                    | | +--------+ |                 |
                    | +------------+                 |
                    +--------------------------------+
              ]]></artwork>
        </figure>

        <t>Each kind is identified by a kind-id, which is a code point
        assigned by IANA. As part of the kind definition, protocol designers
        may define constraints, such as limits on size, on the values which
        may be stored. For many kinds, the set may be restricted to a single
        value; some sets may be allowed to contain multiple identical items
        while others may only have unique items. Note that a kind may be
        employed by multiple usages and new usages are encouraged to use
        previously defined kinds where possible. We define the following data
        models in this document, though other usages can define their own
        structures:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="single value:">There can be at most one item in the
            set and any value overwrites the previous item.</t>

            <t></t>

            <t hangText="array:">Many values can be stored and addressed by a
            numeric index.</t>

            <t></t>

            <t hangText="dictionary:">The values stored are indexed by a key.
            Often this key is one of the values from the certificate of the
            peer sending the Store request.</t>
          </list></t>

        <t>In order to protect stored data from tampering, by other nodes,
        each stored value is digitally signed by the node which created it.
        When a value is retrieved, the digital signature can be verified to
        detect tampering.</t>

        <section title="Storage Permissions">
          <t>A major issue in peer-to-peer storage networks is minimizing the
          burden of becoming a peer, and in particular minimizing the amount
          of data which any peer is required to store for other nodes. RELOAD
          addresses this issue by only allowing any given node to store data
          at a small number of locations in the overlay, with those locations
          being determined by the node's certificate. When a peer uses a Store
          request to place data at a location authorized by its certificate,
          it signs that data with the private key that corresponds to its
          certificate. Then the peer responsible for storing the 
	  data is able to verify that
          the peer issuing the request is authorized to make that request.
          Each data kind defines the exact rules for determining what
          certificate is appropriate.</t>

          <t>The most natural rule is that a certificate authorizes a user to
          store data keyed with their user name X. This rules is used for all
          the kinds defined in this specification. Thus, only a user with a
          certificate for "alice@example.org" could write to that location in
          the overlay. However, other usages can define any rules they choose,
          including publicly writable values.</t>

          <t>The digital signature over the data serves two purposes. First,
          it allows the peer responsible for storing the data to verify that
          this Store is authorized. Second, it provides integrity for the
          data. The signature is saved along with the data value (or values)
          so that any reader can verify the integrity of the data. Of course,
          the responsible peer can "lose" the value but it cannot undetectable
          modify it.</t>

          <t>The size requirements of the data being stored in the overlay are
          variable. For instance, a SIP AoR and voicemail differ widely in the
          storage size. RELOAD leaves it to the Usage and overlay configuration
	  to address the size
          imbalance of various kinds.</t>
        </section>

        <section anchor="sec-usages" title="Usages">
          <t>By itself, the distributed storage layer just provides
          infrastructure on which applications are built. In order to do
          anything useful, a usage must be defined. Each Usage specifies
          several things:</t>

          <t><list style="symbols">
              <t>Registers kind-id code points for any kinds that the Usage
              defines.</t>

              <t>Defines the data structure for each of the kinds.</t>

              <t>Defines access control rules for each kinds.</t>

              <t>Defines how the Resource Name is formed that is hashed to
              form the Resource-ID where each kind is stored.</t>

              <t>Describes how values will be merged after a network
              partition. Unless otherwise specified, the default merging rule
              is to act as if all the values that need to be merged were
              stored and that the order they were stored in corresponds to the
              stored time values associated with (and carried in) their
              values. Because the stored time values are those associated with
              the peer which did the writing, clock skew is generally not an
              issue. If two nodes are on different partitions, clocks, this
              can create merge conflicts. However because RELOAD deliberately
              segregates storage so that data from different users and peers
              is stored in different locations, and a single peer will
              typically only be in a single network partition, this case will
              generally not arise.</t>
            </list></t>

          <t>The kinds defined by a usage may also be applied to other usages.
          However, a need for different parameters, such as different size
          limits, would imply the need to create a new kind.</t>
        </section>

        <section title="Replication">
          <t>Replication in P2P overlays can be used to provide:</t>

          <t><list style="hanging">
              <t hangText="persistence: ">if the responsible peer crashes
              and/or if the storing peer leaves the overlay</t>

              <t hangText="security: ">to guard against DoS attacks by the
              responsible peer or routing attacks to that responsible peer</t>

              <t hangText="load balancing: ">to balance the load of queries
              for popular resources.</t>
            </list></t>

          <t>A variety of schemes are used in P2P overlays to achieve some of
          these goals. Common techniques include replicating on neighbors of
          the responsible peer, randomly locating replicas around the overlay,
          or replicating along the path to the responsible peer.</t>

          <t>The core RELOAD specification does not specify a particular
          replication strategy. Instead, the first level of replication
          strategies are determined by the overlay algorithm, which can base
          the replication strategy on the its particular topology. For
          example, Chord places replicas on successor peers, which will take
          over responsibility should the responsible peer fail <xref
          target="Chord"></xref>.</t>

          <t>If additional replication is needed, for example if data
          persistence is particularly important for a particular usage, then
          that usage may specify additional replication, such as implementing
          random replications by inserting a different well known constant
          into the Resource Name used to store each replicated copy of the
          resource. Such replication strategies can be added independent of
          the underlying algorithm, and their usage can be determined based on
          the needs of the particular usage.</t>
        </section>
      </section>

      <section title="Service Discovery">
        <t>RELOAD does not currently define a generic service discovery
        algorithm as part of the base protocol--although a TURN-specific
	discovery mechanism is provided. A variety of service discovery
        algorithm can be implemented as extensions to the base protocol, such
        as ReDIR <xref target="opendht-sigcomm05"></xref>.</t>
      </section>

      <section title="Application Connectivity">
        <t>There is no requirement that a RELOAD usage must use RELOAD's
        primitives for establishing its own communication if it already
        possesses its own means of establishing connections. For example, one
        could design a RELOAD-based resource discovery protocol which used
        HTTP to retrieve the actual data.</t>

        <t>For more common situations, however, the overlay itself is used to
        establish a connection rather than an external authority such as DNS,
        RELOAD provides connectivity to applications using the same Attach
        method as is used for the overlay maintenance. For example, if a
        P2PSIP node wishes to establish a SIP dialog with another P2PSIP node,
        it will use Attach to establish a direct connection with the other
        node. This new connection is separate from the peer protocol
        connection, it is a dedicated UDP or TCP flow used only for the SIP
        dialog. Each usage specifies which types of connections can be
        initiated using Attach.</t>
      </section>
    </section>

    <section title="P2PSIP Integration Overview">
      <t>The SIP Usage of RELOAD allows SIP user agents to provide a
      peer-to-peer telephony service without the requirement for permanent
      proxy or registration servers. In such a network, the RELOAD overlay
      itself performs the registration and rendezvous functions ordinarily
      associated with such servers.</t>

      <t>The basic function of the SIP usage is to allow Alice to start with a
      SIP URI (e.g., "bob@dht.example.com") and end up with a connection which
      Alice's SIP UA can use to pass SIP messages back and forth to Bob's SIP
      UA. The way this works is as follows:</t>

      <t><list style="numbers">
          <t>Bob, operating Node-ID 1234, stores a mapping from his URI to his
          Node-ID in the overlay. I.e., "sip:bob@dht.example.com ->
          1234".</t>

          <t>Alice, operating Node-ID 5678, decides to call Bob. She looks up
          "sip:bob@dht.example.com" in the overlay and retrieves "1234".</t>

          <t>Alice uses the overlay to route an Attach message to Bob's peer.
          Bob responds with his own Attach and they set up a direct
          connection, as shown below.</t>
        </list></t>

      <figure>
        <artwork><![CDATA[

Alice       Peer1      Overlay     PeerN      Bob
(5678)                                     (1234)
-------------------------------------------------
Attach ->
          Attach ->
                      Attach -> 
                                   Attach ->
                                       <- Attach
                                <- Attach
                   <- Attach
         <- Attach

<------------------ ICE Checks ----------------->
INVITE ----------------------------------------->
<--------------------------------------------- OK
ACK -------------------------------------------->
<------------ ICE Checks for media ------------->
<-------------------- RTP ---------------------->

    ]]></artwork>
      </figure>

      <t>It is important to note that RELOAD's only role here is to set up the
      direct connection between Alice and Bob. As soon as the ICE checks
      complete and the connection is established, then ordinary SIP is used.
      In particular, the establishment of the media channel for the phone call
      happens via the usual SIP mechanisms, and RELOAD is not involved. Media
      never goes over the overlay. After the successful exchange of SIP
      messages, call peers run ICE connectivity checks for media.</t>

      <t>As well as allowing mappings from AORs to Node-IDs, the SIP Usage
      also allows mappings from AORs to other AORs. For instance, if Bob
      wanted his phone calls temporarily forwarded to Charlie, he could store
      the mapping "sip:bob@dht.example.com -> sip:charlie@dht.example.com".
      When Alice wants to call Bob, she retrieves this mapping and can then
      fetch Charlie's AOR to retrieve his Node-ID.</t>

      <!-- EKR RemoveD: Too much information here
            
     
           <section title="SIP Connect">
             <t>This usage allows two clients to form a new TLS or DTLS
             connection between them and then use this connection for sending
             SIP messages to one another. This does not store any information
             in the overlay, but it allows the Attach request to be used to set up
             a TLS or DTLS connection between two peers and then use that
             connection to send SIP messages back and forth.</t>

             <t>The Attach request will ensure that the connection is formed
             to a peer that has a certificate which includes the user that the
             connection is being formed to.</t>
           </section>

           <section title="SIP GRUUs">
             <t>GRUUs that refer to peers in the P2P network are constructed by
             simply forming a GRUU, where the value of gr URI parameter
             contains a base64 encoded version of the destination list that
             will reach the peer. Typically the destination list is just a
             single entry with the Node-ID of peer.</t>
           </section>
-->

      <!-- EKR Removed
           <section title="SIP Tunnel">
           

             <t>This Tunnel request allows two peers to exchange SIP messages
             across the overlay using the Tunnel method without first setting
             up a direct connection using Attach. This allows a SIP message to
             be sent immediately, without the delay associated with Attach and
             for a simple SIP exchange, it may result in fewer messages being
             sent.</t>
           </section>
           -->
    </section>

    <!-- EKR: RemoveD

    <section title="Overview">
      <section title="Distributed Storage Layer">
        <t>RELOAD is designed to be extensible to both structured and
        unstructured overlays. However, this version is only completely worked
        out for structured overlays such as DHTs. The following text assumes
        structured overlays; in particular Resource-IDs are assumed to be
        fixed length for any given overlay, although the protocol allows them
        to be variable length to allow extension to unstructured overlays.</t>

        <t>Each logical address in the DHT where data can be stored is
        referred to as a Resource-ID. A given peer will be responsible for
        storing data from many Resource-ID locations. Typically literature on
        DHTs uses the term "key" to refer to a location in the DHT; however,
        in this specification the term key is used to refer to public or
        private keys used for cryptographic operations and the term
        Resource-ID is used to refer to a location for storage in the DHT.</t>

        <section title="DHT Concepts">
          <t>While very early P2P systems used flood based techniques, some
          newer P2P systems locate resources using a Distributed Hash Table,
          or DHT to improve efficiency. Peers are organized using a
          Distributed Hash Table (DHT) structure. In such a system, every
          resource has a Resource-ID, which is obtained by hashing some
          keyword or value (an Resource Name) that uniquely identifies the
          resource. Resources can be thought of as being stored in a hash
          table at the entry corresponding to their Resource-ID. The peers
          that make up the overlay network are also assigned an ID, called a
          Node-ID, in the same hash space as the Resource-IDs. A peer is
          responsible for storing all resources that have Resource-IDs near
          the peer's Node-ID. The hash space is divided up so that all of the
          hash space is always the responsibility of some particular peer,
          although as peers enter and leave the system a particular peer's
          area may change. Messages are exchanged between the peers in the DHT
          as the peers enter and leave to preserve the structure of the DHT
          and exchange stored entries. Various DHT implementations may
          visualize the hash space as a grid, circle, line, or hypercube.</t>

          <t>Peers keep information about the location of other peers in the
          hash space and typically know about many peers nearby in the hash
          space, and progressively fewer more distant peers. We refer to this
          table of other peers as a Routing Table. When a peer wishes to
          operate on a resource it consults the list of peers it is aware of
          and contacts the peer with the Node-ID nearest the desired
          Resource-ID. If that peer does not know how to find the resource, it
          either returns information about a closer peer it knows about, or
          forwards the request to a closer peer. In this fashion, the request
          eventually reaches the peer responsible for the resource, which then
          replies to the requester.</t>
        </section>

        <section title="DHT Topology">
          <t>Each DHT will have a somewhat different structure, but many of
          the concepts are common. The DHT defines a large space of
          Resource-IDs, which can be thought of as addresses. In many DHTs,
          the Resource-IDs are simply 128- or 160-bit integers. Each DHT also
          has a distance metric such that we can say that Resource-ID A is
          closer to Resource-ID B than to Resource-ID C.</t>

          <t>Each peer in the DHT is assigned a Node-ID and is "responsible"
          for the nearby space of Resource-IDs. So, for instance, if we have a
          peer P, then it could also be responsible for storing data
          associated with Resource-ID P+epsilon as long as no other peer P was
          closer. The DHT Resource-ID space is divided so that some peer is
          responsible for each Resource-ID.</t>
        </section>


      <section title="Migration">
        <t>At some point in time, a given P2P Network may want to migrate from
        one underlying DHT algorithm to another or update to a later extension
        of the protocol. This can also be used for crypto agility issues. The
        migration approach is done by having peers initializing algorithm A.
        When the clients go to periodically renew their credentials, they find
        out that the P2P Network now requires them to use algorithm A but also
        to store all the data with algorithm B. At this point there are
        effectively two DHT rings in use, rings A and B. All data is written
        to both but queries only go to A. At some point when the clients
        periodically renew their credentials, they learn that the P2P Network
        has moved to storing to both A and B but that Fetch requests are done
        with P2P Network B and that any SEND should first be attempted on P2P
        Network B and if that fails, retried on P2P Network A. In the final
        stage when clients renew credentials, they find out that P2P Network A
        is no longer required and only P2P Network B is in use. Some types of
        usages and environments may be able to migrate very quickly and do all
        of these steps in under a week, depending on how quickly software that
        supports both A and B is deployed and how often credentials are
        renewed. On the other hand, some very ad-hoc environments involving
        software from many different providers may take years to migrate.</t>

        <t>[[TODO: This needs more filling out]]</t>
      </section>

      <section title="Usages Layer">

        <section title="Certificate Store Usage">
          <t>This usage allows each user to store their certificate in the overlay
          so that it can be retrieved to be checked by various peers and
          applications. Peers acting on behalf of a particular user store that
          user's certificate in the overlay, and any peer that needs the
          certificate can do a Fetch to retrieve the certificate. Typically it
          is retrieved to check a signature on a request or the signature on a
          chunk of data that the overlay has received.</t>
        </section>

        <section title="TURN Usage">
          <t>This usage defines a new kind for finding STUN-Relay servers. Any
          peer that supports this usage saves a pointer to the IP address and
          port of the TURN server in the overlay. When a peer wishes to discover a
          TURN server, it picks a random Resource-ID and performs a Find at
          that Resource-ID for the appropriate type for the service. If
          nothing is found, this can be repeated until an appropriate set of
          servers are found.</t>
        </section>
        <section title="Diagnostic Usage">
          <t>This usage defines several new kinds that be queried to find
          information about the peer that may be useful for monitoring and
          diagnostics. This includes information such as software version,
          neighbor information, and performance statistics.</t>
        </section>

        <section title="HIP Tunnel Usage">
          <t>This usage allows two peers running HIP to tunnel HIP messages
          across the overlay. This allows the HIP peers to use the overlay as
          a rendezvous system to set up a direct path using HIP NAT traversal
          mechanisms.</t>
        </section>

         -->

    <section title="Overlay Management Protocol">
      <t>This section defines the basic protocols used to create, maintain,
      and use the RELOAD overlay network. We start by defining how messages
      are transmitted, received, and routed in an existing overlay, then
      define the message structure, and then finally define the messages used
      to join and maintain the overlay.</t>

      <section title="Message Routing">
        <t>This section describes procedures used by nodes to route messages
        through the overlay.</t>

        <!--  EKR RemoveD. Repetitive
         <t>
           Regardless of which overlay algorithm is used, a RELOAD overlay
           is a partly connected (incomplete) graph of nodes, each identified by
           Node-ID. Each node maintains a set of connections to some 
           other set of nodes in the overlay. If a node is directly
           connected to the destination of a message, it can send it
           directly. However, in general, any two nodes will probably not be
           directly connected; when node A wants to send a message to
           node B, the message must traverse some set of other peers
     in the graph,
           with the precise set of intermediate peers traversed
           depending on the overlay algorithm.
         </t>
         <t>
           RELOAD intentionally separates the generic mechanisms for
           routing messages from the precise overlay topology.
           The topology
           plugin (see [XREF]) should be thought of as providing a
           routing table. When a node wishes to transmit a message to
           a given Node-ID to which it is not connected, it consults
           the routing table which tells
           it which of its existing connections to forward the message
           down. However, the procedures for sending, receiving, and
           forwarding the messages are the same regardless of the 
           topology and contents of the routing table.
         </t>
         <t>
           RELOAD also incorporates a loose source routing feature using
           DESTINATION LISTS. When a node transmits a message it
           can provide a set of Node-IDs which it wishes the message
           to be routed through. Each intermediate peer examines
           the first entry on the destination list and routes 
           the message to that node. When that node is reached,
           it removes itself from the destination list and routes
           based on the next entry. This repeats until the
           message arrives at its final destination.
           This makes it possible to address a node which
           is potentially behind a NAT or a firewall in such a way that it
           cannot be connected to directly under any circumstances
         </t>
         -->

        <section anchor="sec-request-origination" title="Request Origination">
          <t>In order to originate a message to a given Node-ID or
          resource-id, a node constructs an appropriate destination list. The
          simplest such destination list is a single entry containing the peer
          or resource-id. The resulting message will use the normal overlay
          routing mechanisms to forward the message to that destination. The
          node can also construct a more complicated destination list for
          source routing.</t>

          <t>Once the message is constructed, the node sends the message to
          some adjacent peer. If the first entry on the destination list is
          directly connected, then the message MUST be routed down that
          connection. Otherwise, the topology plugin MUST be consulted to
          determine the appropriate next hop.</t>

          <t>Parallel searches for the resource are a common solution to
          improve reliability in the face of churn or of subversive peers.
          Parallel searches for usage-specified replicas are managed by the
          usage layer. However, a single request can also be routed through
          multiple adjacent peers, even when known to be sub-optimal, to
          improve reliability <xref target="vulnerabilities-acsac04"></xref>.
          Such parallel searches MAY BE specified by the topology plugin.</t>

          <t>Because messages may be lost in transit through the overlay,
          RELOAD incorporates an end-to-end reliability mechanism. When an
          originating node transmits a request it MUST set a 3 second timer.
          If a response has not been received when the timer fires, the
          request is retransmitted with the same transaction identifier. The
          request MAY be retransmitted up to 4 times (for a total of 5
          messages). After the timer for the fifth transmission fires, the
          message SHALL be considered to have failed. Note that this
          retransmission procedure is not followed by intermediate nodes. They
          follow the hop-by-hop reliability procedure described in <xref
          target="sec-reliability"></xref>.</t>
	  
	  <t>
	    The above algorithm can result in multiple requests being
	    delivered to a node. Receiving nodes MUST generate semantically
	    equivalent responses to retransmissions of the same request
	    (this can be determined by transaction id) if the request is
	    received within the maximum request lifetime (15 seconds).
	    For some requests (e.g., FETCH) this can be accomplished merely
	    by processing the request again. For other requests,
	    (e.g., STORE) it
	    may be necessary to maintain state for the duration of the
	    request lifetime.
	  </t>
        </section>

        <section anchor="sec-message-forwarding"
                 title="Message Receipt and Forwarding">
          <t>When a peer receives a message, it first examines the overlay,
          version, and other header fields to determine whether the message is
          one it can process. If any of these are incorrect (e.g., the message
          is for an overlay in which the peer does not participate) it is an
          error. The peer SHOULD generate an appropriate error but if local
          policy can override this in which case the messages is silently
          dropped.</t>

          <t>Once the peer has determined that the message is correctly
          formatted, it examines the first entry on the destination list.
          There are three possible cases here:</t>

          <t><list style="symbols">
              <t>The first entry on the destination list is an id for which
              the peer is responsible.</t>

              <t>The first entry on the destination list is a an id for which
              another peer is responsible.</t>

              <t>The first entry on the destination list is a private id which
              is being used for destination list compression.</t>
            </list></t>

          <t>These cases are handled as discussed below.</t>

          <section anchor="sec-responsible-id" title="Responsible ID">
            <t>If the first entry on the destination list is a ID for which
            the node is responsible, there are several sub-cases. <list
                style="symbols">
                <t>If the entry is a Resource-Id, then it MUST be the only
                entry on the destination list. If there are other entries, the
                message MUST be silently dropped. Otherwise, the message is
                destined for this node and it passes it up to the upper
                layers.</t>

                <t>If the entry is a Node-Id which belongs to this node, then
                the message is destined for this node. If this is the only
                entry on the destination list, the message is destined for
                this node and is passed up to the upper layers. Otherwise the
                entry is removed from the destination list and the message is
                passed it to the routing layer. If the message is a response
                and there is state for the transaction ID, the state is
                reinserted into the destination list first.</t>

                <t>If the entry is a Node-Id which is not equal to this node,
                then the node MUST drop the message silently unless the
                Node-Id corresponds to a node which is directly connected to
                this node (i.e., a client). In that case, it MUST forward the
                message to the destination node as described in the next
                section.</t>
              </list></t>

            <t>
	      Note that this implies that in order to address a message to
	      "the peer that controls region X", a sender sends to resource-id
	      X, not Node-ID X.
	    </t>
          </section>

          <section anchor="sec-other-id" title="Other ID">
            <t>If neither of the other two cases applies, then the peer MUST
            forward the message towards the first entry on the destination
            list. This means that it MUST select one of the peers to which it
            is connected and which is likely to be responsible for the first
            entry on the destination list. If the first entry on the
            destination list is in the peer's connection table, then it SHOULD
            forward the message to that peer directly. Otherwise, it consult
            the routing table to forward the message.</t>

            <t>Any intermediate peer which forwards a RELOAD message MUST
            arrange that if it receives a response to that message the
            response can be routed back through the set of nodes through which
            the request passed. This may be arranged in one of two ways:</t>

            <t><list style="symbols">
                <t>The peer MAY add an entry to the via list in the forwarding
                header that will enable it to determine the correct node.</t>

                <t>The peer MAY keep per-transaction state which will allow it
                to determine the correct node.</t>
              </list></t>

            <t>As an example of the first strategy, if node D receives a
            message from node C with via list (A, B), then D would forward to
            the next node (E) with via list (A, B, C). Now, if E wants to
            respond to the message, it reverses the via list to produce the
            destination list, resulting in (D, C, B, A). When D forwards the
            response to C, the destination list will contain (C, B, A).</t>

            <t>As an example of the second strategy, if node D receives a
            message from node C with transaction ID X and via list (A, B), it
            could store (X, C) in its state database and forward the message
            with the via list unchanged. When D receives the response, it
            consults its state database for transaction id X, determines that
            the request came from C, and forwards the response to C.</t>

            <t>Intermediate peer which modify the via list are not required to
            simply add entries. The only requirement is that the peer be able
            to reconstruct the correct destination list on the return route.
            RELOAD provides explicit support for this functionality in the
            form of private IDs, which can replace any number of via list
            entries. For instance, in the above example, Node D might send E a
            via list containing only the private ID (I). E would then use the
            destination list (D, I) to send its return message. When D
            processes this destination list, it would detect that I is a
            private ID, recover the via list (A, B, C), and reverse that to
            produce the correct destination list (C, B, A) before sending it
            to C. This feature is called List Compression. I MAY either be a
            compressed version of the original via list or an index into a
            state database containing the original via list.</t>

            <t>Note that if an intermediate peer exits the overlay, then on
            the return trip the message cannot be forwarded and will be
            dropped. The ordinary timeout and retransmission mechanisms
            provide stability over this type of failure.</t>
          </section>

          <section anchor="sec-private-Node-ID" title="Private ID">
            <t>If the first entry on the destination list is a private id
            (e.g., a compressed via list), the peer MUST that entry with the
            original via list that it replaced indexes and then re-examine the
            destination list to determine which case now applies.</t>
          </section>
        </section>

        <section anchor="sec-response-origination"
                 title="Response Origination">
          <t>When a peer sends a response to a request, it MUST construct the
          destination list by reversing the order of the entries on the via
          list. This has the result that the response traverses the same peers
          as the request traversed, except in reverse order (symmetric
          routing). Note that this rule will need to be relaxed if other
          routing algorithms are supported.</t>
        </section>
      </section>

      <section title="Message Structure">
        <t>RELOAD is a message-oriented request/response protocol. The
        messages are encoded using binary fields. All integers are represented
        in network byte order. The general philosophy behind the design was to
        use Type, Length, Value fields to allow for extensibility. However,
        for the parts of a structure that were required in all messages, we
        just define these in a fixed position as adding a type and length for
        them is unnecessary and would simply increase bandwidth and introduces
        new potential for interoperability issues.</t>

        <t>Each message has three parts, concatenated as shown below:</t>

        <figure>
          <artwork><![CDATA[
   +-------------------------+
   |    Forwarding Header    |
   +-------------------------+
   |    Message Contents     |
   +-------------------------+
   |       Signature         |
   +-------------------------+
   
]]></artwork>
        </figure>

        <t>The contents of these parts are as follows: <list style="hanging">
            <t></t>

            <t hangText="Forwarding Header:">Each message has a generic header
            which is used to forward the message between peers and to its
            final destination. This header is the only information that an
            intermediate peer (i.e., one that is not the target of a message)
            needs to examine.</t>

            <t></t>

            <t hangText="Message Contents:">The message being delivered
            between the peers. From the perspective of the forwarding layer,
            the contents is opaque, however, it is interpreted by the higher
            layers.</t>

            <t></t>

            <t hangText="Signature:">A digital signature over the message
            contents and parts of the header of the message. Note that this
            signature can be computed without parsing the message
            contents.</t>
          </list></t>

        <t>The following sections describe the format of each part of the
        message.</t>

        <section anchor="sec-presentation-language"
                 title="Presentation Language">
          <t>The structures defined in this document are
          defined using a C-like syntax based on the presentation language
          used to define TLS. Advantages of this style include:</t>

          <t><list style="symbols">
              <t>It is easy to write and familiar enough looking that most
              readers can grasp it quickly.</t>

              <t>The ability to define nested structures allows a separation
              between high-level and low level message structures.</t>

              <t>It has a straightforward wire encoding that allows quick
              implementation, but the structures can be comprehended without
              knowing the encoding.</t>

	      <t>The ability to mechanically (compile) encoders and
	      decoders.</t>

            </list>
          </t>

          <t> This presentation is to some extent a placeholder. We
          consider it an open question what the final protocol definition
          method and encodings use. We expect this to be a question for the WG
          to decide. </t>

          <t>Several idiosyncrasies of this language are worth noting.</t>

          <t><list style="symbols">
              <t>All lengths are denoted in bytes, not objects.</t>

              <t>Variable length values are denoted like arrays with angle
              brackets.</t>

              <t>"select" is used to indicate variant structures.</t>
            </list></t>

          <t>For instance, "uint16 array<0..2^8-2>;" represents up to
          254 bytes but only up to 127 values of two bytes (16 bits)
          each..</t>

          <section anchor="sec-definitions" title="Common Definitions">
            <t>The following definitions are used throughout RELOAD and so are
            defined here. They also provide a convenient introduction to how
            to read the presentation language.</t>

            <t>An enum represents an enumerated type. The values associated
            with each possibility are represented in parentheses and the
            maximum value is represented as a nameless value, for purposes of
            describing the width of the containing integral type. For
            instance, Boolean represents a true or false:</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
       enum { false (0), true(1), (255)} Boolean;
       
     ]]></artwork>
            </figure>

            <t>A boolean value is either a 1 or a 0 and is represented as a
            single byte on the wire.</t>

            <t>The NodeId, shown below, represents a single Node-ID.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[

           typedef opaque       NodeId[16];

       ]]></artwork>
            </figure>

            <t>A NodeId is a fixed-length 128-bit structure represented as a
            series of bytes, most significant byte first. Note: the use of
            "typedef" here is an extension to the TLS language, but its
            meaning should be relatively obvious.</t>

            <t>A ResourceId, shown below, represents a single resource-id.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[

           typedef opaque       ResourceId<0..2^8-1>;

       ]]></artwork>
            </figure>

            <t>Like a NodeId, a resource-id is an opaque string of bytes, but
            unlike Node-IDs, resource-ids are variable length, up to 255 bytes
            (2048 bits) in length. On the wire, each ResourceId is preceded by
            a single length byte (allowing lengths up to 255). Thus, the
            3-byte value "Foo" would be encoded as: 03 46 4f 4f.</t>

            <t>A more complicated example is IpAddressPort, which represents a
            network address and can be used to carry either an IPv6 or IPv4
            address:</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[

      enum {reserved_addr(0), ipv4_address (1), ipv6_address (2), 
           (255)} AddressType;
      
      struct  {
        uint32                  addr;
        uint16                  port;
      } IPv4AddrPort;
      
      struct  {
        uint128                 addr;
        uint16                  port;
      } IPv6AddrPort;
      
      
      struct {
        AddressType             type;
        uint8                   length;
        
        select (type) {
          case ipv4_address:
             IPv4AddrPort       v4addr_port;
          
          case ipv6_address:
             IPv6AddrPort       v6addr_port;

          /* This structure can be extended */

       } IpAddressPort;

       ]]></artwork>
            </figure>

            <t>The first two fields in the structure are the same no matter
            what kind of address is being represented:</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="type "></t>

                <t>the type of address (v4 or v6).</t>

                <t></t>

                <t hangText="length "></t>

                <t>the length of the rest of the structure.</t>
              </list></t>

            <t>By having the type and the length appear at the beginning of
            the structure regardless of the kind of address being represented,
            an implementation which does not understand new address type X can
            still parse the IpAddressPort field and then discard it if it is
            not needed.</t>

            <t>The rest of the IpAddressPort structure is either an
            IPv4AddrPort or an IPv6AddrPort. Both of these simply consist of
            an address represented as an integer and a 16-bit port. As an
            example, here is the wire representation of the IPv4 address
            "192.0.2.1" with port "6100".</t>

            <figure>
              <artwork><![CDATA[
           01           ; type    = IPv4
           06           ; length  = 6
           c0 00 02 01  ; address = 192.0.2.1
           17 d4        ; port    = 6100
           ]]></artwork>
            </figure>
          </section>
        </section>

        <section anchor="sec-forwarding-header" title="Forwarding Header">
          <t>The forwarding header is defined as a ForwardingHeader
	  structure, as shown below.</t>

          <figure>
              <!--begin-pdu-->
            <artwork><![CDATA[

      struct {
        uint32             relo_token;
        uint32             overlay;
        uint8              ttl;
        uint8              reserved;
        uint16             fragment;
        uint8              version;
        uint24             length;
        uint64             transaction_id;
        uint16             flags;
        
        uint16             via_list_length;
        uint16             destination_list_length;
        uint16             route_log_length;
        uint16             options_length;
        Destination        via_list[via_list_length];
        Destination        destination_list
                             [destination_list_length];
        RouteLogEntry      route_log[route_log_length];
        ForwardingOptions  options[options_length];
      } ForwardingHeader;
]]></artwork>
          </figure>
	  
	  <t>
	    The contents of the structure are:
	  </t>
	  <t><list style="hanging">
	    <t></t><t hangText="relo_token"></t><t>
	    The first four bytes identify this message as a RELOAD message.
	    The message is easy to demultiplex from STUN messages by looking at
	    the first bit. This field MUST contain the value 
	    0xc2454c4f (the string 'RELO' with the high bit of the first
	    byte set.).
	  </t>
	  
	  <t></t><t hangText="overlay"></t>
	  <t>
	    The 32 bit checksum/hash of the overlay
	    being used. The variable length string representing the overlay name
	    is hashed with SHA-1 and the low order 32 bits are used. The purpose
	    of this field is to allow nodes to participate in multiple overlays
	    and to detect accidental misconfiguration. This is not a security
	    critical function.
	  </t>
	  <t></t><t hangText="ttl"></t>
	  <t>
	    An 8 bit field indicating the number of
	    iterations, or hops, a message can experience before it is
	    discarded. The TTL value MUST be decremented by one at every hop
	    along the route the message traverses. If the TTL is 0, the message
	    MUST NOT be propagated further and MUST be discarded. The initial
	    value of the TTL should be TBD.
	  </t>

	  <t></t><t hangText="fragment"></t>
	  <t>
	    This field is used to handle fragmentation. The high order
	    two bits are used to indicate the fragmentation status:
	    If the high bit (0x8000) is set, it indicates that the message is
	    a fragment. If the next bit (0x4000) is set, it indicates that this is the
	    last fragment.
	  </t>
	  <t>
	    The remainder of the field is used to indicate the fragment
	      offset.
	      [[Open Issue: This is conceptually clear, but the details are
	      still lacking. Need to define the fragment offset and total length
	      be encoded in the header. Right now we have 14 bits reserved with
	      the intention that they be used for fragmenting, though additional
	      bytes in the header might be needed for fragmentation.]]
	  </t>

	  <t></t><t hangText="version"></t>
	  <t>
	    The version of the RELOAD  protocol being used.
	    This document describes version 0.1, with a value of 0x01.
	  </t>

	  <t></t><t hangText="length"></t>
	  <t>
	    The count in bytes of the size of the
	    message, including the header.
	  </t>

	  <t></t><t hangText="transaction_id"></t>
	  <t> 
	    A unique 64 bit number that identifies this
	    transaction and also serves as a salt to randomize the request and
	    the response. Responses use the same Transaction ID as the request
	    they correspond to. Transaction IDs are also used for fragment
	    reassembly.
	  </t>
	  
	  <t></t><t hangText="flags"></t>
	  <t>
	    The flags word contains control flags. Which are ORed together.
	    There is two currently
	    defined flags: ROUTE-LOG (0x1) and RESPONSE-ROUTE-LOG (0x2).
	    These flags indicate that the route log should be
	    included (see <xref target="sec-route-log"></xref>.).
	  </t>
	  
	  <t></t><t hangText="via_list_length"></t>
	  <t>
	    The length of the via list in bytes. Note that in this field
	    and the following two length fields we depart from the usual
	    variable-length convention of having the length immediately
	    precede the value in order to make it easier for hardware
	    decoding engines to quickly determine the length of the header.
	  </t>
	  
	  <t></t><t hangText="destination_list_length"></t>
	  <t>
	    The length of the destination list in bytes.
	  </t>
	  
	  <t></t><t hangText="route_log_length"></t>
	  <t>
	    The length of the route log in bytes.
	  </t>
	  
	  <t></t><t hangText="options_length"></t>
	  <t>
	    The length of the header options in bytes.
	  </t>

	  <t></t><t hangText="via_list"></t>
	  <t>
	    The via_list contains the sequence of destinations through which
	    the message has passed. The via_list starts out empty and grows as
	    the message traverses each peer.
	  </t>

	  <t></t><t hangText="destination_list"></t>
	  <t>
	    The destination_list contains a sequence of destinations which
	    the message should pass through. The destination list is constructed
	    by the message originator. The first element in the destination list
	    is where the message goes next. The list shrinks as the message
	    traverses each listed peer.
	  </t>

	  <t></t><t hangText="route_log"></t>
	  <t>
	    Contains a series of route log entries. See 
	    <xref target="sec-route-log"/>.
	  </t>

	  <t></t><t hangText="options"></t>
	  <t>
	    Contains a series of ForwardingOptions entries.
	    See <xref target="sec-forwarding-options"/>.
	  </t>

	</list>
	</t>
          <section title="Destination and Via Lists">
            <t>The destination list and via lists are sequences of Destination
            values:</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[

      enum {reserved(0), peer(1), resource(2), compressed(3), (255) }
           DestinationType;
      
     
      select (destination_type) {
        case peer:
           NodeId               node_id;
        
        case resource:
           ResourceId           resource_id;
      
        case compressed:
           opaque               compressed_id<0..2^8-1>;
         
        /* This structure may be extended with new types */
      
      } DestinationData;


      struct {
        DestinationType         type;
        uint8                   length;
        DestinationData         destination_data;
      } Destination;
      ]]></artwork>
            </figure>

            <t>This is a TLV structure with the following contents: <list
                style="hanging">
                <t></t>

                <t hangText="type "></t>

                <t>The type of the DestinationData PDU. This may be one of
                "peer", "resource", or "compressed".</t>

                <t></t>

                <t hangText="length "></t>

                <t>The length of the destination_data.</t>

                <t></t>

                <t hangText="destination_value "></t>

                <t>The destination value itself, which is an encoded
                DestinationData structure, depending on the value of
                "type".</t>
              </list></t>

            <t><list style="hanging">
                <t hangText="Note:">This structure encodes a type, length,
                value. The length field specifies the length of the
                DestinationData values, which allows the addition of new
                DestinationTypes. This allows an implementation which does not
                understand a given DestinationType to skip over it.</t>
              </list></t>

            <t>A DestinationData can be one of three types: <list
                style="hanging">
                <t></t>

                <t hangText="peer"></t>

                <t>A Node-ID.</t>

                <t></t>

                <t hangText="compressed"></t>

                <t>A compressed list of Node-IDs and/or resources. Because
                this value was compressed by one of the peers, it is only
                meaningful to that peer and cannot be decoded by other peers.
                Thus, it is represented as an opaque string.</t>

                <t></t>

                <t hangText="resource"></t>

                <t>The Resource-ID of the resource which is desired. This type
                MUST only appear in the final location of a destination list
                and MUST NOT appear in a via list. It is meaningless to try to
                route through a resource.</t>
              </list></t>
          </section>

          <section anchor="sec-route-log" title="Route Logging">
            <t>The route logging feature provides diagnostic information about
            the path taken by the message so far and in this manner it is
            similar in function to <xref target="RFC3261">SIP's</xref> Via
            header field. If the ROUTE-LOG flag is set in the Flags word, at
            each hop peers MUST append a route log entry to the route log
            element in the header or reject the request. The order of the route
            log entry elements in the message is determined by the order of the
            peers were traversed along the path. The first route log entry
            corresponds to the peer at the first hop along the path, and each
            subsequent entry corresponds to the peer at the next hop along the
            path. If the ROUTE-LOG flag is set, the route log entries in the
            request MUST be copied to the response or the request rejected.  If,
            and only if, the ROUTE-LOG-RESPONSE flag is set in a request, the
            ROUTE-LOG flag MUST be set in the response.</t>

            <t>
            Note that use of the ROUTE-LOG-RESPONSE flag means that the response
            will grow on the return path, which may potentially mean that it
            gets dropped due to becoming too large for some intermediate
            hop. Thus, this option must be used with care.</t>

            <t>The route log is defined as follows:</t>

            <figure>
              <!-- begin-pdu-->

              <artwork><![CDATA[


    enum { (255) } RouteLogExtensionType;
   
    struct {
      RouteLogExtensionType     type;
      uint16                    length;
      
      select (type){
        /* Extension values go here */
      } extension;
    } RouteLogExtension;

    enum { reserved(0), tcp_tls(1),  udp_dtls(2),  (255)}  Transport;

    struct {
      opaque                 version<0..2^8-1>;    /* A string */
      Transport              transport;            /* TCP or UDP */
      NodeId                 id; 
      uint32                 uptime;
      IpAddressPort          address;
      opaque                 certificate<0..2^16-1>;
      RouteLogExtension      extensions<0..2^16-1>;
    } RouteLogEntry;

    struct {
       RouteLogEntry         entries<0..2^16-1>;
    } RouteLog;

]]></artwork>
            </figure>

            <t>The route log consists of an arbitrary number of RouteLogEntry
            values, each representing one node through which the message has
            passed.</t>

            <t>Each RouteLogEntry consists of the following values:</t>

            <t><list style="hanging">
                 

                <t />

                <t hangText="version " />

                <t>A textual representation of the software version</t>

                 

                <t />

                <t hangText="transport " />

                <t>The transport type, currently either "tcp_tls" or
                "udp_dtls".</t>

                 

                <t />

                <t hangText="id " />

                <t>The Node-ID of the peer.</t>

                 

                <t />

                <t hangText="uptime " />

                <t>The uptime of the peer in seconds.</t>

                 

                <t />

                <t hangText="address " />

                <t>The address and port of the peer.</t>

                 

                <t />

                <t hangText="certificate " />

                <t>The peer's certificate. Note that this may be omitted by
                setting the length to zero.</t>

                 

                <t />

                <t hangText="extensions " />

                <t>Extensions, if any.</t>

              </list></t>

            <t>Extensions are defined using a RouteLogExtension structure. New
            extensions are defined by defining a new code point for
            RouteLogExtensionType and adding a new arm to the
            RouteLogExtension structure. The contents of that structure
            are:</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="type"></t>

                <t>The type of the extension.</t>

                <t></t>

                <t hangText="length"></t>

                <t>The length of the rest of the structure.</t>

                <t></t>
				
                <t hangText="extension"></t>

                <t>The extension value.</t>
              </list></t>
          </section>


	  <section title="Forwarding Options" anchor="sec-forwarding-options">
	    <t>
	      The Forwarding header can be extended with forwarding
	      header options, which are a series of ForwardingOptions
	      structures:
	    </t>

            <figure>
              <!-- begin-pdu-->

              <artwork><![CDATA[
    enum { (255) } ForwardingOptionsType;
    
    struct {
      ForwardingOptionsType     type;
      uint8                     flags;
      uint16                    length;
      select (type) {
        /* Option values go here */
      } option;
    } ForwardingOption;
    ]]>
	      </artwork>
	    </figure>
	    <t>
	      Each ForwardingOption consists of the following values:
	    </t>
	    <t><list style="hanging">
	      <t></t><t hangText="type"></t>
	      <t>The type of the option.</t>
	      
	      <t></t><t hangText="length"></t>
	      <t>The length of the rest of the structure.</t>

	      <t></t><t hangText="flags"></t>
	      <t> Three flags are defined FORWARD_CRITICAL(0x01),
	      DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags
	      MUST not be set in a response.

              If the FORWARD_CRITICAL flag is set, any node that would forward
              the message but does not understand this options MUST reject the
              request with an 757 error resonse.

              If the DESTINATION_CRITICAL flag is set, any node generates a
              response to the message but does not understand the forwarding
              option MUST reject the request with an 757 error resonse.

              If the RESPONSE_COPY flag is set, any node generating a response
              MUST copy the option from the request to the response and clear
              the RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL
              flags.  </t>

	      <t></t><t hangText="option"></t>
	      <t>The option value.</t>
	    </list>
	    </t>
	  </section>
        </section>
	
        <section anchor="sec-contents" title="Message Contents Format">
          <t>The second major part of a RELOAD message is the contents part,
          which is defined by MessageContents:</t>

          <figure>
            <!--begin-pdu-->

            <artwork><![CDATA[
       struct {
         MessageCode            message_code;
         opaque                 payload<0..2^24-1>;
       } MessageContents;
       
]]></artwork>
          </figure>

          <t>The contents of this structure are as follows: <list
              style="hanging">
              <t></t>

              <t hangText="message_code "></t>

              <t>This indicates the message that is being sent. The code space
              is broken up as follows. <list style="hanging">
                  <t></t>

                  <t hangText="0">Reserved</t>

                  <t></t>

                  <t hangText="1 .. 0x7fff">Requests and responses. These code
                  points are always paired, with requests being odd and the
                  corresponding response being the request code plus 1. Thus,
                  "ping_request" (the Ping request) has value 1 and
                  "ping_answer" (the Ping response) has value 2</t>

                  <t></t>

                  <t hangText="0xffff">Error</t>
                </list></t>

              <t></t>

              <t hangText="message_body "></t>

              <t>The message body itself, represented as a variable-length
              string of bytes. The bytes themselves are dependent on the code
              value. See the sections describing the various RELOAD methods
              (Join, Update, Attach, Store, Fetch, etc.) for the definitions
              of the payload contents.</t>
            </list></t>

          <section anchor="sec-response-code"
                   title="Response Codes and Response Errors">
            <t>A peer processing a request returns its status in the
            message_code field. If the request was a success, then the message
            code is the response code that matches the request (i.e., the next
            code up). The response payload is then as defined in the
            request/response descriptions.</t>

            <t>If the request failed, then the message code is set to 0xffff
            (error) and the payload MUST be an error_response PDU, as shown
            below.</t>

            <t>When the message code is 0xffff, the payload MUST be an
            ErrorResponse.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
       public struct {
         uint16             error_code;
         opaque             reason_phrase<0..2^8-1>;  /* String*/
         opaque             error_info<0..2^16-1>;
       } ErrorResponse;

             ]]></artwork>
            </figure>

            <t>The contents of this structure are as follows:</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="error_code "></t>

                <t>A numeric error code indicating the error that
                occurred.</t>

                <t></t>

                <t hangText="reason_phrase "></t>

                <t>A free form text string indicating the reason for the
                response. The reason phrase SHOULD BE as indicated in the
                error code list below (e.g., "Moved Temporarily"). [[Open
                Issue: These reason phrases are pretty useless. Like the rest
                of this error system, They're a holdover from SIP. Should we
                remove?]]</t>

                <t></t>

                <t hangText="error_info "></t>

                <t>Payload specific error information. This MUST be empty
                (zero length) except as specified below.</t>
              </list></t>

            <t>The following error code values are defined. [[TODO: These are
            currently semi-aligned with SIP codes. that's probably bad and we
            need to fix.]</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="302 (Moved Temporarily):">The requesting peer
                SHOULD retry the request at the new address specified in the
                302 response message.</t>

                <t></t>

                <t hangText="401 (Unauthorized):">The requesting peer needs to
                sign and provide a certificate. [[TODO: The semantics here
                don't seem quite right.]]</t>

                <t></t>

                <t hangText="403 (Forbidden):">The requesting peer does not
                have permission to make this request.</t>

                <t></t>

                <t hangText="404 (Not Found):">The resource or peer cannot be
                found or does not exist.</t>

                <t></t>

                <t hangText="408 (Request Timeout):">A response to the request
                has not been received in a suitable amount of time. The
                requesting peer MAY resend the request at a later time.</t>

                <t></t>

                <t hangText="412 (Precondition Failed):">A request can't be
                completed because some precondition was incorrect. For
                instance, the wrong generation counter was provided</t>

                <t></t>

                <t hangText="498 (Incompatible with Overlay)">A peer receiving
                the request is using a different overlay, overlay algorithm,
                or hash algorithm. [[Open Issue: What is the best error number
                and reason phrase to use?]]</t>
		
		<t></t>
             <t hangText="757 (Unsupported Forwarding Option)">A peer receiving
                the request with a forwarnding options flaged as critical but the peer does not support this option. See section <xref target="sec-forwarding-options"/>. [[Open Issue: What is the best error number
                and reason phrase to use?]]</t>
              </list></t>
          </section>
        </section>

        <section anchor="sec-signature" title="Signature">
          <t>The third part of a RELOAD message is the signature, represented
          by a Signature structure. The message signature is computed over the
          payload and parts of forwarding header. The payload, in case of a
          Store, may contain an additional signature computed over a StoreReq
          structure. All signatures are formatted using the Signature element.
          This element is also used in other contexts where signatures are
          needed. The input structure to the signature computation varies
          depending on the data element being signed.</t>

          <figure>
            <!--begin-pdu-->

            <artwork><![CDATA[


       enum {reserved(0), signer_identity_peer (1), 
             signer_identity_name (2), signer_identity_certificate (3), 
             (255)} SignerIdentityType;

       select (identity_type) {
         case signer_identity_peer:
           NodeId               id;
 
         case signer_identity_name:
           opaque               name<0..2^16-1>;
         
         case signer_identity_certificate:
           opaque               certificate<0..2^16-1>;

         /* This structure may be extended with new types */
       } SignerIdentityValue;


       struct {
         SignerIdentityType     identity_type;
         uint16                 length;
         SignerIdentityValue    identity[SignerIdentity.length];
       } SignerIdentity;


       struct  {
          SignatureAndHashAlgorithm     algorithm;
          SignerIdentity                identity;
          opaque                        signature_value<0..2^16-1>;
       } Signature;


]]></artwork>
          </figure>

          <t>The signature construct contains the following values:</t>

          <t><list style="hanging">
              <t></t>

              <t hangText="algorithm "></t>

              <t>The signature algorithm in use. The algorithm definitions are
              found in the IANA TLS SignatureAlgorithm Registry.</t>

              <t></t>

              <t hangText="identity "></t>

              <t>The identity or certificate used to form the signature</t>

              <t></t>

              <t hangText="signature_value "></t>

              <t>The value of the signature</t>
            </list></t>

          <t>A number of possible identity formats are permitted. The current
          possibilities are: a Node-ID, a user name, and a certificate.</t>

          <t>For signatures over messages the input to the signature is
          computed over:</t>

          <t><list>
              <t>overlay + transaction_id + MessageContents +
              SignerIdentity</t>
            </list></t>

          <t>Where overlay and transaction_id come from the forwarding header
          and + indicates concatenation.</t>

          <t>[[TODO: Check the inputs to this carefully.]]</t>

          <t>The input to signatures over data values is different, and is
          described in <xref target="sec-data-sig"></xref>.</t>
        </section>
      </section>

      <section anchor="sec-overlay-topology" title="Overlay Topology">
        <t>As discussed in previous sections, RELOAD does not itself implement
        any overlay topology. Rather, it relies on Topology Plugins, which
        allow a variety of overlay algorithms to be used while maintaining the
        same RELOAD core. This section describes the requirements for new
        topology plugins and the methods that RELOAD provides for overlay
        topology maintenance.</t>

        <section title="Topology Plugin Requirements">
          <t>When specifying a new overlay algorithm, at least the following
          need to be described:</t>

          <t><list style="symbols">
              <t>Joining procedures, including the contents of the Join
              message.</t>

              <t>Stabilization procedures, including the contents of the
              Update message, the frequency of topology probes and keepalives,
              and the mechanism used to detect when peers have
              disconnected.</t>

              <t>Exit procedures, including the contents of the Leave
              message.</t>

              <t>The length of the Resource-IDs and Node-IDs. For DHTs, the
              hash algorithm to compute the hash of an identifier.</t>

              <t>The procedures that peers use to route messages.</t>

              <t>The replication strategy used to ensure data redundancy.</t>
            </list></t>
        </section>

        <section title="Methods and types for use by topology plugins">
          <t>This section describes the methods that topology plugins use to
          join, leave, and maintain the overlay.</t>

          <section title="Join">
            <t>A new peer (but which already has credentials) uses the JoinReq
            message to join the overlay. The JoinReq is sent to the
            responsible peer depending on the routing mechanism described in
            the topology plugin. This notifies the responsible peer that the
            new peer is taking over some of the overlay and it needs to
            synchronize its state.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
       struct {
          NodeId                joining_peer_id;
          opaque                overlay_specific_data<0..2^16-1>;
       } JoinReq;

              ]]></artwork>
            </figure>

            <!--    join-request = Node-ID -->

            <t>The minimal JoinReq contains only the Node-ID which the sending
            peer wishes to assume. Overlay algorithms MAY specify other data
            to appear in this request.</t>

            <t>If the request succeeds, the responding peer responds with a
            JoinAns message, as defined below:</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
       struct {
          opaque                overlay_specific_data<0..2^16-1>;
       } JoinAns;
              ]]></artwork>
            </figure>

            <t>If the request succeeds, the responding peer MUST follow up by
            executing the right sequence of Stores and Updates to transfer the
            appropriate section of the overlay space to the joining peer. In
            addition, overlay algorithms MAY define data to appear in the
            response payload that provides additional info.</t>
	    
	    <t>
	      In general,
	      nodes which cannot form connections SHOULD report an
	      error. However, implementations MUST provide some
	      mechanism whereby nodes can determine they are
	      potentially the first node and take responsibility
	      for the overlay. This specification does not mandate
	      any particular mechanism, but a configuration flag
	      or setting seems appropriate.
	    </t>
          </section>

          <section title="Leave">
            <t>The LeaveReq message is used to indicate that a node is exiting
            the overlay. A node SHOULD send this message to each peer with
            which it is directly connected prior to exiting the overlay.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[

       public struct {
          NodeId                leaving_peer_id;
          opaque                overlay_specific_data<0..2^16-1>;
       } LeaveReq;

              ]]></artwork>
            </figure>

            <!--    leave-request = Node-ID -->

            <t>LeaveReq contains only the Node-ID of the leaving
            peer. Overlay algorithms MAY specify other data to appear in this
            request.</t>

            <t>Upon receiving a Leave request, a peer MUST update its own
            routing table, and send the appropriate Store/Update sequences to
            re-stabilize the overlay.</t>
          </section>

          <section title="Update">
            <t>Update is the primary overlay-specific maintenance message. It
            is used by the sender to notify the recipient of the sender's view
            of the current state of the overlay (its routing state) and it is
            up to the recipient to take whatever actions are appropriate to
            deal with the state change.</t>

            <t>The contents of the UpdateReq message are completely
            overlay-specific. The UpdateAns response is expected to be either
            success or an error.</t>
          </section>

          <section anchor="sec-route-query" title="Route_Query">
            <t>The Route_Query request allows the sender to ask a peer where
            they would route a message directed to a given destination. In
            other words, a RouteQuery for a destination X requests the Node-ID
            where the receiving peer would next route to get to X. A
            RouteQuery can also request that the receiving peer initiate an
            Update request to transfer his routing table.</t>

            <t>One important use of the RouteQuery request is to support
            iterative routing. The sender selects one of the peers in its
            routing table and sends it a RouteQuery message with the
            destination_object set to the Node-ID or Resource-ID it wishes to
            route to. The receiving peer responds with information about the
            peers to which the request would be routed. The sending peer MAY
            then Attaches to that peer(s), and repeats the RouteQuery.
            Eventually, the sender gets a response from a peer that is closest
            to the identifier in the destination_object as determined by the
            topology plugin. At that point, the sender can send messages
            directly to that peer.</t>

            <!-- 
          <t>Note that this procedure only works well if all the peers are
          mutually directly reachable either by all having public IP
          addresses or at least by all being behind the same NAT. Accordingly,
          peers MUST only use this method if permitted by the overlay
          configuration (see [XREF]).</t>    -->

            <section title="Request Definition">
              <t>A RouteQueryReq message indicates the peer or resource that
              the requesting peer is interested in. It also contains a
              "send_update" option allowing the requesting peer to request a
              full copy of the other peer's routing table.</t>

              <figure>
                <!--begin-pdu-->

                <artwork><![CDATA[
       struct {
         Boolean                send_update;
         Destination            destination;
         opaque                 overlay_specific_data<0..2^16-1>;
       } RouteQueryReq;

              ]]></artwork>
              </figure>

              <t>The contents of the RouteQueryReq message are as follows:</t>

              <t><list style="hanging">
                  <t></t>

                  <t hangText="send_update "></t>

                  <t>A single byte. This may be set to "true" to indicate that
                  the requester wishes the responder to initiate an Update
                  request immediately. Otherwise, this value MUST be set to
                  "false".</t>

                  <t></t>

                  <t hangText="destination "></t>

                  <t>The destination which the requester is interested in.
                  This may be any valid destination object, including a
                  Node-ID, compressed ids, or resource-id.</t>

                  <t></t>

                  <t hangText="overlay_specific_data "></t>

                  <t>Other data as appropriate for the overlay.</t>
                </list></t>
            </section>

            <section title="Response Definition">
              <t>A response to a successful RouteQueryReq request is a
              RouteQueryAns message. This is completely overlay specific.</t>
            </section>
          </section>

          <!--
         <section title="Diagnostic" anchor="sec-diagnostic">
          <t>Diagnostic is an overlay specific message that a sender can
          use to query the routing or storage state of a peer. In a small
          scale overlay, a sender may send a Diagnostic message to all nodes
          in the overlay to retrieve the appropriate node state. The contents
          of the DiagnosticReq message are completely overlay specific.</t>    
         </section>
-->
        </section>
      </section>

      <section title="Forwarding Layer">
        <t>Each node maintains connections to a set of other nodes defined by
        the topology plugin. <!--For instance, in the Chord topology
         described in <xref target="sec.chord-algorithm"/>, a node would maintain
         connections to 16 nodes in its finger table and to 6 neighbors.--></t>

        <section title="Transports">
          <t>RELOAD can use multiple transports to send its messages. Because
          ICE is used to establish connections (see <xref
          target="sec-ice-reload"></xref>), RELOAD nodes are able to detect
          which transports are offered by other nodes and establish
          connections between each other. Any transport protocol needs to be
          able to establish a secure, authenticated connection, and provide
          data origin authentication and message integrity for individual data
          elements. RELOAD currently supports two transport protocols:</t>

          <t><list style="symbols">
              <t>TLS [REF] over TCP</t>

              <t>DTLS <xref target="RFC4347"></xref> over UDP</t>
            </list></t>

          <t>Note that although UDP does not properly have "connections", both
          TLS and DTLS have a handshake which establishes a stateful
          association, a similar stateful construct, and we simply refer to
          these as "connections" for the purposes of this document.</t>

          <section title="Future Support for HIP">
            <t>The P2PSIP Working Group has expressed interest in supporting a
            HIP-based transport. Such support would require specifying such
            details as:</t>

            <t><list style="symbols">
                <t>How to issue certificates which provided identities
                meaningful to the HIP base exchange. We anticipate that this
                would require a mapping between ORCHIDs and NodeIds.</t>

                <t>How to carry the HIP I1 and I2 messages. We anticipate that
                this would require defining a HIP Tunnel usage.</t>

                <t>How to carry RELOAD messages over HIP.</t>
              </list></t>

            <t>We leave this work as a topic for another draft.</t>
          </section>

          <section anchor="sec-reliability"
                   title="Reliability for Unreliable Transports">
            <t>When RELOAD is carried over DTLS or another unreliable
            transport, it needs to be used with a reliability and congestion
            control mechanism, which is provided on a hop-by-hop basis,
            matching the semantics if TCP were used. The basic principle is
            that each message, regardless of if it carries a request or
            responses, will get an ACK and be reliably retransmitted. The
            receiver's job is very simple, limited to just sending ACKs. All
            the complexity is at the sender side. This allows the sending
            implementation to trade off performance versus implementation
            complexity without affecting the wire protocol.</t>

            <t>In order to support unreliable transport, each message is
            wrapped in a very simple framing layer (FramedMessage) which is
            only used for each hop. This layer contains a sequence number
            which can then be used for ACKs.</t>

            <section title="Framed Message Format">
              <t>The definition of FramedMessage is:</t>

              <figure>
                <!--begin-pdu-->

                <artwork><![CDATA[

      enum {data (128), ack (129), (255)} FramedMessageType;

      struct {            
        FramedMessageType       type;

        select (type) {
          case data:
            uint24              sequence;
            opaque              message<0..2^24-1>;

          case ack:
            uint24              ack_sequence;
            uint32              received;            
        };
      } FramedMessage;

      
              ]]></artwork>
              </figure>

              <t>The type field of the PDU is set to indicate whether the
              message is data or an acknowledgement. Note that these values
              have been set to force the first bit to be high, thus allowing
              easy demultiplexing with STUN. All FramedMessageType values must
              be > 128.</t>

              <t>If the message is of type "data", then the remainder of the
              PDU is as follows: <list style="hanging">
                  <t></t>

                  <t hangText="sequence "></t>

                  <t>the sequence number</t>

                  <t></t>

                  <t hangText="message "></t>

                  <t>the original message that is being transmitted.</t>
                </list></t>

              <t>Each connection has it own sequence number. Initially the
              value is zero and it increments by exactly one for each message
              sent over that connection.</t>

              <t>When the receiver receive a message, it SHOULD immediately
              send an ACK message. The receiver MUST keep track of the 32 most
              recent sequence numbers received on this association in order to
              generate the appropriate ack.</t>

              <t>If the PDU is of type "ack", the contents are as follows:
              <list style="hanging">
                  <t></t>

                  <t hangText="ack_sequence "></t>

                  <t>The sequence number of the message being
                  acknowledged.</t>

                  <t></t>

                  <t hangText="received "></t>

                  <t>A bitmask indicating whether or not each of the previous
                  32 packets has been received before the sequence number in
                  ack_sequence. The high order bit represents the first packet
                  in the sequence space.</t>
                </list></t>

              <t>The received field bits in the ACK provide a very high degree
              of redundancy for the sender to figure out which packets the
              receiver received and can then estimate packet loss rates. If
              the sender also keeps track of the time at which recent sequence
              numbers were sent, the RTT can be estimated.</t>
            </section>

            <section title="Retransmission and Flow Control">
              <t>Because the receiver's role is limited to providing packet
              acknowledgements, a wide variety of congestion control
              algorithms can be implemented on the sender side while using the
              same basic wire protocol. It is RECOMMENDED that senders
              implement TFRC-SP <xref target="RFC4828"></xref> and use the
              received bitmask to allow the sender to compute packet loss
              event rates. Senders MUST implement a retransmission and
              congestion control scheme no more aggressive then TFRC-SP.</t>
            </section>
          </section>

          <!-- EKR RemoveD
              <section title="HIP">
              <t>RELOAD MAY also be used with a HIP transport using the architecture
              for HIP BONE described in <xref
              target="I-D.camarillo-hip-bone"></xref>. From the perspective of the
              P2P layer, HIP looks very much like normal IP. Either TLS (over TCP)
              or DTLS (over UDP) is run over top of the HIP. Thus the reliability
              and congestion control schemes are the same for DTLS section. If an
              overlay is configured such that HIP is the only transport that it will
              use, then it may make sense to configure the p2p layer to only offer
              the ORCHID when gather candidate addresses for ICE. This will
              effectively disable ICE at the p2p layer.</t>

              <t>For overlays that use HIP, the enrollment server MUST provide each
              peer with a unique ORCHID and use that ORCHID to generate the Node-ID
              for the peer (see <xref target="sec-credentials"></xref>. Later when
              the HIP layer wishes to tunnel a message (such as an I1 message)
              through the overlay, the HIP layer can use the ORCHID to generate the
              Node-ID, and then use the Tunnel message with the HIP to route the
              message to that the peer that owns that ORCHID.</t>
              </section>
              
              <section title="TLS">
              <t>TLS runs on top of TCP which offers the best performance from a
              data transfer point of view and does not require as frequent keep
              alive messages.</t>
              </section>
         -->

          <section anchor="sec-frag-reass"
                   title="Fragmentation and Reassembly">
            <t>In order to allow transport over datagram protocols, RELOAD
            messages may be fragmented. If a message is too large for a peer
            to transmit to the next peer it MUST fragment the message. Note
            that this implies that intermediate peers may re-fragment messages
            if the incoming and outgoing paths have different maximum datagram
            sizes. Intermediate peers SHOULD NOT reassemble fragments.</t>

            <t>Upon receipt of a fragmented message by the intended peer, the
            peer holds the fragments in a holding buffer until the entire
            message has been received. The message is then reassembled into a
            single unfragmented message and processed. In order to mitigate
            denial of service attacks, receivers SHOULD time out incomplete
            fragments. [[TODO: Describe algorithm]]</t>
          </section>
        </section>

        <section title="Connection Management Methods">
          <t>This section defines the methods RELOAD uses to form and maintain
          connections between nodes in the overlay. Three methods are
          defined:</t>

          <t><list style="hanging">
              <t hangText="Attach: ">used to form connections between nodes.
              When node A wants to connect to node B, it sends an Attach
              message to node B through the overlay. The Attach contains A's
              ICE parameters. B responds with its ICE parameters and the two
              nodes perform ICE to form connection.</t>

              <t hangText="Ping: ">is a simple request/response which is used
              to verify connectivity (analogous to the UNIX ping command)
              along a path and to gather a small amount of information about
              the resources held by the target peer</t>

              <t hangText="Tunnel: ">in some cases, it will be too expensive
              for an application layer protocol to set up a connection in
              order to send a small number of messages. The Tunnel message
              allows applications to route individual application layer
              protocol messages through the overlay.</t>
            </list></t>

          <section anchor="sec-connect-details" title="Attach">
            <t>A node sends an Attach request when it wishes to establish a
            direct TCP or UDP connection to another node for the purposes of
            sending RELOAD messages or application layer protocol messages,
            such as SIP. Detailed procedures for the Attach and its response
            are described in <xref target="sec-connect-details"></xref>.</t>

            <t>An Attach in and of itself does not result in updating the
            routing table of either node. That function is performed by
            Updates. If node A has Attached to node B, but not received any
            Updates from B, it MAY route messages which are directly addressed
            to B through that channel but MUST NOT route messages through B to
            other peers via that channel. The process of Attaching is
            separate from the process of becoming a peer (using Update) to
            prevent half-open states where a node has started to form
            connections but is not really ready to act as a peer.</t>

            <section anchor="sec-connect-request" title="Request Definition">
              <t>An AttachReq message contains the requesting peer's ICE
              connection parameters formatted into a binary structure.</t>

              <figure>
                <!--begin-pdu-->

                <artwork><![CDATA[

      typedef opaque            IceCandidate<0..2^16-1>;

      struct  {
        opaque                  ufrag<0..2^8-1>;
        opaque                  password<0..2^8-1>;                
        uint16                  application;
        opaque                  role<0..2^8-1>;
        IceCandidate            candidates<0..2^16-1>;
      } AttachReqAns;

]]></artwork>
              </figure>

              <t>The values contained in AttachReq and AttachAns are: <list style="hanging">
                  <t></t>

                  <t hangText="ufrag "></t>

                  <t>The username fragment (from ICE)</t>

                  <t></t>

                  <t hangText="password "></t>

                  <t>The ICE password.</t>

                  <t></t>

                  <t hangText="application "></t>

                  <t>A 16-bit port number. This port number represents the
                  IANA registered port of the protocol that is going to be
                  sent on this connection. For SIP, this is 5060 or 5061, and
                  for RELOAD is TBD. By using the IANA registered port, we
                  avoid the need for an additional registry and allow RELOAD
                  to be used to set up connections for any existing or future
                  application protocol.</t>

                  <t></t>

                  <t hangText="role "></t>

      <!-- TODO: EKR: answering party does TLS client -->

                  <t>An active/passive/actpass attribute from RFC 4145 <xref
                  target="RFC4145"></xref>.</t>

                  <t></t>

                  <t hangText="candidates "></t>

                  <t>One or more ICE candidate values in the string
		  representation used in ordinary ICE. [[OPEN ISSUE:
		  This is convenient for stacks, but unaesthetic.]]
		  Each candidate has an
                  IP address, IP address family, port, transport protocol,
                  priority, foundation, component ID, STUN type and related
                  address. The candidate_list is a list of string candidate
                  values from ICE.</t>
                </list></t>

              <t>These values should be generated using the procedures
              described in <xref target="sec-ice-reload"></xref>.</t>
            </section>

            <section anchor="sec-connect-response" title="Response Definition">
              <t>If a peer receives an Attach request, it SHOULD follow the
              process the request and generate its own response with a
              AttachReqAns. It should then begin ICE checks. When a peer
              receives an Attach response, it SHOULD parse the response and
              begin its own ICE checks.</t>
            </section>

            <section anchor="sec-ice-reload" title="Using ICE With RELOAD">
              <t>This section describes the profile of ICE that is used with
              RELOAD. RELOAD implementations MUST implement full ICE. Because
              RELOAD always tries to use TCP and then UDP as a fallback, there
              will be multiple candidates of the same IP version, which
              requires full ICE.</t>

              <t>In ICE as defined by <xref
              target="I-D.ietf-mmusic-ice"></xref>, SDP is used to carry the
              ICE parameters. In RELOAD, this function is performed by a
              binary encoding in the Attach method. This encoding is more
              restricted than the SDP encoding because the RELOAD environment
              is simpler:</t>

              <t><list style="symbols">
                  <t>Only a single media stream is supported.</t>

                  <t>In this case, the "stream" refers not to RTP or other
                  types of media, but rather to a connection for RELOAD itself
                  or for SIP signaling.</t>

                  <t>RELOAD only allows for a single offer/answer exchange.
                  Unlike the usage of ICE within SIP, there is never a need to
                  send a subsequent offer to update the default candidates to
                  match the ones selected by ICE.</t>
                </list></t>

              <!-- EKR  RemoveD: not appropriate here.

      <t>RELOAD and SIP always run over TLS for TCP connections and DTLS
      <xref target="RFC4347"></xref> for UDP "connections". Consequently,
      once ICE processing has completed, both agents will begin TLS and DTLS
      procedures to establish a secure link. Its important to note that, had
      a TURN server been utilized for the TCP or UDP stream, the TURN server
      will transparently relay the TLS messaging and the encrypted TLS
      content, and thus will not have access to the contents of the
      connection once it is established. Any attack by the TURN server to
      insert itself as a man-in-the-middle are thwarted verifying that
      the certificates used to establish the secure connection match the
      identties of the connecting peers.</t>
-->

              <t>An agent follows the ICE specification as described in <xref
              target="I-D.ietf-mmusic-ice"></xref> and <xref
              target="I-D.ietf-mmusic-ice-tcp"></xref> with the changes and
              additional procedures described in the subsections below.</t>
            </section>

            <section anchor="sec-collect" title="Collecting STUN Servers">
              <t>ICE relies on the node having one or more STUN servers to
              use. In conventional ICE, it is assumed that nodes are
              configured with one or more STUN servers through some
              out-of-band mechanism. This is still possible in RELOAD but
              RELOAD also learns STUN servers as it connects to other peers.
              Because all RELOAD peers implement ICE and use STUN keepalives,
              every peer is a STUN server <xref
              target="I-D.ietf-behave-rfc3489bis"></xref>. Accordingly, any
              peer a node knows will be willing to be a STUN server -- though
              of course it may be behind a NAT.</t>

              <t>A peer on a well-provisioned wide-area overlay will be
              configured with one or more bootstrap peers. These peers make an
              initial list of STUN servers. However, as the peer forms
              connections with additional peers, it builds more peers it can
              use as STUN servers.</t>

              <t>Because complicated NAT topologies are possible, a peer may
              need more than one STUN server. Specifically, a peer that is
              behind a single NAT will typically observe only two IP addresses
              in its STUN checks: its local address and its server reflexive
              address from a STUN server outside its NAT. However, if there
              are more NATs involved, it may discover that it learns
              additional server reflexive addresses (which vary based on where
              in the topology the STUN server is). To maximize the chance of
              achieving a direct connection, a peer SHOULD group other peers
              by the peer-reflexive addresses it discovers through them. It
              SHOULD then select one peer from each group to use as a STUN
              server for future connections.</t>

              <t>Only peers to which the peer currently has connections may be
              used. If the connection to that host is lost, it MUST be removed
              from the list of stun servers and a new server from the same
              group SHOULD be selected.</t>

              <!-- EKR RemoveD. TMI

      <t>OPEN ISSUE: should the peer try to keep at least one peer in each
      group, even if it has no other reason for the connection? Need to
      specify when to stop adding new groups if the peer is behind a really
      bad NAT.</t>

      <t>OPEN ISSUE: RELOAD-01 had a Peer-Info structure that allowed peers
      to exchange information such as a "default" IP-port pair in Updates.
      This structure could be expanded to include the candidate list for a
      peer, thus allowing ICE negotiation to begin or even direct
      communication before an Attach request has been received. (The
      candidate pairs for the P2P port are fixed because the same source
      port is used for all connections.) However, because this would require
      significant changes to the ICE algorithm, we have not introduced such
      an extension at this point.</t>
      -->
            </section>

            <section anchor="sec-gather" title="Gathering Candidates">
              <t>When a node wishes to establish a connection for the purposes
              of RELOAD signaling or SIP signaling (or any other application
              protocol for that matter), it follows the process of gathering
              candidates as described in Section 4 of ICE <xref
              target="I-D.ietf-mmusic-ice"></xref>. RELOAD utilizes a single
              component, as does SIP. Consequently, gathering for these
              "streams" requires a single component.</t>

              <t>An agent MUST implement ICE-tcp <xref
              target="I-D.ietf-mmusic-ice"></xref>, and MUST gather at least
              one UDP and one TCP host candidate for RELOAD and for SIP.</t>

              <t>The ICE specification assumes that an ICE agent is configured
              with, or somehow knows of, TURN and STUN servers. RELOAD
              provides a way for an agent to learn these by querying the
              overlay, as described in <xref target="sec-collect"></xref> and
              <xref target="sec-turn-server"></xref>.</t>

              <t>The agent SHOULD prioritize its TCP-based candidates over its
              UDP-based candidates in the prioritization described in Section
              4.1.2 of ICE <xref target="I-D.ietf-mmusic-ice"></xref>.</t>

              <t>The default candidate selection described in Section 4.1.3 of
              ICE is ignored; defaults are not signaled or utilized by
              RELOAD.</t>
            </section>

            <section title="Encoding the Attach Message">
              <t>Section 4.3 of ICE describes procedures for encoding the SDP
              for conveying RELOAD or SIP ICE candidates. Instead of actually
              encoding an SDP, the candidate information (IP address and port
              and transport protocol, priority, foundation, component ID, type
              and related address) is carried within the attributes of the
              Attach request or its response. Similarly, the username
              fragment and password are carried in the Attach message or its
              response. <xref target="sec-connect-details"></xref> describes
              the detailed attribute encoding for Attach. The Attach request
              and its response do not contain any default candidates or the
              ice-lite attribute, as these features of ICE are not used by
              RELOAD. The Attach request and its response also contain a
              application attribute, with a value of SIP or RELOAD, which
              indicates what protocol is to be run over the connection. The
              RELOAD Attach request MUST only be utilized to set up
              connections for application protocols that can be multiplexed
              with STUN.</t>

              <t>Since the Attach request contains the candidate information
              and short term credentials, it is considered as an offer for a
              single media stream that happens to be encoded in a format
              different than SDP, but is otherwise considered a valid offer
              for the purposes of following the ICE specification. Similarly,
              the Attach response is considered a valid answer for the
              purposes of following the ICE specification.</t>
            </section>

            <section title="Verifying ICE Support">
              <t>An agent MUST skip the verification procedures in Section 5.1
              and 6.1 of ICE. Since RELOAD requires full ICE from all agents,
              this check is not required.</t>
            </section>

            <section title="Role Determination">
              <t>The roles of controlling and controlled as described in
              Section 5.2 of ICE are still utilized with RELOAD. However, the
              offerer (the entity sending the Attach request) will always be
              controlling, and the answerer (the entity sending the Attach
              response) will always be controlled. The connectivity checks
              MUST still contain the ICE-CONTROLLED and ICE-CONTROLLING
              attributes, however, even though the role reversal capability
              for which they are defined will never be needed with RELOAD.
              This is to allow for a common codebase between ICE for RELOAD
              and ICE for SDP.</t>
            </section>

            <section title="Connectivity Checks">
              <t>The processes of forming check lists in Section 5.7 of ICE,
              scheduling checks in Section 5.8, and checking connectivity
              checks in Section 7 are used with RELOAD without change.</t>
            </section>

            <section title="Concluding ICE">
              <t>The controlling agent MUST utilize regular nomination. This
              is to ensure consistent state on the final selected pairs
              without the need for an updated offer, as RELOAD does not
              generate additional offer/answer exchanges.</t>

              <t>The procedures in Section 8 of ICE are followed to conclude
              ICE, with the following exceptions:</t>

              <t><list style="symbols">
                  <t>The controlling agent MUST NOT attempt to send an updated
                  offer once the state of its single media stream reaches
                  Completed.</t>

                  <t>Once the state of ICE reaches Completed, the agent can
                  immediately free all unused candidates. This is because
                  RELOAD does not have the concept of forking, and thus the
                  three second delay in Section 8.3 of ICE does not apply.</t>
                </list></t>
            </section>

            <section title="Subsequent Offers and Answers">
              <t>An agent MUST NOT send a subsequent offer or answer. Thus,
              the procedures in Section 9 of ICE MUST be ignored.</t>
            </section>

            <section title="Media Keepalives">
              <t>STUN MUST be utilized for the keepalives described in Section
              10 of ICE.</t>
            </section>

            <section title="Sending Media">
              <t>The procedures of Section 11 apply to RELOAD as well.
              However, in this case, the "media" takes the form of application
              layer protocols (RELOAD or SIP for example) over TLS or DTLS.
              Consequently, once ICE processing completes, the agent will
              begin TLS or DTLS procedures to establish a secure connection.
	      The node which sent the Attach request MUST be the TLS server.
	      The other node MUST be the TLS client.
              The nodes MUST verify that the certificate presented in the
              handshake matches the identity of the other peer as found in the
              Attach message. Once the TLS or DTLS signaling is complete, the
              application protocol is free to use the connection.</t>

              <t>The concept of a previous selected pair for a component does
              not apply to RELOAD, since ICE restarts are not possible with
              RELOAD.</t>
            </section>

            <section title="Receiving Media">
              <t>An agent MUST be prepared to receive packets for the
              application protocol (TLS or DTLS carrying RELOAD, SIP or
              anything else) at any time. The jitter and RTP considerations in
              Section 11 of ICE do not apply to RELOAD or SIP.</t>
            </section>
          </section>

          <section title="Ping">
            <t>Ping provides a number of primitive "exploration" services:
	    (1) it is used to test connectivity along a path (2) it allows
	     node to determine which resources another node is responsible
	     for (3) it allows some discovery services in multicast settings.
	     A ping can be
            addressed to a specific Node-ID, the peer controlling a given
            location (by using a resource ID) or to the broadcast Node-ID (all
            1s). In either case, the target Node-IDs respond with a simple
            response containing some status information.</t>

            <section title="Request Definition">
              <t>The PingReq message contains a list (potentially empty) of
              the pieces of status information that the requester would like
              the responder to provide.</t>

              <figure>
                <!--begin-pdu-->

                <artwork><![CDATA[
      enum { responsible_set(1), num_resources(2), (255)} 
           PingInformationType;

      struct {
        PingInformationType     requested_info<0..2^8-1>;
      } PingReq

]]></artwork>
              </figure>

              <t>The two currently defined values for PingInformation are:</t>

            <t>  <list style="hanging">
                <t />

                <t hangText="responsible_set" />

                <t>indicates that the peer should Respond with the fraction of
                the overlay for which the responding peer is responsible.</t>

                <t />

                <t hangText="num_resources" />

                <t>indicates that the peer should Respond with the number of
                resources currently being stored by the peer.</t>
              </list> </t>

            </section>

            <section title="Response Definition">
              <t>A successful PingAns response contains the information
              elements requested by the peer.</t>

              <figure>
                <!--begin-pdu-->

                <artwork><![CDATA[

       struct {
         PingInformationType    type;
         
         select (type) {
           case responsible_set:
             uint32             responsible_ppb;

           case num_resources:
             uint32             num_resources;                           

           /* This type may be extended */

         };
       } PingInformation;

       struct {
         uint64                 response_id;
         PingInformation        ping_info<0..2^16-1>;
       } PingAns;


]]></artwork>
              </figure>

              <t>A PingAns message contains the following elements: <list
                  style="hanging">
                  <t></t>

                  <t hangText="response_id "></t>

                  <t>A randomly generated 64-bit response ID. This is used to
                  distinguish Ping responses in cases where the Ping request
                  is multicast.</t>

                  <t></t>

                  <t hangText="ping_info "></t>

                  <t>A sequence of PingInformation structures, as shown
                  below.</t>
                </list></t>

              <t>Each of the current possible Ping information types is a
              32-bit unsigned integer. For type "responsible_ppb", it is the
              fraction of the overlay for which the peer is responsible in
              parts per billion. For type "num_resources", it is the number of
              resources the peer is storing.</t>

              <t>The responding peer SHOULD include any values that the
              requesting peer requested and that it recognizes. They SHOULD be
              returned in the requested order. Any other values MUST NOT be
              returned.</t>
            </section>
          </section>

          <section anchor="sec-tunnel-details" title="Tunnel">
            <t>A node sends a Tunnel request when it wishes to exchange
            application-layer protocol messages without the expense of
            establishing a direct connection via Attach or when ICE is unable
            to establish a direct connection via Attach and a TURN relay is
            not available. The application-level protocols that are routed via
            the Tunnel request are defined by that application's usage.</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="Note:">The decision of whether to route
                application-level traffic across the overlay or to open a
                direct connection requires careful consideration of the
                overhead involved in each transaction. Establishing a direct
                connection requires greater initial setup costs, but after
                setup, communication is faster and imposes no overhead on the
                overlay. For example, for the SIP usage, an INVITE request to
                establish a voice call might be routed over the overlay, a
                SUBSCRIBE with regular updates would be better used with a
                Attach, and media would both impose too great a load on the
                overlay and likely receive unacceptable performance. However,
                there may be a tradeoff between locating TURN servers and
                relying on Tunnel for packet routing.</t>
              </list></t>

            <t>When a usage requires the Tunnel method, it must specify the
            specific application protocol(s) that will be Tunneled and for
            each protocol, specify:</t>

            <t><list style="symbols">
                <t>An application attribute that indicates the protocol being
                tunneled. This the IANA-registered port of the application
                protocol.</t>

                <t>The conditions under which the application will be Tunneled
                over the overlay rather than using a direct Attach.</t>

                <t>A mechanism for moving future application-level
                communication from Tunneling on the overlay to a direct
                Connection, or an explanation why this is unnecessary.</t>

                <t>A means of associating messages together as required for
                dialog-oriented or request/response-oriented protocols.</t>

                <t>How the Tunneled message (and associated responses) will be
                delivered to the correct application. This is particularly
                important if there might be multiple instances of the
                application on or behind a single peer.</t>
              </list></t>

            <section anchor="sec-tunnel-request" title="Request Definition">
              <t>The TunnelReq message contains the application PDU that the
              requesting peer wishes to transmit, along with some control
              information identifying the handling of the PDU.</t>

              <figure>
                <!-- begin-pdu -->

                <artwork><![CDATA[

       struct  {
         uint16                 application;
         opaque                 dialog_id<0..2^8-1>;
         opaque                 application_pdu<0..2^24-1>;
       } TunnelReq;

]]></artwork>
              </figure>

              <t>The values contained in the TunnelReq are:</t>

              <t><list style="hanging">
                  <t></t>

                  <t hangText="application "></t>

                  <t>A 16-bit port number. This port number represents the
                  IANA registered port of the protocol that is going to be
                  sent on this connection. For SIP, this is 5060 or 5061, and
                  for RELOAD is TBD. By using the IANA registered port, we
                  avoid the need for an additional registry and allow RELOAD
                  to be used to set up connections for any existing or future
                  application protocol.</t>

                  <t></t>

                  <t hangText="dialog_id "></t>

                  <t>An arbitrary string providing an application-defined way
                  of associating related Tunneled messages. This attribute may
                  also encode sequence information as required by the
                  application protocol.</t>

                  <t></t>

                  <t hangText="application_pdu "></t>

                  <t>An application PDU in the format specified by the
                  application.</t>
                </list></t>
            </section>

            <section anchor="sec-tunnel-response" title="Response Definition">
              <t>A TunnelAns message serves as confirmation that the message
              was received by the destination peer. It implies nothing about
              the processing of the application. If the application protocol
              specifies an acknowledgement or confirmation, that must be sent
              with a separate Tunnel request. The TunnelAns message is empty
              (has a zero length payload)</t>
            </section>
          </section>
        </section>
      </section>
    </section>

    <section title="Data Storage Protocol">
      <t>RELOAD provides a set of generic mechanisms for storing and
      retrieving data in the Overlay Instance. These mechanisms can be used
      for new applications simply by defining new code points and a small set
      of rules. No new protocol mechanisms are required.</t>

      <t>The basic unit of stored data is a single StoredData structure:</t>

      <figure>
        <!--begin-pdu-->

        <artwork><![CDATA[

      struct {
        uint32                  length;
        uint64                  storage_time;
        uint32                  lifetime;
        StoredDataValue         value;
        Signature               signature;
      } StoredData;

      
      ]]></artwork>
      </figure>

      <t>The contents of this structure are as follows: <list style="hanging">
          <t></t>

          <t hangText="length "></t>

          <t>The length of the rest of the structure in octets.</t>

          <t></t>

          <t hangText="storage_time "></t>

          <t>The time when the data was stored in absolute time, represented
          in seconds since the Unix epoch. Any attempt to store a data value
          with a storage time before that of a value already stored at this
          location MUST generate a 412 error. This prevents rollback attacks.
          Note that this does not require synchronized clocks: the receiving
          peer uses the storage time in the previous store, not its own
          clock.</t>

          <t></t>

          <t hangText="lifetime "></t>

          <t>The validity period for the data, in seconds, starting from the
          time of store.</t>

          <t></t>

          <t hangText="value "></t>

          <t>The data value itself, as described in <xref
          target="sec-kind-model"></xref>.</t>

          <t></t>

          <t hangText="signature "></t>

          <t>A signature over the data value. <xref
          target="sec-data-sig"></xref> describes the signature computation.
          The element is formatted as described in <xref
          target="sec-signature"></xref></t>
        </list></t>

      <!--
    <t>
      [TODO: this doesn't include the resource ID and kind to
      avoid duplicating it in each value. It would make things
      more self-contained, though.]
    </t>
-->

      <t>Each resource-id specifies a single location in the Overlay Instance.
      However, each location may contain multiple StoredData values
      distinguished by kind-id. The definition of a kind describes both the
      data values which may be stored and the data model of the data. Some
      data models allow multiple values to be stored under the same kind-id.
      Section <xref target="sec-kind-model"></xref> describes the available
      data models. Thus, for instance, a given resource-id might contain a
      single-value element stored under kind-id X and an array containing
      multiple values stored under kind-id Y.</t>

      <section anchor="sec-data-sig" title="Data Signature Computation">
        <t>Each StoredData element is individually signed. However, the
        signature also must be self-contained and cover the kind-id and
        resource-id even though they are not present in the StoredData
        structure. The input to the signature algorithm is:</t>

        <t><list>
            <t>resource_id + kind + StoredData</t>
          </list></t>

        <t>Where these values are: <list style="hanging">
            <t></t>

            <t hangText="resource "></t>

            <t>The resource ID where this data is stored.</t>

            <t></t>

            <t hangText="kind "></t>

            <t>The kind-id for this data.</t>

            <t></t>

            <t hangText="StoredData "></t>

            <t>The contents of the stored data value, as described in the
            previous sections.</t>
          </list></t>

        <t>[OPEN ISSUE: Should we include the identity in the string that
        forms the input to the signature algorithm?.]</t>

        <t>Once the signature has been computed, the signature is represented
        using a signature element, as described in <xref
        target="sec-signature"></xref>.</t>
      </section>

      <section anchor="sec-kind-model" title="Data Models">
        <t>The protocol currently defines the following data models:</t>

        <t><list style="symbols">
            <t>single value</t>

            <t>array</t>

            <t>dictionary</t>
          </list></t>

        <!-- TODO: EKR; add a kind in here? -->

        <t>These are represented with the StoredDataValue structure:</t>

        <figure>
          <!--begin-pdu-->

          <artwork><![CDATA[
                    
      enum { reserved(0), single_value(1), array(2), 
             dictionary(3), (255)} DataModel;

      struct {
        Boolean                exists;
        opaque                 value<0..2^32-1>;
      } DataValue;


      struct {
        DataModel                 model;  

        select (model) {
          case single_value:
            DataValue             single_value_entry;

          case array:
            ArrayEntry            array_entry;

          case dictionary:
            DictionaryEntry       dictionary_entry;


          /* This structure may be extended */
        } ;
      } StoredDataValue;
       
          ]]></artwork>
        </figure>

        <t>We now discuss the properties of each data model in turn:</t>

        <section title="Single Value">
          <t>A single-value element is a simple, opaque sequence of bytes.
          There may be only one single-value element for each resource-id,
          kind-id pair.</t>

          <t>A single value element is represented as a DataValue, which
          contains the following two elements:</t><t>

	  <list style="hanging">
              <t hangText="exists"></t>

              <t>This value indicates whether the value exists at all. If it
              is set to False, it means that no value is present. If it is
              True, that means that a value is present. This gives the
              protocol a mechanism for indicating nonexistence as opposed to
              emptiness.</t>

              <t></t>

              <t hangText="value"></t>

              <t>The stored data.</t>
            </list></t>
        </section>

        <section title="Array">
          <t>An array is a set of opaque values addressed by an integer index.
          Arrays are zero based. Note that arrays can be sparse. For instance,
          a Store of "X" at index 2 in an empty array produces an array with
          the values [ NA, NA, "X"]. Future attempts to fetch elements at
          index 0 or 1 will return values with "exists" set to False.</t>

          <t>A array element is represented as an ArrayEntry:</t>

          <figure>
            <!--begin-pdu-->

            <artwork><![CDATA[
            
       struct {
         uint32                  index;
         DataValue               value;
       } ArrayEntry;

       
              ]]></artwork>
          </figure>

          <t>The contents of this structure are: <list style="hanging">
              <t></t>

              <t hangText="index"></t>

              <t>The index of the data element in the array.</t>

              <t></t>

              <t hangText="value"></t>

              <t>The stored data.</t>
            </list></t>

          <!-- EKR: do something about (-1) and array stores. -->
        </section>

        <section title="Dictionary">
          <t>A dictionary is a set of opaque values indexed by an opaque key
          with one value for each key. single dictionary entry is represented
          as follows</t>

          <t>A dictionary element is represented as a DictionaryEntry:</t>

          <figure>
            <!--begin-pdu-->

            <artwork><![CDATA[
              
       typedef opaque           DictionaryKey<0..2^16-1>;
              
       struct {
         DictionaryKey          key;
         DataValue              value;
       } DictionaryEntry;

       
              ]]></artwork>
          </figure>

          <t>The contents of this structure are: <list style="hanging">
	  <t></t>
              <t hangText="key"></t>

              <t>The dictionary key for this value.</t>

	      <t></t><t hangText="value"></t>

              <t>The stored data.</t>
            </list></t>
        </section>
      </section>

      <section title="Data Storage Methods">
        <t>RELOAD provides several methods for storing and retrieving
        data:</t>

        <t><list style="symbols">
            <t>Store values in the overlay</t>

            <t>Fetch values from the overlay</t>

            <t>Remove values from the overlay</t>

            <t>Find the values stored at an individual peer</t>
          </list></t>

        <t>These methods are each described in the following sections.</t>

        <section anchor="sec-store" title="Store">
          <t>The Store method is used to store data in the overlay. The format
          of the Store request depends on the data model which is determined
          by the kind.</t>

          <section anchor="sec-store-req" title="Request Definition">
            <t>A StoreReq message is a sequence of StoreKindData values, each
            of which represents a sequence of stored values for a given kind.
            The same kind-id MUST NOT be used twice in a given store request.
            Each value is then processed in turn. These operations MUST be
            atomic. If any operation fails, the state MUST be rolled back to
            before the request was received.</t>

            <t>The store request is defined by the StoreReq structure:</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
     struct {
         KindId                 kind;
         DataModel              data_model;
         uint64                 generation_counter;
         StoredData             values<0..2^32-1>;
     } StoreKindData;

     struct {
         ResourceId             resource;
         uint8                  replica_number;    
         StoreKindData          kind_data<0..2^32-1>;
     } StoreReq;

              ]]></artwork>
            </figure>

            <t>A single Store request stores data of a number of kinds to a
            single resource location. The contents of the structure are: <list
                style="hanging">
                <t></t>

                <t hangText="resource "></t>

                <t>The resource to store at.</t>

                <t></t>

                <t hangText="replica_number "></t>

                <t>The number of this replica. When a storing peer saves
                replicas to other peers each peer is assigned a replica number
                starting from 1 and sent in the Store message. This field is
                set to 0 when a node is storing its own data. This allows
                peers to distinguish replica writes from original writes.</t>

                <t></t>

                <t hangText="kind_data "></t>

                <t>A series of elements, one for each kind of data to be
                stored.</t>
              </list></t>

            <t>If the replica number is zero, then the peer MUST check that it
            is responsible for the resource and if not reject the request. If
            the replica number is nonzero, then the peer MUST check that it
            expects to be a replica for the resource and if not reject the
            request.</t>

            <t>Each StoreKindData element represents the data to be stored for
            a single kind-id. The contents of the element are: <list
                style="hanging">
                <t></t>

                <t hangText="kind "></t>

                <t>The kind-id. Implementations SHOULD reject requests
                corresponding to unknown kinds unless specifically configured
                otherwise.</t>

                <t></t>

                <t hangText="data_model "></t>

                <t>The data model of the data. The kind defines what this has
                to be so this is redundant in the case where the software
                interpreting the messages understands the kind.</t>

                <t></t>

                <t hangText="generation "></t>

                <t>The expected current state of the generation counter
                (approximately the number of times this object has been
                written, see below for details).</t>

                <t></t>

                <t hangText="values "></t>

                <t>The value or values to be stored. This may contain one or
                more stored_data values depending on the data model associated
                with each kind.</t>
              </list></t>

            <t>The peer MUST perform the following checks:</t>

            <t><list style="symbols">
                <t>The kind_id is known and supported.</t>

                <t>The data_model matches the kind_id.</t>

                <!-- EKR: REMOVED. this doesn't allow conflict resolution.
                <t>The signature over the message is valid or (depending on
                overlay policy) no signature is required.</t> -->

                <t>The signatures over each individual data element (if any)
                are valid.</t>

                <t>Each element is signed by a credential which is authorized
                to write this kind at this resource-id</t>

                <t>For original (non-replica) stores, the peer MUST check that
                if the generation-counter is non-zero, it equals the current
                value of the generation-counter for this kind. This feature
                allows the generation counter to be used in a way similar to
                the HTTP Etag feature.</t>

                <t>The storage time values are greater than that of any value
                which would be replaced by this Store. [[OPEN ISSUE: do peers
                need to save the storage time of Removes to prevent
                reinsertion?]]</t>
              </list></t>

            <t>If all these checks succeed, the peer MUST attempt to store the
            data values. For non-replica stores, if the store succeeds and the
            data is changed, then the peer must increase the generation
            counter by at least one. If there are multiple stored values in a
            single StoreKindData, it is permissible for the peer to increase
            the generation counter by only 1 for the entire kind-id, or by 1
            or more than one for each value. Accordingly, all stored data
            values must have a generation counter of 1 or greater. 0 is used
            by other nodes to indicate that they are indifferent to the
            generation counter's current value. For replica Stores, the peer
            MUST set the generation counter to match the generation_counter in
            the message. Replica Stores MUST NOT use a generation counter of
            0.</t>

            <t>The properties of stores for each data model are as follows:
            <list style="hanging">
                <t></t>

                <t hangText="Single-value:"></t>

                <t>A store of a new single-value element creates the element
                if it does not exist and overwrites any existing value. with
                the new value.</t>

                <t></t>

                <t hangText="Array:"></t>

                <t>A store of an array entry replaces (or inserts) the given
                value at the location specified by the index. Because arrays
                are sparse, a store past the end of the array extends it with
                nonexistent values (exists=False) as required. A store at
                index 0xffffffff places the new value at the end of the array
                regardless of the length of the the array. The resulting
                StoredData has the correct index value when it is subsequently
                fetched.</t>

                <t></t>

                <t hangText="Dictionary:"></t>

                <t>A store of a dictionary entry replaces (or inserts) the
                given value at the location specified by the dictionary 
                key.</t>
              </list></t>

            <t>The following figure shows the relationship between these
            structures for an example store which stores the following values
            at resource "1234"</t>

            <t><list style="symbols">
                <t>The value "abc" in the single value slot for kind X</t>

                <t>The value "foo" at index 0 in the array for kind Y</t>

                <t>The value "bar" at index 1 in the array for kind Y</t>
              </list></t>

            <figure>
              <artwork><![CDATA[
                                  Store
                              resource=1234
                                 /      \
                                /        \
                    StoreKindData        StoreKindData
                       kind=X               kind=Y
                 model=Single-Value       model=Array
                         |                    /\
                         |                   /  \
                     StoredData             /    \
                         |                 /      \
                         |           StoredData  StoredData
                  StoredDataValue        |           |
                   value="abc"           |           |
                                         |           |
                                StoredDataValue  StoredDataValue
                                      index=0      index=1
                                   value="foo"    value="bar"
        
      ]]></artwork>
            </figure>
          </section>

          <section title="Response Definition">
            <t>In response to a successful Store request the peer MUST return
            a StoreAns message containing a series of StoreKindResponse
            elements containing the current value of the generation counter
            for each kind-id, as well as a list of the peers where the data
            was replicated.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
      struct {
        KindId                  kind;
        uint64                  generation_counter;
        NodeId                  replicas<0..2^16-1>;
      } StoreKindResponse;


      struct {
        StoreKindResponse       kind_responses<0..2^16-1>;
      } StoreAns;

              ]]></artwork>
            </figure>

            <t>The contents of each StoreKindResponse are:</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="kind "></t>

                <t>The kind-id being represented.</t>

                <t></t>

                <t hangText="generation "></t>

                <t>The current value of the generation counter for that
                kind-id.</t>

                <t></t>

                <t hangText="replicas "></t>

                <t>The list of other peers at which the data was/will-be
                replicated. In overlays and applications where the responsible
                peer is intended to store redundant copies, this allows the
                storing peer to independently verify that the replicas were in
                fact stored by doing its own Fetch.</t>
              </list></t>

            <t>The response itself is just StoreKindResponse values packed
            end-to-end.</t>

            <t>If any of the generation counters in the request precede the
            corresponding stored generation counter, then the peer MUST fail
            the entire request and respond with a 412 error. The error_info in
            the ErrorResponse MUST be a StoreAns response containing the
            correct generation counter for each kind and empty replicas
            lists.</t>
          </section>
        </section>

        <section title="Fetch">
          <t>The Fetch request retrieves one or more data elements stored at a
          given resource-id. A single Fetch request can retrieve multiple
          different kinds.</t>

          <section title="Request Definition">
            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
      struct {
        int32            first;
        int32            last;
      } ArrayRange;
        
      struct {
        KindId                  kind;
        DataModel               model;
        uint64                  generation;
        uint16                  length;
        
        select (model) {
          case single_value: ;    /* Empty */

          case array:
               ArrayRange       indices<0..2^16-1>;
          
          case dictionary:
               DictionaryKey    keys<0..2^16-1>;

          /* This structure may be extended */

        } model_specifier;
      } StoredDataSpecifier;

      struct {
        ResourceId              resource;
        StoredDataSpecifier     specifiers<0..2^16-1>;
      } FetchReq;

              ]]></artwork>
            </figure>

            <t>The contents of the Fetch requests are as follows:</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="resource "></t>

                <t>The resource ID to fetch from.</t>

                <t></t>

                <t hangText="specifiers "></t>

                <t>A sequence of StoredDataSpecifier values, each specifying
                some of the data values to retrieve.</t>
              </list></t>

            <t>Each StoredDataSpecifier specifies a single kind of data to
            retrieve and (if appropriate) the subset of values that are to be
            retrieved. The contents of the StoredDataSpecifier structure are
            as follows:</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="kind "></t>

                <t>The kind-id of the data being fetched. Implementations
                SHOULD reject requests corresponding to unknown kinds unless
                specifically configured otherwise.</t>

                <t></t>

                <t hangText="model "></t>

                <t>The data model of the data. This must be checked against
                the kind-id.</t>

                <t></t>

                <t hangText="generation "></t>

                <t>The last generation counter that the requesting peer saw.
                This may be used to avoid unnecessary fetches or it may be set
                to zero.</t>

                <t></t>

                <t hangText="length "></t>

                <t>The length of the rest of the structure, thus allowing
                extensibility.</t>

                <t></t>

                <t hangText="model_specifier "></t>

                <t>A reference to the data value being requested within the
                data model specified for the kind. For instance, if the data
                model is "array", it might specify some subset of the
                values.</t>
              </list></t>

            <t>The model_specifier is as follows:</t>

            <t><list style="symbols">
                <t>If the data is of data model single value, the specifier is
                empty.</t>

                <t>If the data is of data model array, the specifier contains
                of a list of ArrayRange elements, each of which contains two
                integers. two integers. The first integer is the beginning of
                the range and the second is the end of the range. 0 is used to
                indicate the first element and 0xffffffff is used to indicate
                the final element. The beginning of the range MUST be earlier
                in the array then the end. The ranges MUST be
                non-overlapping.</t>

                <t>If the data is of data model dictionary then the specifier
                contains a list of the dictionary keys being requested. If no
                keys are specified, than this is a wildcard fetch and all
                key-value pairs are returned. [[TODO: We really need a way to
                return only the keys. We'll need to modify this.]]</t>
              </list></t>

            <t>The generation-counter is used to indicate the requester's
            expected state of the storing peer. If the generation-counter in
            the request matches the stored counter, then the storing peer
            returns a response with no StoredData values.</t>

            <t>Note that because the certificate for a user is typically
            stored at the same location as any data stored for that user, a
            requesting peer which does not already have the user's certificate
            should request the certificate in the Fetch as an
            optimization.</t>
          </section>

          <section title="Response Definition">
            <t>The response to a successful Fetch request is a FetchAns
            message containing the data requested by the requester.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
       struct {
         KindId                 kind;
         uint64                 generation;
         StoredData             values<0..2^32-1>;
       } FetchKindResponse;

       struct {
         FetchKindResponse      kind_responses<0..2^32-1>;
       } FetchAns;

              ]]></artwork>
            </figure>

            <t>The FetchAns structure contains a series of FetchKindResponse
            structures. There MUST be one FetchKindResponse element for each
            kind-id in the request.</t>

            <t>The contents of the FetchKindResponse structure are as follows:
            <list style="hanging">
                <t></t>

                <t hangText="kind "></t>

                <t>the kind that this structure is for.</t>

                <t></t>

                <t hangText="generation "></t>

                <t>the generation counter for this kind.</t>

                <t></t>

                <t hangText="values "></t>

                <t>the relevant values. If the generation counter in the
                request matches the generation-counter in the stored data,
                then no StoredData values are returned. Otherwise, all
                relevant data values MUST be returned. A nonexistent value is
                represented with "exists" set to False.</t>
              </list></t>

            <t>There is one subtle point about signature computation on
            arrays. If the storing node uses the append feature (where the
            index=0xffffffff), then the index in the StoredData that is
            returned will not match that used by the storing node, which would
            break the signature. In order to avoid this issue, the index value
            in array is set to zero before the signature is computed. This
            implies that malicious storing nodes can reorder array entries
            without being detected. [[OPEN ISSUE: We've considered a number of
            alternate designs here that would preserve security against this
            attack if the storing node did not use the append feature.
            However, they are more complicated for one or both sides. If this
            attack is considered serious, we can introduce one of them.]]</t>
          </section>
        </section>

        <section title="Remove">
          <t>The Remove request is used to remove a stored element or elements
          from the storing peer. Any successful remove of an existing element
          for a given kind MUST increment the generation counter by at least
          1.</t>

          <figure>
            <!--begin-pdu-->

            <artwork><![CDATA[
      struct {
        ResourceId              resource;
        StoredDataSpecifier     specifiers<0..2^16-1>;
      } RemoveReq;

      
              ]]></artwork>
          </figure>

          <t>A RemoveReq has exactly the same syntax as a Fetch request except
          that each entry represents a set of values to be removed rather than
          returned. The same kind-id MUST NOT be used twice in a given
          RemoveReq. Each specifier is then processed in turn. These
          operations MUST be atomic. If any operation fails, the state MUST be
          rolled back to before the request was received.</t>

          <t>Before processing the Remove request, the peer MUST perform the
          following checks.</t>

          <t><list style="symbols">
              <t>The kind-id is known.</t>

              <t>The signature over the message is valid or (depending on
              overlay policy) no signature is required.</t>

              <t>The signer of the message has permissions which permit him to
              remove this kind of data. Although each kind defines its own
              access control requirements, in general only the original signer
              of the data should be allowed to remove it.</t>

              <t>If the generation-counter is non-zero, it must equal the
              current value of the generation-counter for this kind. This
              feature allows the generation counter to be used in a way
              similar to the HTTP Etag feature.</t>
            </list></t>

          <t>Assuming that the request is permitted, the operations proceed as
          follows.</t>

          <section title="Single Value">
            <t>A Remove of a single value element causes it not to exist. If
            no such element exists, then this is a silent success.</t>
          </section>

          <section title="Array">
            <t>A Remove of an array element (or element range) replaces those
            elements with null elements. Note that this does not cause the
            array to be packed. An array which contains ["A", "B", "C"] and
            then has element 0 removed produces an array containing [NA, "B",
            "C"]. Note, however, that the removal of the final element of the
            array shortens the array, so in the above case, the removal of
            element 2 makes the array ["A", "B"].</t>
          </section>

          <section title="Dictionary">
            <t>A Remove of a dictionary element (or elements) replaces those
            elements with null elements. If no such elements exist, then this
            is a silent success.</t>
          </section>

          <section title="Response Definition">
            <t>The response to a successful Remove simply contains a list of
            the new generation counters for each kind-id, using the same
            syntax as the response to a Store request. Note that if the
            generation counter does not change, that means that the requested
            items did not exist. However, if the generation counter does
            change, that does not mean that the items existed.</t>

          <figure>
            <!--begin-pdu-->

            <artwork><![CDATA[
      struct {
        StoreKindResponse          kind_responses<0..2^16-1>;
      } RemoveAns;
      
              ]]></artwork>
          </figure>

          </section>
        </section>

        <section title="Find">
          <t>The Find request can be used to explore the Overlay Instance. A
          Find request for a resource-id R and a kind-id T retrieves the
          resource-id (if any) of the resource of kind T known to the target
          peer which is closes to R. This method can be used to walk the
          Overlay Instance by interactively fetching R_n+1=nearest(1 +
          R_n).</t>

          <section title="Request Definition">
            <t>The FindReq message contains a series of resource-IDs and
            kind-ids identifying the resource the peer is interested in.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
   struct {
     ResourceID                 resource;
     KindId                     kinds<0..2^8-1>;
   } FindReq;

              ]]></artwork>
            </figure>

            <!-- find-request = resource-id 1*type-id -->

          <t>The request contains a list of kind-ids which the Find is for, as
          indicated below: <list style="hanging">
              <t></t>

              <t hangText="resource "></t>

              <t>The desired resource-id</t>

              <t></t>

              <t hangText="kinds "></t>

              <t>The desired kind-ids. Each value MUST only appear once.</t>
            </list></t>

          </section>
          <section title="Response Definition">
            <t>A response to a successful Find request is a FindAns message
            containing the closest resource-id for each kind specified in the
            request.</t>

            <figure>
              <!--begin-pdu-->

              <artwork><![CDATA[
  struct {
    KindId                      kind;
    ResourceID                  closest;
  } FindKindData;

  struct {
    FindKindData                results<0..2^16-1>;
  } FindAns;

              ]]></artwork>
            </figure>

            <t>If the processing peer is not responsible for the specified
            resource-id, it SHOULD return a 404 error.</t>

            <!-- EKR removed. It is confusing here.

            <t>When each kind is defined, it can indicate if the kind is not
            allowed to be used in a Find request. This would be done to help
            achieve some types of security properties for the data stored in
            that kind.</t>
-->

            <t>For each kind-id in the request the response MUST contain a
            FindKindData indicating the closest resource-id for that kind-id
            unless the kind is not allowed to be used with Find in which case
            a FindKindData for that kind-id MUST NOT be included in the
            response. If a kind-id is not known, then the corresponding
            resource-id MUST be 0. Note that different kind-ids may have
            different closest resource-ids.</t>

            <t>The response is simply a series of FindKindData elements, one
            per kind, concatenated end-to-end. The contents of each element
            are:</t>

            <t><list style="hanging">
                <t></t>

                <t hangText="kind "></t>

                <t>The kind-id.</t>

                <t></t>

                <t hangText="closest "></t>

                <t>The closest resource ID to the specified resource ID. This
                is 0 if no resource ID is known.</t>
              </list></t>

            <t>Note that the response does not contain the contents of the
            data stored at these resource-ids. If the requester wants this, it
            must retrieve it using Fetch.</t>
          </section>

          <section title="Defining New Kinds">
            <t>A new kind MUST define:</t>

            <t><list style="symbols">
                <t>The meaning of the data to be stored.</t>

                <t>The kind-id.</t>

                <t>The data model (single value, array, dictionary, etc.)</t>

                <t>Access control rules for indicating what credentials are
                allowed to read and write that kind-id at a given
                location.</t>
              </list></t>

            <t>While each kind MUST define what data model is used for its
            data, that does not mean that it must define new data models.
            Where practical, kinds SHOULD use the built-in data models.
            However, they MAY define any new required data models. The
            intention is that the basic data model set be sufficient for most
            applications/usages.</t>
          </section>
        </section>
      </section>
    </section>

    <section anchor="sec-store-usage" title="Certificate Store Usage">
      <t>The Certificate Store usage allows a peer to store its certificate in
      the overlay, thus avoiding the need to send a certificate in each
      message - a reference may be sent instead.</t>

      <t>A user/peer MUST store its certificate at resource-ids derived from
      two Resource Names:</t>

      <t><list style="symbols">
          <t>The user name in the certificate.</t>

          <t>The Node-ID in the certificate.</t>
        </list></t>

      <t>Note that in the second case the certificate is not stored at the
      peer's Node-ID but rather at a hash of the peer's Node-ID. The intention
      here (as is common throughout RELOAD) is to avoid making a peer
      responsible for its own data.</t>

      <t>A peer MUST ensure that the user's certificates are stored in the
      Overlay Instance. New certificates are stored at the end of the list.
      This structure allows users to store and old and new certificate the
      both have the same node-id which allows for migration of certificates
      when they are renewed.</t>

      <!--      <t>when joining and redo the check about every 24 hours after that.
      Certificate data should be stored with an expiry time of 60 days. When
      a client is checking the existence of data, if the expiry is less than
      30 days, it should be refreshed to have an expiry of 60 days. The
      certificate information is frequently used for many operations, and
      peers should cache it for 8 hours.</t>-->

      <t><list style="hanging">
          <t></t>

          <t hangText="Kind IDs">This usage defines the CERTIFICATE kind-id to
          store a peer or user's certificate.</t>

          <t></t>

          <t hangText="Data Model">The data model for CERTIFICATE data is
          array.</t>

          <t></t>

          <t hangText="Access Control">The CERTIFICATE MUST contain a Node-ID
          or user name which, when hashed, maps to the resource-id at which
          the value is being stored.</t>
        </list></t>
    </section>

    <section anchor="sec-turn-server" title="TURN Server Usage">
      <t>The TURN server usage allows a RELOAD peer to advertise that it is
      prepared to be a TURN server as defined in <xref target="I-D.ietf-behave-turn"/>. When a node starts up, it joins the
      overlay network and forms several connection in the process. If the ICE
      stage in any of these connection return a reflexive address that is not
      the same as the peers perceived address, then the peers is behind a NAT
      and not an candidate for a TURN server. Additionally, if the peers IP
      address is in the private address space range, then it is not a
      candidate for a TURN server. Otherwise, the peer SHOULD assume it is a
      potential TURN server and follow the procedures below.</t>

      <t>If the node is a candidate for a TURN server it will insert some
      pointers in the overlay so that other peers can find it. The overlay
      configuration file specifies a turnDensity parameter that indicates how
      many times each TURN server should record itself in the overlay.
      Typically this should be set to the reciprocal of the estimate of what
      percentage of peers will act as TURN servers. For each value, called d,
      between 1 and turnDensity, the peer forms a Resource Name by
      concatenating its peer-ID and the value d. This Resource Name is hashed
      to form a Resource-ID. The address of the peer is stored at that
      Resource-ID using type TURN-SERVICE and the TurnServer object:</t>

      <figure>
        <!--begin-pdu-->

        <artwork><![CDATA[
      struct {
        uint8                   iteration;
        IpAddressAndPort        server_address;
      } TurnServer;
      
  ]]></artwork>
      </figure>

      <t>The contents of this structure are as follows: <list style="hanging">
          <t></t>

          <t hangText="iteration"></t>

          <t>the d value</t>

          <t></t>

          <t hangText="server_address"></t>

          <t>the address at which the TURN server can be contacted.</t>
        </list></t>

      <t><list style="hanging">
          <t hangText="Note:">Correct functioning of this algorithm depends
          critically on having turnDensity be an accurate estimate of the true
          density of TURN servers. If turnDensity is too high, then the
          process of finding TURN servers becomes extremely expensive as
          multiple candidate resource-ids must be probed.</t>
        </list></t>

      <t>Peers peers that provide this service need to support the TURN
      extensions to STUN for media relay of both UDP and TCP traffic as
      defined in [I-D.ietf-behave-turn] and [I-D.ietf-behave-tcp].</t>

      <t>[[OPEN ISSUE: This structure only works for TURN servers that have
      public addresses. It may be possible to use TURN servers that are behind
      well-behaved NATs by first ICE connecting to them. If we decide we want
      to enable that, this structure will need to change to either be a
      peer-id or include that as an option.]]</t>

      <t><list style="hanging">
          <t hangText="Kind IDs">This usage defines the TURN-SERVICE kind-id
          to indicate that a peer is willing to act as a TURN server. The Find
          command MUST return results for the TURN-SERVICE kind-id.</t>

          <t hangText="Data Model">The TURN-SERVICE stores a single value for
          each resource-id.</t>

          <t hangText="Access Control">If certificate-based access control is
          being used, stored data of kind TURN-SERVICE MUST be authenticated
          by a certificate which contains a peer-id which when hashed with the
          iteration counter produces the resource-id being stored at.</t>
        </list></t>

      <t>Peers can find other servers by selecting a random Resource-ID and
      then doing a Find request for the appropriate server type with that
      Resource-ID. The Find request gets routed to a random peer based on the
      Resource-ID. If that peer knows of any servers, they will be returned.
      The returned response may be empty if the peer does not know of any
      servers, in which case the process gets repeated with some other random
      Resource-ID. As long as the ratio of servers relative to peers is not
      too low, this approach will result in finding a server relatively
      quickly.</t>
    </section>

    <section title="SIP Usage">
      <!-- EKR: Fodder from previous P2PSIP overview 
          <t>All SIP URIs for a given overlay MUST be constructed so that they
          terminate in the domain name of the overlay. For instance, if the
          overlay name is "example.com", then all AORs must be of the form
          {sip,sips}:username@example.com. Accordingly, to dereference a URI,
          a P2PSIP implementation MUST check to see if the domain matches an
          overlay which it is a member of. If so, it uses the following
          procedures. Otherwise, it MUST follow <xref target="RFC3263"></xref>
          procedures. Note that unless the P2PSIP overlay provides some kind
          of gateway to ordinary SIP (e.g., a publicly accessible SIP server)
          this is likely to be only partially successful, since, for instance,
          the callee may not be able to call back.</t>

          <section title="SIP Location">
             <t>A peer acting as a SIP UA stores their registration information
             in the overlay by storing either another URI (for retargeting) or a
             destination lists to reach them at a Resource-ID in the overlay formed
             from the user's SIP AOR. When another peer wishes to find a peer
             that is registered for a SIP URI, the lookup of the user's name is
             done by taking the user's SIP Address of Record (AOR) and using it
             as the Resource Name that is hashed to get a Resource-ID. When the
             Resource Name is dereferenced, the result is a set of values. Each
             value is either another SIP URI or a destination list. If the
             value is a SIP URI, the calling peer looks up that URI and
             continues the process until it gets a destination list.</t>

             <t>If the value is a destination list, then it is used to reach a
             peer that represents a SIP UA registered for that AOR. Typically
             this destination list will have just one entry but in the case of
             peers or clients that can not be directly reached (for instance
             via a strict NAT or firewall), a destination list with more than
             one entry may need to be used.</t>

             <t>The Resource Name for this usage is a user's SIP AOR, such as
             "sip:alice@example.com". This allows the set to store many values
             in a dictionary structure. The authorization policy is that Store
             requests are only allowed if the user name in the signing
             certificate, when turned into a SIP URL and hashed, matches the
             Resource-ID. This policy ensures that only a user with the
             certificate with the user name "alice@example.com" can write to
             the Resource-ID that will be used to look up calls to
             "sip:alice@example.com".</t>

             <t>[[Open Issue: Should the Resource Name be
             "sip:alice@example.com", "alice@example.com", or a string that
             includes the code point defined for the kind? The issue here is
             determining whether different usages that store data at a
             Resource Name that is primarily formed from "alice@example.com"
             should hash to the same Resource-ID as the SIP Usage. For example,
             if a buddy list had a Resource Name that was roughly the same, would
             we want the buddy list information to end up on the same peers
             that stored the SIP location data or on different peers?]]</t>
           </section>

-->

      <t>The SIP usage allows a RELOAD overlay to be used as a distributed SIP
      registrar/proxy network augmenting the functionality of <xref target="RFC3263"></xref>. This entails three primary operations:</t>

      <t><list style="symbols">
          <t>Registering one's own AOR with the overlay.</t>

          <t>Looking up a given AOR in the overlay.</t>

          <t>Forming a direct connection to a given peer.</t>
        </list></t>

      <section title="Registering AORs">
        <t>In ordinary SIP, a UA registers its AOR and location with a
        registrar. In RELOAD, this registrar function is provided by the
        overlay as a whole. To register its location, a RELOAD peer stores a
        SipRegistration structure under its own AOR. This uses the
        SIP-REGISTRATION kind-id, which is formally defined in <xref
        target="sec.sip-reg-kind"></xref>. <list style="hanging">
            <t hangText="Note:">GRUUs are handled via a separate mechanism, as
            described in <xref target="sec-gruus"></xref>.</t>
          </list></t>

        <t>As a simple example, if Alice's AOR were
        "sip:alice@dht.example.com" and her Node-ID were "1234", she might
        store the mapping "sip:alice@example.org -> 1234". This would tell
        anyone who wanted to call Alice to contact node "1234".</t>

        <t>RELOAD peers MAY store two kinds of SIP mappings:</t>

        <t><list style="symbols">
            <t>From AORs to destination lists (a single Node-ID is just a
            trivial destination list.)</t>

            <t>From AORs to other AORs.</t>
          </list></t>

        <t>The meaning of the first kind of mapping is "in order to contact
        me, form a connection with this peer." The meaning of the second kind
        of mapping is "in order to contact me, dereference this AOR". This
        allows for forwarding. For instance, if Alice wants calls to her to be
        forwarded to her secretary, Sam, she might insert the following
        mapping "sip:alice@dht.example.org -> sip:sam@dht.example.org".</t>

        <t>The contents of a SipRegistration structure are as follows:</t>

        <figure>
          <!--begin-pdu-->

          <artwork><![CDATA[

       enum {sip_registration_uri (1), sip_registration_route (2), 
          (255)} SipRegistrationType;
      
       select (SipRegistration.type) {
         case sip_registration_uri:
           opaque               uri<0..2^16-1>;

         case sip_registration_route:
           opaque               contact_prefs<0..2^16-1>;
           Destination          destination_list<0..2^16-1>;

         /* This type can be extended */

       } SipRegistrationData;

       struct {
          SipRegistrationType   type;
          uint16                length;
          SipRegistrationData   data;          
      } SipRegistration;


                ]]></artwork>
        </figure>

        <t>The contents of the SipRegistration PDU are:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="type "></t>

            <t>the type of the registration</t>

            <t></t>

            <t hangText="length "></t>

            <t>the length of the rest of the PDU</t>

            <t></t>

            <t hangText="data "></t>

            <t>the registration data</t>
          </list></t>

        <t><list style="symbols">
            <t>If the registration is of type "sip_registration_uri", then the
            contents are an opaque string containing the URI.</t>

            <t>If the registration is of type "sip_registration_route", then
            the contents are an opaque string containing the callee's contact
            preferences and a destination list for the peer.</t>
          </list></t>

        <t>RELOAD explicitly supports multiple registrations for a single AOR.
        The registrations are stored in a Dictionary with the dictionary keys
        being Node-IDs. Consider, for instance, the case where Alice has two
        peers:</t>

        <t><list style="symbols">
            <t>her desk phone (1234)</t>

            <t>her cell phone (5678)</t>
          </list></t>

        <t>Alice might store the following in the overlay at resource
        "sip:alice@dht.example.com".</t>

        <t><list style="symbols">
            <t>A SipRegistration of type "sip_registration_route" with
            dictionary key "1234" and value "1234".</t>

            <t>A SipRegistration of type "sip_registration_route" with
            dictionary key "5678" and value "5678".</t>
          </list></t>

        <t>Note that this structure explicitly allows one Node-ID to forward
        to another Node-ID. For instance, Alice could set calls to her desk
        phone to ring at her cell phone. It's not clear that this is useful in
        this case, but may be useful if Alice has two AORs.</t>

        <t>In order to prevent hijacking, registrations are subject to access
        control rules. Before a Store is permitted, the storing peer MUST
        check that:</t>

        <t><list style="symbols">
            <t>The certificate contains a username that is a SIP AOR that
            hashes to the resource-id being stored at.</t>

            <t>The certificate contains a Node-ID that is the same as the
            dictionary key being stored at.</t>
          </list></t>

        <t>Note that these rules permit Alice to forward calls to Bob without
        his permission. However, they do not permit Alice to forward Bob's
        calls to her. See <xref
        target="sec-security-malicious-retargeting"></xref> for more on this
        point.</t>
      </section>

      <section title="Looking up an AOR">
        <t>When a RELOAD user wishes to call another user, starting with a
        non-GRUU AOR, he follows the following procedure. (GRUUs are discussed
        in <xref target="sec-gruus"></xref>).</t>

        <t><list style="numbers">
            <t>Check to see if the domain part of the AOR matches the domain
            name of an overlay of which he is a member. If not, then this is
            an external AOR, and he MUST do one of the following: <list
                style="symbols">
                <t>Fail the call.</t>

                <t>Use ordinary SIP procedures.</t>

                <t>Attempt to become a member of the overlay indicated by the
                domain part (only possible if the enrollment procedure defined
                in <xref target="sec-discovery"></xref> indicates that this is
                a RELOAD overlay.)</t>
              </list></t>

            <t>Perform a Fetch for kind SIP-REGISTRATION at the resource-id
            corresponding to the AOR. This Fetch SHOULD NOT indicate any
            dictionary keys, which will result in fetching all the stored
            values.</t>

            <t>If any of the results of the Fetch are non-GRUU AORs, then
            repeat step 1 for that AOR.</t>

            <t>Once only GRUUs and destination lists remain, the peer removes
            duplicate destination lists and GRUUs from the list and forms a
            SIP connection to the appropriate peers as described in the
            following sections. If there are also external AORs, the peer
            follows the appropriate procedure for contacting them as well.</t>
          </list></t>
      </section>

      <section title="Forming a Direct Connection">
        <t>Once the peer has translated the AOR into a set of destination
        lists, it then uses the overlay to route Attach messages to each of
        those peers. The "application" field MUST be 5060 to indicate SIP. If
        certificate-based authentication is in use, the responding peer MUST
        present a certificate with a Node-ID matching the terminal entry in
        the route list. Note that it is possible that the peers already have a
        RELOAD connection between them. This MUST NOT be used for SIP
        messages. However, if a SIP connection already exists, that MAY be
        used. Once the Attach succeeds, the peer sends SIP messages over the
        connection as in normal SIP.</t>
      </section>

      <section anchor="sec-gruus" title="GRUUs">
        <t>GRUUs do not require storing data in the Overlay Instance. Rather,
        they are constructed by embedding a base64-encoded destination list in
        the gr URI parameter of the GRUU. The base64 encoding is done with the
        alphabet specified in table 1 of RFC 4648 with the exception that ~ is
        used in place of =. An example GRUU is
        "sip:alice@example.com;gr=MDEyMzQ1Njc4OTAxMjM0NTY3ODk~". When a peer
        needs to route a message to a GRUU in the same P2P network, it simply
        uses the destination list and connects to that peer.</t>

        <t>Because a GRUU contains a destination list, it MAY have the same
        contents as a destination list stored elsewhere in the resource
        dictionary.</t>

        <t>Anonymous GRUUs are done in roughly the same way but require either
        that the enrollment server issue a different Node-ID for each
        anonymous GRUU required or that a destination list be used that
        includes a peer that compresses the destination list to stop the
        Node-ID from being revealed.</t>
      </section>

      <section anchor="sec.sip-reg-kind"
               title="SIP-REGISTRATION Kind Definition">
        <t>The first mapping is provided using the SIP-REGISTRATION
        kind-id:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="Kind IDs">The Resource Name for the SIP-REGISTRATION
            kind-id is the AOR of the user. The data stored is a
            SipRegistrationData, which can contain either another URI or a
            destination list to the peer which is acting for the user.</t>

            <t></t>

            <t hangText="Data Model">The data model for the SIP-REGISTRATION
            kind-id is dictionary. The dictionary key is the Node-ID of the
            storing peer. This allows each peer (presumably corresponding to a
            single device) to store a single route mapping.</t>

            <t></t>

            <t hangText="Access Control">If certificate-based access control
            is being used, stored data of kind-id SIP-REGISTRATION must be
            signed by a certificate which (1) contains user name matching the
            storing URI used as the Resource Name for the resource-id and (2)
            contains a Node-ID matching the storing dictionary key.</t>
          </list></t>

        <t>Data stored under the SIP-REGISTRATION kind is of type
        SipRegistration. This comes in two varieties: <list style="hanging">
            <t></t>

            <t hangText="sip_registration_uri "></t>

            <t>a URI which the user can be reached at.</t>

            <t></t>

            <t hangText="sip_registration_route "></t>

            <t>a destination list which can be used to reach the user's
            peer.</t>
          </list></t>

        <!--
      <section title="SIP Tunnel">
          <t>Two peers can also exchange SIP messages across the
          overlay using the Tunnel method. This allows a SIP message to be
          sent immediately, without the delay associated with Attach. For a
          simple SIP exchange, it may result in fewer messages being sent.</t>

          <t>An implementation SHOULD use Attach for a dialog that is
          expected to endure for sufficient time and exchange significant
          numbers of messages. An implementation MAY establish an initial
          dialog using Tunneling and then migrate it to a direct dialog opened
          with Attach once that negotiation is complete.</t>

          <t>As an application of Tunnel, this usage defines the following
          items:</t>

          <t><list style="symbols">
              <t>For SIP, the application attribute is 5060.</t>

              <t>The application MAY establish any dialog using Tunnel if it
              expects to replace it once an Attach request completes. The
              application SHOULD NOT exchange messages with another SIP UA
              repeatedly using a Tunnel unless it is unable to complete a
              Attach.</t>

              <t>The Replaces header should be used to migrate dialogs
              established via Tunnel to a direct connection.</t>

              <t>The dialogid is the GRUU of the destination of the
              request.</t>

              <t>By using the GRUU of the destination as the dialogid, the
              receiving peer is able to deliver the message to the appropriate
              process without parsing the SIP message.</t>
            </list></t>

    [OPEN ISSUE: How is the Via List constructed for the SIP message?]

          <t>In constructing the message, the SIP UA forms the message as if
          it were being routed directly to the GRUU of the destination. The
          SIP stack hands the message to RELOAD for delivery. Although the
          message is passed through a sequence of untrusted peers, it is not
          subject to modification by those peers because of the message's
          signature.</t>

          <t>OPEN ISSUE: should specify how to request encryption of the
          message end-to-end.</t>

          <t>OPEN ISSUE: If the tunneling vs direct decision can be made
          equivalently to a link-layer decision, it may not be necessary to
          modify the dialog or inform the SIP UA in any way that it has now
          obtained a direct route.</t>

    <t>OPEN ISSUE: what does the via list look like?</t>
        </section>
-->
      </section>
    </section>

    <!--
      <section title="HIP Tunnel">
        <t>This usage allows two peers to exchange HIP messages across the
        overlay using the Tunnel method. This is meant to be used as part of
        the HIP BONE architecture described in <xref
        target="I-D.camarillo-hip-bone"></xref>.</t>

        <t>As an application of Tunnel, this usage defines the following
        items:</t>

        <t><list style="symbols">
            <t>For HIP, the application attribute is TBD (IANA port
            number).</t>

            <t>The dialogid is empty and set to zero length.</t>
          </list></t>

        <t>In order to route HIP messages correctly, there needs to be an
        unambiguous mapping between the ORCHID assigned to each HIP node and
        the Node-ID assigned to that node. The ORCHID MUST be used as the
        Resource Name to generate the Node-ID. [TODO: We need a general scheme
        for mapping Resource Names to IDs so they don't collide. This isn't the
        place to define it.] Messages to a given ORCHID are then routed to the
        mapped Node-ID. <xref target="sec-credentials"></xref> describes more
        considerations for the generation of ORCHIDs for use with RELOAD.</t>

        <t>TODO - should discuss interaction of HIP and P2P retransmission
        timers</t>
      </section>
      -->

    <section title="Diagnostic Usage" toc="default">
      <!-- 
        <t>[[TODO: reduce text of motivation description in the next
        version]]</t>

        <t>The development and deployment of a peer-to-peer system is a
        continuous process. The developers write code which is tested on a
        scale that may be smaller than the actual deployment size. After this
        local testing, the code is deployed in a real environment. Bugs arise
        during development and deployment phases. The designers of the
        peer-to-peer system need mechanisms which can help identify problems
        and bugs in a peer-to-peer system during development and deployment
        phases. Peer-to-peer systems are an example of a distributed system
        and it is not a trivial task to provide protocol mechanisms, tools and
        techniques to identify problems that may arise in such systems.</t>

        <t>The diagnostic mechanisms can broadly be classified into online and
        offline mechanisms. The online mechanisms attempt to identify faults
        in a running system where as offline mechanisms try to infer faults by
        gathering the log files of machines participating in a distributed
        system.</t>

        <t>In a peer-to-peer system, a peer maintains routing state to forward
        messages according to the overlay protocol being used. In addition, a
        peer stores information published by other peers. The routing and
        storage of resources consume network, space (memory), and CPU
        resources. A peer also needs to keep track of how long the P2PSIP
        application has been running and the last time peers in the routing
        table were last contacted. During development and deployment phase, an
        overlay designer needs mechanisms to query some or all of the above
        mentioned information.</t>

        <t>The overlay designer may also treat overlay as a black box and
        determine if the routing mechanisms are working correctly under
        various levels of churn.</t>

        <t>Thus, there are at least two types of online diagnostic mechanisms:
        1) state acquisition 2) black-box diagnostics</t>

        <section title="State Acquisition Mechanisms">
          <t>The protocol provides a DIAGNOSTIC method [TODO] which queries
          the peer for its routing state, average bandwidth, CPU utilization,
          and storage state. The state acquisition mechanism can be used to
          construct a local view of the connectivity state of the system. It
          can also be used to construct a geographical map of the system.</t>

          <t>Below, we identify potential issues with the state acquisition
          mechanisms.</t>

          <t>Security: If any peer can query the routing or storage state of
          any other peer, then clearly privacy and security concerns arise. To
          address this, the state acquisition mechanisms need an access list
          like mechanism so that only the overlay implementer can query the
          state of all the nodes. Alternatively, the state acquisition
          mechanisms are only enabled during the development phase or are only
          enabled for 'admin' users.</t>

          <t>Scalability: It is possible to query the state of few hundred or
          a few thousand nodes (as it is currently done in our live system on
          Planet lab); however, a serial state acquisition of a million node
          is a non starter. In large scale networks, one option is to query
          the state of few hundred nodes and to construct an high level
          connectivity map. CAIDA [ref] collects data at a few vantage points
          to construct BGP maps.</t>

          <t>Instantaneous vs. long term state: Another issue with these state
          acquisitions mechanisms is whether they acquire the instantaneous
          state snapshot or an exponential moving average or a list of
          snapshots over a period of time. For diagnostic metrics such as CPU
          utilization, an exponential moving average metric is also helpful in
          addition to the instantaneous snapshot.</t>

          <t>Pull vs. push: The state acquisition mechanisms can either be
          pull-based or push-based or a combination of both. In pull-based
          mechanisms, peer explicitly request state of another peer. This may
          not be sufficient because pull-based mechanisms require a to
          periodically poll a peer for any change state. In a push-based
          mechanism, peers advertise any change in certain metrics to their
          routing or neighbor peers. As an example of push-based mechanism, a
          peer which starts to relay a call may indicate a change in its
          bandwidth to its routing or neighbor peers in a Ping message.</t>

          <t>Development vs. deployment: A hard problem is to decide which
          diagnostics are absolutely necessary during deployment and which are
          needed during development.</t>

          <t>Clearly, complete state acquisition has security concerns in a
          deployed system. The other option an overlay implementer can use is
          to run a few peers and have complete control over the functionality
          of these peers. These peers are same as other peers with the
          difference that an overlay implementer can explicitly query the
          state of these peers. It can then use this information to 'crawl'
          the overlay network and construct a local map of the network.</t>
        </section>

        <section title="Black-box diagnostics">
          <t>[[TODO: a better name for this section]]</t>

          <t>Black-box diagnostics: DHTs are examples of structured
          peer-to-peer networks and they allow nodes to store key/value pairs
          in the overlay. A simple diagnostic mechanism is to treat the
          overlay as a black-box: publish several key/value pairs at one peer
          and then look them up from another peer. For this kind of diagnostic
          mechanism, clients are more suitable as they do not provide any
          routing or storage services to the overlay and can connect to an
          arbitrary peer.</t>
        </section>
-->

      <t>The Diagnostic Usage allows a node to report various statistics about
      itself that may be useful for diagnostics or performance management. It
      can be used to discover information such as the software version,
      uptime, routing table, stored resource-objects, and performance
      statistics of a peer. The usage defines several new kinds which can be
      retrieved to get the statistics and also allows to retrieve other kinds
      that a node stores. In essence, the usage allows querying a node's state
      such as storage and network to obtain the relevant information.</t>

      <t>The access control model for all kinds is a local policy defined by
      the peer or the overlay policy. The peer may be configured with a list
      of users that it is willing to return the information for and restrict
      access to users with that name. Unless specific policy overrides it,
      data SHOULD NOT be returned for users not on the list. The access
      control can also be determined on a per kind basis - for example, a node
      may be willing to return the software version to any users while
      specific information about performance may not be returned.</t>

      <!--
        <t>A peer may query other peers for kinds defined in this usage using
        a Diagnostic message <xref target="sec-diagnostic"></xref>. A peer MAY 
        request multiple kinds in a single Diagnostic request. </t>
-->

      <!-- 
        A peer can use this information to choose an appropriate 
        peer for its routing or connection table. It may also maintain kinds defined 
        in this usage for peers in its routing and connection table.
        -->

      <!-- 
        [TODO: Do we need a 
        DIAGNOSTIC method? Access control mechanisms for DIAGNOSTIC may be different
        from a Fetch.]
        -->

      <!--        
        <texttable>
          <ttcol align="left">Kind</ttcol>
          <ttcol align="left">Data Model</ttcol>
      <ttcol align="left">Access Control</ttcol>
      <ttcol align="left">Data size</ttcol>
      
          <c>ROUTING_TABLE_SIZE</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 32-bit integer</c>
          <c>SOFTWARE_VERSION</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>US-ASCII string up to 255 characters</c>

          <c>MACHINE_UPTIME</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 64-bit integer</c>
          <c>APP_UPTIME</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 64-bit integer</c>
          <c>MEMORY_FOOTPRINT</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 32-bit integer</c>
          
          <c>DATASIZE_STORED</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 64-bit integer</c>
          <c>INSTANCES_STORED</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 64-bit integer</c>

          <c>MESSAGES_SENT_RCVD</c> <c>array (indexed by method code)</c> <c>admin, cert, shared-key</c> <c>each 
      array entry is a pair of unsigned 64-bit integers representing messages sent and received</c>
          <c>EWMA_BYTES_SENT</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 32-bit integer</c>
          <c>EWMA_BYTES_RCVD</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 32-bit integer</c>
          
          <c>LAST_CONTACT</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 32-bit integer</c>
      <c>RTT</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 32-bit integer</c>
          
          <c>SPARE_LINK_CAPACITY</c> <c>single value</c> <c>admin, cert, shared-key</c> <c>unsigned 32-bit integer</c>          
        </texttable>
-->

      <t>The following kinds are defined:</t>

      <t><list style="hanging">
          <t></t>

          <t hangText="ROUTING_TABLE_SIZE">A single value element containing
          an unsigned 32-bit integer representing the number of peers in the
          peer's routing table.</t>

          <t></t>

          <t hangText="SOFTWARE_VERSION">A single value element containing a
          US-ASCII string that identifies the manufacture, model, and version
          of the software.</t>

          <t></t>

          <t hangText="MACHINE_UPTIME">A single value element containing an
          unsigned 64-bit integer specifying the time the nodes has been up in
          seconds.</t>

          <t></t>

          <t hangText="APP_UPTIME">A single value element containing an
          unsigned 64-bit integer specifying the time the p2p application has
          been up in seconds.</t>

          <t></t>

          <t hangText="MEMORY_FOOTPRINT">A single value element containing an
          unsigned 32-bit integer representing the memory footprint of the
          peer program in kilo bytes.</t>

          <t><list style="hanging">
              <t hangText="Note:">What's a kilo byte? 1000 or 1024? --
              Cullen</t>

              <t hangText="Note:">Good question. 1000 seems like not quite
              enough room but 1024 is too much? -- EKR</t>
            </list></t>

          <t></t>

          <t hangText="DATASIZE_STORED">An unsigned 64-bit integer
          representing the number of bytes of data being stored by this
          node.</t>

          <t></t>

          <t hangText="INSTANCES_STORED">An array element containing the
          number of instances of each kind stored. The array is index by
          kind-id. Each entry is an unsigned 64-bit integer.</t>

          <t></t>

          <t hangText="MESSAGES_SENT_RCVD">An array element containing the
          number of messages sent and received. The array is indexed by method
          code. Each entry in the array is a pair of unsigned 64-bit integers
          (packed end to end) representing sent and received.</t>

          <t></t>

          <t hangText="EWMA_BYTES_SENT">A single value element containing an
          unsigned 32-bit integer representing an exponential weighted average
          of bytes sent per second by this peer.</t>

          <t>sent = alpha x sent_present + (1 - alpha) x sent</t>

          <t>where sent_present represents the bytes sent per second since the
          last calculation and sent represents the last calculation of bytes
          sent per second. A suitable value for alpha is 0.8. This value is
          calculated every five seconds.</t>

          <t></t>

          <t hangText="EWMA_BYTES_RCVD">A single value element containing an
          unsigned 32-bit integer representing an exponential weighted average
          of bytes received per second by this peer. Same calculation as
          above.</t>

          <!--  This need to be indexed by something so I commented them out till we get them fixed
      <t></t><t hangText="LAST_CONTACT">A single value element containing an
            unsigned 32-bit integer specifying the time in number of seconds
            the node was last contacted. A peer typically stores this element 
            for each entry in its routing and connection table.</t>

            
            <t></t><t hangText="RTT">A single value element containing an unsigned
            32-bit integer specifying the recent RTT estimate in ms between
            two peers. A peer typically stores this element for each entry in its
            routing table.</t>
-->

          <!--
            <t></t><t hangText="AS_NUMBER">A single value element containing the
            Autonomous System [TODO REF] number as an unsigned 32-bit integer.
            Zero is returned if the AS number is unknown.</t>

            <t>(OPEN ISSUES: How to determine a AS number? This metric is
            primarily used for advertising and locating STUN/TURN servers. A
            TURN server is inserted and looked up under H(AS). What if there are
            no TURN servers in the same AS? ) [[TODO: I propose we remove this
            unless we can say how to compute it. I note most the software I have
            seen just uses the table lookup on IP address - if this is the case
            it is probably better just to return IP address of NAT. ]]</t>

            <t></t><t hangText="CPU_UTILIZATION">A single value element containing an
            unsigned 8-bit integer representing the percentage CPU load from 1
            to 100.</t>

            <t>(OPEN ISSUE: It is not a very precise metric.)</t>                     

            <t></t><t hangText="NEIGHBOR_TABLE_SIZE">A single value element
            containing an unsigned 32-bit integer representing the number of
            peers in the node's neighbor table.</t>
-->
        </list></t>

      <t>[[TODO: We would like some sort of bandwidth measurement, but we're
      kind of unclear on the units and representation.]]</t>

      <section title="Diagnostic Metrics for a P2PSIP Deployment">
        <!--
          <t>Clearly, all diagnostic metrics are useful during development and
          testing. The hard question is which metrics are absolutely necessary
          for a deployed P2PSIP system. We attempt to identify these metrics
          and classify them under 'resource' and 'peer' metrics.</t>

          <t>For 'resource' metric, we identify CPU_UTILIZATION,
          EWMA_BYTES_SENT, EWMA_BYTES_RCVD, and MEMORY_FOOTPRINT as the key
          metrics and for 'peer' metric we identify UPTIME, LAST_CONTACT, and
          RTT as the metrics that are crucial for a deployed P2PSIP
          system.</t>
-->

        <t>(OPEN QUESTION: any other metrics?)</t>

        <t>Below, we sketch how these metrics can be used. A peer can use
        EWMA_BYTES_SENT and EWMA_BYTES_RCVD of another peer to infer whether
        it is acting as a media relay. It may then choose not to forward any
        requests for media relay to this peer. Similarly, among the various
        candidates for filling up routing table, a peer may prefer a peer with
        a large UPTIME value, small RTT, and small LAST_CONTACT value.</t>
      </section>

      <!--  <t>[[TODO: Why not MIB]]</t> -->
    </section>

    <section anchor="sec.chord-algorithm" title="Chord Algorithm ">
      <t>This algorithm is assigned the name chord-128-2-16+ to indicate it is
      based on Chord, uses SHA-1 then truncates that to 128 bit for the hash
      function, stores 2 redundant copies of all data, and has finger tables
      with at least 16 entries.</t>

      <section title="Overview">
        <t>The algorithm described here is a modified version of the Chord
        algorithm. Each peer keeps track of a finger table of 16 entries and a
        neighborhood table of 6 entries. The neighborhood table contains the 3
        peers before this peer and the 3 peers after it in the DHT ring. The
        first entry in the finger table contains the peer half-way around the
        ring from this peer; the second entry contains the peer that is 1/4 of
        the way around; the third entry contains the peer that is 1/8th of the
        way around, and so on. Fundamentally, the chord data structure can be
        thought of a doubly-linked list formed by knowing the successors and
        predecessor peers in the neighborhood table, sorted by the Node-ID. As
        long as the successor peers are correct, the DHT will return the
        correct result. The pointers to the prior peers are kept to enable
        inserting of new peers into the list structure. Keeping multiple
        predecessor and successor pointers makes it possible to maintain the
        integrity of the data structure even when consecutive peers
        simultaneously fail. The finger table forms a skip list, so that
        entries in the linked list can be found in O(log(N)) time instead of
        the typical O(N) time that a linked list would provide.</t>

        <t>A peer, n, is responsible for a particular Resource-ID k if k is
        less than or equal to n and k is greater than p, where p is the peer
        id of the previous peer in the neighborhood table. Care must be taken
        when computing to note that all math is modulo 2^128.</t>
      </section>

      <section title="Routing">
        <t>If a peer is not responsible for a Resource-ID k, but is directly
        connected to a node with Node-Id k, then it routes the message to that
        node. Otherwise, it routes the request to the peer in the routing
        table that has the largest Node-ID that is in the interval between the
        peer and k.</t>
      </section>

      <section title="Redundancy ">
        <t>When a peer receives a Store request for Resource-ID k, and it is
        responsible for Resource-ID k, it stores the data and returns a
        success response. [[Open Issue: should it delay sending this success
        until it has successfully stored the redundant copies?]]. It then
        sends a Store request to its successor in the neighborhood table and
        to that peers successor. Note that these Store requests are addressed
        to those specific peers, even though the Resource-ID they are being
        asked to store is outside the range that they are responsible for. The
        peers receiving these check they came from an appropriate predecessor
        in their neighborhood table and that they are in a range that this
        predecessor is responsible for, and then they store the data. They do
        not themselves perform further Stores because they can determine that
        they are not responsible for the resource-ID.</t>

        <t>Note that a malicious node can return a success response but not
        store the data locally or in the replica set. Requesting peers which
        wish to ensure that the replication actually occurred SHOULD contact
        each peer listed in the replicas field of the Store response and
        retrieve a copy of the data. [[TODO: Do we want to have some
        optimization in Fetch where they can retrieve just a digest instead of
        the data values?]]</t>
      </section>

      <section title="Joining">
        <t>The join process for a joining party (JP) with Node-ID n is as
        follows.</t>

        <t><list style="numbers">
            <t>JP connects to its chosen bootstrap node.</t>

            <t>JP uses a series of Pings to populate its routing table.</t>

            <t>JP sends Attach requests to initiate connections to each of
            the peers in the connection table as well as to the desired finger
            table entries. Note that this does not populate their routing
            tables, but only their connection tables, so JP will not get
            messages that it is expected to route to other nodes.</t>

            <t>JP enters all the peers it contacted into its routing
            table.</t>

            <t>JP sends a Join to its immediate successor, the admitting peer
            (AP) for Node-ID n. The AP sends the response to the Join.</t>

            <t>AP does a series of Store requests to JP to store the data that
            JP will be responsible for.</t>

            <t>AP sends JP an Update explicitly labeling JP as its
            predecessor. At this point, JP is part of the ring and responsible
            for a section of the overlay. AP can now forget any data which is
            assigned to JP and not AP.</t>

            <t>AP sends an Update to all of its neighbors with the new values
            of its neighbor set (including JP).</t>

            <t>JP sends UpdateS to all the peers in its routing table.</t>
          </list></t>

        <t>In order to populate its routing table, JP sends a Ping via the
        bootstrap node directed at resource-id n+1 (directly after its own
        resource-id). This allows it to discover its own successor. Call that
        node p0. It then sends a ping to p0+1 to discover its successor (p1).
        This process can be repeated to discover as many successors as
        desired. The values for the two peers before p will be found at a
        later stage when n receives an Update.</t>

        <t>In order to set up its neighbor table entry for peer i, JP simply
        sends an Attach to peer (n+2^(numBitsInNodeId-i). This will be routed
        to a peer in approximately the right location around the ring.</t>
      </section>

      <section title="Routing Attaches">
        <t>When a peer needs to Attach to a new peer in its neighborhood
        table, it MUST source-route the Attach request through the peer from
        which it learned the new peer's Node-ID. Source-routing these requests
        allows the overlay to recover from instability.</t>

        <t>All other Attach requests, such as those for new finger table
        entries, are routed conventionally through the overlay.</t>

        <t>If a peer is unable to successfully Attach with a peer that should
        be in its neighborhood, it MUST locate either a TURN server or another
        peer in the overlay, but not in its neighborhood, through which it can
        exchange messages with its neighbor peer</t>
      </section>

      <section title="Updates">
        <t>A chord Update is defined as</t>

        <figure>
          <!--begin-pdu-->

          <artwork><![CDATA[
      enum { reserved (0), 
             peer_ready(1), neighbors(2), full(3), (255) }
           ChordUpdateType;


      struct {
        ChordUpdateType         type;
  
        select(type){
          case peer_ready:                   /* Empty */
            ;
          
          case neighbors:
            NodeId              predecessors<0..2^16-1>;
            NodeId              successors<0..2^16-1>;

          case full:
            NodeId              predecessors<0..2^16-1>;
            NodeId              successors<0..2^16-1>;
            NodeId              fingers<0..2^16-1>;             
        };
      } ChordUpdate;

              ]]></artwork>
        </figure>

        <t>The "type" field contains the type of the update, which depends on
        the reason the update was sent.</t>

        <t><list style="hanging">
            <t hangText="peer_ready: ">this peer is ready to receive messages.
            This message is used to indicate that a node which has Attached
            is a peer and can be routed through. It is also used as a
            connectivity check to non-neighbor pers.</t>

            <t hangText="neighbors: ">this version is sent to members of the
            Chord neighbor table.</t>

            <t hangText="full: ">this version is sent to peers which request
            an Update with a RouteQueryReq.</t>
          </list></t>

        <t>If the message is of type "neighbors", then the contents of the
        message will be:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="predecessors "></t>

            <t>The predecessor set of the Updating peer.</t>

            <t></t>

            <t hangText="successors "></t>

            <t>The successor set of the Updating peer.</t>
          </list></t>

        <t>If the message is of type "full", then the contents of the message
        will be:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="predecessors "></t>

            <t>The predecessor set of the Updating peer.</t>

            <t></t>

            <t hangText="successors "></t>

            <t>The successor set of the Updating peer.</t>

            <t></t>

            <t hangText="fingers "></t>

            <t>The finger table if the Updating peer, in numerically
            ascending order.</t>
          </list></t>

        <t>A peer MUST maintain an association (via Attach) to every member
        of its neighbor set. A peer MUST attempt to maintain at least three
        predecessors and three successors. However, it MUST send its entire
        set in any Update message sent to neighbors.</t>

        <section title="Sending Updates">
          <t>Every time a connection to a peer in the neighborhood set is lost
          (as determined by connectivity pings or failure of some request),
          the peer should remove the entry from its neighborhood table and
          replace it with the best match it has from the other peers in its
          routing table. It then sends an Update to all its remaining
          neighbors. The update will contain all the Node-IDs of the current
          entries of the table (after the failed one has been removed). Note
          that when replacing a successor the peer SHOULD delay the creation
          of new replicas for 30 seconds after removing the failed entry from
          its neighborhood table in order to allow a triggered update to
          inform it of a better match for its neighborhood table.</t>

          <t>If connectivity is lost to all three of the peers that succeed
          this peer in the ring, then this peer should behave as if it is
          joining the network and use Pings to find a peer and send it a Join.
          If connectivity is lost to all the peers in the finger table, this
          peer should assume that it has been disconnected from the rest of
          the network, and it should periodically try to join the DHT.</t>
        </section>

        <section title="Receiving Updates">
          <t>When a peer, N, receives an Update request, it examines the
          Node-IDs in the UpdateReq and at its neighborhood table and decides
          if this UpdateReq would change its neighborhood table. This is done
          by taking the set of peers currently in the neighborhood table and
          comparing them to the peers in the update request. There are three
          major cases:</t>

          <t><list style="symbols">
              <t>The UpdateReq contains peers that would not change the
              neighbor set because they match the neighborhood table.</t>

              <t>The UpdateReq contains peers closer to N than those in its
              neighborhood table.</t>

              <t>The UpdateReq defines peers that indicate a neighborhood
              table further away from N than some of its neighborhood table.
              Note that merely receiving peers further away does not
              demonstrate this, since the update could be from a node far away
              from N. Rather, the peers would need to bracket N.</t>
            </list></t>

          <t>In the first case, no change is needed.</t>

          <t>In the second case, N MUST attempt to Attach to the new peers
          and if it is successful it MUST adjust its neighbor set accordingly.
          Note that it can maintain the now inferior peers as neighbors, but
          it MUST remember the closer ones.</t>

          <t>The third case implies that a neighbor has disappeared, most
          likely because it has simply been disconnected but perhaps because
          of overlay instability. N MUST Ping the questionable peers to
          discover if they are indeed missing and if so, remove them from its
          neighborhood table.</t>

          <t>After any Pings and Attaches are done, if the neighborhood table
          changes, the peer sends an Update request to each of its neighbors
          that was in either the old table or the new table. These Update
          requests are what ends up filling in the predecessor/successor
          tables of peers that this peer is a neighbor to. A peer MUST NOT
          enter itself in its successor or predecessor table and instead
          should leave the entries empty.</t>

          <t>If peer N which is responsible for a resource-id R discovers that
          the replica set for R (the next two nodes in its successor set) has
          changed, it MUST send a Store for any data associated with R to any
          new node in the replica set. It SHOULD not delete data from peers
          which have left the replica set.</t>

          <t>When a peer N detects that it is no longer in the replica set for
          a resource R (i.e., there are three predecessors between N and R),
          it SHOULD delete all data associated with R from its local
          store.</t>
        </section>

        <section title="Stabilization">
          <t>There are four components to stabilization: <list style="numbers">
              <t>exchange Updates with all peers in its routing table to
              exchange state</t>

              <t>search for better peers to place in its finger table</t>

              <t>search to determine if the current finger table size is
              sufficiently large</t>

              <t>search to determine if the overlay has partitioned and needs
              to recover</t>
            </list></t>

          <t>A peer MUST periodically send an Update request to every peer in
          its routing table. The purpose of this is to keep the predecessor
          and successor lists up to date and to detect connection failures.
          The default time is about every ten minutes, but the enrollment
          server SHOULD set this in the configuration document using the
          "chord-128-2-16+-update-frequency" element (denominated in seconds.)
          A peer SHOULD randomly offset these Update requests so they do not
          occur all at once. If an Update request fails or times out, the peer
          MUST mark that entry in the neighbor table invalid and attempt to
          reestablish a connection. If no connection can be established, the
          peer MUST attempt to establish a new peer as its neighbor and do
          whatever replica set adjustments are required.</t>

          <t>Periodically a peer should select a random entry i from the
          finger table and do a Ping to resource (n+2^(numBitsInNodeId-i). The
          purpose of this is to find a more accurate finger table entry if
          there is one. This is done less frequently than the connectivity
          checks in the previous section because forming new connections is
          somewhat expensive and the cost needs to be balanced against the
          cost of not having the most optimal finger table entries. The
          default time is about every hour, but the enrollment server SHOULD
          set this in the configuration document using the
          "chord-128-2-16+-ping-frequency" element (denominated in seconds).
          If this returns a different peer than the one currently in this
          entry of the peer table, then a new connection should be formed to
          this peer and it should replace the old peer in the finger
          table.</t>

          <t>As an overlay grows, more than 16 entries may be required in the
          finger table for efficient routing. To determine if its finger table
          is sufficiently large, one an hour the peer should perform a Ping to
          determine whether growing its finger table by four entries would
          result in it learning at least two peers that it does not already
          have in its neighbor table. If so, then the finger table SHOULD be
          grown by four entries. Similarly, if the peer observes that its
          closest finger table entries are also in its neighbor table, it MAY
          shrink its finger table to the minimum size of 16 entries. [[OPEN
          ISSUE: there are a variety of algorithms to gauge the population of
          the overlay and select an appropriate finger table size. Need to
          consider which is the best combination of effectiveness and
          simplicity.]]</t>

          <t>To detect that a partitioning has occurred and to heal the
          overlay, a peer P MUST periodically repeat the discovery process
          used in the initial join for the overlay to locate an appropriate
          bootstrap peer, B. If an overlay has multiple mechanisms for
          discovery it should randomly select a method to locate a bootstrap
          peer. P should then send a Ping for its own Node-ID routed through
          B. If a response is received from a peer S', which is not P's
          successor, then the overlay is partitioned and P should send a
          Attach to S' routed through B, followed by an Update sent to S'.
          (Note that S' may not be in P's neighborhood table once the overlay
          is healed, but the connection will allow S' to discover appropriate
          neighbor entries for itself via its own stabilization.)</t>
        </section>
      </section>

      <section title="Route Query">
        <t>For this topology plugin, the RouteQueryReq contains no additional
        information. The RouteQueryAns contains the single node ID of the next
        peer to which the responding peer would have routed the request
        message in recursive routing:</t>

        <figure>
          <!--begin-pdu-->

          <artwork><![CDATA[

    struct {
       NodeId                  next_id;
    } ChordRouteQueryAns;
]]></artwork>
        </figure>

        <t>The contents of this structure are as follows: <list
            style="hanging">
            <t></t>

            <t hangText="next_peer "></t>

            <t>The peer to which the responding peer would route the message
            to in order to deliver it to the destination listed in the
            request.</t>
          </list></t>

        <t>If the requester set the send_update flag, the responder SHOULD
        initiate an Update immediately after sending the RouteQueryAns.</t>
      </section>

      <section title="Leaving">
        <t>Peers SHOULD send a Leave request prior to exiting the Overlay
        Instance. Any peer which receives a Leave for a peer n in its neighbor
        set must remove it from the neighbor set, update its replica sets as
        appropriate (including Stores of data to new members of the replica
        set) and send Updates containing its new predecessor and successor
        tables.</t>
      </section>
    </section>

    <section anchor="secEnrollment" title="Enrollment and Bootstrap">
      <section anchor="sec-discovery" title="Discovery">
        <t>When a peer first joins a new overlay, it starts with a discovery
        process to find an enrollment server. Related work to the approach
        used here is described in <xref
        target="I-D.garcia-p2psip-dns-sd-bootstrapping"></xref> and <xref
        target="I-D.matthews-p2psip-bootstrap-mechanisms"></xref>. The peer
        first determines the overlay name. This value is provided by the user
        or some other out of band provisioning mechanism. If the name is an IP
        address, that is directly used otherwise the peer MUST do a DNS SRV
        query using a Service name of "p2p_enroll" and a protocol of tcp to
        find an enrollment server.</t>

        <t>If the overlay name ends in .local, then a DNS SRV lookup using
        implement <xref target="I-D.cheshire-dnsext-dns-sd"></xref> with a
        Service name of "p2p_menroll" can also be tried to find an enrollment
        server. If they implement this, the user name MAY be used as the
        Instance Identifier label.</t>

        <t>Once an address for the enrollment servers is determined, the peer
        forms an HTTPS connection to that IP address. The certificate MUST
        match the overlay name as described in <xref target="RFC2818"></xref>.
        The peer then performs a GET to the URL formed by appending a path of
        "/p2psip/enroll" to the overlay name. For example, if the overlay name
        was example.com, the URL would be
        "https://example.com/p2psip/enroll".</t>

        <t>The result is an XML configuration file with the syntax described
        in the following section.</t>
      </section>

      <section anchor="sec-configuration" title="Overlay Configuration">
        <t>This specification defines a new content type
        "application/p2p-overlay+xml" for an MIME entity that contains overlay
        information. This information is fetched from the enrollment server,
        as described above. An example document is shown below.</t>

        <figure>
          <artwork><![CDATA[
   <?xml version="1.0" encoding="UTF-8"?>
     <overlay instance-name="chord.example.com" expiration="86400">
       <toplogy-plugin algorithm-name="chord-128-2-16+"/>
       <root-cert>[PEM encoded certificate here]</root-cert>
       <required-kind name="SIP-REGISTRATION" max-values="10" 
        max-size="1000"/>
       <credential-server url="https://www.example.com/csr"/>
       <bootstrap-peer address="192.0.2.2" port="5678"/>
       <bootstrap-peer address="192.0.2.3" port="5678"/>
       <bootstrap-peer address="192.0.2.4" port="5678"/>
       <multicast-bootstrap="192.0.2.99" port="5678"/>
     </overlay>
              ]]></artwork>
        </figure>

        <t>The file MUST be a well formed XML document and it SHOULD contain
        an encoding declaration in the XML declaration. If the charset
        parameter of the MIME content type declaration is present and it is
        different from the encoding declaration, the charset parameter takes
        precedence. Every application conferment to this specification MUST
        accept the UTF-8 character encoding to ensure minimal
        interoperability. The namespace for the elements defined in this
        specification is urn:ietf:params:xml:ns:p2p:overlay.</t>

        <t>The file can contain multiple "overlay" elements where each one
        contains the configuration information for a different overlay. Each
        "overlay" has the following attributes:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="instance-name:">name of the overlay</t>

            <t></t>

            <t hangText="expiration:">time in future at which this overlay
            configuration is not longer valid and need to be retrieved again.
            This is expressed in seconds from the current time.</t>
          </list></t>

        <t>Inside each overlay element, the following elements can occur:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="topology-plugin"></t>

            <t>This element has an attribute called algorithm-name that
            describes the overlay-algorithm being used.</t>

            <t></t>

            <t hangText="root-cert "></t>

            <t>This element contains a PEM encoded X.509v3 certificate that is
            the root trust store used to sign all certificates in this
            overlay. There can be more than one of these.</t>

            <t></t>

            <t hangText="required-kinds "></t>

            <t>This element indicates the kinds that members must support. It
            has three attributes: <list style="symbols">
                <t>name: a string representing the kind.</t>

                <t>max-count: the maximum number of values which members of
                the overlay must support.</t>

                <t>max-size: the maximum size of individual values.</t>
              </list> For instance, the example above indicates that members
            must support SIP-REGISTRATION with a maximum of 10 values of up to
            1000 bytes each. Multiple required-kinds elements MAY be
            present.</t>

            <t></t>

            <t hangText="credential-server "></t>

            <t>This element contains the URL at which the credential server
            can be reached in a "url" element. This URL MUST be of type
            "https:". More than one credential-server element may be
            present.</t>

            <t></t>

            <t hangText="self-signed-permitted "></t>

            <t>This element indicates whether self-signed certificates are
            permitted. If it is set to "TRUE", then self-signed certificates
            are allowed, in which case the credential-server and root-cert
            elements may be absent. Otherwise, it SHOULD be absent, but MAY be
            set "FALSE". This element also contains an attribute "digest"
            which indicates the digest to be used to compute the Node-ID.
            Valid values for this parameter are "SHA-1" and "SHA-256".</t>

            <t></t>

            <t hangText="bootstrap-peer "></t>

            <t>This elements represents the address of one of the bootstrap
            peers. It has an attribute called "address" that represents the IP
            address (either IPv4 or IPv6, since they can be distinguished) and
            an attribute called "port" that represents the port. More than one
            bootstrap-peer element may be present.</t>

            <t></t>

            <t hangText="multicast-bootstrap "></t>

            <t>This element represents the address of a multicast address and
            port that may be used for bootstrap and that peers SHOULD listen
            on to enable bootstrap. It has an attributed called "address" that
            represents the IP address and an attribute called "port" that
            represents the port. More than one "multicast-bootstrap" element
            may be present.</t>

            <t></t>

            <t hangText="clients-permitted "></t>

            <t>This element represents whether clients are permitted or
            whether all nodes must be peers. If it is set to "TRUE" or absent,
            this indicates that clients are permitted. If it is set to "FALSE"
            then nodes MUST join as peers.</t>

            <t></t>

            <t hangText="chord-128-2-16+-update-frequency "></t>

            <t>The update frequency for the Chord-128-2-16+ topology plugin
            (see <xref target="sec.chord-algorithm"></xref>).</t>

            <t></t>

            <t hangText="chord-128-2-16+-ping-frequency "></t>

            <t>The ping frequency for the Chord-128-2-16+ topology plugin (see
            <xref target="sec.chord-algorithm"></xref>).</t>

            <t></t>

            <t hangText="credential-server"></t>

            <t>Base URL for credential server.</t>

            <t></t>

            <t hangText="shared-secret"></t>

            <t>If shared secret mode is used, this contains the shared
            secret.</t>
          </list></t>

        <t>[[TODO: Do a RelaxNG grammar.]]</t>
      </section>

      <section anchor="sec-credentials" title="Credentials">
        <t>If the configuration document contains a credential-server element,
        credentials are required to join the Overlay Instance. A peer which
        does not yet have credentials MUST contact the credential server to
        acquire them.</t>

        <t>In order to acquire credentials, the peer generates an asymmetric
        key pair and then generates a "Simple Enrollment Request" (as defined
        in <xref target="I-D.ietf-pkix-2797-bis"></xref>) and sends this over
        HTTPS as defined in <xref target="I-D.ietf-pkix-cmc-trans"></xref> to
        the URL in the credential-server element. The subjectAltName in the
        request MUST contain the required user name.</t>

        <t>The credential server MUST authenticate the request using the
        provided user name and password. If the authentication succeeds and
        the requested user name is acceptable, the server and returns a
        certificate. The SubjectAltName field in the certificate contains the
        following values:</t>

        <t><list style="symbols">
            <t>One or more Node-IDs which MUST be cryptographically random
            <xref target="RFC4086"></xref>. These MUST be chosen by the
            credential server in such a way that they are unpredictable to the
            requesting user. These are of type URI and MUST contain RELOAD
            URIs as described in <xref target="sec-reload-uri"></xref> and
            MUST contain a Destination list with a single entry of type
            "node_id".</t>

            <t>The names this user is allowed to use in the overlay, using
            type rfc822Name.</t>
          </list></t>

        <t>The certificate is returned in a "Simple Enrollment Response".
        [[TODO: REF]]</t>

        <t>The client MUST check that the certificate returned was signed by
        one of the certificates received in the "root-cert" list of the
        overlay configuration data. The peer then reads the certificate to
        find the Node-IDs it can use.</t>

        <!--        <section title="Credentials for HIP">
          <t>When RELOAD is used with HIP, the certificates MUST be generated
          so that: <list style="symbols">
              <t>Each node is assigned a unique ORCHID.</t>

              <t>The Node-ID can be uniquely determined from the ORCHID.</t>
            </list> Because in general, ORCHIDs are shorter than Node-IDs,
          this means that the ORCHIDS MUST be generated first and MUST be
          cryptographically random in order to make the Node-IDs
          cryptographically random. The mapping function used to produce the
          Node-ID from the ORCHID MUST be the same as that used by the Overlay Instance to
          produce resource-ids from Resource Names.</t>

          <t>In addition to the usual attributes, when HIP is in use
          certificates MUST contain a subjectAltName with an iPAddress value
          containing the HIP ORCHID. This allows these certificates to be used
          by the HIP peers during the HIP base exchange.</t>
        </section>-->

        <section title="Self-Generated Credentials">
          <t>If the "self-signed-permitted" element is present and set to
          "TRUE", then a node MUST generate its own self-signed certificate to
          join the overlay. The self-signed certificate MAY contain any user
          name of the users choice. Users SHOULD make some attempt to make it
          unique but this document does not specify any mechanisms for
          that.</t>

          <t>The Node-Id MUST be computed by applying the digest specified in
          the self-signed-permitted element to the DER representation of the
          user's public key. When accepting a self-signed certificate, nodes
          MUST check that the Node-ID and public keys match. This prevents
          Node-ID theft.</t>

          <t>Once the node has constructed a self-signed certificate, it MAY
          join the overlay. Before storing its certificate in the overlay
          (<xref target="sec-store-usage"></xref>) it SHOULD look to see if
          the user name is already taken and if so choose another user name.
          Note that this only provides protection against accidental name
          collisions. Name theft is still possible. If protection against name
          theft is desired, then the enrollment service must be used.</t>
        </section>
      </section>

      <section title="Joining the Overlay Peer">
        <t>In order to join the overlay, the peer MUST contact a peer.
        Typically this means contacting the bootstrap peers, since they are
        guaranteed to have public IP addresses (the system should not
        advertise them as bootstrap peers otherwise). If the peer has cached
        peers it SHOULD contact them first by sending a Ping request to the
        known peer address with the destination Node-ID set to that peer's
        Node-ID.</t>

        <t>If no cached peers are available, then the peer SHOULD send a Ping
        request to the address and port found in the broadcast-peers element
        in the configuration document. This MAY be a multicast or anycast
        address. The Ping should use the wildcard Node-ID as the destination
        Node-ID.</t>

        <t>The responder peer that receives the Ping request SHOULD check that
        the overlay name is correct and that the requester peer sending the
        request has appropriate credentials for the overlay before responding
        to the Ping request even if the response is only an error.</t>

        <t>When the requester peer finally does receive a response from some
        responding peer, it can note the Node-ID in the response and use this
        Node-ID to start sending requests to join the Overlay Instance as
        described in <xref target="sec-overlay-topology"></xref>.</t>

        <t>After a peer has successfully joined the overlay network, it SHOULD
        periodically look at any peers to which it has managed to form direct
        connections. Some of these peers MAY be added to the cached-peers list
        and used in future boots. Peers that are not directly connected MUST
        NOT be cached. The RECOMMENDED number of peers to cache is 10.</t>
      </section>
    </section>

    <section title="Message Flow Example">
      <t>In the following example, we assume that JP has formed a connection
      to one of the bootstrap peers. JP then sends an Attach through that peer
      to the admitting peer (AP) to initiate a connection. When AP responds,
      JP and AP use ICE to set up a connection and then set up TLS.</t>

      <figure>
        <artwork><![CDATA[
         JP        PPP       PP        AP        NP        NNP       BP
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |Attach Dest=JP     |         |         |         |         |
          |---------------------------------------------------------->|
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |Attach Dest=JP     |         |         |
          |         |         |<--------------------------------------|
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |Attach Dest=JP     |         |         |
          |         |         |-------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |AttachAns          |         |         |
          |         |         |<--------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |AttachAns          |         |         |
          |         |         |-------------------------------------->|
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |AttachAns          |         |         |         |         |
          |<----------------------------------------------------------|
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |TLS      |         |         |         |         |         |
          |.............................|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |

    ]]></artwork>
      </figure>

      <t>Once JP has connected to AP, it needs to populate its Routing Table.
      In Chord, this means that it needs to populate its neighbor table and
      its finger table. To populate its neighbor table, it needs the successor
      of AP, NP. It sends an Attach to the Resource-IP AP+1, which gets routed
      to NP. When NP responds, JP and NP use ICE and TLS to set up a
      connection.</t>

      <figure>
        <artwork><![CDATA[

         JP        PPP       PP        AP        NP        NNP       BP
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |Attach AP+1        |         |         |         |         |
          |---------------------------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |Attach AP+1        |         |
          |         |         |         |-------->|         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |AttachAns          |         |
          |         |         |         |<--------|         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |AttachAns          |         |         |         |         |
          |<----------------------------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |Attach   |         |         |         |         |         |
          |-------------------------------------->|         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |TLS      |         |         |         |         |         |
          |.......................................|         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |

    ]]></artwork>
      </figure>

      <t>JP also needs to populate its finger table (for Chord). It issues a
      Attach to a variety of locations around the overlay. The diagram below
      shows it sending an Attach halfway around the Chord ring the JP +
      2^127.</t>

      <figure>
        <artwork><![CDATA[

         JP        NP        XX        TP
          |         |         |         |
          |         |         |         |
          |         |         |         |
          |Attach JP+2<<126   |         |
          |-------->|         |         |
          |         |         |         |
          |         |         |         |
          |         |Attach JP+2<<126   |
          |         |-------->|         |
          |         |         |         |
          |         |         |         |
          |         |         |Attach JP+2<<126
          |         |         |-------->|
          |         |         |         |
          |         |         |         |
          |         |         |AttachAns|
          |         |         |<--------|
          |         |         |         |
          |         |         |         |
          |         |AttachAns|         |
          |         |<--------|         |
          |         |         |         |
          |         |         |         |
          |AttachAns|         |         |
          |<--------|         |         |
          |         |         |         |
          |         |         |         |
          |TLS      |         |         |
          |.............................|
          |         |         |         |
          |         |         |         |
          |         |         |         |
          |         |         |         |

    ]]></artwork>
      </figure>

      <t>Once JP has a reasonable set of connections he is ready to take his
      place in the DHT. He does this by sending a Join to AP. AP does a series
      of Store requests to JP to store the data that JP will be responsible
      for. AP then sends JP an Update explicitly labeling JP as its
      predecessor. At this point, JP is part of the ring and responsible for a
      section of the overlay. AP can now forget any data which is assigned to
      JP and not AP.</t>

      <figure>
        <artwork><![CDATA[

         JP        PPP       PP        AP        NP        NNP       BP
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |JoinReq  |         |         |         |         |         |
          |---------------------------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |JoinAns  |         |         |         |         |         |
          |<----------------------------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |StoreReq Data A    |         |         |         |         |
          |<----------------------------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |StoreAns |         |         |         |         |         |
          |---------------------------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |StoreReq Data B    |         |         |         |         |
          |<----------------------------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |StoreAns |         |         |         |         |         |
          |---------------------------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |UpdateReq|         |         |         |         |         |
          |<----------------------------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |UpdateAns|         |         |         |         |         |
          |---------------------------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |

    ]]></artwork>
      </figure>

      <t>In Chord, JP's neighbor table needs to contain its own predecessors.
      It couldn't connect to them previously because Chord has no way to route
      immediately to your predecessors. However, now that it has received an
      Update from AP, it has APs predecessors, which are also its own, so it
      sends Attaches to them. Below it is shown connecting to its closest
      predecessor, PP.</t>

      <figure>
        <artwork><![CDATA[

         JP        PPP       PP        AP        NP        NNP       BP
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |Attach Dest=PP     |         |         |         |         |
          |---------------------------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |Attach Dest=PP     |         |         |
          |         |         |<--------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |AttachAns|         |         |         |
          |         |         |-------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |AttachAns|         |         |         |         |         |
          |<----------------------------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |TLS      |         |         |         |         |         |
          |...................|         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |UpdateReq|         |         |         |         |         |
          |------------------>|         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |UpdateAns|         |         |         |         |         |
          |<------------------|         |         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |UpdateReq|         |         |         |         |         |
          |---------------------------->|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |UpdateAns|         |         |         |         |         |
          |<----------------------------|         |         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |UpdateReq|         |         |         |         |         |
          |-------------------------------------->|         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
          |UpdateAns|         |         |         |         |         |
          |<--------------------------------------|         |         |
          |         |         |         |         |         |         |
          |         |         |         |         |         |         |
    ]]></artwork>
      </figure>

      <t>Finally, now that JP has a copy of all the data and is ready to route
      messages and receive requests, it sends Updates to everyone in its
      Routing Table to tell them it is ready to go. Below, it is shown sending
      such an update to TP.</t>

      <figure>
        <artwork><![CDATA[

         JP        NP        XX        TP
          |         |         |         |
          |         |         |         |
          |         |         |         |
          |Update   |         |         |
          |---------------------------->|
          |         |         |         |
          |         |         |         |
          |UpdateAns|         |         |
          |<----------------------------|
          |         |         |         |
          |         |         |         |
          |         |         |         |
          |         |         |         |
    ]]></artwork>
      </figure>
    </section>

    <section title="Security Considerations">
      <section title="Overview">
        <t>RELOAD provides a generic storage service, albeit one designed to
        be useful for P2PSIP. In this section we discuss security issues that
        are likely to be relevant to any usage of RELOAD. In <xref
        target="section.sip-issues"></xref> we describe issues that are
        specific to SIP.</t>

        <t>In any Overlay Instance, any given user depends on a number of
        peers with which they have no well-defined relationship except that
        they are fellow members of the Overlay Instance. In practice, these
        other nodes may be friendly, lazy, curious, or outright malicious. No
        security system can provide complete protection in an environment
        where most nodes are malicious. The goal of security in RELOAD is to
        provide strong security guarantees of some properties even in the face
        of a large number of malicious nodes and to allow the overlay to
        function correctly in the face of a modest number of malicious
        nodes.</t>

        <t>P2PSIP deployments require the ability to authenticate both peers
        and resources (users) without the active presence of a trusted entity
        in the system. We describe two mechanisms. The first mechanism is
        based on public key certificates and is suitable for general
        deployments. The second is an admission control mechanism based on an
	overlay-wide shared symmetric
        key.</t>
      </section>

      <section title="Attacks on P2P Overlays">
        <t>The two basic functions provided by overlay nodes are storage and
        routing: some node is responsible for storing a peer's data and for
        allowing a peer to fetch other peer's data. Some other set of nodes
        are responsible for routing messages to and from the storing nodes.
        Each of these issues is covered in the following sections.</t>

        <t>P2P overlays are subject to attacks by subversive nodes that may
        attempt to disrupt routing, corrupt or remove user registrations, or
        eavesdrop on signaling. The certificate-based security algorithms we
        describe in this draft are intended to protect overlay routing and
        user registration information in RELOAD messages.</t>

        <t>To protect the signaling from attackers pretending to be valid
        peers (or peers other than themselves), the first requirement is to
        ensure that all messages are received from authorized members of the
        overlay. For this reason, RELOAD transports all messages over a secure
        channel (TLS and DTLS are defined in this document) which provides
        message integrity and authentication of the directly communicating
        peer. In addition, 
        messages and data are digitally signed with the sender's private key,
        providing end-to-end security for communications.</t>
      </section>

      <section title="Certificate-based Security">
        <t>This specification stores users' registrations and possibly other
        data in an overlay network. This requires a solution to securing this
        data as well as securing, as well as possible, the routing in the
        overlay. Both types of security are based on requiring that every
        entity in the system (whether user or peer) authenticate
        cryptographically using an asymmetric key pair tied to a
        certificate.</t>

        <t>When a user enrolls in the Overlay Instance, they request or are
        assigned a unique name, such as "alice@dht.example.net". These names
        are unique and are meant to be chosen and used by humans much like a
        SIP Address of Record (AOR) or an email address. The user is also
        assigned one or more Node-IDs by the central enrollment authority.
        Both the name and the peer ID are placed in the certificate, along
        with the user's public key.</t>

        <t>Each certificate enables an entity to act in two sorts of
        roles:</t>

        <t><list style="symbols">
            <t>As a user, storing data at specific Resource-IDs in the Overlay
            Instance corresponding to the user name.</t>

            <t>As a overlay peer with the peer ID(s) listed in the
            certificate.</t>
          </list></t>

        <t>Note that since only users of this Overlay Instance need to
        validate a certificate, this usage does not require a global PKI.
        Instead, certificates are signed by require a central enrollment
        authority which acts as the certificate authority for the Overlay
        Instance. This authority signs each peer's certificate. Because each
        peer possesses the CA's certificate (which they receive on enrollment)
        they can verify the certificates of the other entities in the overlay
        without further communication. Because the certificates contain the
        user/peer's public key, communications from the user/peer can be
        verified in turn.</t>

        <t>If self-signed certificates are used, then the security provided is
        significantly decreased, since attackers can mount Sybil attacks. In
        addition, attackers cannot trust the user names in certificates
        (though they can trust the Node-Ids because they are cryptographically
        verifiable). This scheme is only appropriate for small deployments,
        such as a small office or ad hoc overlay set up among participants in
        a meeting. Some additional security can be provided by using the
        shared secret admission control scheme as well.</t>

        <t>Because all stored data is signed by the owner of the data the
        storing peer can verify that the storer is authorized to perform a
        store at that resource-id and also allows any consumer of the data to
        verify the provenance and integrity of the data when it retrieves
        it.</t>

        <t>All implementations MUST implement certificate-based security.</t>
      </section>

      <section title="Shared-Secret Security">
        <t>RELOAD also supports a shared secret admission control scheme that
        relies on a single key that is shared among all members of the
        overlay. It is appropriate for small groups that wish to form a
        private network without complexity. In shared secret mode, all the
        peers share a single symmetric key which is used to key TLS-PSK <xref
        target="RFC4279"></xref> or TLS-SRP <xref
        target="I-D.ietf-tls-srp"></xref> mode. A peer which does not know the
        key cannot form TLS connections with any other peer and therefore
        cannot join the overlay.</t>

        <t>One natural approach to a shared-secret scheme is to use a
        user-entered password as the key. The difficulty with this is that in
        TLS-PSK mode, such keys are very susceptible to dictionary attacks. If
        passwords are used as the source of shared-keys, then TLS-SRP is a
        superior choice because it is not subject to dictionary attacks.</t>
      </section>

      <section title="Storage Security">
        <t>When certificate-based security is used in RELOAD, any given
        Resource-ID/kind-id pair (a slot) is bound to some small set of
        certificates. In order to write data in a slot, the writer must prove
        possession of the private key for one of those certificates. Moreover,
        all data is stored signed by the certificate which authorized its
        storage. This set of rules makes questions of authorization and data
        integrity - which have historically been thorny for overlays -
        relatively simple.</t>

        <section title="Authorization">
          <t>When a client wants to store some value in a slot, it first
          digitally signs the value with its own private key. It then sends a
          Store request that contains both the value and the signature towards
          the storing peer (which is defined by the Resource Name construction
          algorithm for that particular kind of value).</t>

          <t>When the storing peer receives the request, it must determine
          whether the storing client is authorized to store in this slot. In
          order to do so, it executes the Resource Name construction algorithm
          for the specified kind based on the user's certificate information.
          It then computes the Resource-ID from the Resource Name and verifies
          that it matches the slot which the user is requesting to write to.
          If it does, the user is authorized to write to this slot, pending
          quota checks as described in the next section.</t>

          <t>For example, consider the certificate with the following
          properties:</t>

          <figure>
            <artwork><![CDATA[
        User name: alice@dht.example.com
        Node-ID:   013456789abcdef
        Serial:    1234
        ]]></artwork>
          </figure>

          <t>If Alice wishes to Store a value of the "SIP Location" kind, the
          Resource Name will be the SIP AOR "sip:alice@dht.example.com". The
          Resource-ID will be determined by hashing the Resource Name. When a
          peer receives a request to store a record at Resource-ID X, it takes
          the signing certificate and recomputes the Resource Name, in this
          case "alice@dht.example.com". If H("alice@dht.example.com")=X then
          the Store is authorized. Otherwise it is not. Note that the Resource
          Name construction algorithm may be different for other kinds.</t>
        </section>

        <section title="Distributed Quota">
          <t>Being a peer in a Overlay Instance carries with it the
          responsibility to store data for a given region of the Overlay
          Instance. However, if clients were allowed to store unlimited
          amounts of data, this would create unacceptable burdens on peers, as
          well as enabling trivial denial of service attacks. RELOAD addresses
          this issue by requiring configurations to define maximum sizes for each
          kind of stored data. Attempts to store values exceeding this size
          MUST be rejected (if peers are inconsistent about this, then strange
          artifacts will happen when the zone of responsibility shifts and a
          different peer becomes responsible for overlarge data). Because each
          slot is bound to a small set of certificates, these size
          restrictions also create a distributed quota mechanism, with the
          quotas administered by the central enrollment server.</t>

          <t>Allowing different kinds of data to have different size
          restrictions allows new usages the flexibility to define limits that
          fit their needs without requiring all usages to have expansive
          limits.</t>
        </section>

        <section title="Correctness">
          <t>Because each stored value is signed, it is trivial for any
          retrieving peer to verify the integrity of the stored value. Some
          more care needs to be taken to prevent version rollback attacks.
          Rollback attacks on storage are prevented by the use of store times
          and lifetime values in each store. A lifetime represents the latest
          time at which the data is valid and thus limits (though does not
          completely prevent) the ability of the storing node to perform a
          rollback attack on retrievers. In order to prevent a rollback attack
          at the time of the Store request, we require that storage times be
          monotonically increasing. Storing peers MUST reject Store requests
          with storage times smaller than or equal to those they are currently
          storing. In addition, a fetching node which receives a data value
          with a storage time older than the result of the previous fetch
          knows a rollback has occurred.</t>
        </section>

        <section title="Residual Attacks">
          <t>The mechanisms described here provide a high degree of security,
          but some attacks remain possible. Most simply, it is possible for
          storing nodes to refuse to store a value (i.e., reject any request).
          In addition, a storing node can deny knowledge of values which it
          previously accepted. To some extent these attacks can be ameliorated
          by attempting to store to/retrieve from replicas, but a retrieving
          client does not know whether it should try this or not, since there
          is a cost to doing so.</t>

          <t>Although the certificate-based authentication scheme prevents a
          single peer from being able to forge data owned by other peers.
          Furthermore, although a subversive peer can refuse to return data
          resources for which it is responsible it cannot return forged data
          because it cannot provide authentication for such registrations.
          Therefore parallel searches for redundant registrations can mitigate
          most of the affects of a compromised peer. The ultimate reliability
          of such an overlay is a statistical question based on the
          replication factor and the percentage of compromised peers.</t>

          <t>In addition, when a kind is is multivalued (e.g., an array data
          model), the storing node can return only some subset of the values,
          thus biasing its responses. This can be countered by using single
          values rather than sets, but that makes coordination between
          multiple storing agents much more difficult. This is a tradeoff that
          must be made when designing any usage.</t>
        </section>
      </section>

      <section title="Routing Security">
        <t>Because the storage security system guarantees (within limits) the
        integrity of the stored data, routing security focuses on stopping the
        attacker from performing a DOS attack on the system by misrouting
        requests in the overlay. There are a few obvious observations to make
        about this. First, it is easy to ensure that an attacker is at least a
        valid peer in the Overlay Instance. Second, this is a DOS attack only.
        Third, if a large percentage of the peers on the Overlay Instance are
        controlled by the attacker, it is probably impossible to perfectly
        secure against this.</t>

        <section title="Background">
          <t>In general, attacks on DHT routing are mounted by the attacker
          arranging to route traffic through or two nodes it controls. In the
          Eclipse attack <xref target="Eclipse"></xref> the attacker tampers
          with messages to and from nodes for which it is on-path with respect
          to a given victim node. This allows it to pretend to be all the
          nodes that are reachable through it. In the Sybil attack <xref
          target="Sybil"></xref>, the attacker registers a large number of
          nodes and is therefore able to capture a large amount of the traffic
          through the DHT.</t>

          <t>Both the Eclipse and Sybil attacks require the attacker to be
          able to exercise control over her peer IDs. The Sybil attack
          requires the creation of a large number of peers. The Eclipse attack
          requires that the attacker be able to impersonate specific peers. In
          both cases, these attacks are limited by the use of centralized,
          certificate-based admission control.</t>
        </section>

        <section title="Admissions Control">
          <t>Admission to an RELOAD Overlay Instance is controlled by
          requiring that each peer have a certificate containing its peer ID.
          The requirement to have a certificate is enforced by using
          certificate-based mutual authentication on each connection. Thus,
          whenever a peer connects to another peer, each side automatically
          checks that the other has a suitable certificate. These peer IDs are
          randomly assigned by the central enrollment server. This has two
          benefits:</t>

          <t><list style="symbols">
              <t>It allows the enrollment server to limit the number of peer
              IDs issued to any individual user.</t>

              <t>It prevents the attacker from choosing specific peer IDs.</t>
            </list></t>

          <t>The first property allows protection against Sybil attacks
          (provided the enrollment server uses strict rate limiting policies).
          The second property deters but does not completely prevent Eclipse
          attacks. Because an Eclipse attacker must impersonate peers on the
          other side of the attacker, he must have a certificate for suitable
          peer IDs, which requires him to repeatedly query the enrollment
          server for new certificates which only will match by chance. From
          the attacker's perspective, the difficulty is that if he only has a
          small number of certificates the region of the Overlay Instance he
          is impersonating appears to be very sparsely populated by comparison
          to the victim's local region.</t>
        </section>

        <section title="Peer Identification and Authentication">
          <t>In general, whenever a peer engages in overlay activity that
          might affect the routing table it must establish its identity. This
          happens in two ways. First, whenever a peer establishes a direct
          connection to another peer it authenticates via certificate-based
          mutual authentication. All messages between peers are sent over this
          protected channel and therefore the peers can verify the data origin
          of the last hop peer for requests and responses without further
          cryptography.</t>

          <t>In some situations, however, it is desirable to be able to
          establish the identity of a peer with whom one is not directly
          connected. The most natural case is when a peer Updates its state.
          At this point, other peers may need to update their view of the
          overlay structure, but they need to verify that the Update message
          came from the actual peer rather than from an attacker. To prevent
          this, all overlay routing messages are signed by the peer that
          generated them.</t>

          <t>[OPEN ISSUE: this allows for replay attacks on requests. There
          are two basic defenses here. The first is global clocks and loose
          anti-replay. The second is to refuse to take any action unless you
          verify the data with the relevant node. This issue is
          undecided.]</t>

          <t>[TODO: I think we are probably going to end up with generic
          signatures or at least optional signatures on all overlay
          messages.]</t>
        </section>

        <section title="Protecting the Signaling">
          <t>The goal here is to stop an attacker from knowing who is
          signaling what to whom. An attacker being able to observe the
          activities of a specific individual is unlikely given the
          randomization of IDs and routing based on the present peers
          discussed above. Furthermore, because messages can be routed using
          only the header information, the actual body of the RELOAD message
          can be encrypted during transmission.</t>

          <t>There are two lines of defense here. The first is the use of TLS
          or DTLS for each communications link between peers. This provides
          protection against attackers who are not members of the overlay. The
          second line of defense, if certificate-based security is used, is to
          digitally sign each message. This prevents adversarial peers from
          modifying messages in flight, even if they are on the routing
          path.</t>
        </section>

        <section title="Residual Attacks">
          <t>The routing security mechanisms in RELOAD are designed to contain
          rather than eliminate attacks on routing. It is still possible for
          an attacker to mount a variety of attacks. In particular, if an
          attacker is able to take up a position on the overlay routing
          between A and B it can make it appear as if B does not exist or is
          disconnected. It can also advertise false network metrics in attempt
          to reroute traffic. However, these are primarily DoS attacks.</t>

          <t>The certificate-based security scheme secures the namespace, but
          if an individual peer is compromised or if an attacker obtains a
          certificate from the CA, then a number of subversive peers can still
          appear in the overlay. While these peers cannot falsify responses to
          resource queries, they can respond with error messages, effecting a
          DoS attack on the resource registration. They can also subvert
          routing to other compromised peers. To defend against such attacks,
          a resource search must still consist of parallel searches for
          replicated registrations.</t>
        </section>
      </section>

      <section anchor="section.sip-issues" title="SIP-Specific Issues">
        <section title="Fork Explosion">
          <t>Because SIP includes a forking capability (the ability to
          retarget to multiple recipients), fork bombs are a potential DoS
          concern. However, in the SIP usage of RELOAD, fork bombs are a much
          lower concern because the calling party is involved in each
          retargeting event and can therefore directly measure the number of
          forks and throttle at some reasonable number.</t>
        </section>

        <section anchor="sec-security-malicious-retargeting"
                 title="Malicious Retargeting">
          <t>Another potential DoS attack is for the owner of an attractive
          number to retarget all calls to some victim. This attack is
          difficult to ameliorate without requiring the target of a SIP
          registration to authorize all stores. The overhead of that
          requirement would be excessive and in addition there are good use
          cases for retargeting to a peer without there explicit
          cooperation.</t>
        </section>

        <section title="Privacy Issues">
          <t>All RELOAD SIP registration data is public. Methods of providing
          location and identity privacy are still being studied.</t>
        </section>
      </section>
    </section>

    <section title="IANA Considerations">
      <t>This section contains the new code points registered by this
      document.</t>

      <t>[[TODO - add IANA registration for p2p_enroll SRV and
      p2p_menroll]]</t>


      <section title="Overlay Algorithm Types">
        <t>IANA SHALL create/(has created) a "RELOAD Overlay Algorithm Type"
        Registry. Entries in this registry are strings denoting the names of
        overlay algorithms. The registration policy for this registry is
        RFC 5226 IETF Review.</t>

        <t>The initial contents of this registry are:</t>

        <t><list style="hanging">
            <t></t>

            <t hangText="chord-128-2-16+ "></t>

            <t>The algorithm defined in <xref
            target="sec.chord-algorithm"></xref> of this document.</t>
          </list></t>
      </section>

      <section title="Data Kind-Id">
        <t>IANA SHALL create/(has created) a "RELOAD Data Kind-Id" Registry.
        Entries in this registry are 32-bit integers denoting data kinds, as
        described in <xref target="sec-usages"></xref>. Code points
	in the range 0x00000000 to 0x7fffffff SHALL be registered via RFC 5226
	Standards Action. Code points in the range 0x8000000 to 0xffffffff
	SHALL be registered via RFC 5226 Expert Review.</t>

        <t>The initial contents of this registry are:</t>

        <t></t>

        <texttable>
          <ttcol align="left">Kind</ttcol>

          <ttcol align="right">Kind-Id</ttcol>

          <c>SIP-REGISTRATION</c>

          <c>1</c>

          <c>TURN_SERVICE</c>

          <c>2</c>

          <c>CERTIFICATE</c>

          <c>3</c>

          <c>ROUTING_TABLE_SIZE</c>

          <c>4</c>

          <c>SOFTWARE_VERSION</c>

          <c>5</c>

          <c>MACHINE_UPTIME</c>

          <c>6</c>

          <c>APP_UPTIME</c>

          <c>7</c>

          <c>MEMORY_FOOTPRINT</c>

          <c>8</c>

          <c>DATASIZE_StoreD</c>

          <c>9</c>

          <c>INSTANCES_StoreD</c>

          <c>10</c>

          <c>MESSAGES_SENT_RCVD</c>

          <c>11</c>

          <c>EWMA_BYTES_SENT</c>

          <c>12</c>

          <c>EWMA_BYTES_RCVD</c>

          <c>13</c>

          <c>LAST_CONTACT</c>

          <c>14</c>

          <c>RTT</c>

          <c>15</c>
        </texttable>
      </section>

      <section title="Data Model">
        <t>IANA SHALL create/(has created) a "RELOAD Data Model" Registry.
        Entries in this registry are 8-bit integers denoting data models, as
	described in <xref target="sec-kind-model"></xref>. Code points in
	this registry SHALL be registered via RFC 5226 IETF Review.</t>

        <t></t>

        <texttable>
          <ttcol align="left">Data Model</ttcol>

          <ttcol align="right">Identifier</ttcol>

          <c>SINGLE_VALUE</c>

          <c>1</c>

          <c>ARRAY</c>

          <c>2</c>

          <c>DICTIONARY</c>

          <c>3</c>
        </texttable>
      </section>

      <section title="Message Codes">
        <t>IANA SHALL create/(has created) a "RELOAD Message Code" Registry.
        Entries in this registry are 16-bit integers denoting method codes as
        described in <xref target="sec-contents"></xref>. These codes SHALL
	be registred via RFC 5226 Standards Track.</t>

        <t>The initial contents of this registry are:</t>

        <t></t>

        <texttable>
          <ttcol align="left">Message Code Name</ttcol>

          <ttcol align="right">Code Value</ttcol>

          <c>reserved</c>

          <c>0</c>

          <c>ping_req</c>

          <c>1</c>

          <c>ping_ans</c>

          <c>2</c>

          <c>attach_req</c>

          <c>3</c>

          <c>attach_ans</c>

          <c>4</c>

          <c>tunnel_req</c>

          <c>5</c>

          <c>tunnel_ans</c>

          <c>6</c>

          <c>store_req</c>

          <c>7</c>

          <c>store_ans</c>

          <c>8</c>

          <c>fetch_req</c>

          <c>9</c>

          <c>fetch_ans</c>

          <c>10</c>

          <c>remove_req</c>

          <c>11</c>

          <c>remove_ans</c>

          <c>12</c>

          <c>find_req</c>

          <c>13</c>

          <c>find_ans</c>

          <c>14</c>

          <c>join_req</c>

          <c>15</c>

          <c>join_ans</c>

          <c>16</c>

          <c>leave_req</c>

          <c>17</c>

          <c>leave_ans</c>

          <c>18</c>

          <c>update_req</c>

          <c>19</c>

          <c>update_ans</c>

          <c>20</c>

          <c>route_query_req</c>

          <c>21</c>

          <c>route_query_ans</c>

          <c>22</c>

          <c>reserved</c>

          <c>0x8000..0xfffe</c>

          <c>error</c>

          <c>0xffff</c>
        </texttable>
      </section>

      <section title="Error Codes">
        <t>IANA SHALL create/(has created) a "RELOAD Error Code" Registry.
        Entries in this registry are 16-bit integers denoting error codes.
	New entries SHALL be defined via RFC 5226 Standards Track.</t>
      </section>

      <section title="Route Log Extension Types">
        <t>IANA SHALL create/(has created) a "RELOAD Route Log Extension Type
        Registry. This registry is currently empty. New entries SHALL be 
	defined via RFC 5226 Expert Review.</t>
      </section>
      
      <section title="Transport Types">
	<t>IANA shall create/(has created) a "RELOAD Transport Type Registry."
	This registry SHALL be initially populated with the following
	values:
	</t>
	<figure>
	  <artwork>
            reserved     0
            tcp_tls      1
            udp_dtls     2
	  </artwork>
	</figure>
	<t>
	  New entries SHALL be defined via RFC 5226 Standards Action.
	</t>
      </section>

      <section title="Forwarding Options">
	<t>IANA shall create/(has created) a "RELOAD Forwarding Option Registry".
	Entries in this registry between 0 and 127 SHALL be defined via RFC
	5226 Standards Track. Entries in this registry between 128 and
	255 SHALL be defined via RFC 5226 Specification Required.
	</t>
      </section>
      
      <section title="Ping Information Types">
	<t>IANA shall create/(has created) a "RELOAD Ping Information Type
	Registry". This registry SHALL be initially populated with the
	following values:
	</t>
	<figure>
	  <artwork>
            responsible_set  1
            requested_info   2
	  </artwork>
	</figure>
	<t>
	  Entries in this registry SHALL be defined via RFC 5226 Standards Track.
	</t>
      </section>
      <section anchor="sec-reload-uri" title="reload: URI Scheme">

        <t>This section describes the scheme for a reload: URI, which can be
        used to refer to either: </t>

        <t> <list style="symbols">
          <t>A peer.</t>
          
          <t>A resource inside a peer.</t>
        </list> </t>
        
        <t> The reload: URI is defined using a subset of the URI
        schema specified in Appendix A. of RFC 3986 [REF] and the associated
        URI Guidelines [REF: RFC4395] per the following ABNF syntax: </t>
        <figure>
          <artwork><![CDATA[
    RELOAD-URI = "reload://" destination "@" overlay "/" 
             [specifier]
 
          destination = 1 * HEXDIG
    overlay = reg-name
    specifier = 1*HEXDIG
    
    ]]></artwork>
          </figure> 

          <t> The definitions of these productions are as follows: </t>
          <t> <list style="hanging">
            <t hangText="destination: ">a hex-encoded Destination List
            object.</t>
            
            <t />

            <t hangText="overlay: ">the name of the overlay.</t>

            <t />
            
            <t hangText="specifier :">a hex-encoded StoredDataSpecifier
            indicating the data element.</t>
          </list></t>

        <t>If no specifier is present than this URI addresses the peer which
        can be reached via the indicated destination list at the indicated
        overlay name. If a specifier is present, then the URI addresses the
        data value.</t>

        <section title="URI Registration">
          <t>The following summarizes the information necessary to register
          the reload: URI. [NOTE TO IANA/RFC-EDITOR: Please replace XXXX with
          the RFC number for this specification in the following list.]</t>

          <t><list style="hanging">
              <t hangText="URI Scheme Name: ">reload</t>

              <t hangText="Status: ">permanent</t>

              <t hangText="URI Scheme Syntax: ">see <xref
              target="sec-reload-uri"></xref>.</t>

              <t hangText="URI Scheme Semantics: ">The reload: URI is intended
              to be used as a reference to a RELOAD peer or resource.</t>

              <t hangText="Encoding Considerations: ">The reload: URI is not
              intended to be human-readable text, therefore they are encoded
              entirely in US-ASCII.</t>

              <t
              hangText="Applications/protocols that use this URI scheme: ">The
              RELOAD protocol described in RFC XXXX.</t>

              <t>TBD for the rest of this template.</t>
            </list></t>
        </section>
      </section>
    </section>

    <section title="Acknowledgments">
      <t>This draft is a merge of the "REsource LOcation And Discovery
      (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B.
      Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen
      Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security
      Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick,
      the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia
      Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) draft
      by Salman A. Baset, Henning Schulzrinne, and Marcin Matuszewski.</t>

      <t>Thanks to the many people who contributed including: Michael Chen,
      TODO - fill in.</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 fullname="Scott Bradner" initials="S." surname="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 month="March" year="1997" />

          <area>General</area>

          <keyword>keyword</keyword>
        </front>

        <seriesInfo name="BCP" value="14" />

        <seriesInfo name="RFC" value="2119" />

        <format octets="4723" target="ftp://ftp.isi.edu/in-notes/rfc2119.txt"
                type="TXT" />

        <format octets="15905"
                target="http://xml.resource.org/public/rfc/html/rfc2119.html"
                type="HTML" />

        <format octets="5661"
                target="http://xml.resource.org/public/rfc/xml/rfc2119.xml"
                type="XML" />
      </reference>

      <reference anchor="I-D.ietf-mmusic-ice">
        <front>
          <title>Interactive Connectivity Establishment (ICE): A Protocol for
          Network Address Translator (NAT) Traversal for Offer/Answer
          Protocols</title>

          <author fullname="Jonathan Rosenberg" initials="J"
                  surname="Rosenberg">
            <organization></organization>
          </author>

          <date day="12" month="June" year="2007" />

          <abstract>
            <t>This document describes a protocol for Network Address
            Translator (NAT) traversal for multimedia sessions established
            with the offer/ answer model. This protocol is called Interactive
            Connectivity Establishment (ICE). ICE makes use of the Session
            Traversal Utilities for NAT (STUN) protocol, applying its binding
            discovery and relay usages, in addition to defining a new usage
            for checking connectivity between peers. ICE can be used by any
            protocol utilizing the offer/answer model, such as the Session
            Initiation Protocol (SIP).</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-ietf-mmusic-ice-16" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-mmusic-ice-16.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.ietf-behave-rfc3489bis">
        <front>
          <title>Session Traversal Utilities for (NAT) (STUN)</title>

          <author fullname="Jonathan Rosenberg" initials="J"
                  surname="Rosenberg">
            <organization></organization>
          </author>

          <date day="8" month="March" year="2007" />

          <abstract>
            <t>Session Traversal Utilities for NAT (STUN) is a lightweight
            protocol that serves as a tool for application protocols in
            dealing with NAT traversal. It allows a client to determine the IP
            address and port allocated to them by a NAT and to keep NAT
            bindings open. It can also serve as a check for connectivity
            between a client and a server in the presence of NAT, and for the
            client to detect failure of the server. STUN works with many
            existing NATs, and does not require any special behavior from
            them. As a result, it allows a wide variety of applications to
            work through existing NAT infrastructure.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-ietf-behave-rfc3489bis-06" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-behave-rfc3489bis-06.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.ietf-behave-turn">
        <front>
          <title>Obtaining Relay Addresses from Simple Traversal Underneath
          NAT (STUN)</title>

          <author fullname="Jonathan Rosenberg" initials="J"
                  surname="Rosenberg">
            <organization></organization>
          </author>

          <date day="7" month="March" year="2007" />

          <abstract>
            <t>This specification defines a usage of the Simple Traversal
            Underneath NAT (STUN) Protocol for asking the STUN server to relay
            packets towards a client. This usage is useful for elements behind
            NATs whose mapping behavior is address and port dependent. The
            extension purposefully restricts the ways in which the relayed
            address can be used. In particular, it prevents users from running
            general purpose servers from ports obtained from the STUN
            server.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-ietf-behave-turn-03" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-behave-turn-03.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.ietf-pkix-cmc-trans">
        <front>
          <title>Certificate Management over CMS (CMC) Transport
          Protocols</title>

          <author fullname="Jim Schaad" initials="J" surname="Schaad">
            <organization></organization>
          </author>

          <author fullname="Michael Myers" initials="M" surname="Myers">
            <organization></organization>
          </author>

          <date day="16" month="May" year="2006" />

          <abstract>
            <t>This document defines a number of transport mechanisms that are
            used to move CMC (Certificate Management over CMS (Cryptographic
            Message Syntax)) messages. The transport mechanisms described in
            this document are: HTTP, file, mail and TCP.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-ietf-pkix-cmc-trans-05" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-pkix-cmc-trans-05.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.ietf-pkix-2797-bis">
        <front>
          <title>Certificate Management Messages over CMS</title>

          <author fullname="Michael Myers" initials="M" surname="Myers">
            <organization></organization>
          </author>

          <author fullname="Jim Schaad" initials="J" surname="Schaad">
            <organization></organization>
          </author>

          <date day="3" month="March" year="2006" />

          <abstract>
            <t>This document defines the base syntax for CMC, a Certificate
            Management protocol using CMS (Cryptographic Message Syntax). This
            protocol addresses two immediate needs within the Internet PKI
            community: 1. The need for an interface to public key
            certification products and services based on CMS and PKCS #10
            (Public Key Cryptography 2. The need in S/MIME (Secure MIME) for a
            certificate enrollment protocol for DSA-signed certificates with
            Diffie-Hellman public keys. CMC also requires the use of the
            transport document and the requirements usage document along with
            this document for a full definition.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-ietf-pkix-2797-bis-04" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-pkix-2797-bis-04.txt"
                type="TXT" />
      </reference>

      <reference anchor="RFC4279">
        <front>
          <title>Pre-Shared Key Ciphersuites for Transport Layer Security
          (TLS)</title>

          <author fullname="P. Eronen" initials="P." surname="Eronen">
            <organization></organization>
          </author>

          <author fullname="H. Tschofenig" initials="H." surname="Tschofenig">
            <organization></organization>
          </author>

          <date month="December" year="2005" />

          <abstract>
            <t>This document specifies three sets of new ciphersuites for the
            Transport Layer Security (TLS) protocol to support authentication
            based on pre-shared keys (PSKs). These pre-shared keys are
            symmetric keys, shared in advance among the communicating parties.
            The first set of ciphersuites uses only symmetric key operations
            for authentication. The second set uses a Diffie-Hellman exchange
            authenticated with a pre-shared key, and the third set combines
            public key authentication of the server with pre-shared key
            authentication of the client. [STANDARDS TRACK]</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="4279" />

        <format octets="32160" target="ftp://ftp.isi.edu/in-notes/rfc4279.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.ietf-tls-srp">
        <front>
          <title>Using SRP for TLS Authentication</title>

          <author fullname="Dave Taylor" initials="D" surname="Taylor">
            <organization></organization>
          </author>

          <date day="14" month="June" year="2007" />

          <abstract>
            <t>This memo presents a technique for using the Secure Remote
            Password protocol as an authentication method for the Transport
            Layer Security protocol.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-ietf-tls-srp-14" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-tls-srp-14.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.ietf-mmusic-ice-tcp">
        <front>
          <title>TCP Candidates with Interactive Connectivity Establishment
          (ICE</title>

          <author fullname="Jonathan  Rosenberg" initials="J"
                  surname="Rosenberg">
            <organization></organization>
          </author>

          <date day="8" month="March" year="2007" />

          <abstract>
            <t>Interactive Connectivity Establishment (ICE) defines a
            mechanism for NAT traversal for multimedia communication protocols
            based on the offer/answer model of session negotiation. ICE works
            by providing a set of candidate transport addresses for each media
            stream, which are then validated with peer-to-peer connectivity
            checks based on Simple Traversal of UDP over NAT (STUN). ICE
            provides a general framework for describing alternates, but only
            defines UDP-based transport protocols. This specification extends
            ICE to TCP-based media, including the ability to offer a mix of
            TCP and UDP-based candidates for a single stream.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-ietf-mmusic-ice-tcp-03" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-mmusic-ice-tcp-03.txt"
                type="TXT" />
      </reference>

      <reference anchor="RFC3261">
        <front>
          <title>SIP: Session Initiation Protocol</title>

          <author fullname="J. Rosenberg" initials="J." surname="Rosenberg">
            <organization></organization>
          </author>

          <author fullname="H. Schulzrinne" initials="H."
                  surname="Schulzrinne">
            <organization></organization>
          </author>

          <author fullname="G. Camarillo" initials="G." surname="Camarillo">
            <organization></organization>
          </author>

          <author fullname="A. Johnston" initials="A." surname="Johnston">
            <organization></organization>
          </author>

          <author fullname="J. Peterson" initials="J." surname="Peterson">
            <organization></organization>
          </author>

          <date month="June" year="2002" />
        </front>

        <seriesInfo name="RFC" value="3261" />

        <format octets="647976"
                target="ftp://ftp.isi.edu/in-notes/rfc3261.txt" type="TXT" />
      </reference>

      <reference anchor="RFC3263">
        <front>
          <title>Session Initiation Protocol (SIP): Locating SIP
          Servers</title>

          <author fullname="J. Rosenberg" initials="J." surname="Rosenberg">
            <organization></organization>
          </author>

          <author fullname="H. Schulzrinne" initials="H."
                  surname="Schulzrinne">
            <organization></organization>
          </author>

          <date month="June" year="2002" />

          <abstract>
            <t>The Session Initiation Protocol (SIP) uses DNS procedures to
            allow a client to resolve a SIP Uniform Resource Identifier (URI)
            into the IP address, port, and transport protocol of the next hop
            to contact. It also uses DNS to allow a server to send a response
            to a backup client if the primary client has failed. This document
            describes those DNS procedures in detail. [STANDARDS TRACK]</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="3263" />

        <format octets="42310" target="ftp://ftp.isi.edu/in-notes/rfc3263.txt"
                type="TXT" />
      </reference>

      <reference anchor="RFC4347">
        <front>
          <title>Datagram Transport Layer Security</title>

          <author fullname="E. Rescorla" initials="E." surname="Rescorla">
            <organization></organization>
          </author>

          <author fullname="N. Modadugu" initials="N." surname="Modadugu">
            <organization></organization>
          </author>

          <date month="April" year="2006" />

          <abstract>
            <t>This document specifies Version 1.0 of the Datagram Transport
            Layer Security (DTLS) protocol. The DTLS protocol provides
            communications privacy for datagram protocols. The protocol allows
            client/server applications to communicate in a way that is
            designed to prevent eavesdropping, tampering, or message forgery.
            The DTLS protocol is based on the Transport Layer Security (TLS)
            protocol and provides equivalent security guarantees. Datagram
            semantics of the underlying transport are preserved by the DTLS
            protocol. [STANDARDS TRACK]</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="4347" />

        <format octets="56014" target="ftp://ftp.isi.edu/in-notes/rfc4347.txt"
                type="TXT" />
      </reference>

      <reference anchor="RFC4828">
        <front>
          <title>TCP Friendly Rate Control (TFRC): The Small-Packet (SP)
          Variant</title>

          <author fullname="S. Floyd" initials="S." surname="Floyd">
            <organization></organization>
          </author>

          <author fullname="E. Kohler" initials="E." surname="Kohler">
            <organization></organization>
          </author>

          <date month="April" year="2007" />

          <abstract>
            <t>This document proposes a mechanism for further experimentation,
            but not for widespread deployment at this time in the global
            Internet.</t><t> TCP-Friendly Rate Control (TFRC) is a
            congestion control mechanism for unicast flows operating in a
            best-effort Internet environment (RFC 3448). TFRC was intended for
            applications that use a fixed packet size, and was designed to be
            reasonably fair when competing for bandwidth with TCP connections
            using the same packet size. This document proposes TFRC-SP, a
            Small-Packet (SP) variant of TFRC, that is designed for
            applications that send small packets. The design goal for TFRC-SP
            is to achieve the same bandwidth in bps (bits per second) as a TCP
            flow using packets of up to 1500 bytes. TFRC-SP enforces a minimum
            interval of 10 ms between data packets to prevent a single flow
            from sending small packets arbitrarily
            frequently.</t><t> Flows using TFRC-SP compete
            reasonably fairly with large-packet TCP and TFRC flows in
            environments where large-packet flows and small-packet flows
            experience similar packet drop rates. However, in environments
            where small-packet flows experience lower packet drop rates than
            large-packet flows (e.g., with Drop-Tail queues in units of
            bytes), TFRC-SP can receive considerably more than its share of
            the bandwidth. This memo defines an Experimental Protocol for the
            Internet community.</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="4828" />

        <format octets="116808"
                target="ftp://ftp.isi.edu/in-notes/rfc4828.txt" type="TXT" />
      </reference>
    </references>

    <references title="Informative References">
      <reference anchor="I-D.ietf-behave-tcp">
        <front>
          <title>NAT Behavioral Requirements for TCP</title>

          <author fullname="Saikat Guha" initials="S" surname="Guha">
            <organization></organization>
          </author>

          <date day="30" month="April" year="2007" />

          <abstract>
            <t>This document defines a set of requirements for NATs that
            handle TCP that would allow many applications, such as
            peer-to-peer applications and on-line games, to work consistently.
            Developing NATs that meet this set of requirements will greatly
            increase the likelihood that these applications will function
            properly.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-ietf-behave-tcp-07" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-behave-tcp-07.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.ietf-p2psip-concepts">
        <front>
          <title>Concepts and Terminology for Peer to Peer SIP</title>

          <author fullname="David Bryan" initials="D" surname="Bryan">
            <organization></organization>
          </author>

          <date day="3" month="July" year="2007" />

          <abstract>
            <t>This document defines concepts and terminology for use of the
            Session Initiation Protocol in a peer-to-peer environment where
            the traditional proxy-registrar and message routing functions are
            replaced by a distributed mechanism that might be implemented
            using a distributed hash table or other distributed data mechanism
            with similar external properties. This document includes a
            high-level view of the functional relationships between the
            network elements defined herein, a conceptual model of operations,
            and an outline of the related open problems being addressed by the
            P2PSIP working group. As this document matures, it is expected to
            define the general framework for P2PSIP.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-ietf-p2psip-concepts-00" />

        <format target="http://www.ietf.org/internet-drafts/draft-ietf-p2psip-concepts-00.txt"
                type="TXT" />
      </reference>

      <reference anchor="RFC4145">
        <front>
          <title>TCP-Based Media Transport in the Session Description Protocol
          (SDP)</title>

          <author fullname="D. Yon" initials="D." surname="Yon">
            <organization></organization>
          </author>

          <author fullname="G. Camarillo" initials="G." surname="Camarillo">
            <organization></organization>
          </author>

          <date month="September" year="2005" />

          <abstract>
            <t>This document describes how to express media transport over TCP
            using the Session Description Protocol (SDP). It defines the SDP
            'TCP' protocol identifier, the SDP 'setup' attribute, which
            describes the connection setup procedure, and the SDP 'connection'
            attribute, which handles connection reestablishment. [STANDARDS
            TRACK]</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="4145" />

        <format octets="30225" target="ftp://ftp.isi.edu/in-notes/rfc4145.txt"
                type="TXT" />
      </reference>

<!--
      <reference anchor="RFC4572">
        <front>
          <title>Connection-Oriented Media Transport over the Transport Layer
          Security (TLS) Protocol in the Session Description Protocol
          (SDP)</title>

          <author fullname="J. Lennox" initials="J." surname="Lennox">
            <organization></organization>
          </author>

          <date month="July" year="2006" />

          <abstract>
            <t>This document specifies how to establish secure
            connection-oriented media transport sessions over the Transport
            Layer Security (TLS) protocol using the Session Description
            Protocol (SDP). It defines a new SDP protocol identifier,
            'TCP/TLS'. It also defines the syntax and semantics for an SDP
            'fingerprint' attribute that identifies the certificate that will
            be presented for the TLS session. This mechanism allows media
            transport over TLS connections to be established securely, so long
            as the integrity of session descriptions is
            assured.</t><t> This document extends and updates RFC
            4145. [STANDARDS TRACK]</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="4572" />

        <format octets="38658" target="ftp://ftp.isi.edu/in-notes/rfc4572.txt"
                type="TXT" />
      </reference>
-->

<!--
      <reference anchor="RFC2617">
        <front>
          <title abbrev="HTTP Authentication">HTTP Authentication: Basic and
          Digest Access Authentication</title>

          <author fullname="John Franks" initials="J." surname="Franks">
            <organization>Northwestern University, Department of
            Mathematics</organization>

            <address>
              <postal>
                <street>Northwestern University</street>

                <city>Evanston</city>

                <region>IL</region>

                <code>60208-2730</code>

                <country>USA</country>
              </postal>

              <email>john@math.nwu.edu</email>
            </address>
          </author>

          <author fullname="Phillip M. Hallam-Baker" initials="P.M."
                  surname="Hallam-Baker">
            <organization>Verisign Inc.</organization>

            <address>
              <postal>
                <street>301 Edgewater Place</street>

                <street>Suite 210</street>

                <city>Wakefield</city>

                <region>MA</region>

                <code>01880</code>

                <country>USA</country>
              </postal>

              <email>pbaker@verisign.com</email>
            </address>
          </author>

          <author fullname="Jeffery L. Hostetler" initials="J.L."
                  surname="Hostetler">
            <organization>AbiSource, Inc.</organization>

            <address>
              <postal>
                <street>6 Dunlap Court</street>

                <city>Savoy</city>

                <region>IL</region>

                <code>61874</code>

                <country>USA</country>
              </postal>

              <email>jeff@AbiSource.com</email>
            </address>
          </author>

          <author fullname="Scott D. Lawrence" initials="S.D."
                  surname="Lawrence">
            <organization>Agranat Systems, Inc.</organization>

            <address>
              <postal>
                <street>5 Clocktower Place</street>

                <street>Suite 400</street>

                <city>Maynard</city>

                <region>MA</region>

                <code>01754</code>

                <country>USA</country>
              </postal>

              <email>lawrence@agranat.com</email>
            </address>
          </author>

          <author fullname="Paul J. Leach" initials="P.J." surname="Leach">
            <organization>Microsoft Corporation</organization>

            <address>
              <postal>
                <street>1 Microsoft Way</street>

                <city>Redmond</city>

                <region>WA</region>

                <code>98052</code>

                <country>USA</country>
              </postal>

              <email>paulle@microsoft.com</email>
            </address>
          </author>

          <date month="June" year="1999" />

          <abstract>
            <t>"HTTP/1.0", includes the specification for a Basic Access
            Authentication scheme. This scheme is not considered to be a
            secure method of user authentication (unless used in conjunction
            with some external secure system such as SSL ), as the user name
            and password are passed over the network as cleartext.</t>

            <t>This document also provides the specification for HTTP's
            authentication framework, the original Basic authentication scheme
            and a scheme based on cryptographic hashes, referred to as "Digest
            Access Authentication". It is therefore also intended to serve as
            a replacement for RFC 2069 . Some optional elements specified by
            RFC 2069 have been removed from this specification due to problems
            found since its publication; other new elements have been added
            for compatibility, those new elements have been made optional, but
            are strongly recommended.</t>

            <t>Like Basic, Digest access authentication verifies that both
            parties to a communication know a shared secret (a password);
            unlike Basic, this verification can be done without sending the
            password in the clear, which is Basic's biggest weakness. As with
            most other authentication protocols, the greatest sources of risks
            are usually found not in the core protocol itself but in policies
            and procedures surrounding its use.</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="2617" />

        <format octets="77638" target="ftp://ftp.isi.edu/in-notes/rfc2617.txt"
                type="TXT" />

        <format octets="114842"
                target="http://xml.resource.org/public/rfc/html/rfc2617.html"
                type="HTML" />

        <format octets="87592"
                target="http://xml.resource.org/public/rfc/xml/rfc2617.xml"
                type="XML" />
      </reference>
-->

      <reference anchor="RFC2818">
        <front>
          <title>HTTP Over TLS</title>

          <author fullname="E. Rescorla" initials="E." surname="Rescorla">
            <organization></organization>
          </author>

          <date month="May" year="2000" />

          <abstract>
            <t>This memo describes how to use Transport Layer Security (TLS)
            to secure Hypertext Transfer Protocol (HTTP) connections over the
            Internet. This memo provides information for the Internet
            community.</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="2818" />

        <format octets="15170" target="ftp://ftp.isi.edu/in-notes/rfc2818.txt"
                type="TXT" />
      </reference>

      <reference anchor="RFC4086">
        <front>
          <title>Randomness Requirements for Security</title>

          <author fullname="D. Eastlake" initials="D." surname="Eastlake">
            <organization></organization>
          </author>

          <author fullname="J. Schiller" initials="J." surname="Schiller">
            <organization></organization>
          </author>

          <author fullname="S. Crocker" initials="S." surname="Crocker">
            <organization></organization>
          </author>

          <date month="June" year="2005" />

          <abstract>
            <t>Security systems are built on strong cryptographic algorithms
            that foil pattern analysis attempts. However, the security of
            these systems is dependent on generating secret quantities for
            passwords, cryptographic keys, and similar quantities. The use of
            pseudo-random processes to generate secret quantities can result
            in pseudo-security. A sophisticated attacker may find it easier to
            reproduce the environment that produced the secret quantities and
            to search the resulting small set of possibilities than to locate
            the quantities in the whole of the potential number
            space.</t><t> Choosing random quantities to foil a
            resourceful and motivated adversary is surprisingly difficult.
            This document points out many pitfalls in using poor entropy
            sources or traditional pseudo-random number generation techniques
            for generating such quantities. It recommends the use of truly
            random hardware techniques and shows that the existing hardware on
            many systems can be used for this purpose. It provides suggestions
            to ameliorate the problem when a hardware solution is not
            available, and it gives examples of how large such quantities need
            to be for some applications. This document specifies an Internet
            Best Current Practices for the Internet Community, and requests
            discussion and suggestions for improvements.</t>
          </abstract>
        </front>

        <seriesInfo name="BCP" value="106" />

        <seriesInfo name="RFC" value="4086" />

        <format octets="114321"
                target="ftp://ftp.isi.edu/in-notes/rfc4086.txt" type="TXT" />
      </reference>

      <reference anchor="RFC3280">
        <front>
          <title>Internet X.509 Public Key Infrastructure Certificate and
          Certificate Revocation List (CRL) Profile</title>

          <author fullname="R. Housley" initials="R." surname="Housley">
            <organization></organization>
          </author>

          <author fullname="W. Polk" initials="W." surname="Polk">
            <organization></organization>
          </author>

          <author fullname="W. Ford" initials="W." surname="Ford">
            <organization></organization>
          </author>

          <author fullname="D. Solo" initials="D." surname="Solo">
            <organization></organization>
          </author>

          <date month="April" year="2002" />

          <abstract>
            <t>This memo profiles the X.509 v3 certificate and X.509 v2
            Certificate Revocation List (CRL) for use in the Internet.
            [STANDARDS TRACK]</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="3280" />

        <format octets="295556"
                target="ftp://ftp.isi.edu/in-notes/rfc3280.txt" type="TXT" />
      </reference>

      <!--
      <reference anchor="sosimple">
        <front>
          <title>SOSIMPLE: A Serverless, Standards-based, P2P SIP
          Communication System</title>

          <author fullname="David A. Bryan" initials="D. A." surname="Bryan">
            <organization>College of William and Mary</organization>
          </author>

          <author fullname="Cullen Jennings" initials="C." surname="Jennings">
            <organization>Cisco Systems</organization>
          </author>

          <author fullname="Bruce B. Lowekamp" initials="B. B."
                  surname="Lowekamp">
            <organization>College of William and Mary</organization>
          </author>

          <date month="June" year="2005" />
        </front>

        <seriesInfo name="Proceedings of the 2005 International Workshop on Advanced Architectures and Algorithms for Internet Delivery and Applications (AAA-IDEA)"
                    value="'05" />

        <format target="http://www.cs.wm.edu/~bryan/pubs/bryan-AAA-IDEA2005.pdf"
                type="PDF" />
      </reference>

      <reference anchor="I-D.bryan-p2psip-dsip">
        <front>
          <title>dSIP: A P2P Approach to SIP Registration and Resource
          Location</title>

          <author fullname="D. Bryan" initials="D." surname="Bryan">
            <organization></organization>
          </author>

          <author fullname="B. Lowekamp" initials="B." surname="Lowekamp">
            <organization></organization>
          </author>

          <author fullname="C. Jennings" initials="C." surname="Jennings">
            <organization></organization>
          </author>

          <date month="February" year="2007" />
        </front>

        <seriesInfo name="Internet Draft" value="draft-bryan-p2psip-dsip-00" />
      </reference>
-->

      <reference anchor="Sybil">
        <front>
          <title>The Sybil Attack</title>

          <author fullname="John R. Douceur" initials="J. R."
                  surname="Douceur">
            <organization>Microsoft Research</organization>
          </author>

          <date month="March" year="2002" />
        </front>

        <seriesInfo name="IPTPS" value="02" />

        <format target="http://www.cs.rice.edu/Conferences/IPTPS02/101.pdf"
                type="PDF" />
      </reference>

      <reference anchor="Eclipse">
        <front>
          <title>Eclipse Attacks on Overlay Networks: Threats and
          Defenses</title>

          <author fullname="Atul Singh" initials="A." surname="Singh">
            <organization></organization>
          </author>

          <author fullname="Tsuen-Wan Ngan" initials="T. W." surname="Ngan">
            <organization></organization>
          </author>

          <author fullname="Peter Druschel" initials="T." surname="Druschel">
            <organization></organization>
          </author>

          <author fullname="Dan S. Wallach" initials="D. S." surname="Wallach">
            <organization></organization>
          </author>

          <date month="April" year="2006" />
        </front>

        <seriesInfo name="INFOCOM" value="2006" />
      </reference>

      <reference anchor="I-D.cheshire-dnsext-multicastdns">
        <front>
          <title>Multicast DNS</title>

          <author fullname="Stuart Cheshire" initials="S" surname="Cheshire">
            <organization></organization>
          </author>

          <author fullname="Marc Krochmal" initials="M" surname="Krochmal">
            <organization></organization>
          </author>

          <date day="25" month="August" year="2006" />
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-cheshire-dnsext-multicastdns-06" />

        <format target="http://www.ietf.org/internet-drafts/draft-cheshire-dnsext-multicastdns-06.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.cheshire-dnsext-dns-sd">
        <front>
          <title>DNS-Based Service Discovery</title>

          <author fullname="Marc Krochmal" initials="M" surname="Krochmal">
            <organization></organization>
          </author>

          <author fullname="Stuart Cheshire" initials="S" surname="Cheshire">
            <organization></organization>
          </author>

          <date day="28" month="August" year="2006" />

          <abstract>
            <t>This document describes a convention for naming and structuring
            DNS resource records. Given a type of service that a client is
            looking for, and a domain in which the client is looking for that
            service, this convention allows clients to discover a list of
            named instances of that desired service, using only standard DNS
            queries. In short, this is referred to as DNS-based Service
            Discovery, or DNS-SD.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-cheshire-dnsext-dns-sd-04" />

        <format target="http://www.ietf.org/internet-drafts/draft-cheshire-dnsext-dns-sd-04.txt"
                type="TXT" />
      </reference>

      <!--
<reference anchor='I-D.jennings-p2psip-security'>
<front>
<title>Security Mechanisms for Peer to Peer SIP</title>

<author initials='C' surname='Jennings' fullname='Cullen Jennings'>
    <organization />
</author>

<date month='February' day='27' year='2007' />

<abstract><t>This document describes an overview of some security mechanisms for P2P SIP. Specifically it discusses mechanisms that can be used to secure the stored data and the routing in the distributed storage. This draft is an very early draft to outline the possible solution space and far more details would be needed. This work is being discussed on the p2psip@ietf.org mailing list.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-jennings-p2psip-security-00' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-jennings-p2psip-security-00.txt' />
</reference>
-->

      <reference anchor="I-D.matthews-p2psip-bootstrap-mechanisms">
        <front>
          <title>Bootstrap Mechanisms for P2PSIP</title>

          <author fullname="Eric Cooper" initials="E" surname="Cooper">
            <organization></organization>
          </author>

          <date day="26" month="February" year="2007" />

          <abstract>
            <t>This document describes mechanisms that a peer can use to
            locate and establish a Peer Protocol connection to an admitting
            peer in order to join an overlay network. In the first mechanism,
            the joining peer uses multicast to locate a bootstrap peer; in the
            second, the node uses one or more bootstrap servers to locate a
            bootstrap peer; in both cases, the bootstrap peer then proxies the
            request by the joining peer on to the admitting peer. Each
            mechanism has its advantages and disadvantages, and a node can
            utilize both.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-matthews-p2psip-bootstrap-mechanisms-00" />

        <format target="http://www.ietf.org/internet-drafts/draft-matthews-p2psip-bootstrap-mechanisms-00.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.garcia-p2psip-dns-sd-bootstrapping">
        <front>
          <title>P2PSIP bootstrapping using DNS-SD</title>

          <author fullname="Gustavo Garcia" initials="G" surname="Garcia">
            <organization></organization>
          </author>

          <date day="25" month="October" year="2007" />

          <abstract>
            <t>This document describes a DNS-based bootstrap mechanism to
            discover the initial peer or peers needed to join a P2PSIP
            Overlay. The document specifies the use of DNS Service Discovery
            (DNS-SD) and the format of the required resource records to
            support the discovery of P2PSIP peers. This mechanism can be
            applied in scenarios with DNS servers or combined with multicast
            DNS to fulfill different proposed P2PSIP use cases.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-garcia-p2psip-dns-sd-bootstrapping-00" />

        <format target="http://www.ietf.org/internet-drafts/draft-garcia-p2psip-dns-sd-bootstrapping-00.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.camarillo-hip-bone">
        <front>
          <title>HIP BONE: Host Identity Protocol (HIP) Based Overlay
          Networking Environment</title>

          <author fullname="Gonzalo Camarillo" initials="G"
                  surname="Camarillo">
            <organization></organization>
          </author>

          <author fullname="Pekka Nikander" initials="P" surname="Nikander">
            <organization></organization>
          </author>

          <author fullname="Jani Hautakorpi" initials="J" surname="Hautakorpi">
            <organization></organization>
          </author>

          <date day="21" month="December" year="2007" />

          <abstract>
            <t>This document specifies a framework to build HIP (Host Identity
            Protocol)-based overlay networks. This framework uses HIP to
            perform connection management. Other functions, such as data
            storage and retrieval or overlay maintenance, are implemented
            using protocols other than HIP. These protocols are loosely
            referred to as peer protocols.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-camarillo-hip-bone-00" />

        <format target="http://www.ietf.org/internet-drafts/draft-camarillo-hip-bone-00.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.pascual-p2psip-clients">
        <front>
          <title>P2PSIP Clients</title>

          <author fullname="Victor Pascual" initials="V" surname="Pascual">
            <organization></organization>
          </author>

          <author fullname="Marchin Matuszewski" initials="M"
                  surname="Matuszewski">
            <organization></organization>
          </author>

          <author fullname="Eunsoo Shim" initials="E" surname="Shim">
            <organization></organization>
          </author>

          <author fullname="Hewen  Zhang" initials="H" surname="Zhang">
            <organization></organization>
          </author>

          <author fullname="Song Yongchao" initials="S" surname="Yongchao">
            <organization></organization>
          </author>

          <date day="25" month="February" year="2008" />

          <abstract>
            <t>This document describes why and when some devices would better
            be a Client rather than a Peer. The purpose of this document is to
            facilitate the discussion and understanding about the Client node
            type.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-pascual-p2psip-clients-01" />

        <format target="http://www.ietf.org/internet-drafts/draft-pascual-p2psip-clients-01.txt"
                type="TXT" />
      </reference>

      <reference anchor="RFC4787">
        <front>
          <title>Network Address Translation (NAT) Behavioral Requirements for
          Unicast UDP</title>

          <author fullname="F. Audet" initials="F." surname="Audet">
            <organization></organization>
          </author>

          <author fullname="C. Jennings" initials="C." surname="Jennings">
            <organization></organization>
          </author>

          <date month="January" year="2007" />

          <abstract>
            <t>This document defines basic terminology for describing
            different types of Network Address Translation (NAT) behavior when
            handling Unicast UDP and also defines a set of requirements that
            would allow many applications, such as multimedia communications
            or online gaming, to work consistently. Developing NATs that meet
            this set of requirements will greatly increase the likelihood that
            these applications will function properly. This document specifies
            an Internet Best Current Practices for the Internet Community, and
            requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>

        <seriesInfo name="BCP" value="127" />

        <seriesInfo name="RFC" value="4787" />

        <format octets="68693" target="ftp://ftp.isi.edu/in-notes/rfc4787.txt"
                type="TXT" />
      </reference>

      <reference anchor="I-D.jiang-p2psip-sep">
        <front>
          <title>Service Extensible P2P Peer Protocol</title>

          <author fullname="XingFeng Jiang" initials="X" surname="Jiang">
            <organization></organization>
          </author>

          <author fullname="Hewen Zhang" initials="H" surname="Zhang">
            <organization></organization>
          </author>

          <date day="22" month="February" year="2008" />

          <abstract>
            <t>This document describes the Service Extensible Protocol (SEP),
            which is the peer protocol spoken between P2PSIP Overlay peers to
            share information and organize the P2PSIP Overlay Network. SEP
            uses a flexible forwarding mechanism to avoid congestion in the
            Overlay. It also proposes a general service discovery method and a
            built-in NATtraversal mechanism. By using these methods, SEP tries
            to improve the success rate and reduce the latency of the
            transaction.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft" value="draft-jiang-p2psip-sep-01" />

        <format target="http://www.ietf.org/internet-drafts/draft-jiang-p2psip-sep-01.txt"
                type="TXT" />
      </reference>

      <reference anchor="stoica-non-transitive-worlds05">
        <front>
          <title>Non-Transitive Connectivity and DHTs</title>

          <author initials="M.J." surname="Freedman" > <organization></organization></author>

          <author initials="K." surname="Lakshminarayanan" > <organization></organization></author>

          <author initials="S." surname="Rhea" > <organization></organization></author>

          <author initials="I." surname="Stoica" > <organization></organization></author>
        </front>

        <seriesInfo name="" value="WORLDS'05" /> 
      </reference>

      <reference anchor="stoica-geometry-sigcomm03">
        <front>
          <title>The Impact of DHT Routing Geometry on Resilience and
          Proximity</title>

          <author initials="K." surname="Gummadi" > <organization></organization></author>

          <author initials="R." surname="Gummadi"  > <organization></organization></author>

          <author initials="S." surname="Gribble"  > <organization></organization></author>

          <author initials="S." surname="Ratnasamy"  > <organization></organization></author>

          <author initials="S." surname="Shenker"  > <organization></organization></author>

          <author initials="I." surname="Stoica"  > <organization></organization></author>
        </front>

        <seriesInfo name="" value="SIGCOMM'03" />
      </reference>

      <reference anchor="ng-analytical-churn-ieeep2p06">
        <front>
          <title>Analytical Study on Improving DHT Lookup Performance under
          Churn</title>

          <author initials="D." surname="Wu"  > <organization></organization></author>

          <author initials="Y." surname="Tian"  > <organization></organization></author>

          <author initials="K.-W." surname="Ng"  > <organization></organization></author>
        </front>

        <seriesInfo name="" value="IEEE P2P'06" />
      </reference>

      <reference anchor="bryan-design-hotp2p08">
        <front>
          <title>The Design of a Versatile, Secure P2PSIP Communications
          Architecture for the Public Internet</title>

          <author initials="D." surname="Bryan" > <organization></organization></author>

          <author initials="B." surname="Lowekamp" > <organization></organization></author>

          <author initials="M." surname="Zangrilli" > <organization></organization></author>
        </front>

        <seriesInfo name="" value="Hot-P2P'08" />
      </reference>

      <reference anchor="opendht-sigcomm05">
        <front>
          <title>OpenDHT: A Public DHT and its Uses</title>

          <author initials="S." surname="Rhea" > <organization></organization></author>

          <author initials="B." surname="Godfrey" > <organization></organization></author>

          <author initials="B." surname="Karp" > <organization></organization></author>

          <author initials="J." surname="Kubiatowicz" > <organization></organization></author>

          <author initials="S." surname="Ratnasamy" > <organization></organization></author>

          <author initials="S." surname="Shenker" > <organization></organization></author>

          <author initials="I." surname="Stoica" > <organization></organization></author>

          <author initials="H." surname="Yu" > <organization></organization></author>
        </front>

        <seriesInfo name="" value="SIGCOMM'05" />
      </reference>

      <reference anchor="Chord">
        <front>
          <title>Chord: A Scalable Peer-to-peer Lookup Service for Internet
          Applications</title>

          <author fullname="Ian Stoica" initials="I." surname="Stoica">
            <organization>MIT Laboratory for Computer Science</organization>
          </author>

          <author fullname="Robert Morris" initials="R." surname="Morris">
            <organization>MIT Laboratory for Computer Science</organization>
          </author>

          <author fullname="David Liben-Nowell" initials="D."
                  surname="Liben-Nowell">
            <organization>MIT Laboratory for Computer Science</organization>
          </author>

          <author fullname="David Karger" initials="D." surname="Karger">
            <organization>MIT Laboratory for Computer Science</organization>
          </author>

          <author fullname="M. Frans Kaashoek" initials="M. Frans"
                  surname="Kaashoek">
            <organization>MIT Laboratory for Computer Science</organization>
          </author>

          <author fullname="Frank Dabek" initials="F." surname="Dabek">
            <organization>MIT Laboratory for Computer Science</organization>
          </author>

          <author fullname="Hari Balakrishnan" initials="H."
                  surname="Balakrishnan">
            <organization>MIT Laboratory for Computer Science</organization>
          </author>
        </front>

        <seriesInfo name="IEEE/ACM Transactions on Networking"
                    value="Volume 11, Issue 1, 17-32, Feb 2003" />

        <format target="http://pdos.csail.mit.edu/chord/papers/paper-ton.pdf"
                type="PDF" />
      </reference>

      <reference anchor="vulnerabilities-acsac04">
        <front>
          <title>Vulnerabilities and Security Threats in Structured
          Peer-to-Peer Systems: A Quantitative Analysis</title>

          <author initials="M." surname="Srivatsa" > <organization></organization></author>

          <author initials="L." surname="Liu" > <organization></organization></author>
        </front>

        <seriesInfo name="" value="ACSAC 2004" />
      </reference>

      
<reference anchor='I-D.zheng-p2psip-diagnose'>
<front>
<title>Diagnose P2PSIP Overlay Network Failures</title>

<author initials='S' surname='Yongchao' fullname='Song Yongchao'>
    <organization />
</author>

<author initials='H' surname='Zhang' fullname='Hewen Zhang'>
    <organization />
</author>

<author initials='X' surname='Jiang' fullname='XingFeng Jiang'>
    <organization />
</author>

<date month='July' day='6' year='2008' />

<abstract><t>This document describes a simple and efficient mechanism that can be used to detect and localize failures in P2PSIP overlay network.  This document mainly consists of two parts: information carried in a P2PSIP "Echo request" message and "Echo response" message for the purpose of fault detection and localization, and mechanisms for processing those messages.</t></abstract>

</front>

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



<reference anchor='I-D.song-p2psip-security-eval'>
<front>
<title>P2PSIP Security Analysis and Evaluation</title>

<author initials='S' surname='Yongchao' fullname='Song Yongchao'>
    <organization />
</author>

<author initials='B' surname='Zhao' fullname='Ben Zhao'>
    <organization />
</author>

<author initials='X' surname='Jiang' fullname='XingFeng  Jiang'>
    <organization />
</author>

<author initials='J' surname='Haifeng' fullname='Jiang Haifeng'>
    <organization />
</author>

<date month='February' day='4' year='2008' />

<abstract><t>This document provides an analysis and evaluation of security with P2PSIP overlay network.  The draft compares security difference between C/S and P2P, then partitions the P2PSIP architecture into layers, and analyze the security issues in each layer and the security relationship among the layers.  Security issues with different kind of application scenarios are distinct.  This draft classifies the application scenarios into two main types, and the security threats with these two types of scenarios are analyzed in detail.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-song-p2psip-security-eval-00' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-song-p2psip-security-eval-00.txt' />
</reference>

<reference anchor='I-D.matthews-p2psip-id-loc'>
<front>
<title>An ID/Locator Architecture for P2PSIP</title>

<author initials='E' surname='Cooper' fullname='Eric Cooper'>
    <organization />
</author>

<author initials='A' surname='Johnston' fullname='Alan Johnston'>
    <organization />
</author>

<author initials='P' surname='Matthews' fullname='Philip  Matthews'>
    <organization />
</author>

<date month='February' day='25' year='2008' />

<abstract><t>This document describes an architecture where peers in an peer-to- peer overlay use special IP addresses to identify other peers.  Two of the advantages of this approach are that (a) most existing applications can run in an overlay without needing any changes and (b) peer mobility and NAT traversal are handled in a way that is transparent to most applications.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-matthews-p2psip-id-loc-01' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-matthews-p2psip-id-loc-01.txt' />
</reference>


<reference anchor='I-D.zheng-p2psip-client-protocol'>
<front>
<title>P2PSIP Client Protocol</title>

<author initials='S' surname='Yongchao' fullname='Song Yongchao'>
    <organization />
</author>

<author initials='X' surname='Jiang' fullname='XingFeng Jiang'>
    <organization />
</author>

<author initials='H' surname='Zhang' fullname='Hewen Zhang'>
    <organization />
</author>

<author initials='H' surname='Deng' fullname='Hui  Deng'>
    <organization />
</author>

<date month='February' day='23' year='2008' />

<abstract><t>This document defines P2PSIP client protocol, one protocol for client-peer communication, which is used to create, implement and maintain the services between a client and its associated peers.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-zheng-p2psip-client-protocol-01' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-zheng-p2psip-client-protocol-01.txt' />
</reference>

<reference anchor='I-D.hardie-p2poverlay-pointers'>
<front>
<title>Mechanisms for use in pointing to overlay networks, nodes, or resources</title>

<author initials='T' surname='Hardie' fullname='Ted Hardie'>
    <organization />
</author>

<date month='January' day='27' year='2008' />

<abstract><t>Discovering overlay networks and the resources found within in them presents a number of bootstrapping problems.  While those hard problems are under discussion, this draft proposes a small set of mechanisms which are intended to be generically useful for providing pointers to peer-to-peer overlay networks in web pages, email messages, and other textual media.  While the mechanisms described below each meet similar needs, they are not mutually exclusive; it is expected that each will find some useful deployment during the early days of peer-to-peer overlay deployment.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-hardie-p2poverlay-pointers-00' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-hardie-p2poverlay-pointers-00.txt' />
</reference>

    </references>

    <!--
            
        <t>The forwarding layer is responsible for looking at message and
        doing one of three things:</t>

        <t><list style="symbols">
            <t>Deciding the message was destined for this peer and passing the
            message up to the layer above this.</t>

            <t>Looking at the Node-ID that represents the next peer to send
            the message too and if there is an existing connection, sending
            the message over the connection.</t>

            <t>Requesting the overlay Routing logic to tell the forwarding layer
            which peer the message needs to be forwarded to (based on the
            target Node-ID or resource-id), and then sending the message.</t>
          </list></t>
-->

    <!--
        <section anchor="sec-via-list" title="Via Lists">
    <t>
      [TODO: BBL; I would merge this into the symmetric section
      and try to trim a bit.]
    </t>
          <t>In a general messaging system, messages need a source and a
          destination and peers need to be able to send a response to the peer
          that sent the request. This can be particularly tricky in overlay
          networks when a new peer is joining, or the overlay network is
          stabilizing and different peers have different ideas on what the
          overlay topology is. A simple and reliable way to make sure that a
          response can reach the node that sent the request in these
          situations is to have the response traverse the reverse path of the
          request.</t>

          <t>The approach used here is to have each node the request traverses
          add its Node-ID to the "via list" in the request. Then the response
          is routed by looking at the list and using it as list of peers that
          the response will be routed thorough. To support this, each message
          has a destination list of nodes it needs to be routed through as
          well as a via list of what nodes it has traversed.</t>

          <t>When a peer receives a message from the Transport Layer, it adds
          the Node-ID of the node it received the message from to the end of
          the via list. When a peer goes to transmit a message to the
          Transport Layer, it looks at the first entry on the destination
          list. If the entry is this peer, it removes this entry from the list
          and looks at the next entry and if the entry is not this peer, it
          sends the message to the first peer on the destination list.</t>

          <t>When a peer goes to send a response to a request, it can simply
          copy the via list in reverse to form the destination list for the
          response if it wishes to route the response along the reverse path
          as the request.</t>

          <t>Peers that are willing to maintain state may do list compression
          for privacy reason and to reduce the message size. They do this by
          taking some number of entries off the via list and replacing them
          with a unique entry that this peer can later identify. Later, if the
          peer sees the unique entry in a destination list, it removes the
          unique entry and replaces it with the all the entries removed from
          the original via list (and reverses the order of these entries).
          Note that this technique will generally require storing some
          per-message state on the intermediate peer, so this is a
          bandwidth/per-peer state tradeoff. The exception is if the list is
          not compressed but rather the Node-IDs are simply encrypted.</t>

          <t>The via list approach provides several features. First it allows
          a response to follow the same path as the request. This is
          particularly important for peers that are sending requests while
          they are joining and before other peers can route to them as well as
          situations where message are being exchanged to stabilize the
          overlay network. It also makes it easier to diagnose and manage the
          system when all peers see the response to any request they
          forward.</t>
        </section>
-->
  </back>
</rfc>

PAFTECH AB 2003-20262026-04-23 10:15:00