P2PSIP                                                       C. Jennings
Internet-Draft                                                     Cisco
Intended status:  Standards Track                            B. Lowekamp
Expires:  May 21, 2008                         SIPeerior; William & Mary
                                                             E. Rescorla
                                                       Network Resonance
                                                            J. Rosenberg
                                                       November 18, 2007

                REsource LOcation And Discovery (RELOAD)

Status of this Memo

   By submitting this Internet-Draft, each author represents that any
   applicable patent or other IPR claims of which he or she is aware
   have been or will be disclosed, and any of which he or she becomes
   aware will be disclosed, in accordance with Section 6 of BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at

   The list of Internet-Draft Shadow Directories can be accessed at

   This Internet-Draft will expire on May 21, 2008.

Copyright Notice

   Copyright (C) The IETF Trust (2007).


   This document defines REsource LOcation And Discovery (RELOAD), a
   peer-to-peer (P2P) binary signaling protocol for usage on the
   Internet.  A P2P signaling protocol provides its clients with an

Jennings, et al.          Expires May 21, 2008                  [Page 1]

Internet-Draft                   RELOAD                    November 2007

   abstract hash table 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 it can be utilized
   by other applications with similar requirements by defining new
   usages that specify the data types that must be stored for a
   particular application, such as location for SIP.  RELOAD defines a
   security model based on a certificate enrollment service that
   provides unique identities.  NAT traversal is a fundamental service
   of the protocol.

   This draft represents a concrete proposal for the P2PSIP Peer
   Protocol.  The protocol described here builds on the lessons and
   experiences from designing and implementing the dSIP, ASP, and RELOAD
   protocols and is a merge of features from RELOAD-01 and ASP.

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  5
     1.1.  Architecture . . . . . . . . . . . . . . . . . . . . . . .  6
       1.1.1.  Usage Layer  . . . . . . . . . . . . . . . . . . . . .  7
       1.1.2.  Overlay Routing and Storage Layer  . . . . . . . . . .  8
       1.1.3.  Forwarding Layer . . . . . . . . . . . . . . . . . . .  9
     1.2.  Security . . . . . . . . . . . . . . . . . . . . . . . . .  9
   2.  Terminology  . . . . . . . . . . . . . . . . . . . . . . . . .  9
   3.  Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
     3.1.  Distributed Storage Layer  . . . . . . . . . . . . . . . . 11
       3.1.1.  DHT Concepts . . . . . . . . . . . . . . . . . . . . . 11
       3.1.2.  DHT Topology . . . . . . . . . . . . . . . . . . . . . 12
       3.1.3.  Routing  . . . . . . . . . . . . . . . . . . . . . . . 12
       3.1.4.  Storing and Retrieving Typed Data  . . . . . . . . . . 14
       3.1.5.  Joining, Leaving, and Maintenance  . . . . . . . . . . 15
     3.2.  Forwarding Layer . . . . . . . . . . . . . . . . . . . . . 15
       3.2.1.  Forming Direct Connections . . . . . . . . . . . . . . 16
       3.2.2.  Via Lists  . . . . . . . . . . . . . . . . . . . . . . 16
       3.2.3.  Clients  . . . . . . . . . . . . . . . . . . . . . . . 17
     3.3.  Transport Layer  . . . . . . . . . . . . . . . . . . . . . 18
     3.4.  Enrollment . . . . . . . . . . . . . . . . . . . . . . . . 18
       3.4.1.  Certificate Issuance . . . . . . . . . . . . . . . . . 19
       3.4.2.  Bootstrap  . . . . . . . . . . . . . . . . . . . . . . 19
     3.5.  Security . . . . . . . . . . . . . . . . . . . . . . . . . 20
       3.5.1.  Certificate-Based Security . . . . . . . . . . . . . . 20
       3.5.2.  Shared-Key Security  . . . . . . . . . . . . . . . . . 21
     3.6.  Migration  . . . . . . . . . . . . . . . . . . . . . . . . 22
     3.7.  Usages Layer . . . . . . . . . . . . . . . . . . . . . . . 22
       3.7.1.  SIP Usage  . . . . . . . . . . . . . . . . . . . . . . 23
       3.7.2.  Certificate Store Usage  . . . . . . . . . . . . . . . 25
       3.7.3.  TURN Usage . . . . . . . . . . . . . . . . . . . . . . 25

Jennings, et al.          Expires May 21, 2008                  [Page 2]

Internet-Draft                   RELOAD                    November 2007

       3.7.4.  Other Usages . . . . . . . . . . . . . . . . . . . . . 25
   4.  Base Protocol  . . . . . . . . . . . . . . . . . . . . . . . . 26
     4.1.  Forwarding Header  . . . . . . . . . . . . . . . . . . . . 26
       4.1.1.  Changes to Forwarding Header . . . . . . . . . . . . . 29
       4.1.2.  Message Routing  . . . . . . . . . . . . . . . . . . . 30
       4.1.3.  Fragmentation and Reassembly . . . . . . . . . . . . . 32
       4.1.4.  Route Logging  . . . . . . . . . . . . . . . . . . . . 32
     4.2.  Message Contents Format  . . . . . . . . . . . . . . . . . 34
       4.2.1.  Common Header  . . . . . . . . . . . . . . . . . . . . 35
       4.2.2.  Payload  . . . . . . . . . . . . . . . . . . . . . . . 35
       4.2.3.  Signature  . . . . . . . . . . . . . . . . . . . . . . 35
     4.3.  Response Codes and Response Errors . . . . . . . . . . . . 37
     4.4.  Timeout and Retransmission . . . . . . . . . . . . . . . . 39
   5.  Method Definitions . . . . . . . . . . . . . . . . . . . . . . 39
     5.1.  Connection Management  . . . . . . . . . . . . . . . . . . 39
       5.1.1.  PING . . . . . . . . . . . . . . . . . . . . . . . . . 39
       5.1.2.  CONNECT  . . . . . . . . . . . . . . . . . . . . . . . 41
       5.1.3.  TUNNEL . . . . . . . . . . . . . . . . . . . . . . . . 44
     5.2.  Data Storage and Retrieval . . . . . . . . . . . . . . . . 46
       5.2.1.  STORE  . . . . . . . . . . . . . . . . . . . . . . . . 46
       5.2.2.  FETCH  . . . . . . . . . . . . . . . . . . . . . . . . 53
       5.2.3.  REMOVE . . . . . . . . . . . . . . . . . . . . . . . . 57
       5.2.4.  FIND . . . . . . . . . . . . . . . . . . . . . . . . . 58
     5.3.  DHT Maintenance  . . . . . . . . . . . . . . . . . . . . . 60
       5.3.1.  JOIN . . . . . . . . . . . . . . . . . . . . . . . . . 60
       5.3.2.  LEAVE  . . . . . . . . . . . . . . . . . . . . . . . . 61
       5.3.3.  UPDATE . . . . . . . . . . . . . . . . . . . . . . . . 61
   6.  ICE and Connection Formation . . . . . . . . . . . . . . . . . 61
     6.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . . 62
     6.2.  Collecting STUN Servers  . . . . . . . . . . . . . . . . . 63
     6.3.  Gathering Candidates . . . . . . . . . . . . . . . . . . . 64
     6.4.  Encoding the CONNECT Message . . . . . . . . . . . . . . . 64
     6.5.  Verifying ICE Support  . . . . . . . . . . . . . . . . . . 65
     6.6.  Role Determination . . . . . . . . . . . . . . . . . . . . 65
     6.7.  Connectivity Checks  . . . . . . . . . . . . . . . . . . . 66
     6.8.  Concluding ICE . . . . . . . . . . . . . . . . . . . . . . 66
     6.9.  Subsequent Offers and Answers  . . . . . . . . . . . . . . 66
     6.10. Media Keepalives . . . . . . . . . . . . . . . . . . . . . 66
     6.11. Sending Media  . . . . . . . . . . . . . . . . . . . . . . 66
     6.12. Receiving Media  . . . . . . . . . . . . . . . . . . . . . 67
   7.  Chord Algorithm  . . . . . . . . . . . . . . . . . . . . . . . 67
     7.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . . 67
     7.2.  Routing  . . . . . . . . . . . . . . . . . . . . . . . . . 67
     7.3.  Redundancy . . . . . . . . . . . . . . . . . . . . . . . . 68
     7.4.  Joining  . . . . . . . . . . . . . . . . . . . . . . . . . 68
     7.5.  UPDATEs  . . . . . . . . . . . . . . . . . . . . . . . . . 69
       7.5.1.  Sending UPDATEs  . . . . . . . . . . . . . . . . . . . 70
       7.5.2.  Receiving UPDATEs  . . . . . . . . . . . . . . . . . . 70

Jennings, et al.          Expires May 21, 2008                  [Page 3]

Internet-Draft                   RELOAD                    November 2007

       7.5.3.  Stabilization  . . . . . . . . . . . . . . . . . . . . 71
     7.6.  Leaving  . . . . . . . . . . . . . . . . . . . . . . . . . 72
   8.  Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . . 72
     8.1.  Discovery  . . . . . . . . . . . . . . . . . . . . . . . . 72
     8.2.  Overlay Configuration  . . . . . . . . . . . . . . . . . . 72
     8.3.  Credentials  . . . . . . . . . . . . . . . . . . . . . . . 74
     8.4.  Locating a Peer  . . . . . . . . . . . . . . . . . . . . . 74
   9.  Usages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
     9.1.  Generic Usage Requirements . . . . . . . . . . . . . . . . 75
     9.2.  SIP Usage  . . . . . . . . . . . . . . . . . . . . . . . . 76
       9.2.1.  SIP-REGISTRATION type  . . . . . . . . . . . . . . . . 76
       9.2.2.  GRUUs  . . . . . . . . . . . . . . . . . . . . . . . . 78
       9.2.3.  SIP Connect  . . . . . . . . . . . . . . . . . . . . . 78
       9.2.4.  SIP Tunnel . . . . . . . . . . . . . . . . . . . . . . 78
     9.3.  TURN Usage . . . . . . . . . . . . . . . . . . . . . . . . 79
     9.4.  Certificate Store Usages . . . . . . . . . . . . . . . . . 82
   10. Security Considerations  . . . . . . . . . . . . . . . . . . . 83
     10.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . 83
     10.2. Attacks on P2P Overlays  . . . . . . . . . . . . . . . . . 84
     10.3. Certificate-based Security . . . . . . . . . . . . . . . . 84
     10.4. Shared-Secret Security . . . . . . . . . . . . . . . . . . 85
     10.5. Storage Security . . . . . . . . . . . . . . . . . . . . . 86
       10.5.1. Authorization  . . . . . . . . . . . . . . . . . . . . 86
       10.5.2. Distributed Quota  . . . . . . . . . . . . . . . . . . 87
       10.5.3. Correctness  . . . . . . . . . . . . . . . . . . . . . 87
       10.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . . 87
     10.6. Routing Security . . . . . . . . . . . . . . . . . . . . . 88
       10.6.1. Background . . . . . . . . . . . . . . . . . . . . . . 88
       10.6.2. Admissions Control . . . . . . . . . . . . . . . . . . 89
       10.6.3. Peer Identification and Authentication . . . . . . . . 89
       10.6.4. Protecting the Signaling . . . . . . . . . . . . . . . 90
       10.6.5. Residual Attacks . . . . . . . . . . . . . . . . . . . 90
     10.7. SIP-Specific Issues  . . . . . . . . . . . . . . . . . . . 90
       10.7.1. Fork Explosion . . . . . . . . . . . . . . . . . . . . 91
       10.7.2. Malicious Retargeting  . . . . . . . . . . . . . . . . 91
       10.7.3. Privacy Issues . . . . . . . . . . . . . . . . . . . . 91
   11. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
   12. Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 91
   13. Appendix: Operation with SIP clients outside the DHT domain  . 91
   14. Appendix: Notes on DHT Algorithm Selection . . . . . . . . . . 91
   15. References . . . . . . . . . . . . . . . . . . . . . . . . . . 92
     15.1. Normative References . . . . . . . . . . . . . . . . . . . 92
     15.2. Informative References . . . . . . . . . . . . . . . . . . 93
   Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 94
   Intellectual Property and Copyright Statements . . . . . . . . . . 96

Jennings, et al.          Expires May 21, 2008                  [Page 4]

Internet-Draft                   RELOAD                    November 2007

1.  Introduction

   This document defines REsource LOcation And Discovery (RELOAD), a
   peer-to-peer (P2P) signaling protocol for usage on the Internet.  It
   provides a Distributed Hash Table (DHT) service, which allows
   participating nodes to read and write entries into a hash table that
   is stored collectively among the participants.  RELOAD is a
   lightweight, binary protocol.  It provides several functions that are
   critical for a successful P2P protocol for the Internet.  These are:

   Security Framework:  Security is one of the most challenging problems
      in a P2P protocol.  A P2P network will often be established among
      a set of peers none of which trust each other.  Yet, despite this
      lack of trust, the network must operate reliably to allow storage
      and retrieval of data.  RELOAD defines an abstract enrollment
      server, which all entities trust to generate unique identifiers
      for each user.  Using that small amount of trust as an anchor,
      RELOAD defines a security framework that allows for authorization
      of P2P protocol functions and authentication of data stored in the
   Usage Model:  RELOAD is designed to support a variety of
      applications, including P2P multimedia communications with the
      Session Initiation Protocol [I-D.ietf-p2psip-concepts].
      Consequently, RELOAD has the notion of a usage, one of which is
      defined to support each application (this document also defines
      the SIP usage for multimedia communications).  Each usage
      identifies a set of data types that need to be stored and
      retrieved from the DHT (the SIP usage defines data types for
      registrations, certificates, and Traversal Using Relay NAT (TURN)
      [I-D.ietf-behave-turn] servers).  Each type defines a data
      structure, authorization policies, size quota, and information
      required for storage and retrieval in the DHT.  The usage concept
      allows RELOAD to be used with new applications through a simple
      documentation process that supplies the details for each
   NAT Traversal:  Operations for NAT traversal are part of the base
      design, including establishing new RELOAD connections and
      tunneling SIP or other application protocols required by P2PSIP.
      RELOAD makes use of Interactive Connectivity Establishment (ICE)
      [I-D.ietf-mmusic-ice] to facilitate the creation of the P2P
      network and the establishment of links for use by the application
      protocol (SIP and RTP, for example).  RELOAD also defines how
      peers in the P2P network act as STUN and TURN servers and how
      those resources can be discovered through the DHT.  With these
      features, RELOAD can run in modes in which all the peers are
      behind NATs, yet are able to fully participate without imposing
      any constraints on the actual DHT algorithm or routing topology.

Jennings, et al.          Expires May 21, 2008                  [Page 5]

Internet-Draft                   RELOAD                    November 2007

   High Performance Routing:  The very nature of DHT 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 to reduce
      the amount of bandwidth and processing required of peers.  It does
      so by using a very lightweight binary protocol, and furthermore,
      by defining a packet structure that facilitates low-complexity
      forwarding, including hardware-based forwarding.  In particular, a
      fixed-length header is used for routing the message through the
      overlay without the contents needing to be parsed by (or even
      visible to) intermediate peers.  The header includes no
      information about specific IP addresses because none are needed to
      route along an overlay.  The header only includes lists of peers
      which the message should be routed through/too, as well as some
      minor options and version flags.  Clearly separating the header
      components necessary for routing from the message contents
      simplifies processing and increases security.
   Transport Flexibility:  RELOAD has native support for both DTLS and
      TLS for the underlying transport protocol, with support for DTLS
      over UDP as mandatory to implement.  TLS over TCP is preferred
      because it has better bulk performance and connection stability,
      but UDP is more likely to provide direct connections between peers
      in the presence of NATs.  Explicit support for fragmentation is
      provided and required when using UDP.  Because there is no single
      universally available and suitable transport protocol, the peer
      protocol must be flexible in this regard.  New transports can be
      supported trivially.
   Pluggable DHT Algorithms:  RELOAD has been designed with an abstract
      interface to the DHT layer to simplify implementing a variety of
      DHT algorithms.  This specification also defines how RELOAD is
      used with Chord, which is mandatory to implement.  Specifying a
      default "must implement" DHT will allow interoperability, while
      the extensibility allows selection of DHTs optimized for a
      particular application.

   These properties were designed specifically to meet the requirements
   for a P2P protocol to support SIP.  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 [I-D.ietf-p2psip-concepts].

1.1.  Architecture

   Architecturally this specification splits into several layers, as
   shown in the following figure.

Jennings, et al.          Expires May 21, 2008                  [Page 6]

Internet-Draft                   RELOAD                    November 2007


          -------------------------------------- Usage-defined API
            +-------+  +-------+
Usage       | SIP   |  | XMPP  |  ...
Layer       | Usage |  | Usage |
            +-------+  +-------+
          -------------------------------------- Distributed Storage API

Overlay     Overlay              +-------------+
Routing &   Routing &    +----+  | +-----+     |
Storage     Replication  | DB |  | |Chord| ... | Topology
Layer       Logic        +----+  | |     |     | Plugins
                                 | +-----+     |
                               +------+ +-----+
Forwarding     Forwarding &    | STUN | | ICE |
Layer          Encoding Logic  +------+ +-----+
          -------------------------------------- Common Packet Encoding
Transport     +-------+  +------+
Layer         |TLS    |  |DTLS  |
              +-------+  +------+

   The three layers defined by RELOAD include:
   Usage Layer:  Provides an application-specific interface that maps an
      application's requirements onto the generic services of the DHT.
   Overlay Routing & Storage Layer:  Implements the DHT.  Chooses what
      links to establish to form the DHT's overlay network, manages the
      storage and migration of data for this peer and on behalf of other
      peers, and performs searches for requested data across the DHT.
   Forwarding Layer:  Provides services analogous to the Link Layer in
      the IP model.  Also handles setting up connections across NATs
      using ICE.

1.1.1.  Usage Layer

   The top layer, called the Usage Layer, has application usages, such
   as the SIP Location Usage, that use the abstract distributed storage
   API to store and retrieve data from the DHT.  The goal of this layer
   is to implement application-specific usages of the Overlay Routing
   and Storage Layer below it.  The Usage defines how a specific
   application maps its data into something that can be stored in the
   DHT, where to store the data, how to secure the data, and finally how
   applications can retrieve and use the data.

   The architecture diagram shows both a SIP usage and an XMPP usage.  A
   single application may require multiple usages.  A usage may define

Jennings, et al.          Expires May 21, 2008                  [Page 7]

Internet-Draft                   RELOAD                    November 2007

   multiple types of data that are stored in the overlay and may also
   rely on types originally defined by other usages.  A usage is not
   itself encoded on the wire --- only the types are --- but is rather a
   specification of the functionality that is required for a given

   One usage may depend on another.  For example, the SIP usage depends
   on a Certificate Store usage (not shown in the diagram) to obtain the
   certificates required to authenticate messages.  Because certificates
   are stored in standard X.509 form, there is no reason for each usage
   to specify this service independently.

1.1.2.  Overlay Routing and Storage Layer

   The Overlay Routing and Storage Layer stores and retrieves
   information, performs maintenance of the DHT as peers join and leave
   the DHT, and routes messages on the overlay.  The DHT implementation
   is provided by a pluggable component so that each overlay can select
   an appropriate DHT that relies on the common RELOAD core code.

   The Overlay Routing and Replication Logic provides a fairly generic
   interface that allows the DHT implementation to control the overlay
   and resource operations and messages.  Since each DHT is defined and
   functions differently, we generically refer to the table of other
   peers that the DHT maintains and uses to route requests (neighbors)
   as a Routing Table.  The Logic component makes queries to the DHT's
   Routing Table to determine the next hop, then encodes and sends the
   message itself.  Similarly, the DHT issues periodic update requests
   through the logic component to maintain and update its Routing Table.

   The DHT shown in the illustration is Chord, but a variety of DHT
   algorithms are possible through a pluggable interface.  A single node
   could be functioning in multiple overlays simultaneously, each using
   its own DHT algorithm.  Each peer is identified by and its location
   in the overlay determined by its Peer-ID that is assigned by the
   enrollment server when the user or peer first enrolls in the overlay.
   The Peer-ID also determines the range of Resource-IDs for which it
   will be responsible.  The exact mapping between these is determined
   by the DHT algorithm used by the overlay, therefore the logic
   component always queries the DHT to determine where a particular
   resource should be stored.

   As peers enter and leave, resources may be stored on different peers,
   so the information related to them is exchanged as peers enter and
   leave.  Redundancy is used to protect against loss of information in
   the event of a peer failure and to protect against compromised or
   subversive peers.  The Logic component notifies the DHT as neighbors
   join and leave, and the DHT updates its Routing Table and issues

Jennings, et al.          Expires May 21, 2008                  [Page 8]

Internet-Draft                   RELOAD                    November 2007

   resource migration requests as appropriate.

1.1.3.  Forwarding Layer

   This 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 required by the
   DHT's Routing Table.  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

1.2.  Security

   RELOAD's security framework is built upon an enrollment server.  The
   enrollment server issues each new peer a certificate that assigns it
   a Peer-ID.  By generating the Peer-IDs randomly and controlling what
   peers are issued certificates, the enrollment server protects against
   many of the attacks on the overlay network.  Similarly, all users are
   issued certificates for their identities by the enrollment server.
   All resources stored on the overlay must be signed by their creator,
   thus ensuring that an attacker cannot forge data belonging to another
   user.  The enrollment process is a one-time-only procedure.  The peer
   or user do not have to communicate further with it once they have
   obtained their certificates.

   TLS or DTLS are used for communication between peers.  In combination
   with the certificates, this provides both confidentiality and
   authentication for communication across the overlay.  Applications
   such as P2PSIP can also make use of the users' certificates to
   achieve secure end-to-end connections at the application layer.

   In addition to the enrollment server model, RELOAD offers a security
   model using a pre-shared-key.  Although this provides significantly
   less security than is provided through an enrollment server, it
   allows ad hoc or ephemeral overlays to be set up with minimal effort
   on the part of the users.

2.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   document are to be interpreted as described in RFC 2119 [RFC2119].

   We use the terminology and definitions from the Concepts and
   Terminology for Peer to Peer SIP [I-D.ietf-p2psip-concepts] draft
   extensively in this document.  Other terms used in this document are

Jennings, et al.          Expires May 21, 2008                  [Page 9]

Internet-Draft                   RELOAD                    November 2007

   defined inline when used and are also defined below for reference.

   The following important terms from the Concepts document are defined
   below for reference.

      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
   DHT Algorithm:  An algorithm that defines the rules for determining
      which peers in a DHT store a particular piece of data and for
      determining a topology of interconnections amongst peers in order
      to find a piece of data.  Examples of DHT algorithms are Chord,
      Bamboo and Tapestry.
   DHT Instance:  A specific hash table and the collection of peers that
      are collaborating to provide read and write access to it.  There
      can be any number of DHT instances running in an IP network at a
      time, and each operates in isolation of the others.
   P2P Network:  Another name for a DHT instance.
   P2P Network Name:  A string that identifies a unique P2P network.
      P2P network names look like DNS names - for example,
      "example.org".  Lookup of such a name in DNS would typically
      return services associated with the DHT, such as enrollment
      servers, bootstrap peers, or gateways (for example, a SIP gateway
      between a traditional SIP and a P2P SIP network called
   Resource-ID:  A non-human-friendly value that identifies some
      resources and which is used as a key for storing and retrieving
      the resource.  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.
   Peer:  A host that is participating in the DHT.  By virtue of its
      participation it can store data and is responsible for some
      portion of the overlay.
   Peer-ID:  A Resource-ID that uniquely identifies a peer.  Peer-IDs 0
      and 2^N - 1 are reserved and are invalid peer-IDs.  A value of
      zero is not used in the wire protocol but can be used to indicate
      an invalid peer in implementations and APIs.  The peer-id of 2^N-1
      is used on the wire protocol as a wildcard.
   Resource:  An object associated with an identifier.  The identifier
      for the object is a string that can be mapped into a Resource-ID
      by using the string as a seed to the hash function.  A SIP
      resource, for example, is identified by its AOR.

Jennings, et al.          Expires May 21, 2008                 [Page 10]

Internet-Draft                   RELOAD                    November 2007

   User:  A human being.

   We also introduce the following important new terms.
   Connection Table:  The set of peers to which a peer is directly
      connected.  This includes peers with which CONNECT handshakes have
      been done but which have not sent any UPDATEs.
   Routing Table:  The set of peers which a peer can use to route DHT
      messages.  In general, these peers will all be on the connection
      table but not vice versa, because some peers will have CONNECTed
      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.
   Seed:  A seed is a string used as an input to a hash function, the
      result of which is a Resource-ID.
   Usage:  A usage is an application that wishes to use the DHT for some
      purpose.  Each application wishing to use the DHT defines a set of
      data types that it wishes to use.  The SIP usage defines the
      location, certificate, STUN server and TURN server data types.

3.  Overview

3.1.  Distributed Storage Layer

   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.

3.1.1.  DHT Concepts

   While very early P2P systems used flood based techniques, most 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 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 Peer-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 Peer-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

Jennings, et al.          Expires May 21, 2008                 [Page 11]

Internet-Draft                   RELOAD                    November 2007

   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, or

   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 search, it
   consults the list of peers it is aware of and contacts the peer with
   the Peer-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.

3.1.2.  DHT Topology

   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. When the Resource-IDs are n-bit
   integers, they are often considered to be arranged in a ring so that
   (2^n)-1 and (0) are consecutive and distance is simply distance
   around the ring.

   Each peer in the DHT is assigned a Peer-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.

3.1.3.  Routing

   The way routing works in a DHT is specified by the specific DHT
   algorithm but the basic concepts are common to most systems.  Each
   peer maintains connections to some other set of peers N. There need
   not be anything special about the peers in N, except that the peer
   has a direct connection to them:  it can reach them without going
   through any other peer.  When it wishes to deliver a message to some
   peer P, it selects some member of N, N_i that is closer to P than
   itself (as a degenerate case, P may be in N).  The peer sends message
   to message to N_i.  At this point two things can happen:

Jennings, et al.          Expires May 21, 2008                 [Page 12]

Internet-Draft                   RELOAD                    November 2007

   Recursive Routing  N_i repeats the same process as P, sending the
      message to one of its peers N_j.  This same process repeats until
      the message is delivered to N.
   Iterative Routing  N_i consults its table of direct connections and
      selects a new peer N_j which is closer to N. It responds to the
      original sending peer with a redirect to N_j.  The original peer
      then sends the message to N_j, where the process repeats until the
      sending peer is redirected to N.

   The advantage of iterative routing is that it consumes less resources
   for the intermediate peers; they only have to send redirect messages
   rather than forwarding requests and responses.  The advantage of
   recursive routing is that it does not require the sending or
   receiving peer to have a rich set of connections to other nodes in
   the overlay.  Thus, iterative routing is problematic in NATed
   networks because there is no way to guarantee that a peer will be
   able to form a connection to whatever peer it is redirected to.

   [[TODO:  The details of which routing strategy are to be used and how
   they are selected are kind of unclear.  This needs WG discussion.]]

   In most DHTs, the peers in N are selected in a particular way.  One
   common strategy is to have them arranged exponentially further away
   from yourself so that any message can be routed in a O(log(N)) steps.
   The details of the routing structure depend on the DHT algorithm,
   however, since it defines the distance metric and the structure of
   the connection table.

   In RELOAD, messages may either be REQUESTS or RESPONSES to REQUESTS.
   Requests are routed as described above.  In principle, responses
   could be routed the same way.  This is called "Asymmetric" routing
   because requests and responses will generally follow different paths
   through the network.  Asymmetric routing makes diagnosis of errors
   difficult because you need to be able to acquire debugging
   information at multiple locations.  In the alternative strategy,
   called "Symmetric" routing, as requests travel through the network
   they accumulate a history of the peers they passed through and
   responses are routed in the opposite direction so that they follow
   the same path in reverse.  RELOAD supports both flavors of routing.

   Symmetric routing is easier to debug.  Symmetric routing is also
   required when the overlay topology is changing.  For example, when a
   new peer is joining the overlay, asymmetric routing cannot work
   because the response would not be able to reach the new peer until it
   has completed the joining process.  Symmetric routing solves this
   situation because the response is routed from the admitting peer
   through the bootstrap peer, thus relying on a path that is already
   known and established.  In order to implement symmetric routing,

Jennings, et al.          Expires May 21, 2008                 [Page 13]

Internet-Draft                   RELOAD                    November 2007

   RELOAD provides the Via List (Section 3.2.2) feature.  Asymmetric
   routing, however, requires no state to be stored in the message (as a
   Via List) or in on-path peers.

   [[TODO:  again, this is a topic that needs WG discussion.  It seems
   like there are situations where symmetric is very desirable (e.g.,
   startup).  It's less clear that asymmetric will have a performance/
   state difference that will be significant.]]

3.1.4.  Storing and Retrieving Typed Data

   The Data Storage Layer provides operations to STORE, FETCH, and
   REMOVE data.  Each location in the DHT is referenced by a single
   integer Resource-ID.  However, each location may contain data
   elements of multiple types.  Furthermore, there may be multiple
   values of each type, as shown below.

                       |            Resource-ID         |
                       |                                |
                       | +------------+  +------------+ |
                       | |   Type 1   |  |   Type 2   | |
                       | |            |  |            | |
                       | | +--------+ |  | +--------+ | |
                       | | | Value  | |  | | Value  | | |
                       | | +--------+ |  | +--------+ | |
                       | |            |  |            | |
                       | | +--------+ |  | +--------+ | |
                       | | | Value  | |  | | Value  | | |
                       | | +--------+ |  | +--------+ | |
                       | |            |  +------------+ |
                       | | +--------+ |                 |
                       | | | Value  | |                 |
                       | | +--------+ |                 |
                       | +------------+                 |

   Each type-id is a code point assigned by IANA.  Note that a type-id
   may be employed by multiple usages and new usages are encouraged to
   use previously defined types where possible.  As part of the type
   definition, protocol designers may define constraints, such as limits
   on size, on the values which may be stored.  For many types, the set
   may be restricted to a single item; some sets may be allowed to
   contain multiple identical items while others may only have unique
   items.  Some typical types of sets that a type definition would use

Jennings, et al.          Expires May 21, 2008                 [Page 14]

Internet-Draft                   RELOAD                    November 2007

   single value:  There can be at most one item in the set and any value
      overwrites the previous item.
   array:  Many values can be stored and addressed by index.
   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.

3.1.5.  Joining, Leaving, and Maintenance

   When a new peer wishes to join the DHT, it must have a peer-id that
   it is allowed to use.  It uses one of the peer-ids in the certificate
   it received from the enrollment server.  The main steps in joining
   the DHT are:

   o  Forming connections to some other peers.
   o  Acquiring the data values this peer is responsible for storing.
   o  Informing the other peers which were previously responsible for
      that data that this peer has taken over responsibility.

   First, the peer ("JP," for Joining Peer) uses the bootstrap
   procedures to find some (any) peer in the DHT.  It then typically
   contacts the peer which would have formerly been responsible for the
   peer's Resource-ID (since that is where in the DHT the peer will be
   joining), the Admitting Peer (AP).  It copies the other peer's state,
   including the data values it is now responsible for and the
   identities of the peers with which the other peer has direct

   The details of this operation depend mostly on the DHT involved, but
   a typical case would be:

   1.  JP sends a JOIN request to AP announcing its intention to join.
   2.  AP sends an OK response.
   3.  AP does a sequence of STOREs to JP to give it the data it will
   4.  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 DHT.
   5.  JP makes its own connections to the appropriate peers in the DHT.

   After this process is completed, JP is a full member of the DHT and
   can process STORE/FETCH requests.

3.2.  Forwarding Layer

   The forwarding layer is responsible for looking at message and doing
   one of three things:

Jennings, et al.          Expires May 21, 2008                 [Page 15]

Internet-Draft                   RELOAD                    November 2007

   o  Deciding the message was destined for this peer and passing the
      message up to the layer above this.
   o  Looking at the peer-id that represents the next peer to send the
      message too and if there is an existing connection, sending the
      message over the connection.
   o  Requesting the DHT Routing logic to tell the forwarding layer
      which peer the message needs to be forwarded to, and then sending
      the message.

3.2.1.  Forming Direct Connections

   As described in Section 3.1.3, a peer maintains a set of direct
   connections to other peers in the DHT.  Consider the case of a peer
   JP just joining the DHT.  It communicates with the admitting peer AP
   and gets the list of the peers in AP's routing table.  Naively, it
   could simply connect to the IP address listed for each peer, but this
   works poorly if some of those peers are behind a NAT or firewall.
   Instead, we use the CONNECT request to establish a connection.

   Say that peer A wishes to form a direct connection to peer B. It
   gathers ICE candidates and packages them up in a CONNECT request
   which it sends to B through usual DHT routing procedures.  B does its
   own candidate gathering and sends back an OK 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 DHT peers.

   In general, a peer needs to maintain connections to all of the peers
   near it in the DHT and to enough other peers to have efficient
   routing (the details depend on the specific DHT).  If a peer cannot
   form a connection to some other peer, this isn't necessarily a
   disaster; DHTs can route correctly even with not 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.

3.2.2.  Via Lists

   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.

Jennings, et al.          Expires May 21, 2008                 [Page 16]

Internet-Draft                   RELOAD                    November 2007

   The approach used to do this is to have each node the request
   traverses add its peer-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 route list of nodes it needs to be routed through
   as well as a via list of what nodes it has traversed.

   When a peer receives a message from the Transport Layer, it adds the
   peer-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 route 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 route list.

   When a peer goes to send a response to a request, it can simply copy
   the via list in reverse to form the route list for the response if it
   wishes to route the response along the reverse path as the request.
   [Discussion is need about if all responses are routed this way or

   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 route 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 peer-ids are simply encrypted.

   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.

3.2.3.  Clients

   RELOAD also allows for the possibility of Client nodes.  A client is
   a node which connects to an admitting peer (or peers) like an
   ordinary peer but never sends a JOIN or an UPDATE.  It is therefore
   in the AP's connection table but not routing table and never is used
   to store any DHT data.  However, because it is reachable through the

Jennings, et al.          Expires May 21, 2008                 [Page 17]

Internet-Draft                   RELOAD                    November 2007

   AP, it can still send and receive messages.  The client MUST still
   have the usual credentials.

   Because the client may only have a connection to a single AP, which,
   due to topology shifts may no longer be the responsible peer, clients
   SHOULD use symmetric routing and should advertise route lists that
   contain both the AP to which they are connected and themselves.
   E.g., if the client has peer-id X and the AP has peer-id Y, the
   client should advertise the route list (Y, X).  This guarantees

   Note that clients MAY also contact APs which are not in fact
   responsible for the client's peer-id.

3.3.  Transport Layer

   This layer sends and receives messages over TLS and DTLS.  For TLS it
   simply pushes the messages into the stream.  For DTLS it takes care
   of fragmentation issues.  The reason for including TLS is the
   improved performance it can offer for bulk transport of data.  The
   reason for including DTLS is that the percentage of the time that two
   devices behind NATs can form a direct connection without a relay is
   much higher for DTLS than for TLS.

3.4.  Enrollment

   Before a new user can join the DHT for the first time, they must
   enroll in the P2P Network for the DHT 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

   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".  An DNS SRV lookup is done on this name for the
   service name p2p_enroll and a proto of tcp.  If the TLD for the name
   is .local, then this DNS SRV lookup is done using
   [I-D.cheshire-dnsext-multicastdns] 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

Jennings, et al.          Expires May 21, 2008                 [Page 18]

Internet-Draft                   RELOAD                    November 2007

   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 DHT, information about the DHT 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 DHT.  The DHT also
   informs the peers what Usages it is required to support to be a peer
   on this P2P Network.  An initial list of bootstrap nodes that consist
   of multiple bootstrap entries that each have the IP address and port
   for contacting a bootstrap server.  Some of the address may be
   multicast addresses.  In the case of multicast DNS, every peer may
   also act as an enrollment server.

   If shared-key security (Section 3.5.2) is being used, then the peer
   can proceed directly to bootstrap.  If certificate-based security
   (Section 3.5.1 is being used, the peer MUST contact the credential
   server to obtain a certificate.

3.4.1.  Certificate Issuance

   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 their public key.  The
   properties of the certificate are discussed more in Section 3.5.  The
   amount of authentication performed here can vary radically depending
   on the DHT network being joined.  Some networks may do no
   verification at all and some may require extensive identity
   verification.  The only invariant that the enrollment server needs to
   ensure is that no two users may have the same identity.

3.4.2.  Bootstrap

   The above steps are only done the first time a peer joins a new
   overlay or when the overlay parameters are close to expiring and need
   to be refreshed.  The next step is the bootstrap step which is done
   every time the peer boots.

   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.

Jennings, et al.          Expires May 21, 2008                 [Page 19]

Internet-Draft                   RELOAD                    November 2007

3.5.  Security

3.5.1.  Certificate-Based Security

   The certificate-based security model revolves around the enrollment
   process allocating a unique name to the user and issuing a
   certificate [RFC3280] for a public/private key pair for the user.
   All peers in a particular DHT can verify these certificates.  A given
   peer acts on behalf of a user, and that user is somewhat responsible
   for its operation.

   The certificate serves two purposes:

   o  It entitles the user to store data at specific locations in the
   o  It entitles the user to operate a peer that has a peer-id found in
      the certificate.  When the peer is acting as a DTLS or TLS server,
      it can use this certificate so that a client connecting to it
      knows it is connected to the correct server.

   When a user enrolls, or enrolls a new device, the user is given a
   certificate.  This certificate contains information that identifies
   the user and the device they are using.  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.

   The contents of the certificate include:

   o  A public key provided by the user.
   o  Zero, one, or more user names that the DHT is allowing this user
      to use.  For example, "alice@example.org".  Typically a
      certificate will have one name.  In the SIP usage, this name
      corresponds to the AOR.
   o  Zero, one, or more peer-ids.  Typically there will be one peer-id.
      Each device will use a different peer-id, even if two devices
      belong to the same user.  Peer-IDs should be chosen randomly by
      the enrollment server.
   o  A serial number that is unique to this certificate across all the
      certificates issued for this DHT.
   o  An expiration time for the certificate.

   Note that because peer-IDs are chosen randomly, they will be randomly
   distributed with respect to the user name.  This has the result that
   any given peer is highly unlikely to be responsible for storing data
   corresponding to its own user, which promotes high availability.

Jennings, et al.          Expires May 21, 2008                 [Page 20]

Internet-Draft                   RELOAD                    November 2007  Storage Permissions

   When a peer uses a STORE request to place data at a particular
   location X, it must sign with the private key that corresponds to a
   certificate that is suitable for storing at location X. Each data
   type in a usage defines the exact rules for determining what
   certificate is appropriate.  However, the most natural rule is that a
   certificate for a user name or peer-id X is a permission to store
   data at the same resource id that would be found by an attempt to
   look up X.

   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 undetectably
   modify it.  Peer Permissions

   The second purpose of a certificate is to allow the device to act as
   a peer with the specified peer-ID.  When a peer wishes to connect to
   peer X, it forms a TLS/DTLS connection to the peer and then performs
   TLS mutual authentication and verifies that the presented certificate
   contains peer-ID X.

   Note that because the formation of a connection between two nodes
   generally requires traversing other nodes in the DHT, as specified in
   Section 3.2.1, those nodes can interfere with connection initiation.
   However, if they attempt to impersonate the target peer they will be
   unable to complete the TLS mutual authentication:  therefore such
   attacks can be detected.  Expiry and Renewal

   At some point before the certificate expires, the user will need to
   get a new certificate from the enrollment server.

3.5.2.  Shared-Key Security

   RELOAD also defines a shared-key security model which can be used in
   closed networks where the peers are not mutually suspicious.  In this
   model, the peers all share a single key which is used to authenticate
   the peer-to-peer DTLS connections via TLS-PSK.  If shared-key
   security mode is in use, a TLS-PSK cipher suite MUST be used.  This
   is useful for admission control, but is completely unsafe in any
   setting where peers are not mutually trusted, since it allows any

Jennings, et al.          Expires May 21, 2008                 [Page 21]

Internet-Draft                   RELOAD                    November 2007

   peer to impersonate any other peer.

3.6.  Migration

   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 basically 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.

3.7.  Usages Layer

   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 needs to specify several things:

   o  Register code points for any type that the Usage defines.
   o  Define the data structure for each of the types.
   o  Define access control rules for each type.
   o  Provide a size limit for each type.
   o  Define how the seed is formed that is hashed to form the
      Resource-ID where each type is stored.
   o  Describe 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 storing times
      associated with (and carried in) their values.

   The types 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 type.

Jennings, et al.          Expires May 21, 2008                 [Page 22]

Internet-Draft                   RELOAD                    November 2007

3.7.1.  SIP Usage

   From the perspective of P2PSIP, the most important usage is the SIP
   Usage.  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 Bob's SIP UA can use to pass SIP messages back and
   forth to Alice's SIP UA.

   This is done using three key operations that are provided by the SIP
   Usage.  They are:

   o  Mapping SIP URIs that are not GRUUs to other SIP URIs or to the
      DHT peer responsible for the SIP UA.
   o  Mapping SIP GRUUs to the DHT peer responsible for the SIP UA.
   o  Forming a connection directly to a DHT peer that is used to send
      SIP messages to the SIP UA.

   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 [RFC3263] procedures.  Note
   that unless the P2PSIP overlay provides some kind of SIP gateway,
   this is likely to be only partially successful, since, for instance,
   the callee may not be able to call back.  SIP Location

   A peer acting as a SIP UA stores their registration information in
   the DHT by storing either another URI (for retargeting) or a route
   lists to reach them at a Resource-ID in the DHT 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 or Record (AOR) and using it as the
   seed that is hashed to get a Resource-ID.  When the seed is
   dereferenced, the result is a set of values.  Each value is either
   another SIP URI or a route list.  If the value is a SIP URI, the
   calling peer looks up that URI and continues the process until he
   gets a route list.

   If the value is a route list, then it is used to reach a peer that
   represents a SIP UA registered for that AOR.  Typically this route
   list will have just one entry but in the case of peers or clients
   that can not be directly reached, a route list with more than one
   entry may need to be used.

Jennings, et al.          Expires May 21, 2008                 [Page 23]

Internet-Draft                   RELOAD                    November 2007

   The seed for this usage is a user's SIP AOR, such as
   "sip:alice@example.com".  This allows the set to store many values
   but only one for each peer.  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

   Open Issue:  Should the seed be "sip:alice@example.com",
   "alice@example.com", or a string that includes the code point defined
   for the type?  The issue here is determining whether different usages
   that store data at a seed 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 seed 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?  SIP GRUUs

   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 route list that will reach the peer.
   Typically the route list is just a single entry with the peer-id of
   peer.  SIP Connect

   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 DHT, but it
   allows the CONNECT 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.

   The CONNECT 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.  SIP Tunnel

   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 CONNECT.  This allows a SIP message to be sent
   immediately, without the delay associated with CONNECT and for a
   simple SIP exchange, it may result in fewer messages being sent.

Jennings, et al.          Expires May 21, 2008                 [Page 24]

Internet-Draft                   RELOAD                    November 2007

3.7.2.  Certificate Store Usage

   This usage allows each user to store their certificate in the DHT 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 DHT, 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 DHT has received.

3.7.3.  TURN Usage

   This usage defines a new type 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 DHT.  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.

3.7.4.  Other Usages

   This will likely be left out of scope of the initial system but just
   to give people a flavor of how these issues might be dealt with....  Storing Buddy Lists

   Buddy lists with reciprocal subscribes - when see indication buddy
   might be online, such as SUBSCRIBE from buddy, retry SUBSCRIBE to
   buddy.  Subscriber ends up doing composition.

   Single users with different devices can synchronize buddy lists when
   both are online  Storing Users' VCards  Finding Voicemail Message Recorder

   Voicemail is a complicated problem because the amount of storage
   required to store a voicemail message can be large.  Some proposed
   designs may require peers to store voicemail and others may require
   users to provide their own storage and delivery systems.
   Accordingly, this is being left out of the base protocol.

Jennings, et al.          Expires May 21, 2008                 [Page 25]

Internet-Draft                   RELOAD                    November 2007

4.  Base Protocol

   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, just
   define theses in a fixed position as adding a type and length for
   them is unnecessary and would simply increases bandwidth and
   introduces new potentials for interoperability issues.

   Each message has three parts:

   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.
   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.
   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.

   The following sections describe the format of each part of the

4.1.  Forwarding Header

   The layout of the forwarding header is shown below

Jennings, et al.          Expires May 21, 2008                 [Page 26]

Internet-Draft                   RELOAD                    November 2007

       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      |       R       |       E       |       L       |       O       |
   4  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                           Overlay                             |
   8  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |               |               |F|L|                           |
      |      TTL      |    Routing    |R|F|      Fragment Offset      |
      |               |               |A|R|                           |
      |               |               |G|G|                           |
   12 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |E|             |                                               |
      |X|  Version    |                    Length                     |
      |P|             |                                               |
   16 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        Transaction ID                         |
      +                                                               +
      |                                                               |
   24 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     Route     |      Via      |                               |
      |     List      |      List     |            Flags              |
      |     Length    |     Length    |                               |
   28 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                                                               |
      //                          Route List                         //
      |                                                               |
      |                                                               |
      //                           Via List                          //
      |                                                               |
      |                                                               |
      //                          Route Log                          //
      |                                                               |

   The first four bytes identify this message as a RELOAD message.

   The Overlay field is the 32bit checksum/hash of the overlay being
   used.  The CRC-32 checksum MUST be used to convert the variable
   length string representing the overlay name into a 32bit value.  The
   purpose of this field is to allow nodes to participate in multiple
   overlays and to detect accidental misconfiguration.

   TTL (time-to-live) is an 8 bit field indicating the number of

Jennings, et al.          Expires May 21, 2008                 [Page 27]

Internet-Draft                   RELOAD                    November 2007

   iterations, or hops, a message can experience before it is discarded.
   The TTL u_int8 number MUST be stored in network byte order and 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.

   Routing is an 8 bit field that specifies the type of routing the
   requester would like for the message.  The following Routing options
   MUST be understood:

   UNSPECIFIED  : 0x00
   RECURSIVE    : 0x01
   ITERATIVE    : 0x02

   If a peer is unable or unwilling to perform the type of routing
   requested, the peer MUST respond with a 499 error message that
   indicates its unwillingness to process the message.

   FRAG is a 1 bit field used to specify if this message is a fragment.

   NOT-FRAGMENT    : 0x0
   FRAGMENT        : 0x1

   LFRG is a 1 bit field used to specify whether this is the last
   fragment in a complete message.

   LAST-FRAGMENT        : 0x1

   [[Open Issue:  How should 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.]]

   EXP is a 1 bit field that specifies if this protocol is experimental
   or not.  The EXP bit can be set to denote that this version of the
   protocol is private, in-house.  This makes it possible to have
   private protocol versions that don't collide with IETF standards.

   Version is a 7 bit field that indicates the version of the RELOAD
   protocol being used.

   Version1.0       : 0x1

Jennings, et al.          Expires May 21, 2008                 [Page 28]

Internet-Draft                   RELOAD                    November 2007

   The message Length is the count in bytes of the size of the message,
   including the header.

   The Transaction ID is 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

   The Route List Length and the Via List Length contain the lengths of
   the route and via lists respectively, in the number of peer-ids.

   [[Open Issue:  How should we handle peer-id lengths?  This basically
   assumes they're fixed length per DHT algorithm (but not fixed-length
   for RELOAD) so that you can unambiguously parse things.  Should we
   have a length byte?]]

   The flags word contains control flags.  There is one currently
   defined flag.

   ROUTE-LOG       : 0x1

   The ROUTE-LOG flag indicates that the route log should be included
   (see Section 4.1.4

   The Route List contains a sequence of peer-ids which the message
   should pass through.  The route list is constructed by the message
   originator.  The route list shrinks as the message traverses each
   listed peer.

   The Via List contains the sequence of peer-ids through which the
   message has passed.  The via list starts out empty and grows as the
   message traverses each peer.

4.1.1.  Changes to Forwarding Header

   The RELOAD-01 forwarding header was completely fixed, whereas this
   header includes lists that change en-route.  However, this type of
   operation is easily accomplished in both software and hardware,
   therefore we still view it as a low-overhead header.  The changes
   include the following.
   o  Rearranged fields to have a cleaner separation between payload and
   o  Removed DHT, Hash, and Security parameters.  These are now in the
      overlay bootstrap system rather than per-message.

Jennings, et al.          Expires May 21, 2008                 [Page 29]

Internet-Draft                   RELOAD                    November 2007

   o  Source and destination IDs are now route lists to accommodate
      source routing and recursion without state on intermediate peers.
   o  Added route log to header to allow payload/header separation.

4.1.2.  Message Routing  Request Origination

   In order to send a message to a given peer-id or resource-id, a peer
   must construct an appropriate route list.  The most common such route
   list is a single entry containing the peer/resource-id.  This simply
   uses the normal DHT routing mechanisms to forward the message to that

   Messages can also be source routed.  In order to construct a source
   route, the originator provides a route list containing a sequence of
   resource-ids.  The semantics of this route list are that the message
   is to traverse in order (potentially with intermediate hops) each
   entry on the route list.  As each peer is traversed, that entry is
   removed from the route list.  This makes it possible to address a
   peer which is potentially behind a NAT or a firewall in such a way
   that it cannot be connected to directly under any circumstances.  Response Origination

   When a peer sends a response to a request, it SHOULD construct the
   route list by reversing the order of the entries on the via list.
   This has the result that the response traverses (at least) the same
   peers as the request traversed, except in reverse order (symmetric
   routing).  For asymmetric routing, the peer MAY simply use the first
   entry on the via list.  Message Receipt and Forwarding

   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 MAY simply
   drop the message.

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

   o  The first entry on the route list is a private id which is being
      used for route list compression.

Jennings, et al.          Expires May 21, 2008                 [Page 30]

Internet-Draft                   RELOAD                    November 2007

   o  The first entry on the route list is an id for which the peer is
   o  The first entry on the route list is for which another peer is

   These cases are handled separately.  Private ID

   If the first entry on the route list is a private id, the peer
   replaces that entry with the store local value that it indexes and
   then re-examines the route list to determine which case now applies.  Responsible ID

   If the first entry on the route list is a id for which the peer is
   responsible, the peer strips the entry off the route list.  If there
   are remaining entries on the route list, the peer then re-examines
   the route list to determine which case now applies.  If the route
   list is now empty, then the message was destined for this peer and it
   MUST pass it to the next layer up.  Other ID

   If neither of the other two cases applies, then the peer MUST forward
   the message towards the first entry on the route list.  This means
   that it MUST select one of the peers in its route table which is
   closer to the first entry than to itself and send the message to that
   peer.  If the first entry on the route list is in the peer's
   connection table, then it SHOULD forward the message to that peer

   When forwarding a message, the peer MUST:

   o  Decrement the TTL value
   o  Update the via list.

   The natural way to update the via list is simply to add the peer-id
   of the peer from which the message was received to the end of the
   list.  However, peers may use any algorithm of their choice provided
   that if the peer received a route list constructed by reversing the
   via list it would be able to route the outgoing message correctly,
   enabling symmetric routing.

   For instance, if node D receives a message from node C with via list
   (A, B), the simple approach is simply to 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 route list, resulting in (D,

Jennings, et al.          Expires May 21, 2008                 [Page 31]

Internet-Draft                   RELOAD                    November 2007

   C, B, A).  When D forwards the response to C, the route list will
   contain (B, A).  However, node D could also list compression and send
   E the via list (X).  E would then use the route list (D, X).  When D
   processes this route list, it MUST detect that X is a compressed
   entry, recover the via list (A, B, C), and reverse that to produce
   the correct route list (C, B, A) before sending it to C.

   Note that if a peer is using list compression and then exits the
   overlay, the message cannot be forwarded and will be dropped.  The
   ordinary timeout and retransmission networks provide stability over
   this type of failure.

4.1.3.  Fragmentation and Reassembly

   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.

   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 prevent denial of
   service attacks, receivers SHOULD time out incomplete fragments.
   [[TODO:  Describe algorithm]]

4.1.4.  Route Logging

   The route logging feature provides diagnostic information about the
   path taken by the request so far and in this manner it is similar in
   function to SIP's [RFC3261] 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.  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 in a request, the route log MUST
   be copied into the response and the ROUTE-LOG flag set so that the
   originator receives the ROUTE-LOG data.

Jennings, et al.          Expires May 21, 2008                 [Page 32]

Internet-Draft                   RELOAD                    November 2007

   STRUCTURE: route_log
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |          Entries Len          |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                            Entries                            |
       /                                                               /
       |                                                               |

   The route log is simply a variable length list of route log entries.
   The first two bytes are the length, followed by a sequence of route
   leg entries, each of which may be individually parsed.

  STRUCTURE: route_log_entry
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |          Version Len          |                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
      |                            Version                            |
      /                                                               /
      |                                                               |
      |   Transport   |                                               |
      +-+-+-+-+-+-+-+-+                                               +
      |                               Id                              |
      +                                                               +
      |                                                               |
      +                                                               +
      |                                                               |
      +               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |               |                     Uptime                    |
      |               |        Certificate Len        |               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
      |                          Certificate                          |
      /                                                               /
      |                                                               |
      |                                                               |
      /                                                               /
      |                            Address                            |
      /                                                               /
      |                                                               |

Jennings, et al.          Expires May 21, 2008                 [Page 33]

Internet-Draft                   RELOAD                    November 2007

  STRUCTURE: ip4_address_type
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |      0x01     |                      Addr                     |
  004 +-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |               |              Port             |
  007 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  STRUCTURE: ip6_address_type
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |      0x02     |                                               |
  004 +-+-+-+-+-+-+-+-+                                               +
      |                              Addr                             |
  008 +                                                               +
      |                                                               |
  012 +                                                               +
      |                                                               |
  016 +               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |               |              Port             |
  019 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Each route log entry consists of the following values:
   Version -  A textual representation of the software version
   Transport -  The transport type, 1 for TLS, 2 for DTLS
   Id -  The peer-id of the peer.
   Uptime -  The uptime of the peer in seconds.
   Certificate -  The peer's certificate.  Note that this may be omitted
      by setting the length to zero.
   Address -  The address and port of the peer.

4.2.  Message Contents Format

   Although from the perspective of the forwarding layer the content is
   opaque, all RELOAD messages share a common content structure
   consisting of two parts:

   Common Header:  A common header containing the request method/
      response code, and a transaction ID.
   Payload:  The actual body of the request/response.  These are
      dependent on whether this is a request or response and the type of
      request being carried.

Jennings, et al.          Expires May 21, 2008                 [Page 34]

Internet-Draft                   RELOAD                    November 2007

4.2.1.  Common Header

   The layout of the common header is shown below:

       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      |R|                               |                             |
      |/|              Code             |           Reserved          |
      |r|                               |                             |
    4 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   R/r is a one bit field used to specify if this is a request or a

   REQUEST       : 0x0
   RESPONSE      : 0x1

   Code is a 15 bit field that indicates either the message method or
   the response code (depending on the value of the R/r bit)

4.2.2.  Payload

   Payload is a simple string of uninterpreted bytes preceded by a
   length field indicating the length of the data.  The bytes themselves
   are dependent on the code value.

       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      |                                                               |
      |                             Length                            |
      |                                                               |
    4 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                                                               |
      //                     Length bytes of data                    //
      |                                                               |

4.2.3.  Signature

   The Signature element is used to attach signatures to messages and or
   stored data elements.  All signatures are formatted using this
   element.  However, the input structure to the signature computation

Jennings, et al.          Expires May 21, 2008                 [Page 35]

Internet-Draft                   RELOAD                    November 2007

   varies depending on the data element being signed.

   STRUCTURE: signature
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |   Algorithm   |      Signature Value Len      |               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                        Signature Value                        |
       /                                                               /
       |                                                               |
       |                                                               |
       /                                                               /
       |                            Identity                           |
       /                                                               /
       |                                                               |

   The signature construct is just a container for the signature.  It
   contains the following values:
   Algorithm -  The signature algorithm in use.  This may have the
      values RSA-SHA1 (0x01) or RSA-SHA-256 (0x02).
   Value -   The signature value itself.  This is just the string of
      bytes emitted by the signature algorithm.
   Identity -  The identity or certificate used to form the signature

   A number of possible identity formats are permitted, as shown below.
   The peer may indicate any of:

   o  Peer-id
   o  User name
   o  The certificate itself.

   The first byte of the identity field is a type indicating the type of
   identity in use.

   For signatures over messages the input to the signature function is:

Jennings, et al.          Expires May 21, 2008                 [Page 36]

Internet-Draft                   RELOAD                    November 2007

   STRUCTURE: message_signature_input
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                            Overlay                            |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                                                               |
   008 +                                                               +
       |                              Xid                              |
   012 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                                                               |
       /                                                               /
       |                        Signer Identity                        |
       /                                                               /
       |                                                               |
       |                                                               |
       /                                                               /
       |                        Message Contents                       |
       /                                                               /
       |                                                               |

   The contents of this structure are as follows:

   Overlay -  The overlay identifier from the message.
   Xid -  The transaction id from the message.
   Signer Identity -  The identify of the signer (from the signature
   Message Contents -  The contents section of the message.

   [[TODO:  Check the inputs to this carefully.]]

   The input to signatures over data values is different, and is
   decribed in Section

4.3.  Response Codes and Response Errors

   A peer processing a request returns its status in the Code field of
   the common header.  If the request was a success, the code should be
   200 (OK) and the payload should be as specified above.  If the
   request failed, then the response code should be as defined below.

Jennings, et al.          Expires May 21, 2008                 [Page 37]

Internet-Draft                   RELOAD                    November 2007

   200 (OK):  Indicates a successful request.  The information returned
      in the response will depend on the request method.
   302 (Moved Temporarily):  The requesting peer SHOULD retry the
      request at the new address specified in the 302 response message.
   401 (Unauthorized):  The requesting peer needs to sign and provide a
      certificate.  [[TODO:  The semantics here don't seem quite
   403 (Forbidden):  The requesting peer does not have permission to
      make this request.
   404 (Not Found):  The resource or peer cannot be found or does not
   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.
   412 (Precondition Failed):  A request can't be completed because some
      precondition was incorrect.  For instance, the wrong generation
      counter was provided
   498 (Incompatible with Overlay)  A peer receiving the request is
      using a different overlay, DHT algorithm, or hash algorithm.
      [[Open Issue:  What is the best error number and reason phrase to
   499 (UnWilling To Proxy)  A peer receiving the request is unwilling
      to support the Routing mechanism specified in the Routing field of
      the message header.  [[Open Issue:  What is the best error number
      and reason phrase to use?]]

   For any code other than 200, the payload should be as defined below:

   STRUCTURE: error_response
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |       Reason Phrase Len       |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                         Reason Phrase                         |
       /                                                               /
       |                                                               |
       |         Error Info Len        |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                           Error Info                          |
       /                                                               /
       |                                                               |

   The contents of this payload are:

Jennings, et al.          Expires May 21, 2008                 [Page 38]

Internet-Draft                   RELOAD                    November 2007

   Reason Phrase -  A freeform text string indicating the reason for the
      response.  The reason phrase SHOULD BE as indicated in the above
      list (e.g., "Moved Temporarily).
   Error Info -  Payload specific error information.  This MUST be empty
      except as specified below.

   For the response code 302, the error-payload-rest is the peer-id of
   the peer to which the request SHOULD be redirected.  This error code
   is used for iterative routing.

4.4.  Timeout and Retransmission

   Timeout and retransmission are handled on an end-to-end basis.  The
   requesting node retransmits requests until it receives a response or
   a timeout.  The retransmit algorithm defined in Section of
   [RFC3261] SHOULD be used.  Retransmissions MUST use the same
   transaction ID.

5.  Method Definitions

   In this section, we define the initial set of methods supported by
   RELOAD.  New methods are defined by adding new method codes.  Each
   method defines the contents of the payload element (see
   Section 4.2.2).

5.1.  Connection Management

5.1.1.  PING

   PING is used to test connectivity along a path.  A ping can be
   addressed to a specific peer-id or to the anycast peer-id (all 1s).
   In either case, the target peer-ids respond with a simple response
   containing some status information.  Request Definition

   STRUCTURE: ping_request
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       | Ping Info Len |                                               |
       +-+-+-+-+-+-+-+-+                                               +
       |                           Ping Info                           |
       /                                                               /
       |                                                               |

Jennings, et al.          Expires May 21, 2008                 [Page 39]

Internet-Draft                   RELOAD                    November 2007

   The PING request contains a list (potentially empty) of the pieces of
   status information that the requester would like the responder to
   provide.  The two currently defined types are:

   NUM-RESOURCES   : 0x02

   RESPONSIBLE-SET indicates that the peer should Respond with the
   fraction of the overlay for which the responding peer is responsible
   (in parts per billion).

   NUM-RESOURCES indicates that the peer should Respond with the number
   of resources currently being stored by the peer.  Response Definition

   STRUCTURE: ping_response
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                                                               |
   004 +                                                               +
       |                          Response Id                          |
   008 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |           Infos Len           |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                             Infos                             |
       /                                                               /
       |                                                               |

   The ping response contains the following elements:
   Response ID -  A randomly generated 64-bit response ID.  This is used
      to distinguish PING responses in cases where the PING request is
   Infos -  A sequence of ping info data structures, as shown below.

Jennings, et al.          Expires May 21, 2008                 [Page 40]

Internet-Draft                   RELOAD                    November 2007

  STRUCTURE: ping_info_data
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |                                                               |
      /                                                               /
      |                              Info                             |
      /                                                               /
      |                                                               |

  STRUCTURE: info_responsible_type
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |      0x01     |             Info Responsible Type             |
  004 +-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |               |
  005 +-+-+-+-+-+-+-+-+

  STRUCTURE: info_num_resources_type
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |      0x02     |            Info Num Resources Type            |
  004 +-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |               |
  005 +-+-+-+-+-+-+-+-+

   The ping info data elements are simple typed elements, with a type
   identifier as the leading 16 bits and then arbitrary (type-specific)
   text following.  In the case of the two defined types, the responses
   are 32-bit integers.

   The responding peer SHOULD include any values that the requesting
   peer requested and that it recognizes.  They SHOULD be returned in
   the requested order.

5.1.2.  CONNECT

   A node sends a CONNECT 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 CONNECT and its response are described in
   Section 6.

Jennings, et al.          Expires May 21, 2008                 [Page 41]

Internet-Draft                   RELOAD                    November 2007


   A CONNECT does not result in updating the routing table of either
   node.  That function is performed by UPDATEs.  If node A has
   CONNECTed to node 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.  Request Definition

Jennings, et al.          Expires May 21, 2008                 [Page 42]

Internet-Draft                   RELOAD                    November 2007

   STRUCTURE: connect_data
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |           Ufrag Len           |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                             Ufrag                             |
       /                                                               /
       |                                                               |
       |          Password Len         |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                            Password                           |
       /                                                               /
       |                                                               |
       |          Application          |        Fingerprint Len        |
       |                                                               |
       /                                                               /
       |                          Fingerprint                          |
       /                                                               /
       |                                                               |
       |            Role Len           |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                              Role                             |
       /                                                               /
       |                                                               |
       |       Candidate List Len      |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                         Candidate List                        |
       /                                                               /
       |                                                               |

   STRUCTURE: candidate
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |      Candidate String Len     |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                        Candidate String                       |
       /                                                               /
       |                                                               |

Jennings, et al.          Expires May 21, 2008                 [Page 43]

Internet-Draft                   RELOAD                    November 2007

   The values contained in connect-request are:

   Ufrag -  The username fragment (from ICE)
   Password -  The ICE password.
   Application -  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.
   Fingerprint -  One fingerprint attribute (from RFC 4572 [RFC4572].
   Role -  An active/passive/actpass attribute from RFC 4145 [RFC4145].
   Candidate -  One or more ICE candidate values.  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.

   These values should be generated using the procedures of Section 6.  Response Definition

   If a peer receives a CONNECT request, it SHOULD follow the procedures
   of Section 6 to process the request and generate its own response,
   containing a connect-data production.  It should then begin ICE
   checks.  When a peer receives a CONNECT response, it SHOULD parse the
   response and begin its own ICE checks.

5.1.3.  TUNNEL

   A node sends a TUNNEL request when it wishes to exchange application-
   layer protocol messages without the expense of establishing a direct
   connection via CONNECT or when ICE is unable to establish a direct
   connection via CONNECT 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.


   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 to establish a voice call might
   be routed over the overlay, a SUBSCRIBE with regular updates would be
   better used with a CONNECT, 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

Jennings, et al.          Expires May 21, 2008                 [Page 44]

Internet-Draft                   RELOAD                    November 2007

   relying on TUNNEL for packet routing.

   When a usage requires the TUNNEL method, it must specify the specific
   application protocol(s) that will be TUNNELed and for each protocol,
   o  An application attribute that indicates the protocol being
      tunneled.  This the IANA-registered port of the application
   o  The conditions under which the application will be TUNNELed over
      the overlay rather than using a direct CONNECT.
   o  A mechanism for moving future application-level communication from
      TUNNELing on the overlay to a direct CONNECTion, or an explanation
      why this is unnecessary.
   o  A means of associating messages together as required for dialog-
      oriented or request/response-oriented protocols.
   o  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.  Request Definition

   STRUCTURE: tunnel_data
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |          Application          |         Dialog Id Len         |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                                                               |
       /                                                               /
       |                           Dialog Id                           |
       /                                                               /
       |                                                               |
       |      Application Pdu Len      |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                        Application Pdu                        |
       /                                                               /
       |                                                               |

   For each of the values indicated here which were originally text,
   they are preceded by a length field of either one or two bytes.

   The values contained in connect-request are:

Jennings, et al.          Expires May 21, 2008                 [Page 45]

Internet-Draft                   RELOAD                    November 2007

   Application -  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.
   Dialog ID -  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
   Application PDU -  An application PDU in the format specified by the
      application.  Response Definition

   A TUNNEL response 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

5.2.  Data Storage and Retrieval

   The STORE, FETCH, and REMOVE methods are used to manipulate
   information in the DHT.  They form an instantiation of the abstract
   GET and PUT operations described in [I-D.ietf-p2psip-concepts].

5.2.1.  STORE

   The STORE method is used to store data in the overlay.  As described
   in Section 3.1.4 each location may contain data of multiple types.
   Each type-id is a code point assigned to a specific application usage
   by IANA.  As part of the Usage definition, protocol designers may
   define constraints, such as limits on size, on the values which may
   be stored.  For many types, the set may be restricted to a single
   item; some sets may be allowed to contain multiple identical items
   while others may only have unique items.  The protocol currently
   defines the following data models:

   o  single value
   o  array
   o  dictionary

   Each type-id MUST specify the appropriate data model for that type.
   The format of the STORE request depends on the data model.

Jennings, et al.          Expires May 21, 2008                 [Page 46]

Internet-Draft                   RELOAD                    November 2007  Request Definition

   A STORE production is a sequence of type-data pairs, each of which
   represents a sequence of stored values for a given type-id.  The same
   type-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.

   STRUCTURE: store_request
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                                                               |
   004 +                                                               +
       |                            Resource                           |
   008 +                                                               +
       |                                                               |
   012 +                                                               +
       |                                                               |
   016 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |         Store Data Len        |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                           Store Data                          |
       /                                                               /
       |                                                               |

   A single STORE request stores data of a number of types to a single
   resource location.  The contents of the request are:
   Resource -  The resource to store at.
   Store Type Data -  A series of elements, one for each type of data to
      be stored.

Jennings, et al.          Expires May 21, 2008                 [Page 47]

Internet-Draft                   RELOAD                    November 2007

   STRUCTURE: store_type_data
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                      Type                     |               |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                           Generation                          |
   008 +                                               +-+-+-+-+-+-+-+-+
       |                                               |               |
   012 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |   Values Len  |                                               |
       +-+-+-+-+-+-+-+-+                                               +
       |                             Values                            |
       /                                                               /
       |                                                               |

   Each store type data element represents the data to be stored for a
   single type-id.  The contents of the element are:
   Type -  The type-id
   Generation -  The expected current state of the generation counter.
   Values -  The value or values to be stored.  This may contain one or
      more stored_data values depending on the data model associated
      with each type-id.

   STRUCTURE: stored_data
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                             Length                            |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                          Storage Time                         |
   008 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                            Lifetime                           |
   012 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                                                               |
       /                                                               /
       |                           Data-value                          |
       /                                                               /
       |                                                               |
       |                                                               |
       /                                                               /
       |                           Signature                           |
       /                                                               /
       |                                                               |

Jennings, et al.          Expires May 21, 2008                 [Page 48]

Internet-Draft                   RELOAD                    November 2007

   Each stored_data element represents a single stored data value.
   These elements are individually signed.  The contents of the element
   are as follows:
   Length -  The length of the stored data element.
   Storage Time -  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 known to
      the receiving peer 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.
   Lifetime -  The validity period for the data, in seconds, starting
      from the time of store.
   Signature -  A signature over the data value.  Section
      describes the signature computation.  The element is formatted as
      described in Section 4.2.3
   Data Value -  The data value itself, as described below.

Jennings, et al.          Expires May 21, 2008                 [Page 49]

Internet-Draft                   RELOAD                    November 2007

   STRUCTURE: single_value_entry
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |           Value Len           |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                             Value                             |
       /                                                               /
       |                                                               |

   STRUCTURE: array_entry
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                             Index                             |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |           Value Len           |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                             Value                             |
       /                                                               /
       |                                                               |

   STRUCTURE: dictionary_entry
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |            Key Len            |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                              Key                              |
       /                                                               /
       |                                                               |
       |           Value Len           |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                             Value                             |
       /                                                               /
       |                                                               |

   The responsible peer MUST perform the following checks:

   o  The type-id is known.
   o  The signature over the message is valid or (depending on overlay
      policy) no signature is required.

Jennings, et al.          Expires May 21, 2008                 [Page 50]

Internet-Draft                   RELOAD                    November 2007

   o  The signatures over each individual data element (if any) are
   o  Each element is signed by a credential which is authorized to
      write this type at this resource-id
   o  If the generation-counter is non-zero, it must equal the current
      value of the generation-counter for this type.  This feature
      allows the generation counter to be used in a way similar to the
      HTTP Etag feature.
   o  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?]]

   If all these checks succeed, the peer MUST attempt to store the data
   values.  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 store-type-data, it is permissible
   for the peer to increase the generation counter by only 1 for the
   entire type-id, or by 1 or more than one for each value.

   We now discuss each type of value.  Single Value

   There may be only one single-value element for each resource-id, type
   pair.  A store of a new single-value element MUST overwrite the
   current value.  Array

   A store of an array entry replaces (or inserts) the given value at
   the location specified by the index.  Arrays are zero-based.  Note
   that arrays can be sparse.  Thus, 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 empty strings.
   If the index value is -1, then the value is placed at the end of the
   array.  Dictionary

   A stored dictionary entry has a dictionary-key used as a lookup key
   and a dictionary-value containing the data.  There may be only one
   value any given dictionary-key and therefore a write to a dictionary-
   key overwrites whatever is there.  Response Definition

   In response to a successful STORE request the peer MUST return a
   series of store_type_response elements containing the current value

Jennings, et al.          Expires May 21, 2008                 [Page 51]

Internet-Draft                   RELOAD                    November 2007

   of the generation counter for each type-id.

   STRUCTURE: store_type_response
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                      Type                     |               |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                           Generation                          |
   008 +                                               +-+-+-+-+-+-+-+-+
       |                                               |
   011 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   The contents of each element are:
   Type -  The type-id being represented.
   Generation -  The current value of the generation counter for that

   The response itself is just the store_type_response values packed

   If the request was rejected because of an invalid generation counter,
   then the store-response MUST also be returned, but with a response
   code of 412.  Otherwise, the response MAY contain a response-error-
   reason production or MAY be empty.  [[TODO:  The generation counter
   may need more thinking for uniqueness.]]  Data Signature Computation

   Each stored-data element is individually signed.  However, the
   signature also must be self-contained and cover the type-id and
   resource-id even though they are not present in the stored value.
   The data signed is defined as:

Jennings, et al.          Expires May 21, 2008                 [Page 52]

Internet-Draft                   RELOAD                    November 2007

   STRUCTURE: stored_data_to_be_signed
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                                                               |
   004 +                                                               +
       |                            Resource                           |
   008 +                                                               +
       |                                                               |
   012 +                                                               +
       |                                                               |
   016 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                      Type                     |               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                          Stored Data                          |
       /                                                               /
       |                                                               |

   The contents of this value are as follows:
   Resource -  The resource ID where this data is stored.
   Type -  The type-id for this data.
   Stored Data -  The contents of the stored data value, as described in
      the stored_data PDU of Section

   [[TODO:  Should we include the identity?.]]

   Once the signature has been computed, the signature is represented
   using a signature element, as described in Section 4.2.3.

5.2.2.  FETCH

   The FETCH request retrieves one or more data elements stored at a
   given resource-id.  Request Definition

   The request consists of a single fetch_request element followed by a
   series of fetch_type_data elements.

Jennings, et al.          Expires May 21, 2008                 [Page 53]

Internet-Draft                   RELOAD                    November 2007

   STRUCTURE: fetch_request
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                                                               |
   004 +                                                               +
       |                            Resource                           |
   008 +                                                               +
       |                                                               |
   012 +                                                               +
       |                                                               |
   016 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |         Fetch Data Len        |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                           Fetch Data                          |
       /                                                               /
       |                                                               |

   The contents of the request are as follows:
   Resource -  The resource ID to fetch from.
   Fetch Data -  A sequence of data specifiers, one for each desired
      type ID.

   Each fetch_type_data element is specified as follows.

   STRUCTURE: fetch_type_data
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                      Type                     |               |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                           Generation                          |
   008 +                                               +-+-+-+-+-+-+-+-+
       |                                               |               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                           Reference                           |
       /                                                               /
       |                                                               |

   Type -  The type of the data being fetched.

Jennings, et al.          Expires May 21, 2008                 [Page 54]

Internet-Draft                   RELOAD                    November 2007

   Generation -  The last generation counter that the requesting peer
      saw.  This is used to avoid unnecessary fetches.
   Reference -  A reference to the data value being requested within the
      data model specified for the type, as specified below.

   STRUCTURE: fetch_array_reference
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                             First                             |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                              Last                             |
   008 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   STRUCTURE: fetch_dictionary_reference
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |      Dictionary Keys Len      |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                        Dictionary Keys                        |
       /                                                               /
       |                                                               |

   STRUCTURE: dictionary_key
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |         Key Value Len         |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                           Key Value                           |
       /                                                               /
       |                                                               |

   As with STORE, the fetch request contains a list of type-ids and
   associated references.  The reference encoding depends on the type of
   value being stored.
   o  If the data is of type single value, the reference is empty.
   o  If the data is of type array, the reference contains 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
      -1 is used to indicate the final element.  The beginning of the
      range MUST be earlier in the array then the end.

Jennings, et al.          Expires May 21, 2008                 [Page 55]

Internet-Draft                   RELOAD                    November 2007

   o  If the data is of type dictionary then the reference 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
      should be returned.

   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 cache hit
   indicator rather than the stored data.

   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.  Response Definition

   STRUCTURE: fetch_response
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                      Type                     |               |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                           Generation                          |
   008 +                                               +-+-+-+-+-+-+-+-+
       |                                               |               |
   012 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |Stored Data Len|                                               |
       +-+-+-+-+-+-+-+-+                                               +
       |                          Stored Data                          |
       /                                                               /
       |                                                               |

   There MUST be one fetch_type_data element for each type-id in the
   request.  If the generation-counter in the request matches the
   generation-counter in the stored data, then the count of stored data
   elements MUST be zero.  Otherwise, all relevant data values MUST be
   returned.  A nonexistent value is represented as a value with an
   empty data value portion and no signature.  In particular, if a
   dictionary key that does not exist is requested, then there must be a
   dictionary entry with that key but an empty value.

Jennings, et al.          Expires May 21, 2008                 [Page 56]

Internet-Draft                   RELOAD                    November 2007

5.2.3.  REMOVE

   The REMOVE request is used to remove a stored element or elements
   from the storing peer.  Although each type-id defines its own access
   control requirements, in general only the original signer of the data
   should be allowed to remove it.  Any successful remove of an existing
   element for a given type-id MUST increment the generation counter by
   at least one.

   A remove-request 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 type-id MUST NOT be used twice in a
   given remove-request.  Each fetch-type-data 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.

   Before processing the REMOVE request, the peer MUST perform the
   following checks.

   o  The type-id is known.
   o  The signature over the message is valid or (depending on overlay
      policy) no signature is required.
   o  The signer of the message has permissions which permit him to
      remove this type of data.
   o  If the generation-counter is non-zero, it must equal the current
      value of the generation-counter for this type.  This feature
      allows the generation counter to be used in a way similar to the
      HTTP Etag feature.

   Assuming that the request is permitted, the operations proceed as
   follows.  Single Value

   A REMOVE of a single value element simple causes it not to exist.  If
   no such element exists, then this simply is a silent success.  Array

   A REMOVE of an array element (or element range) replaces those
   elements with empty 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"].

Jennings, et al.          Expires May 21, 2008                 [Page 57]

Internet-Draft                   RELOAD                    November 2007  Dictionary

   A REMOVE of a dictionary element (or elements) replaces those
   elements with empty elements.  If no such elements exist, then this
   is a silent success.  Response Definition

   The response to a successful REMOVE simply contains a list of the new
   generation counters for each type-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.

5.2.4.  FIND

   The FIND request is used to explore the DHT.  A FIND request for a
   resource-id R and a type-id T retrieves the resource-id (if any) of
   the resource of type T known to the target peer which is closes to R.
   This method can be used to walk the DHT by interactively fetching
   R_n+1=nearest(1 + R_n).  Request Definition

   STRUCTURE: find_request
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                                                               |
   004 +                                                               +
       |                            Resource                           |
   008 +                                                               +
       |                                                               |
   012 +                                                               +
       |                                                               |
   016 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |    Ids Len    |                                               |
       +-+-+-+-+-+-+-+-+                                               +
       |                              Ids                              |
       /                                                               /
       |                                                               |

   The request contains a list of type-ids which the FIND is for, as
   indicated below.

Jennings, et al.          Expires May 21, 2008                 [Page 58]

Internet-Draft                   RELOAD                    November 2007

   Resource -  The desired resource-id
   Ids -  The desired type-ids.  Each value MUST only appear once.  Response Definition

   STRUCTURE: find_type_data
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                      Type                     |               |
   004 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                        Closest Resource                       |
   008 +                                                               +
       |                                                               |
   012 +                                                               +
       |                                                               |
   016 +                                               +-+-+-+-+-+-+-+-+
       |                                               |
   019 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   If the processing peer is not responsible for the specified
   resource-id, it SHOULD return a 404 error.

   When each type is defined, it can indicate if the type 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 type.

   For each type-id in the request the response MUST contain a find-
   response-value indicating the closest resource-id for that type-id
   unless the type is not allowed to be used with FIND in which case a
   find_type_data for that type_id MUST NOT be included in the response.
   If a type-id is not known, then the corresponding resource-id MUST be
   0.  Note that different type-ids may have different closest resource-

   The response is simply a series of find_type_data elements, one per
   type, concatenated end-to-end.  The contents of each element are:
   Type -  The type-id.
   Closest Resource -  The closest resource ID to the specified resource
      ID.  This is 0 if no resource ID is known.

   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.

Jennings, et al.          Expires May 21, 2008                 [Page 59]

Internet-Draft                   RELOAD                    November 2007

5.3.  DHT Maintenance

   This section describes methods that are expected to be useful for all
   DHTs.  These methods have generic semantics (join, leave, update) and
   some common fields, but where appropriate allow room for DHT-specific

5.3.1.  JOIN

   A new peer (but which already has credentials) uses the JOIN message
   to join the DHT.  The JOIN is sent to the peer which previously was
   responsible for the resource-id corresponding to the peer-id which
   the new peer has.  This notifies the responsible peer that the new
   peer is taking over some of the overlay and it needs to synchronize
   its state.

   STRUCTURE: join_request
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                                                               |
   004 +                                                               +
       |                        Desired Peer Id                        |
   008 +                                                               +
       |                                                               |
   012 +                                                               +
       |                                                               |
   016 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                                                               |
       /                                                               /
       |                       Dht Specific Data                       |
       /                                                               /
       |                                                               |

   The default JOIN request contains only the peer-id which the sending
   peer wishes to assume.  DHTs MAY specific other data to appear in
   this request.

   By default, responding peer simply responds with success or failure.
   However, if it is success it 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, DHTs MAY define
   data to appear in the response payload.

Jennings, et al.          Expires May 21, 2008                 [Page 60]

Internet-Draft                   RELOAD                    November 2007

5.3.2.  LEAVE

   The LEAVE message is used to indicate that a peer is exiting the
   overlay.  The peer SHOULD send this message to each peer with which
   it is directly connected prior to exiting the overlay.

   STRUCTURE: leave_request
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                                                               |
   004 +                                                               +
       |                        Leaving Peer Id                        |
   008 +                                                               +
       |                                                               |
   012 +                                                               +
       |                                                               |
   016 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                                                               |
       /                                                               /
       |                       Dht Specific Data                       |
       /                                                               /
       |                                                               |

   The default LEAVE request contains only the peer-id of the leaving
   peer.  DHTs MAY specific other data to appear in this request.

   Upon receiving LEAVE, a peer MUST update its own routing and routing
   table, and send the appropriate STORE/UPDATE sequences to restabilize
   the overlay.

5.3.3.  UPDATE

   Update is the primary DHT-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 and it is up to the recipient to take
   whatever actions are appropriate to deal with the state change.

   The contents of the UPDATE request are completely DHT-specific.  The
   UPDATE response is expected to be either success or an error.

6.  ICE and Connection Formation

   At numerous times during the operation of RELOAD, a node will need to

Jennings, et al.          Expires May 21, 2008                 [Page 61]

Internet-Draft                   RELOAD                    November 2007

   establish a connection to another node.  This may be for the purposes
   of building finger tables when the node joins the P2P network, or
   when the node learns of a new neighbor through an UPDATE and needs to
   establish a connection to that neighbor.

   In addition, a node may need to connect to another node for the
   purposes of an application connection.  In the case of SIP, when a
   node has looked up the target AOR in the DHT, it will obtain a
   Node-ID that identifies that peer.  The next step will be to
   establish a "direct" connection for the purposes of performing SIP

   In both of these cases, the node starts with a destination Node-ID,
   and its objective is to create a connection (ideally using TCP, but
   falling back to UDP when it is not available) to the node with that
   given Node-ID.  The establishment of this connection is done using
   the CONNECT request in conjunction with ICE.  It is assumed that the
   reader has familiarity with ICE.

   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.

6.1.  Overview

   To utilize ICE, the CONNECT method provides a basic offer/answer
   operation that exchanges a set of candidates for a single "stream".
   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.
   The CONNECT request contains the candidates for this stream, and the
   CONNECT response contains the corresponding answer with candidates
   for that stream.  Though CONNECT provides an offer/answer exchange,
   it does not actually carry or utilize Session Description Protocol
   (SDP) messages.  Rather, it carries the raw ICE parameters required
   for ICE operation, and the ICE spec is utilized as if these
   parameters had actually been used in an SDP offer or answer.  In
   essence, ICE is utilized by mapping the CONNECT parameters into an
   SDP for the purposes of following the details of ICE itself.  That
   avoids the need for RELOAD to respecify ICE, yet allows it to operate
   without the baggage that SDP would bring.

   In addition, 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.

   RELOAD and SIP always run over TLS for TCP connections and DTLS
   [RFC4347] for UDP "connections".  Consequently, once ICE processing

Jennings, et al.          Expires May 21, 2008                 [Page 62]

Internet-Draft                   RELOAD                    November 2007

   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 by the usage of the fingerprint
   mechanism of RFC 4572 [RFC4572], which will reveal that the TLS and
   DTLS certificates are not a match for the ones used to sign the
   RELOAD messages.

   An agent follows the ICE specification as described in
   [I-D.ietf-mmusic-ice] and [I-D.ietf-mmusic-ice-tcp] with the changes
   and additional procedures described in the subsections below.

6.2.  Collecting STUN Servers

   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[I-D.ietf-behave-rfc3489bis].
   Accordingly, any peer you know about will be willing to be a STUN
   server for you -- though of course it may be behind a NAT.

   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.

   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.

   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

Jennings, et al.          Expires May 21, 2008                 [Page 63]

Internet-Draft                   RELOAD                    November 2007

   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.

   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 a CONNECT 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.

6.3.  Gathering Candidates

   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 [I-D.ietf-mmusic-ice].  RELOAD utilizes
   a single component, as does SIP.  Consequently, gathering for these
   "streams" requires a single component.

   An agent MUST implement ICE-tcp [I-D.ietf-mmusic-ice], and MUST
   gather at least one UDP and one TCP host candidate for RELOAD and for

   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 ring, as described in
   Section 6.2 and Section 9.3.

   The agent SHOULD prioritize its TCP-based candidates over its UDP-
   based candidates in the prioritization described in Section 4.1.2 of
   ICE [I-D.ietf-mmusic-ice].

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

6.4.  Encoding the CONNECT Message

   Section 4.3 of ICE describes procedures for encoding the SDP.
   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 CONNECT request or its response.  Similarly, the
   username fragment and password are carried in the CONNECT message or

Jennings, et al.          Expires May 21, 2008                 [Page 64]

Internet-Draft                   RELOAD                    November 2007

   its response.  Section 5.1.2 describes the detailed attribute
   encoding for CONNECT.  The CONNECT 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 CONNECT request and its
   response also contain a Next-Protocol attribute, with a value of SIP
   or RELOAD, which indicates what protocol is to be run over the
   connection.  The RELOAD CONNECT request MUST only be utilized to set
   up connections for application protocols that can be multiplexed with
   STUN and RELOAD itself.

   Since the CONNECT 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 CONNECT response is
   considered a valid answer for the purposes of following the ICE

   Since all messages with RELOAD are secured between nodes, the node
   MUST implement the fingerprint attribute of RFC 4572 [RFC4572], and
   encode it into the CONNECT request and response as described in
   Section 5.1.2.  This fingerprint will be matched with the
   certificates utilized to authenticate the RELOAD CONNECT request and
   its response.

   Similarly, the node MUST implement the active, passive, and actpass
   attributes from RFC 4145 [RFC4145].  However, here they refer
   strictly to the role of active or passive for the purposes of TLS
   handshaking.  The TCP connection directions are signaled as part of
   the ICE candidate attribute.

6.5.  Verifying ICE Support

   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.

6.6.  Role Determination

   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 CONNECT request) will always be controlling, and
   the answerer (the entity sending the CONNECT 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.

Jennings, et al.          Expires May 21, 2008                 [Page 65]

Internet-Draft                   RELOAD                    November 2007

6.7.  Connectivity Checks

   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.

6.8.  Concluding ICE

   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.

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

   o  The controlling agent MUST NOT attempt to send an updated offer
      once the state of its single media stream reaches Completed.
   o  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.

6.9.  Subsequent Offers and Answers

   An agent MUST NOT send a subsequent offer or answer.  Thus, the
   procedures in Section 9 of ICE MUST be ignored.

6.10.  Media Keepalives

   STUN MUST be utilized for the keepalives described in Section 10 of

6.11.  Sending Media

   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 fingerprint from the CONNECT
   request and its response are used as described in RFC 4572 [RFC4572],
   to ensure that another node in the P2P network, acting as a TURN
   server, has not inserted itself as a man-in-the-middle.  Once the TLS
   or DTLS signaling is complete, the application protocol is free to
   use the connection.

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

Jennings, et al.          Expires May 21, 2008                 [Page 66]

Internet-Draft                   RELOAD                    November 2007

6.12.  Receiving Media

   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.

7.  Chord Algorithm

   This algorithm is assigned the name chord-128-2-8 to indicate it is
   based on Chord, uses a 128 bit hash function, stores 2 redundant
   copies of all data, and has finger tables with 8 entries.

7.1.  Overview

   The algorithm described here is a modified version of the Chord
   algorithm.  Each peer keeps track of a finger table of 8 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 peer-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 rapidly be found - it
   needs to be there so that peers can be found in O(log(N)) time
   instead of the typical O(N) time that a linked list would provide.

   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.

7.2.  Routing

   If a peer is not responsible for a Resource-ID k, then it routes a
   request to that location by routing it to the peer in either the
   neighborhood or finger table that has the largest peer-id that is
   still less than or equal to k.

Jennings, et al.          Expires May 21, 2008                 [Page 67]

Internet-Draft                   RELOAD                    November 2007

7.3.  Redundancy

   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.


   This redundancy algorithm breaks if the storing node is malicious and
   does not store the data in the replica set.  Applications which wish
   to have defenses against that must explicitly store multiple copies
   of the data with separate peers.  [[OPEN ISSUE:  Where should a
   replication algorithm of this type be described?  The DHT?  The
   storage layer?  The usage?]]

7.4.  Joining

   The join process for a joining party (JP) with peer-id n is as
   1.  JP connects to its chosen bootstrap node.
   2.  JP uses a series of PINGs to populate its routing table.
   3.  JP sends CONNECT 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.
   4.  JP enters all the peers it contacted into its routing table.
   5.  JP sends a JOIN to its immediate successor, the admitting peer
       (AP) for peer-id n.  The AP sends the response to the JOIN.
   6.  AP does a series of STORE requests to JP to store the data that
       JP will be responsible for.
   7.  AP sends JP an UPDATE explicitly labelling 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.
   8.  AP sends an UPDATE to all of its neighbors with the new values of
       its neighbor set (including JP).

Jennings, et al.          Expires May 21, 2008                 [Page 68]

Internet-Draft                   RELOAD                    November 2007

   9.  JP sends UPDATES to all the peers in its routing table.

   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.

   In order to set up its neighbor table entry for peer i, JP simply
   sends a CONNECT to peer (n+2^(numBitsInPeerId-i).  This will be
   routed to a peer in approximately the right location around the ring.

7.5.  UPDATEs

   An UPDATE is defined as

   STRUCTURE: chord_update
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |Predecessors Le|                                               |
       +-+-+-+-+-+-+-+-+                                               +
       |                          Predecessors                         |
       /                                                               /
       |                                                               |
       | Successors Len|                                               |
       +-+-+-+-+-+-+-+-+                                               +
       |                           Successors                          |
       /                                                               /
       |                                                               |

   The contents of this message are:
   Predecessors -  The predecessor set of the UPDATEing peer.
   Successors -  The successor set of the UPDATEing peer.

   A peer MUST maintain an association (via CONNECT) 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.

Jennings, et al.          Expires May 21, 2008                 [Page 69]

Internet-Draft                   RELOAD                    November 2007

7.5.1.  Sending UPDATEs

   Every time a connection to a peer in the neighborhood set is lost (as
   determined by connectivity pings), the peer should remove the entry
   from its neighborhood table and send an UPDATE to all the remaining
   neighbors.  The update will contain all the peer-ids of the current
   entries of the table (after the failed one has been removed).

   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.

7.5.2.  Receiving UPDATEs

   When a peer, N, receives an UPDATE request, it examines the peer-ids
   in the UPDATE and at its neighborhood table and decides if this
   UPDATE 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
   o  The UPDATE contains peers that would not change the neighbor set
      because they match the neighborhood table.
   o  The UPDATE contains peers closer to N than those in its
      neighborhood table.
   o  The UPDATE 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.

   In the first case, no change is needed.

   In the second case, N MUST attempt to CONNECT 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.

   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.

   After any PINGs and CONNECTs are done, if the neighborhood table
   changes, the peer sends an UPDATE request to each of its neighbors

Jennings, et al.          Expires May 21, 2008                 [Page 70]

Internet-Draft                   RELOAD                    November 2007

   that was in either the old table or the new table.  These UPDATEs 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

   A 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.

   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.

7.5.3.  Stabilization

   A peer MUST periodically send an UPDATE 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-8-update-
   frequency" element (denominated in seconds.)  A peer SHOULD randomly
   offset these UPDATEs so they do not occur all at once.  If an UPDATE
   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

   Periodically a peer should select a random entry i from the finger
   table and do a PING to peer (n+2^(numBitsInPeerId-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-8-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.

Jennings, et al.          Expires May 21, 2008                 [Page 71]

Internet-Draft                   RELOAD                    November 2007

7.6.  Leaving

   Peers SHOULD send a LEAVE request prior to exiting the DHT.  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.

8.  Enrollment and Bootstrap

8.1.  Discovery

   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 [I-D.garcia-p2psip-dns-sd-bootstrapping]
   and [I-D.matthews-p2psip-bootstrap-mechanisms].  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 proto of tcp to find
   an enrollment server.

   If the overlay name ends in .local, then the DNS SRV lookup is done
   using implement [I-D.cheshire-dnsext-dns-sd] with a Service name of
   "p2p_menroll" can also be tried to find an enrollment server.  If
   they implement this, the user name can be used as the Instance
   Identifier label.

   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 [RFC2818].  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".

   The result is an XML configuration file with the syntax described in
   the following section.

8.2.  Overlay Configuration

   This specification defines a new content type "application/
   p2p-overlay+xml" for an MIME entity that contains overlay
   information.  An example document is shown below.

Jennings, et al.          Expires May 21, 2008                 [Page 72]

Internet-Draft                   RELOAD                    November 2007

      <?xml version="1.0" encoding="US-ASCII"?>
        <overlay name="chord.example.com" expiration="86400">
          <dht name="chord-128-2-8"/>
          <root-cert>[DER here]</root-cert>
          <required-usage name="SIP"/>
          <credential-server url="https://www.example.com/csr"/>
          <bootstrap-peer address="" port="5678"/>
          <bootstrap-peer address="" port="5678"/>
          <bootstrap-peer address="" port="5678"/>
          <multicast-bootstrap="" port="5678"/>

   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 the minimal
   interoperability.  The namespace for the elements defined in this
   specification is urn:ietf:params:xml:ns:p2p:overlay.

   The file can contain multiple "overlay" elements where each one
   contains the configuration information for a different overlay.  Each
   "overlay" has the following attributes:

   name:  name of the overlay
   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.

   Inside each overlay element, the following elements can occur:
   dht -  This element has an attribute called name that describes which
      dht algorithm is being used.
   root-cert -  This element contains a DER 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.
   required-usage -  This element has an attribute called "name" that
      describes a usage that peers in this overlay are required to
      support.  More than one required-usage element may be present.
   credential-server -  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.
   bootstrap-peer -  This elements represents the address of one of the
      bootstrap peers.  It has an attribute called "address" that
      represents the IP address and an attribute called "port" that
      represents the port.  More than one bootstrap-peer element may be

Jennings, et al.          Expires May 21, 2008                 [Page 73]

Internet-Draft                   RELOAD                    November 2007

   multicast-bootstrap -  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.

   [[TODO:  Do a RelaxNG grammar.]]

8.3.  Credentials

   If a credential-server element is provided in the configuration
   document, that means that credentials are required to use the DHT.  A
   peer which does not yet have credentials MUST contact the credential
   server to acquire them.

   In order to acquire credentials, the peer generates an asymmetric key
   pair and then generates a "Simple Enrollment Request" (as defined in
   [I-D.ietf-pkix-2797-bis]) and sends this over HTTPS as defined in
   [I-D.ietf-pkix-cmc-trans] to the URL in the credential-server
   element.  The subjectAltName in the request MUST contain the required
   user name(s).

   The credential server MUST authenticate the request using HTTP digest
   [RFC2617].  If the authentication succeeds and the requested user
   name(s) is acceptable, the server and returns a certificate.  The
   SubjectAltName field in the certificate contains the following

   o  One or more Peer-IDs which MUST be cryptographically random
      [RFC4086].  These MUST be chosen by the credential server in such
      a way that they are unpredictable to the requesting user.
   o  The names this user is allowed to use in the overlay

   The certificate is returned in a "Simple Enrollment Response".

   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
   Peer-IDs it can use.

8.4.  Locating a Peer

   In order to join the overlay, the peer MUST contact a bootstrap peer.
   If the peer has cached bootstrap peers it SHOULD contact them first
   by sending a PING to the known peer address with the destination
   peer-id set to that peer's peer-id.

Jennings, et al.          Expires May 21, 2008                 [Page 74]

Internet-Draft                   RELOAD                    November 2007

   If no cached peers are available, then the peer SHOULD send a PING 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 peer-id as the destination peer-id.

   The responder peer that receives the PING 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 even if the response is only an error.

   When the requester peer finally does receive a response from some
   responding peer, it can note the peer-id in the response and use this
   peer-id to start sending requests to join the DHT as described in
   Section 3.1.5 and Section 5.3.

   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.

9.  Usages

9.1.  Generic Usage Requirements

   A new usage MUST specify the following information:
   o  The type-ids which the usage defines and what each type means.
   o  The data model for the data being stored (single value, array,
      dictionary, etc.) for each type-id
   o  Access control rules for each type-id.
   o  The minimum amounts of data of each type that a conformant
      implementation MUST store.

   While each type-id MUST define what data model is used for its data,
   that does not mean that it must define new data models.  Where
   useful, type-ids SHOULD use the build-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.


   New usages MAY (and where useful SHOULD) reuse existing type-ids.
   New type-ids only need to be defined where different data is stored
   or different behavior is required.

Jennings, et al.          Expires May 21, 2008                 [Page 75]

Internet-Draft                   RELOAD                    November 2007

9.2.  SIP Usage

   The SIP usage allows a RELOAD overlay to be used as a distributed SIP
   registrar/proxy network.  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 Bob's SIP UA can use to pass SIP
   messages back and forth to Alice's SIP UA.  Provides the following
   three functions:

   o  Mapping SIP URIs that are not GRUUs to the overlay peer
      responsible for the SIP UA.
   o  Mapping SIP GRUUs to the DHT peer responsible for the SIP UA.
   o  Forming a connection directly to a DHT peer that is used to send
      SIP messages to the SIP UA.

   Section 3.7.1 provides an overview of how these fit together.


   The first mapping is provided using the SIP-REGISTRATION type:

   Type IDs  The seed for the SIP-REGISTRATION type is a URI, typically
      the AOR for the user.  The data stored is a sip-registration-data,
      which can contain either another URI or a route-list to the peer
      which is acting for the user.  [[TODO:  we want to somehow put
      caller-prefs in here along with the route list, but I'm not sure
      how to do it yet.]]
   Data Model  The data model for the SIP-REGISTRATION type is
      dictionary.  The dictionary key is the peer-id of the storing
      peer.  This allows each peer (presumably corresponding to a single
      device) to store a single route mapping.
   Access Control  If certificate-based access control is being used,
      stored data of type SIP-REGISTRATION must be signed by a
      certificate which (1) contains user name matching the storing URI
      used as the seed for the resource-id and (2) contains a peer-id
      matching the storing dictionary key.
   Data Sizes  Peers MUST be prepared to store SIP-REGISTRATION values
      of up to 10K and must be prepared to store up to 10 values for
      each user name.

   The contents of the SIP-REGISTRATION type are

Jennings, et al.          Expires May 21, 2008                 [Page 76]

Internet-Draft                   RELOAD                    November 2007

   STRUCTURE: sip_registration
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |                                                               |
       /                                                               /
       |                       Registration Data                       |
       /                                                               /
       |                                                               |

   STRUCTURE: sip_registration_uri_type
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |      0x01     | Sip Registration Uri Type Len |               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                   Sip Registration Uri Type                   |
       /                                                               /
       |                                                               |

   STRUCTURE: sip_registration_route_type
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
       |      0x02     |       Contact Prefs Len       |               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
       |                         Contact Prefs                         |
       /                                                               /
       |                                                               |
       |         Route List Len        |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                           Route List                          |
       /                                                               /
       |                                                               |

   A registration may contain either a URI (type code 0x01) or a contact
   preferences structure and a route list (type code 0x01).  The leading
   byte indicates the type.

Jennings, et al.          Expires May 21, 2008                 [Page 77]

Internet-Draft                   RELOAD                    November 2007

9.2.2.  GRUUs

   GRUUs do not require storing data in the DHT.  Rather, they are
   constructed by embedding a base64-encoded route 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 route list and connects to that peer.

   Anonymous GRUUs are done in roughly the same way but require either
   that the enrollment server issue a different peer-id for each
   anonymous GRUU required or that a route list be used that includes a
   peer that compresses the route list to stop the peer-id from being

9.2.3.  SIP Connect

   Once the route list for a user has been identified, the calling peer
   uses the CONNECT request to form a connection to the peer identified
   by the route list.  The CONNECT request MUST contain the connect-
   application value of 5160 (SIP).  If certificate-based authentication
   is in use, the responding peer MUST present a certificate with a
   peer-id matching the terminal entry in the route list.

   [[TODO:  Note that this constrains route lists from hiding the last
   peer-id when used here.  I think that's OK, but we should take a

   Once the association has been formed, the calling peer sends generic
   SIP messages down the new association and ordinary SIP procedures are

9.2.4.  SIP Tunnel

   This usage allows two peers to exchange SIP messages across the
   overlay using the TUNNEL method.  TUNNEL is provided as an
   alternative to using CONNECT because it allows a SIP message to be
   sent immediately, without the delay associated with CONNECT.  For a
   simple SIP exchange, it may result in fewer messages being sent, as

   An implementation MUST use CONNECT 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 CONNECT
   once that negotiation is complete.

Jennings, et al.          Expires May 21, 2008                 [Page 78]

Internet-Draft                   RELOAD                    November 2007

   As an application of TUNNEL, this usage defines the following items:
   o  For SIP, the application attribute is 5060.
   o  The application MAY establish any dialog using TUNNEL if it
      expects to replace it once a CONNECT request completes.  The
      application SHOULD NOT exchange messages with another SIP UA
      repeatedly using a TUNNEL unless it is unable to complete a
   o  The Replaces header should be used to migrate dialogs established
      via TUNNEL to a direct connection.
   o  The dialogid is the GRUU of the destination of the request.
   o  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.

   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.

   OPEN ISSUE:  should specify how to request encryption of the message


   The easiest implementation of TUNNEL is likely to default to sending
   all messages across a TUNNEL when the first message is sent to a new
   destination GRUU and simultaneously issuing a CONNECT.  Messages then
   continue through the TUNNEL until the CONNECT completes, at which
   point they are delivered via the new connection.

   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.

9.3.  TURN Usage

   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.

   If the node is a candidate for a TURN server it will insert some

Jennings, et al.          Expires May 21, 2008                 [Page 79]

Internet-Draft                   RELOAD                    November 2007

   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 seed by
   concatenating its peer-ID and the value d.  This seed is hashed to
   form a Resource-ID.  The address of the peer is stored at that
   Resource-ID using type TURN-SERVICE and the turn-server production:


   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.

   Peers peers that provide the STUN-Relay server type 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 [Add REF for TURN-

Jennings, et al.          Expires May 21, 2008                 [Page 80]

Internet-Draft                   RELOAD                    November 2007

  STRUCTURE: turn_server
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |   Iteration   |                                               |
      +-+-+-+-+-+-+-+-+                                               +
      |                            Address                            |
      /                                                               /
      |                                                               |

  STRUCTURE: ip4_address_type
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |      0x01     |                      Addr                     |
  004 +-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |               |              Port             |
  007 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  STRUCTURE: ip6_address_type
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
      |      0x02     |                                               |
  004 +-+-+-+-+-+-+-+-+                                               +
      |                              Addr                             |
  008 +                                                               +
      |                                                               |
  012 +                                                               +
      |                                                               |
  016 +               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |               |              Port             |
  019 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   [[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.]]

   Type IDs  This usage defines the TURN-SERVICE type-id to indicate
      that a peer is willing to act as a TURN server.  The FIND command
      MUST return results for the TURN-SERVICE type-id.

Jennings, et al.          Expires May 21, 2008                 [Page 81]

Internet-Draft                   RELOAD                    November 2007

   Data Model  The TURN-SERVICE stores a single value for each
   Access Control  If certificate-based access control is being used,
      stored data of type 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.
   Data Sizes  TURN-SERVICE values are of fixed size.  Peers MUST be
      prepared to store values with iteration counter of up to 100.

   The data is stored in a data structure with the IP address of the
   server and an indication whether the address is an IPv4 or IPv6
   address.  The seed used to form the storage Resource-ID is simply the
   peer-id.  The access control rule is that the certificate used to
   sign the request must contain a peer-id that when hashed would match
   the Resource-ID where the data is being stored.

   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.

   Open issues:  Should there be low and high bandwidth version of STUN-
   Relay one can find?  Low would be usable for signaling type things
   and high would be usable for audio, video, and others.

9.4.  Certificate Store Usages

   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.

   A user/peer SHOULD store its certificate at resource-ids derived from
   two seeds:

   o  The user names in the certificate.
   o  The peer-ids in the certificate.

   Note that in the second case the certificate is not stored at the
   peer's peer-id but rather at a hash of the peer's peer-id.  The
   intention here (as is common throughout RELOAD) is to avoid making a
   peer responsible for its own data.

   A peer should ensure that the user's certificates are stored in the

Jennings, et al.          Expires May 21, 2008                 [Page 82]

Internet-Draft                   RELOAD                    November 2007

   DHT 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.

   Type IDs  This usage defines the CERTIFICATE type-id to store a peer
      or user's certificate.
   Data Model  The data model for CERTIFICATE data is of type array.
   Access Control  The CERTIFICATE MUST contain a peer-id or user name
      which, when hashed, maps the resource-id at which the value is
      being stored.
   Data Sizes  Peers MUST be prepared to store at least 10 certificates
      of sizes up to 1K each.

10.  Security Considerations

10.1.  Overview

   RELOAD provides a somewhat generic DHT storage service, albeit one
   designed to be useful for P2P SIP.  In this section we discuss
   security issues that are likely to be relevant to any usage of
   RELOAD.  In the subsequent section we describe issues that are
   specific to SIP.

   In any DHT, 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 DHT.  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 DHT to function correctly in the
   face of a modest number of malicious nodes.

   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 based on an overlay-wide shared symmetric
   key and is suitable only for limited deployments in which the
   relationship between admitted peers is not adversarial.

Jennings, et al.          Expires May 21, 2008                 [Page 83]

Internet-Draft                   RELOAD                    November 2007

10.2.  Attacks on P2P Overlays

   The two basic functions provided by DHT nodes are storage and
   routing:  some node is responsible for storing your data and for
   allowing you to fetch data from others.  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.

   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 DHT routing and user
   registration information in RELOAD messages.

   To protect the signaling, 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 DTLS or TLS, which
   provides message integrity and authentication of the directly
   communicating peer.  In addition, when the certificate-based security
   system is used, messages and data are digitally signed with the
   sender's private key, providing end-to-end security for

   In order to protect data storage, in the certificate-based security
   scheme, all stored data is signed by the owner of the data.  This
   allows the storing peer to 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.

10.3.  Certificate-based Security

   This specification stores users' registrations and possibly other
   data in a Distributed Hash table (DHT).  This requires a solution to
   securing this data as well as securing, as well as possible, the
   routing in the DHT.  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.

   When a user enrolls in the DHT, 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 peer-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.

   Each certificate enables an entity to act in two sorts of roles:

Jennings, et al.          Expires May 21, 2008                 [Page 84]

Internet-Draft                   RELOAD                    November 2007

      As a user, storing data at specific Resource-IDs in the DHT
      corresponding to the user name.
      As a DHT peer with the peer ID(s) listed in the certificate.

   Note that since only users of this DHT need to validate a
   certificate, this usage does not require a global PKI.  It does,
   however, require a central enrollment authority which acts as the
   certificate authority for the DHT.  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.

   All implementations MUST implement certificate-based security.

10.4.  Shared-Secret Security

   For small environments where deployment of the PKI necessary to use a
   certificate-based model is impractical, RELOAD supports a shared
   secret security 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 [RFC4279] or TLS-SRP [I-D.ietf-tls-srp] mode.  A peer which does
   not know the key cannot form TLS connections with any other peer and
   therefore cannot join the overlay.

   The shared-secret scheme prohibits unauthorized peers from joining
   the overlay, but it provides no protection from a compromised peer
   inserting arbitrary resource registrations, performing a Sybil
   attack[Sybil], or performing other attacks on the resources or
   routing.  Thus, it is only safe to use in limited settings in which
   peers are not adversarial.  In addition, because the messages and
   data are not authenticated, each intermediate peer MUST take care to
   use TLS and check the other peer's knowledge of the shared secret, or
   message insertion is possible.

   If the shared secret key for the shared-key security scheme is
   discovered by an attacker, then most of the security of the scheme is
   lost:  an attacker can impersonate any peer to any other peer.  Thus,
   the shared-secret scheme is only appropriate for small deployments,
   such as a small office or ad hoc overlay set up among participants in
   a meeting.

   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 highly subject to dictionary attacks.  If

Jennings, et al.          Expires May 21, 2008                 [Page 85]

Internet-Draft                   RELOAD                    November 2007

   passwords are used as the source of shared-keys, then TLS-SRP is a
   superior choice because it is not subject to dictionary attacks.

10.5.  Storage Security

   When certificate-based security is used in RELOAD, any given
   Resource-ID/type code pair (a slot) is deterministically 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 DHTs - relatively simple.

   When shared-secret security is used, then all peers trust all other
   peers, provided that they have demonstrated that they have the
   credentials to join the overlay at all.  The following text therefore
   applies only to certificate-based security.

10.5.1.  Authorization

   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 seed construction algorithm for
   that particular type of value).

   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 seed construction algorithm for the specified
   type based on the user's certificate information.  It then computes
   the Resource-ID from the seed 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.

   For example, consider the certificate with the following properties:

           User name: alice@dht.example.com
           Peer-Id:   013456789abcdef
           Serial:    1234

   If Alice wishes to STORE a value of the "SIP Location" type, the seed
   will be the SIP AOR "sip:alice@dht.example.com".  The Resource-ID
   will be determined by hashing the seed.  When a peer receives a
   request to store a record at Resource-ID X, it takes the signing
   certificate and recomputes the seed, in this case
   "alice@dht.example.com".  If H("alice@dht.example.com")=X then the

Jennings, et al.          Expires May 21, 2008                 [Page 86]

Internet-Draft                   RELOAD                    November 2007

   STORE is authorized.  Otherwise it is not.  Note that the seed
   construction algorithm may be different for other types.

10.5.2.  Distributed Quota

   Being a peer in a DHT carries with it the responsibility to store
   data for a given region of the DHT.  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 each usage to
   define maximum sizes for each type of stored data.  Attempts to store
   values exceeding this size SHOULD be rejected.  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.

   Allowing different types 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.  Because
   peers know at joining time what usages they must support (see
   Section 8.2), peers can to some extent predict their storage

10.5.3.  Correctness

   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.

10.5.4.  Residual Attacks

   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 (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

Jennings, et al.          Expires May 21, 2008                 [Page 87]

Internet-Draft                   RELOAD                    November 2007

   client has trouble knowing whether it should try this or not (since
   there is a cost to doing so.)

   Although the certificate-based authentication scheme compromising 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.

   In addition, when a type is multivalued (e.g., an array), 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.

10.6.  Routing Security

   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 mis-
   routing requests in the DHT.  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 DHT.  Second, this is a DOS attack only.
   Third, if a large percentage of the peers on the DHT are controlled
   by the attacker, it is probably impossible to perfectly secure
   against this.

10.6.1.  Background

   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 [Eclipse] 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 [Sybil], the attacker
   registers a large number of nodes and is therefore able to capture a
   large amount of the traffic through the DHT.

   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,

Jennings, et al.          Expires May 21, 2008                 [Page 88]

Internet-Draft                   RELOAD                    November 2007

   certificate-based admission control.

10.6.2.  Admissions Control

   Admission to an RELOAD DHT is controlled by requiring that each peer
   have a certificate containing its peer ID.  The requirement to have a
   certificate is enforced by using TLS 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:

   o  It allows the enrollment server to limit the number of peer IDs
      issued to any individual user.
   o  It prevents the attacker from choosing specific peer IDs.

   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 DHT he is
   impersonating appears to be very sparsely populated by comparison to
   the victim's local region.

10.6.3.  Peer Identification and Authentication

   In general, whenever a peer engages in DHT 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 TLS 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.

   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 DHT structure, but
   they need to verify that the UPDATE message came from the actual peer
   rather than from an attacker.  To prevent this, all DHT routing
   messages are signed by the peer that generated them.

   [TODO:  this allows for replay attacks on requests.  There are two
   basic defenses here.  The first is global clocks and loose anti-

Jennings, et al.          Expires May 21, 2008                 [Page 89]

Internet-Draft                   RELOAD                    November 2007

   replay.  The second is to refuse to take any action unless you verify
   the data with the relevant node.  This issue is undecided.]

   [TODO:  I think we are probably going to end up with generic
   signatures or at least optional signatures on all DHT messages.]

10.6.4.  Protecting the Signaling

   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

   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.

10.6.5.  Residual Attacks

   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 DHT 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.

   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 404 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.

10.7.  SIP-Specific Issues

Jennings, et al.          Expires May 21, 2008                 [Page 90]

Internet-Draft                   RELOAD                    November 2007

10.7.1.  Fork Explosion

   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.

10.7.2.  Malicious Retargeting

   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 ratargeting to
   a peer without there explicit cooperation.

10.7.3.  Privacy Issues

   All RELOAD SIP registration data is public.  Methods of providing
   location and identity privacy are still being studied.

11.  Examples

   See draft [TODO add ref] for message flow examples.

12.  Acknowledgments

   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,
   and the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia
   Zangrilli and David A. Bryan.

13.  Appendix: Operation with SIP clients outside the DHT domain

14.  Appendix: Notes on DHT Algorithm Selection

   An important point:  if you assume NATs are doing ICE to set up
   connections, you want a lot fewer connections than you might have on
   a very open network - this might push towards something like Chord

Jennings, et al.          Expires May 21, 2008                 [Page 91]

Internet-Draft                   RELOAD                    November 2007

   with fewer connections than, say, bamboo.

   TODO - ref draft-irtf-p2prg-survey-search

15.  References

15.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

              Rosenberg, J., "Interactive Connectivity Establishment
              (ICE): A Protocol for Network Address Translator (NAT)
              Traversal for Offer/Answer Protocols",
              draft-ietf-mmusic-ice-16 (work in progress), June 2007.

              Rosenberg, J., "Session Traversal Utilities for (NAT)
              (STUN)", draft-ietf-behave-rfc3489bis-06 (work in
              progress), March 2007.

              Rosenberg, J., "Obtaining Relay Addresses from Simple
              Traversal Underneath NAT (STUN)",
              draft-ietf-behave-turn-03 (work in progress), March 2007.

              Schaad, J. and M. Myers, "Certificate Management over CMS
              (CMC) Transport Protocols", draft-ietf-pkix-cmc-trans-05
              (work in progress), May 2006.

              Myers, M. and J. Schaad, "Certificate Management Messages
              over CMS", draft-ietf-pkix-2797-bis-04 (work in progress),
              March 2006.

   [RFC4279]  Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites
              for Transport Layer Security (TLS)", RFC 4279,
              December 2005.

              Taylor, D., "Using SRP for TLS Authentication",
              draft-ietf-tls-srp-14 (work in progress), June 2007.

              Rosenberg, J., "TCP Candidates with Interactive

Jennings, et al.          Expires May 21, 2008                 [Page 92]

Internet-Draft                   RELOAD                    November 2007

              Connectivity Establishment (ICE",
              draft-ietf-mmusic-ice-tcp-03 (work in progress),
              March 2007.

   [RFC3261]  Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston,
              A., Peterson, J., Sparks, R., Handley, M., and E.
              Schooler, "SIP: Session Initiation Protocol", RFC 3261,
              June 2002.

   [RFC3263]  Rosenberg, J. and H. Schulzrinne, "Session Initiation
              Protocol (SIP): Locating SIP Servers", RFC 3263,
              June 2002.

   [RFC4347]  Rescorla, E. and N. Modadugu, "Datagram Transport Layer
              Security", RFC 4347, April 2006.

15.2.  Informative References

              Bryan, D., "Concepts and Terminology for Peer to Peer
              SIP", draft-ietf-p2psip-concepts-00 (work in progress),
              July 2007.

   [RFC4145]  Yon, D. and G. Camarillo, "TCP-Based Media Transport in
              the Session Description Protocol (SDP)", RFC 4145,
              September 2005.

   [RFC4572]  Lennox, J., "Connection-Oriented Media Transport over the
              Transport Layer Security (TLS) Protocol in the Session
              Description Protocol (SDP)", RFC 4572, July 2006.

   [RFC2617]  Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S.,
              Leach, P., Luotonen, A., and L. Stewart, "HTTP
              Authentication: Basic and Digest Access Authentication",
              RFC 2617, June 1999.

   [RFC2818]  Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.

   [RFC4086]  Eastlake, D., Schiller, J., and S. Crocker, "Randomness
              Requirements for Security", BCP 106, RFC 4086, June 2005.

   [RFC3280]  Housley, R., Polk, W., Ford, W., and D. Solo, "Internet
              X.509 Public Key Infrastructure Certificate and
              Certificate Revocation List (CRL) Profile", RFC 3280,
              April 2002.

   [Sybil]    Douceur, J., "The Sybil Attack", IPTPS '02, March 2002.

Jennings, et al.          Expires May 21, 2008                 [Page 93]

Internet-Draft                   RELOAD                    November 2007

   [Eclipse]  Singh, A., Ngan, T., Druschel, T., and D. Wallach,
              ""Eclipse Attacks on Overlay Networks: Threats and

              Cheshire, S. and M. Krochmal, "Multicast DNS",
              draft-cheshire-dnsext-multicastdns-06 (work in progress),
              August 2006.

              Krochmal, M. and S. Cheshire, "DNS-Based Service
              Discovery", draft-cheshire-dnsext-dns-sd-04 (work in
              progress), August 2006.

              Cooper, E., "Bootstrap Mechanisms for P2PSIP",
              draft-matthews-p2psip-bootstrap-mechanisms-00 (work in
              progress), February 2007.

              Garcia, G., "P2PSIP bootstrapping using DNS-SD",
              draft-garcia-p2psip-dns-sd-bootstrapping-00 (work in
              progress), October 2007.

Authors' Addresses

   Cullen Jennings
   170 West Tasman Drive
   MS: SJC-21/2
   San Jose, CA  95134

   Phone:  +1 408 421-9990
   Email:  fluffy@cisco.com

   Bruce B. Lowekamp
   SIPeerior; William & Mary
   3000 Easter Circle
   Williamsburg, VA  23188

   Phone:  +1 757 565 0101
   Email:  lowekamp@sipeerior.com

Jennings, et al.          Expires May 21, 2008                 [Page 94]

Internet-Draft                   RELOAD                    November 2007

   Eric Rescorla
   Network Resonance
   2064 Edgewood Drive
   Palo Alto, CA  94303

   Phone:  +1 650 320-8549
   Email:  ekr@networkresonance.com

   Jonathan Rosenberg
   Edison, NJ

   Email:  jdrosen@cisco.com

Jennings, et al.          Expires May 21, 2008                 [Page 95]

Internet-Draft                   RELOAD                    November 2007

Full Copyright Statement

   Copyright (C) The IETF Trust (2007).

   This document is subject to the rights, licenses and restrictions
   contained in BCP 78, and except as set forth therein, the authors
   retain all their rights.

   This document and the information contained herein are provided on an

Intellectual Property

   The IETF takes no position regarding the validity or scope of any
   Intellectual Property Rights or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; nor does it represent that it has
   made any independent effort to identify any such rights.  Information
   on the procedures with respect to rights in RFC documents can be
   found in BCP 78 and BCP 79.

   Copies of IPR disclosures made to the IETF Secretariat and any
   assurances of licenses to be made available, or the result of an
   attempt made to obtain a general license or permission for the use of
   such proprietary rights by implementers or users of this
   specification can be obtained from the IETF on-line IPR repository at

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights that may cover technology that may be required to implement
   this standard.  Please address the information to the IETF at


   Funding for the RFC Editor function is provided by the IETF
   Administrative Support Activity (IASA).

Jennings, et al.          Expires May 21, 2008                 [Page 96]