Internet DRAFT - draft-ietf-p2psip-reload

draft-ietf-p2psip-reload






P2PSIP                                                       C. Jennings
Internet-Draft                                                     Cisco
Intended status:  Standards Track                            B. Lowekamp
Expires:  January 12, 2009                        SIPeerior Technologies
                                                             E. Rescorla
                                                       Network Resonance
                                                                S. Baset
                                                          H. Schulzrinne
                                                     Columbia University
                                                           July 11, 2008


                REsource LOcation And Discovery (RELOAD)
                      draft-ietf-p2psip-reload-00

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

   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
   http://www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on January 12, 2009.

Copyright Notice

   Copyright (C) The IETF Trust (2008).

Abstract

   This document defines REsource LOcation And Discovery (RELOAD), a
   peer-to-peer (P2P) signaling protocol for use on the Internet.  A P2P



Jennings, et al.        Expires January 12, 2009                [Page 1]

Internet-Draft                   RELOAD                        July 2008


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


Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   6
     1.1.   Basic Setting  . . . . . . . . . . . . . . . . . . . . .   7
     1.2.   Architecture . . . . . . . . . . . . . . . . . . . . . .   8
       1.2.1.   Usage Layer  . . . . . . . . . . . . . . . . . . . .  10
       1.2.2.   Routing Layer  . . . . . . . . . . . . . . . . . . .  10
       1.2.3.   Storage  . . . . . . . . . . . . . . . . . . . . . .  11
       1.2.4.   Topology Plugin  . . . . . . . . . . . . . . . . . .  11
       1.2.5.   Forwarding Layer . . . . . . . . . . . . . . . . . .  12
     1.3.   SIP Usage  . . . . . . . . . . . . . . . . . . . . . . .  12
     1.4.   Security . . . . . . . . . . . . . . . . . . . . . . . .  13
     1.5.   Structure of This Document . . . . . . . . . . . . . . .  13
   2.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .  14
   3.  Overlay Management Overview . . . . . . . . . . . . . . . . .  16
     3.1.   Security and Identification  . . . . . . . . . . . . . .  16
       3.1.1.   Shared-Key Security  . . . . . . . . . . . . . . . .  17
     3.2.   Clients  . . . . . . . . . . . . . . . . . . . . . . . .  17
       3.2.1.   Client Routing . . . . . . . . . . . . . . . . . . .  18
       3.2.2.   Client Behavior  . . . . . . . . . . . . . . . . . .  18
         3.2.2.1.  Why Not Only Peers? . . . . . . . . . . . . . . .  18
         3.2.2.2.  Minimum Functionality Requirements for Clients  .  19
         3.2.2.3.  Clients as Application-Level Agents . . . . . . .  20
     3.3.   Routing  . . . . . . . . . . . . . . . . . . . . . . . .  20
       3.3.1.   Routing Alternatives . . . . . . . . . . . . . . . .  22
         3.3.1.1.  Iterative vs Recursive  . . . . . . . . . . . . .  23
         3.3.1.2.  Symmetric vs Forward response . . . . . . . . . .  23
         3.3.1.3.  Direct Response . . . . . . . . . . . . . . . . .  23
         3.3.1.4.  Relay Peers . . . . . . . . . . . . . . . . . . .  24
         3.3.1.5.  Symmetric Route Stability . . . . . . . . . . . .  25
     3.4.   Connectivity Management  . . . . . . . . . . . . . . . .  26
     3.5.   Overlay Algorithm Support  . . . . . . . . . . . . . . .  26
       3.5.1.   Support for Pluggable Overlay Algorithms . . . . . .  27
       3.5.2.   Joining, Leaving, and Maintenance Overview . . . . .  27
     3.6.   First-Time Setup . . . . . . . . . . . . . . . . . . . .  28



Jennings, et al.        Expires January 12, 2009                [Page 2]

Internet-Draft                   RELOAD                        July 2008


       3.6.1.   Initial Configuration  . . . . . . . . . . . . . . .  28
       3.6.2.   Enrollment . . . . . . . . . . . . . . . . . . . . .  29
   4.  Application Support Overview  . . . . . . . . . . . . . . . .  29
     4.1.   Data Storage . . . . . . . . . . . . . . . . . . . . . .  29
       4.1.1.   Storage Permissions  . . . . . . . . . . . . . . . .  31
       4.1.2.   Usages . . . . . . . . . . . . . . . . . . . . . . .  31
       4.1.3.   Replication  . . . . . . . . . . . . . . . . . . . .  32
     4.2.   Service Discovery  . . . . . . . . . . . . . . . . . . .  33
     4.3.   Application Connectivity . . . . . . . . . . . . . . . .  33
   5.  P2PSIP Integration Overview . . . . . . . . . . . . . . . . .  33
   6.  Overlay Management Protocol . . . . . . . . . . . . . . . . .  34
     6.1.   Message Routing  . . . . . . . . . . . . . . . . . . . .  35
       6.1.1.   Request Origination  . . . . . . . . . . . . . . . .  35
       6.1.2.   Message Receipt and Forwarding . . . . . . . . . . .  36
         6.1.2.1.  Responsible ID  . . . . . . . . . . . . . . . . .  36
         6.1.2.2.  Other ID  . . . . . . . . . . . . . . . . . . . .  37
         6.1.2.3.  Private ID  . . . . . . . . . . . . . . . . . . .  38
       6.1.3.   Response Origination . . . . . . . . . . . . . . . .  38
     6.2.   Message Structure  . . . . . . . . . . . . . . . . . . .  38
       6.2.1.   Presentation Language  . . . . . . . . . . . . . . .  39
         6.2.1.1.  Common Definitions  . . . . . . . . . . . . . . .  40
       6.2.2.   Forwarding Header  . . . . . . . . . . . . . . . . .  42
         6.2.2.1.  Destination and Via Lists . . . . . . . . . . . .  44
         6.2.2.2.  Route Logging . . . . . . . . . . . . . . . . . .  46
         6.2.2.3.  Forwarding Options  . . . . . . . . . . . . . . .  48
       6.2.3.   Message Contents Format  . . . . . . . . . . . . . .  49
         6.2.3.1.  Response Codes and Response Errors  . . . . . . .  50
       6.2.4.   Signature  . . . . . . . . . . . . . . . . . . . . .  51
     6.3.   Overlay Topology . . . . . . . . . . . . . . . . . . . .  53
       6.3.1.   Topology Plugin Requirements . . . . . . . . . . . .  53
       6.3.2.   Methods and types for use by topology plugins  . . .  54
         6.3.2.1.  Join  . . . . . . . . . . . . . . . . . . . . . .  54
         6.3.2.2.  Leave . . . . . . . . . . . . . . . . . . . . . .  54
         6.3.2.3.  Update  . . . . . . . . . . . . . . . . . . . . .  55
         6.3.2.4.  Route_Query . . . . . . . . . . . . . . . . . . .  55
     6.4.   Forwarding Layer . . . . . . . . . . . . . . . . . . . .  56
       6.4.1.   Transports . . . . . . . . . . . . . . . . . . . . .  56
         6.4.1.1.  Future Support for HIP  . . . . . . . . . . . . .  57
         6.4.1.2.  Reliability for Unreliable Transports . . . . . .  57
         6.4.1.3.  Fragmentation and Reassembly  . . . . . . . . . .  59
       6.4.2.   Connection Management Methods  . . . . . . . . . . .  59
         6.4.2.1.  Attach  . . . . . . . . . . . . . . . . . . . . .  60
         6.4.2.2.  Ping  . . . . . . . . . . . . . . . . . . . . . .  65
         6.4.2.3.  Tunnel  . . . . . . . . . . . . . . . . . . . . .  67
   7.  Data Storage Protocol . . . . . . . . . . . . . . . . . . . .  69
     7.1.   Data Signature Computation . . . . . . . . . . . . . . .  70
     7.2.   Data Models  . . . . . . . . . . . . . . . . . . . . . .  71
       7.2.1.   Single Value . . . . . . . . . . . . . . . . . . . .  71



Jennings, et al.        Expires January 12, 2009                [Page 3]

Internet-Draft                   RELOAD                        July 2008


       7.2.2.   Array  . . . . . . . . . . . . . . . . . . . . . . .  72
       7.2.3.   Dictionary . . . . . . . . . . . . . . . . . . . . .  72
     7.3.   Data Storage Methods . . . . . . . . . . . . . . . . . .  73
       7.3.1.   Store  . . . . . . . . . . . . . . . . . . . . . . .  73
         7.3.1.1.  Request Definition  . . . . . . . . . . . . . . .  73
         7.3.1.2.  Response Definition . . . . . . . . . . . . . . .  77
       7.3.2.   Fetch  . . . . . . . . . . . . . . . . . . . . . . .  78
         7.3.2.1.  Request Definition  . . . . . . . . . . . . . . .  78
         7.3.2.2.  Response Definition . . . . . . . . . . . . . . .  80
       7.3.3.   Remove . . . . . . . . . . . . . . . . . . . . . . .  81
         7.3.3.1.  Single Value  . . . . . . . . . . . . . . . . . .  82
         7.3.3.2.  Array . . . . . . . . . . . . . . . . . . . . . .  82
         7.3.3.3.  Dictionary  . . . . . . . . . . . . . . . . . . .  82
         7.3.3.4.  Response Definition . . . . . . . . . . . . . . .  82
       7.3.4.   Find . . . . . . . . . . . . . . . . . . . . . . . .  82
         7.3.4.1.  Request Definition  . . . . . . . . . . . . . . .  82
         7.3.4.2.  Response Definition . . . . . . . . . . . . . . .  83
         7.3.4.3.  Defining New Kinds  . . . . . . . . . . . . . . .  84
   8.  Certificate Store Usage . . . . . . . . . . . . . . . . . . .  84
   9.  TURN Server Usage . . . . . . . . . . . . . . . . . . . . . .  85
   10. SIP Usage . . . . . . . . . . . . . . . . . . . . . . . . . .  86
     10.1.  Registering AORs . . . . . . . . . . . . . . . . . . . .  87
     10.2.  Looking up an AOR  . . . . . . . . . . . . . . . . . . .  89
     10.3.  Forming a Direct Connection  . . . . . . . . . . . . . .  90
     10.4.  GRUUs  . . . . . . . . . . . . . . . . . . . . . . . . .  90
     10.5.  SIP-REGISTRATION Kind Definition . . . . . . . . . . . .  90
   11. Diagnostic Usage  . . . . . . . . . . . . . . . . . . . . . .  91
     11.1.  Diagnostic Metrics for a P2PSIP Deployment . . . . . . .  93
   12. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . .  93
     12.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . .  93
     12.2.  Routing  . . . . . . . . . . . . . . . . . . . . . . . .  94
     12.3.  Redundancy . . . . . . . . . . . . . . . . . . . . . . .  94
     12.4.  Joining  . . . . . . . . . . . . . . . . . . . . . . . .  94
     12.5.  Routing Attaches . . . . . . . . . . . . . . . . . . . .  95
     12.6.  Updates  . . . . . . . . . . . . . . . . . . . . . . . .  95
       12.6.1.  Sending Updates  . . . . . . . . . . . . . . . . . .  97
       12.6.2.  Receiving Updates  . . . . . . . . . . . . . . . . .  97
       12.6.3.  Stabilization  . . . . . . . . . . . . . . . . . . .  98
     12.7.  Route Query  . . . . . . . . . . . . . . . . . . . . . . 100
     12.8.  Leaving  . . . . . . . . . . . . . . . . . . . . . . . . 100
   13. Enrollment and Bootstrap  . . . . . . . . . . . . . . . . . . 100
     13.1.  Discovery  . . . . . . . . . . . . . . . . . . . . . . . 101
     13.2.  Overlay Configuration  . . . . . . . . . . . . . . . . . 101
     13.3.  Credentials  . . . . . . . . . . . . . . . . . . . . . . 104
       13.3.1.  Self-Generated Credentials . . . . . . . . . . . . . 104
     13.4.  Joining the Overlay Peer . . . . . . . . . . . . . . . . 105
   14. Message Flow Example  . . . . . . . . . . . . . . . . . . . . 106
   15. Security Considerations . . . . . . . . . . . . . . . . . . . 111



Jennings, et al.        Expires January 12, 2009                [Page 4]

Internet-Draft                   RELOAD                        July 2008


     15.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . 111
     15.2.  Attacks on P2P Overlays  . . . . . . . . . . . . . . . . 112
     15.3.  Certificate-based Security . . . . . . . . . . . . . . . 112
     15.4.  Shared-Secret Security . . . . . . . . . . . . . . . . . 113
     15.5.  Storage Security . . . . . . . . . . . . . . . . . . . . 113
       15.5.1.  Authorization  . . . . . . . . . . . . . . . . . . . 114
       15.5.2.  Distributed Quota  . . . . . . . . . . . . . . . . . 114
       15.5.3.  Correctness  . . . . . . . . . . . . . . . . . . . . 115
       15.5.4.  Residual Attacks . . . . . . . . . . . . . . . . . . 115
     15.6.  Routing Security . . . . . . . . . . . . . . . . . . . . 116
       15.6.1.  Background . . . . . . . . . . . . . . . . . . . . . 116
       15.6.2.  Admissions Control . . . . . . . . . . . . . . . . . 116
       15.6.3.  Peer Identification and Authentication . . . . . . . 117
       15.6.4.  Protecting the Signaling . . . . . . . . . . . . . . 117
       15.6.5.  Residual Attacks . . . . . . . . . . . . . . . . . . 118
     15.7.  SIP-Specific Issues  . . . . . . . . . . . . . . . . . . 118
       15.7.1.  Fork Explosion . . . . . . . . . . . . . . . . . . . 118
       15.7.2.  Malicious Retargeting  . . . . . . . . . . . . . . . 118
       15.7.3.  Privacy Issues . . . . . . . . . . . . . . . . . . . 119
   16. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 119
     16.1.  Overlay Algorithm Types  . . . . . . . . . . . . . . . . 119
     16.2.  Data Kind-Id . . . . . . . . . . . . . . . . . . . . . . 119
     16.3.  Data Model . . . . . . . . . . . . . . . . . . . . . . . 120
     16.4.  Message Codes  . . . . . . . . . . . . . . . . . . . . . 120
     16.5.  Error Codes  . . . . . . . . . . . . . . . . . . . . . . 121
     16.6.  Route Log Extension Types  . . . . . . . . . . . . . . . 121
     16.7.  Transport Types  . . . . . . . . . . . . . . . . . . . . 121
     16.8.  Forwarding Options . . . . . . . . . . . . . . . . . . . 122
     16.9.  Ping Information Types . . . . . . . . . . . . . . . . . 122
     16.10. reload: URI Scheme . . . . . . . . . . . . . . . . . . . 122
       16.10.1. URI Registration . . . . . . . . . . . . . . . . . . 123
   17. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 123
   18. References  . . . . . . . . . . . . . . . . . . . . . . . . . 124
     18.1.  Normative References . . . . . . . . . . . . . . . . . . 124
     18.2.  Informative References . . . . . . . . . . . . . . . . . 125
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . 128
   Intellectual Property and Copyright Statements  . . . . . . . . . 130














Jennings, et al.        Expires January 12, 2009                [Page 5]

Internet-Draft                   RELOAD                        July 2008


1.  Introduction

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


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

   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].  RELOAD
      allows the definition of new application usages, each of which can
      define its own data types, along with the rules for their use.
      This allows RELOAD to be used with new applications through a
      simple documentation process that supplies the details for each
      application.

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

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

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



Jennings, et al.        Expires January 12, 2009                [Page 6]

Internet-Draft                   RELOAD                        July 2008


      for a particular application.

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

1.1.  Basic Setting

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

             +--------+              +--------+              +--------+
             | Node 10|--------------| Node 20|--------------| Node 30|
             +--------+              +--------+              +--------+
                 |                       |                       |
                 |                       |                       |
             +--------+              +--------+              +--------+
             | Node 40|--------------| Node 50|--------------| Node 60|
             +--------+              +--------+              +--------+
                 |                       |                       |
                 |                       |                       |
             +--------+              +--------+              +--------+
             | Node 70|--------------| Node 80|--------------| Node 90|
             +--------+              +--------+              +--------+
                                         |
                                         |
                                     +--------+
                                     | Node 85|
                                     |(Client)|
                                     +--------+

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



Jennings, et al.        Expires January 12, 2009                [Page 7]

Internet-Draft                   RELOAD                        July 2008


   graph to efficiently reach every other node within a small number of
   hops.

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

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

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

1.2.  Architecture

   Architecturally RELOAD is divided into several layers, as shown in
   the following figure:























Jennings, et al.        Expires January 12, 2009                [Page 8]

Internet-Draft                   RELOAD                        July 2008


                    Application

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

   The major components of RELOAD are:


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

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

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




Jennings, et al.        Expires January 12, 2009                [Page 9]

Internet-Draft                   RELOAD                        July 2008



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

   Forwarding Layer:  The Forwarding Layer provides packet forwarding
      services between nodes.  It also handles setting up connections
      across NATs using ICE.

1.2.1.  Usage Layer

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

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

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

1.2.2.  Routing Layer

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

   o  Send a message to a given peer, specified by Node-Id or
      Resource-Id.
   o  Receive messages that other peers sent to a Node-Id or Resource-Id
      for which this peer is responsible.

   All usages are clients of the Routing Layer and use RELOAD's services
   by sending and receiving messages from peers.  For instance, when a



Jennings, et al.        Expires January 12, 2009               [Page 10]

Internet-Draft                   RELOAD                        July 2008


   usage wants to store data, it does so by sending Store requests.
   Note that the Storage component and the Topology Plugin are
   themselves clients of the Routing Layer, because they need to send
   and receive messages from other peers.

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

1.2.3.  Storage

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

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

1.2.4.  Topology Plugin

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

   The Topology Plugin is responsible for maintaining the overlay
   algorithm Routing Table, which is consulted by the Routing Layer
   before routing a message.  When connections are made or broken, the
   Forwarding Layer notifies the Topology Plugin, which adjusts the



Jennings, et al.        Expires January 12, 2009               [Page 11]

Internet-Draft                   RELOAD                        July 2008


   routing table as appropriate.  The Topology Plugin will also instruct
   the Forwarding Layer to form new connections as dictated by the
   requirements of the overlay algorithm Topology.

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

1.2.5.  Forwarding Layer

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

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

1.3.  SIP Usage

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

   The SIP Usage involves two basic functions:
   Registration:    SIP UAs can use the RELOAD data storage
      functionality to store a mapping from their AOR to their Node-Id
      in the overlay, and to retrieve the Node-Id of other UAs.
   Rendezvous:    Once a SIP UA has identified the Node-Id for an AOR it
      wishes to call, it can use the RELOAD message routing system to
      set up a direct connection which can be used to exchange SIP
      messages.

   For instance, Bob could register his Node-Id, "1234", under his AOR,
   "sip:bob@dht.example.com".  When Alice wants to call Bob, she queries
   the overlay for "sip:bob@dht.example.com" and gets back Node-Id 1234.



Jennings, et al.        Expires January 12, 2009               [Page 12]

Internet-Draft                   RELOAD                        July 2008


   She then uses the overlay to establish a direct connection with Bob
   and can use that direct connection to perform a standard SIP INVITE.

1.4.  Security

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

   Connection Level:    Connections between peers are secured with TLS
      or DTLS.
   Message Level:    Each RELOAD message must be signed.
   Object Level:    Stored objects must be signed by the storing peer.

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

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

1.5.  Structure of This Document

   The remainder of this document is structured as follows.

   o  Section 2 provides definitions of terms used in this document.
   o  Section 3 provides an overview of the mechanisms used to establish
      and maintain the overlay.
   o  Section 4 provides an overview of the mechanism RELOAD provides to
      support other applications.
   o  Section 5 provides an overview of the SIP usage for RELOAD.
   o  Section 6 defines the protocol messages that RELOAD uses to
      establish and maintain the overlay.
   o  Section 7 defines the protocol messages that are used to store and
      retrieve data using RELOAD.





Jennings, et al.        Expires January 12, 2009               [Page 13]

Internet-Draft                   RELOAD                        July 2008


   o  Sections 8-10 define three Usages of RELOAD that provide
      certificate storage, SIP, and Diagnostics.
   o  Section 11 defines a specific Topology Plugin using Chord.
   o  Section 12 defines the mechanisms that new RELOAD nodes use to
      join the overlay for the first time.
   o  Section 13 provides an extended example.
   o  Sections 14 and 15 provide Security and IANA considerations.


2.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in RFC 2119 [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
   defined inline when used and are also defined below for reference.
   Terms which are new to this document (and perhaps should be added to
   the concepts document) are marked with a (*).


   DHT:  A distributed hash table.  A DHT is an abstract hash table
      service realized by storing the contents of the hash table across
      a set of peers.

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

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

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

   Client:  A host that is able to store data in and retrieve data from
      the overlay but which is not participating in routing or data
      storage for the overlay.






Jennings, et al.        Expires January 12, 2009               [Page 14]

Internet-Draft                   RELOAD                        July 2008



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

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

   Resource:  An object or group of objects associated with a string
      identifier see "Resource Name" below.

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

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

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

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



Jennings, et al.        Expires January 12, 2009               [Page 15]

Internet-Draft                   RELOAD                        July 2008



   Destination List:  A list of IDs through which a message is to be
      routed.  A single Node-ID is a trivial form of destination list.
      (*)

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


3.  Overlay Management Overview

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

3.1.  Security and Identification

   Every node in the RELOAD overlay is identified by a Node-ID.  The
   Node-ID is used for three major purposes:

   o  To address the node itself.
   o  To determine its position in the overlay topology when the overlay
      is structured.
   o  To determine the set of resources for which the node is
      responsible.

   Each node has a certificate [RFC3280] containing a Node-ID, which is
   globally unique.

   The certificate serves multiple purposes:

   o  It entitles the user to store data at specific locations in the
      Overlay Instance.  Each data kind defines the specific rules for
      determining which certificates can access each resource-ID/kind-id
      pair.  For instance, some kinds might allow anyone to write at a
      given location, whereas others might restrict writes to the owner
      of a single certificate.
   o  It entitles the user to operate a node that has a Node-ID found in
      the certificate.  When the node forms a connection to another
      peer, it can use this certificate so that a node connecting to it
      knows it is connected to the correct node.  In addition, the node
      can sign messages, thus providing integrity and authentication for
      messages which are sent from the node.



Jennings, et al.        Expires January 12, 2009               [Page 16]

Internet-Draft                   RELOAD                        July 2008


   o  It entitles the user to use the user name found in the
      certificate.

   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.

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

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

3.1.1.  Shared-Key Security

   RELOAD also provides an admission control system based on shared
   keys.  In this model, the peers all share a single key which is used
   to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP.

3.2.  Clients

   RELOAD defines a single protocol that is used both as the peer
   protocol and the client protocol for the overlay.  This simplifies
   implementation, particularly for devices that may act in either role,
   and allows clients to inject messages directly into the overlay.

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

   RELOAD's client support allows nodes that are not participating in
   the overlay as peers to utilize the same implementation and to



Jennings, et al.        Expires January 12, 2009               [Page 17]

Internet-Draft                   RELOAD                        July 2008


   benefit from the same security mechanisms as the peers.  Clients
   possess and use certificates that authorize the user to store data at
   its locations in the overlay.  The Node-ID in the certificate is used
   to identify the particular client as a member of the overlay and to
   authenticate its messages.

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

3.2.1.  Client Routing

   There are two routing options by which a client may be located in an
   overlay.

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

3.2.2.  Client Behavior

   There are a wide variety of reasons a node may act as a client rather
   than as a peer [I-D.pascual-p2psip-clients].  This section outlines
   some of those scenarios and how the client's behavior changes based
   on its capabilities.

3.2.2.1.  Why Not Only Peers?

   For a number of reasons, a particular node may be forced to act as a
   client even though it is willing to act as a peer.  These include:

   o  The node does not have appropriate network connectivity---
      typically because it is behind an overly restrictive NAT, or it
      has a low-bandwidth network connection.



Jennings, et al.        Expires January 12, 2009               [Page 18]

Internet-Draft                   RELOAD                        July 2008


   o  The node may not have sufficient resources, such as computing
      power, storage space, or battery power.
   o  The overlay algorithm may dictate specific requirements for peer
      selection.  These may include participation in the overlay to
      determine trustworthiness, control the number of peers in the
      overlay to reduce overly-long routing paths, or ensure minimum
      application uptime before a node can join as a peer.

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

3.2.2.2.  Minimum Functionality Requirements for Clients

   A node may act as a client simply because it does not have the
   resources or even an implementation of the topology plugin required
   to acts as a peer in the overlay.  In order to exchange RELOAD
   messages with a peer, a client must meet a minimum level of
   functionality.  Such a client must:

   o  Implement RELOAD's connection-management connections that are used
      to establish the connection with the peer.
   o  Implement RELOAD's data storage and retrieval methods (with client
      functionality).
   o  Be able to calculate Resource-IDs used by the overlay.
   o  Possess security credentials required by the overlay it is
      implementing.

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

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



Jennings, et al.        Expires January 12, 2009               [Page 19]

Internet-Draft                   RELOAD                        July 2008


   a client, as described in the next section.

3.2.2.3.  Clients as Application-Level Agents

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

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

3.3.  Routing

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

   RELOAD's routing capabilities must meet the following requirements:

   NAT Traversal:    RELOAD must support establishing and using
      connections between nodes separated by one or more NATs, including
      locating peers behind NATs for those overlays allowing/requiring
      it.
   Clients:    RELOAD must support requests from and to clients that do
      not participate in overlay routing.
   Client promotion:  RELOAD must support clients that become peers at a
      later point as determined by the overlay algorithm and deployment.
   Low state:    RELOAD's routing algorithms must not require
      significant state to be stored on intermediate peers.
   Return routability in unstable topologies:    At some points in
      times, different nodes may have inconsistent information about the
      connectivity of the routing graph.  In all cases, the response to
      a request needs to delivered to the node that sent the request and
      not to some other node.

   To meet these requirements, RELOAD's routing relies on two basic
   mechanisms:






Jennings, et al.        Expires January 12, 2009               [Page 20]

Internet-Draft                   RELOAD                        July 2008


   Via Lists:    The forwarding header used by all RELOAD messages
      contains both a Via List (built hop-by-hop as the message is
      routed through the overlay) and a Destination List (providing
      source-routing capabilities for requests and return-path routing
      for responses).
   Route_Query:    The Route_Query method allows a node to query a peer
      for the next hop it will use to route a message.  This method is
      useful for diagnostics and for iterative routing.

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

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

   A         B         X         Z
   -------------------------------

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


                       <----------
                      Dest=X, B, A
             <----------
               Dest=B, A
   <----------
        Dest=A

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

   This figure shows use of full via-lists by intermediate peers B and
   X. However, if B and/or X are willing to store state, then they may
   elect to truncate the lists, save that information internally (keyed



Jennings, et al.        Expires January 12, 2009               [Page 21]

Internet-Draft                   RELOAD                        July 2008


   by the transaction id), and return the response message along the
   path from which it was received when the response is received.  This
   option requires greater state on intermediate peers but saves a small
   amount of bandwidth and reduces the need for modifying the message
   enroute.  Selection of this mode of operation is a choice for the
   individual peer---the techniques are mutually interoperable even on a
   single message.  The figure below shows B using full via lists but X
   truncating them and saving the state internally.

   A         B         X         Z
   -------------------------------

   ---------->
   Dest=Z
             ---------->
             Via=A
             Dest=Z
                       ---------->
                       Dest=Z

                       <----------
                            Dest=X
               <----------
               Dest=B, A
   <----------
        Dest=A

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

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

3.3.1.  Routing Alternatives

   Significant discussion has been focused on the selection of a routing
   algorithm for P2PSIP.  This section discusses the motivations for
   selection of symmetric recursive routing for RELOAD and describes the
   extensions that would be required to support additional routing
   algorithms.




Jennings, et al.        Expires January 12, 2009               [Page 22]

Internet-Draft                   RELOAD                        July 2008


3.3.1.1.  Iterative vs Recursive

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

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

3.3.1.2.  Symmetric vs Forward response

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

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

   Furthermore, forward-only responses are less likely to reach the
   querying peer than symmetric recursive because the forward path is
   more likely to have a failed peer than the request path (which was
   just tested to route the request) [stoica-non-transitive-worlds05].

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

3.3.1.3.  Direct Response

   Another routing option is Direct Response routing, in which the
   response is returned directly to the querying node.  In the previous
   example, if A encodes its IP address in the request, then Z can



Jennings, et al.        Expires January 12, 2009               [Page 23]

Internet-Draft                   RELOAD                        July 2008


   simply deliver the response directly to A. In the absence of NATs or
   other connectivity issues, this is the optimal routing technique.

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

   o  The IP address listed by A may be unreachable, either due to NAT
      or firewall rules.  Therefore, a direct response technique must
      fallback to symmetric response [stoica-non-transitive-worlds05].
      The hop-by-hop ACKs used by RELOAD allow Z to determine when A has
      received the message (and the TLS negotiation will provide earlier
      confirmation that A is reachable), but this fallback requires a
      timeout that will increase the response latency whenever A is not
      reachable from Z.
   o  Whenever A is behind a NAT it will have multiple candidate IP
      addresses, each of which must be advertised to ensure
      connectivity, therefore Z will need to attempt multiple
      connections to deliver the response.
   o  One (or all) of A's candidate addresses may route from Z to a
      different device on the Internet.  In the worst case these nodes
      may actually be running RELOAD on the same port.  Therefore,
      establishing a secure connection to authenticate A before
      delivering the response is absolutely necessary.  This step
      diminishes the efficiency of direct response because multiple
      roundtrips are required before the message can be delivered.
   o  If A is behind a NAT and does not have a connection already
      established with Z, there are only two ways the direct response
      will work.  The first is that A and Z are both behind the same
      NAT, in which case the NAT is not involved.  In the more common
      case, when Z is outside A's NAT, the response will only be
      received if A's NAT implements endpoint-independent filtering.  As
      the choice of filtering mode conflates application transparency
      with security [RFC4787], and no clear recommendation is available,
      the prevalence of this feature in future devices remains unclear.

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

3.3.1.4.  Relay Peers

   SEP [I-D.jiang-p2psip-sep] has proposed implementing a form of direct
   response by having A identify a peer, Q, that will be directly



Jennings, et al.        Expires January 12, 2009               [Page 24]

Internet-Draft                   RELOAD                        July 2008


   reachable by any other peer.  A uses Attach to establish a connection
   with Q and advertises Q's IP address in the request sent to Z. Z
   sends the response to Q, which relays it to A. This then reduces the
   latency to two hops, plus Z negotiating a secure connection to Q.

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

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

   A concept similar to relay peers, essentially choosing a relay peer
   at random, has previously been suggested to solve problems of
   pairwise non-transitivity [stoica-non-transitive-worlds05], but
   deterministic filtering provided by NATs make random relay peers no
   more likely to work than the responding peer.

3.3.1.5.  Symmetric Route Stability

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

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

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



Jennings, et al.        Expires January 12, 2009               [Page 25]

Internet-Draft                   RELOAD                        July 2008


   Finally, because RELOAD retries the end-to-end request, that retry
   will address the issues of churn that remain.

3.4.  Connectivity Management

   In order to provide efficient routing, a peer needs to maintain a set
   of direct connections to other peers in the Overlay Instance.  Due to
   the presence of NATs, these connections often cannot be formed
   directly.  Instead, we use the Attach request to establish a
   connection.  Attach uses ICE [I-D.ietf-mmusic-ice-tcp] to establish
   the connection.  It is assumed that the reader is familiar with ICE.

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

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

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

3.5.  Overlay Algorithm Support

   The Topology Plugin allows RELOAD to support a variety of overlay
   algorithms.  This draft defines a DHT based on Chord [Chord], which
   is mandatory to implement, but the base RELOAD protocol is designed
   to support a variety of overlay algorithms.





Jennings, et al.        Expires January 12, 2009               [Page 26]

Internet-Draft                   RELOAD                        July 2008


3.5.1.  Support for Pluggable Overlay Algorithms

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

3.5.2.  Joining, Leaving, and Maintenance Overview

   When a new peer wishes to join the Overlay Instance, it must have a
   Node-ID that it is allowed to use.  It uses the Node-ID in the
   certificate it received from the enrollment server.  The details of
   the joining procedure are defined by the overlay algorithm, but the
   general steps for joining an Overlay Instance are:

   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.

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

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

   o  Forming connections to other peers in the overlay to populate its
      Routing Table.
   o  Getting a copy of the data it is now responsible for storing and
      assuming responsibility for that data.

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

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




Jennings, et al.        Expires January 12, 2009               [Page 27]

Internet-Draft                   RELOAD                        July 2008


   1.  JP (Joining Peer) sends a Join request to AP (Admitting Peer)
       announcing its intention to join.
   2.  AP sends a Join response.
   3.  AP does a sequence of Stores to JP to give it the data it will
       need.
   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 Overlay Instance.
   5.  JP makes its own connections to the appropriate peers in the
       Overlay Instance.

   After this process is completed, JP is a full member of the Overlay
   Instance and can process Store/Fetch requests.

   Note that the first node is a special case.  When ordinary nodes
   cannot form connections to the bootstrap nodes, then they are not
   part of the overlay.  However, the first node in the overlay can
   obviously not connect to others nodes.  In order to support this
   case, potential first nodes (which must also serve as bootstrap nodes
   initially) must somehow be instructed (perhaps by configuration
   settings) that they are the entire overlay, rather than not part of
   it.

3.6.  First-Time Setup

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

3.6.1.  Initial Configuration

   In the first phase of the process, the user starts out with the name
   of the overlay and uses this to download an initial set of overlay
   configuration parameters.  The user does a DNS SRV lookup on the
   overlay name to get the address of a configuration server.  It can
   then connect to this server with HTTPS to download a configuration
   document which contains the basic overlay configuration parameters as
   well as a set of bootstrap nodes which can be used to join the
   overlay.






Jennings, et al.        Expires January 12, 2009               [Page 28]

Internet-Draft                   RELOAD                        July 2008


3.6.2.  Enrollment

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


4.  Application Support Overview

   RELOAD is not intended to be used alone, but rather as a substrate
   for other applications.  These applications can use RELOAD for a
   variety of purposes:

   o  To store data in the overlay and retrieve data stored by other
      nodes.
   o  As a discovery mechanism for services such as TURN.
   o  To form direct connections which can be used to transmit
      application-level messages.

   This section provides an overview of these services.

4.1.  Data Storage

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
















Jennings, et al.        Expires January 12, 2009               [Page 29]

Internet-Draft                   RELOAD                        July 2008


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

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


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

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






Jennings, et al.        Expires January 12, 2009               [Page 30]

Internet-Draft                   RELOAD                        July 2008


4.1.1.  Storage Permissions

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

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

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

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

4.1.2.  Usages

   By itself, the distributed storage layer just provides infrastructure
   on which applications are built.  In order to do anything useful, a
   usage must be defined.  Each Usage specifies several things:

   o  Registers kind-id code points for any kinds that the Usage
      defines.
   o  Defines the data structure for each of the kinds.
   o  Defines access control rules for each kinds.
   o  Defines how the Resource Name is formed that is hashed to form the
      Resource-ID where each kind is stored.




Jennings, et al.        Expires January 12, 2009               [Page 31]

Internet-Draft                   RELOAD                        July 2008


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

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

4.1.3.  Replication

   Replication in P2P overlays can be used to provide:

   persistence:    if the responsible peer crashes and/or if the storing
      peer leaves the overlay
   security:    to guard against DoS attacks by the responsible peer or
      routing attacks to that responsible peer
   load balancing:    to balance the load of queries for popular
      resources.

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

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

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



Jennings, et al.        Expires January 12, 2009               [Page 32]

Internet-Draft                   RELOAD                        July 2008


4.2.  Service Discovery

   RELOAD does not currently define a generic service discovery
   algorithm as part of the base protocol--although a TURN-specific
   discovery mechanism is provided.  A variety of service discovery
   algorithm can be implemented as extensions to the base protocol, such
   as ReDIR [opendht-sigcomm05].

4.3.  Application Connectivity

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

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


5.  P2PSIP Integration Overview

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

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

   1.  Bob, operating Node-ID 1234, stores a mapping from his URI to his
       Node-ID in the overlay.  I.e., "sip:bob@dht.example.com -> 1234".
   2.  Alice, operating Node-ID 5678, decides to call Bob. She looks up
       "sip:bob@dht.example.com" in the overlay and retrieves "1234".
   3.  Alice uses the overlay to route an Attach message to Bob's peer.
       Bob responds with his own Attach and they set up a direct
       connection, as shown below.



Jennings, et al.        Expires January 12, 2009               [Page 33]

Internet-Draft                   RELOAD                        July 2008


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

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


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

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


6.  Overlay Management Protocol

   This section defines the basic protocols used to create, maintain,
   and use the RELOAD overlay network.  We start by defining how
   messages are transmitted, received, and routed in an existing
   overlay, then define the message structure, and then finally define
   the messages used to join and maintain the overlay.






Jennings, et al.        Expires January 12, 2009               [Page 34]

Internet-Draft                   RELOAD                        July 2008


6.1.  Message Routing

   This section describes procedures used by nodes to route messages
   through the overlay.

6.1.1.  Request Origination

   In order to originate a message to a given Node-ID or resource-id, a
   node constructs an appropriate destination list.  The simplest such
   destination list is a single entry containing the peer or
   resource-id.  The resulting message will use the normal overlay
   routing mechanisms to forward the message to that destination.  The
   node can also construct a more complicated destination list for
   source routing.

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

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

   Because messages may be lost in transit through the overlay, RELOAD
   incorporates an end-to-end reliability mechanism.  When an
   originating node transmits a request it MUST set a 3 second timer.
   If a response has not been received when the timer fires, the request
   is retransmitted with the same transaction identifier.  The request
   MAY be retransmitted up to 4 times (for a total of 5 messages).
   After the timer for the fifth transmission fires, the message SHALL
   be considered to have failed.  Note that this retransmission
   procedure is not followed by intermediate nodes.  They follow the
   hop-by-hop reliability procedure described in Section 6.4.1.2.

   The above algorithm can result in multiple requests being delivered
   to a node.  Receiving nodes MUST generate semantically equivalent
   responses to retransmissions of the same request (this can be
   determined by transaction id) if the request is received within the
   maximum request lifetime (15 seconds).  For some requests (e.g.,
   FETCH) this can be accomplished merely by processing the request
   again.  For other requests, (e.g., STORE) it may be necessary to
   maintain state for the duration of the request lifetime.



Jennings, et al.        Expires January 12, 2009               [Page 35]

Internet-Draft                   RELOAD                        July 2008


6.1.2.  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 if local
   policy can override this in which case the messages is silently
   dropped.

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

   o  The first entry on the destination list is an id for which the
      peer is responsible.
   o  The first entry on the destination list is a an id for which
      another peer is responsible.
   o  The first entry on the destination list is a private id which is
      being used for destination list compression.

   These cases are handled as discussed below.

6.1.2.1.  Responsible ID

   If the first entry on the destination list is a ID for which the node
   is responsible, there are several sub-cases.
   o  If the entry is a Resource-Id, then it MUST be the only entry on
      the destination list.  If there are other entries, the message
      MUST be silently dropped.  Otherwise, the message is destined for
      this node and it passes it up to the upper layers.
   o  If the entry is a Node-Id which belongs to this node, then the
      message is destined for this node.  If this is the only entry on
      the destination list, the message is destined for this node and is
      passed up to the upper layers.  Otherwise the entry is removed
      from the destination list and the message is passed it to the
      routing layer.  If the message is a response and there is state
      for the transaction ID, the state is reinserted into the
      destination list first.
   o  If the entry is a Node-Id which is not equal to this node, then
      the node MUST drop the message silently unless the Node-Id
      corresponds to a node which is directly connected to this node
      (i.e., a client).  In that case, it MUST forward the message to
      the destination node as described in the next section.

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



Jennings, et al.        Expires January 12, 2009               [Page 36]

Internet-Draft                   RELOAD                        July 2008


6.1.2.2.  Other ID

   If neither of the other two cases applies, then the peer MUST forward
   the message towards the first entry on the destination list.  This
   means that it MUST select one of the peers to which it is connected
   and which is likely to be responsible for the first entry on the
   destination list.  If the first entry on the destination list is in
   the peer's connection table, then it SHOULD forward the message to
   that peer directly.  Otherwise, it consult the routing table to
   forward the message.

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

   o  The peer MAY add an entry to the via list in the forwarding header
      that will enable it to determine the correct node.
   o  The peer MAY keep per-transaction state which will allow it to
      determine the correct node.

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

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

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



Jennings, et al.        Expires January 12, 2009               [Page 37]

Internet-Draft                   RELOAD                        July 2008


   original via list.

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

6.1.2.3.  Private ID

   If the first entry on the destination list is a private id (e.g., a
   compressed via list), the peer MUST that entry with the original via
   list that it replaced indexes and then re-examine the destination
   list to determine which case now applies.

6.1.3.  Response Origination

   When a peer sends a response to a request, it MUST construct the
   destination list by reversing the order of the entries on the via
   list.  This has the result that the response traverses the same peers
   as the request traversed, except in reverse order (symmetric
   routing).  Note that this rule will need to be relaxed if other
   routing algorithms are supported.

6.2.  Message Structure

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

   Each message has three parts, concatenated as shown below:

      +-------------------------+
      |    Forwarding Header    |
      +-------------------------+
      |    Message Contents     |
      +-------------------------+
      |       Signature         |
      +-------------------------+


   The contents of these parts are as follows:





Jennings, et al.        Expires January 12, 2009               [Page 38]

Internet-Draft                   RELOAD                        July 2008



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

6.2.1.  Presentation Language

   The structures defined in this document are defined using a C-like
   syntax based on the presentation language used to define TLS.
   Advantages of this style include:

   o  It is easy to write and familiar enough looking that most readers
      can grasp it quickly.
   o  The ability to define nested structures allows a separation
      between high-level and low level message structures.
   o  It has a straightforward wire encoding that allows quick
      implementation, but the structures can be comprehended without
      knowing the encoding.
   o  The ability to mechanically (compile) encoders and decoders.

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

   Several idiosyncrasies of this language are worth noting.

   o  All lengths are denoted in bytes, not objects.
   o  Variable length values are denoted like arrays with angle
      brackets.
   o  "select" is used to indicate variant structures.

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






Jennings, et al.        Expires January 12, 2009               [Page 39]

Internet-Draft                   RELOAD                        July 2008


6.2.1.1.  Common Definitions

   The following definitions are used throughout RELOAD and so are
   defined here.  They also provide a convenient introduction to how to
   read the presentation language.

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

          enum { false (0), true(1), (255)} Boolean;


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

   The NodeId, shown below, represents a single Node-ID.


              typedef opaque       NodeId[16];


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

   A ResourceId, shown below, represents a single resource-id.


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


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

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







Jennings, et al.        Expires January 12, 2009               [Page 40]

Internet-Draft                   RELOAD                        July 2008


         enum {reserved_addr(0), ipv4_address (1), ipv6_address (2),
              (255)} AddressType;

         struct  {
           uint32                  addr;
           uint16                  port;
         } IPv4AddrPort;

         struct  {
           uint128                 addr;
           uint16                  port;
         } IPv6AddrPort;


         struct {
           AddressType             type;
           uint8                   length;

           select (type) {
             case ipv4_address:
                IPv4AddrPort       v4addr_port;

             case ipv6_address:
                IPv6AddrPort       v6addr_port;

             /* This structure can be extended */

          } IpAddressPort;


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


   type
      the type of address (v4 or v6).

   length
      the length of the rest of the structure.

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

   The rest of the IpAddressPort structure is either an IPv4AddrPort or
   an IPv6AddrPort.  Both of these simply consist of an address



Jennings, et al.        Expires January 12, 2009               [Page 41]

Internet-Draft                   RELOAD                        July 2008


   represented as an integer and a 16-bit port.  As an example, here is
   the wire representation of the IPv4 address "192.0.2.1" with port
   "6100".

              01           ; type    = IPv4
              06           ; length  = 6
              c0 00 02 01  ; address = 192.0.2.1
              17 d4        ; port    = 6100

6.2.2.  Forwarding Header

   The forwarding header is defined as a ForwardingHeader structure, as
   shown below.


         struct {
           uint32             relo_token;
           uint32             overlay;
           uint8              ttl;
           uint8              reserved;
           uint16             fragment;
           uint8              version;
           uint24             length;
           uint64             transaction_id;
           uint16             flags;

           uint16             via_list_length;
           uint16             destination_list_length;
           uint16             route_log_length;
           uint16             options_length;
           Destination        via_list[via_list_length];
           Destination        destination_list
                                [destination_list_length];
           RouteLogEntry      route_log[route_log_length];
           ForwardingOptions  options[options_length];
         } ForwardingHeader;

   The contents of the structure are:


   relo_token
      The first four bytes identify this message as a RELOAD message.
      The message is easy to demultiplex from STUN messages by looking
      at the first bit.  This field MUST contain the value 0xc2454c4f
      (the string 'RELO' with the high bit of the first byte set.).






Jennings, et al.        Expires January 12, 2009               [Page 42]

Internet-Draft                   RELOAD                        July 2008



   overlay
      The 32 bit checksum/hash of the overlay being used.  The variable
      length string representing the overlay name is hashed with SHA-1
      and the low order 32 bits are used.  The purpose of this field is
      to allow nodes to participate in multiple overlays and to detect
      accidental misconfiguration.  This is not a security critical
      function.

   ttl
      An 8 bit field indicating the number of iterations, or hops, a
      message can experience before it is discarded.  The TTL value MUST
      be decremented by one at every hop along the route the message
      traverses.  If the TTL is 0, the message MUST NOT be propagated
      further and MUST be discarded.  The initial value of the TTL
      should be TBD.

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

   version
      The version of the RELOAD protocol being used.  This document
      describes version 0.1, with a value of 0x01.

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

   transaction_id
      A unique 64 bit number that identifies this transaction and also
      serves as a salt to randomize the request and the response.
      Responses use the same Transaction ID as the request they
      correspond to.  Transaction IDs are also used for fragment
      reassembly.






Jennings, et al.        Expires January 12, 2009               [Page 43]

Internet-Draft                   RELOAD                        July 2008



   flags
      The flags word contains control flags.  Which are ORed together.
      There is two currently defined flags:  ROUTE-LOG (0x1) and
      RESPONSE-ROUTE-LOG (0x2).  These flags indicate that the route log
      should be included (see Section 6.2.2.2.).

   via_list_length
      The length of the via list in bytes.  Note that in this field and
      the following two length fields we depart from the usual variable-
      length convention of having the length immediately precede the
      value in order to make it easier for hardware decoding engines to
      quickly determine the length of the header.

   destination_list_length
      The length of the destination list in bytes.

   route_log_length
      The length of the route log in bytes.

   options_length
      The length of the header options in bytes.

   via_list
      The via_list contains the sequence of destinations through which
      the message has passed.  The via_list starts out empty and grows
      as the message traverses each peer.

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

   route_log
      Contains a series of route log entries.  See Section 6.2.2.2.

   options
      Contains a series of ForwardingOptions entries.  See
      Section 6.2.2.3.

6.2.2.1.  Destination and Via Lists

   The destination list and via lists are sequences of Destination
   values:





Jennings, et al.        Expires January 12, 2009               [Page 44]

Internet-Draft                   RELOAD                        July 2008


         enum {reserved(0), peer(1), resource(2), compressed(3), (255) }
              DestinationType;


         select (destination_type) {
           case peer:
              NodeId               node_id;

           case resource:
              ResourceId           resource_id;

           case compressed:
              opaque               compressed_id<0..2^8-1>;

           /* This structure may be extended with new types */

         } DestinationData;


         struct {
           DestinationType         type;
           uint8                   length;
           DestinationData         destination_data;
         } Destination;

   This is a TLV structure with the following contents:

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

   length
      The length of the destination_data.

   destination_value
      The destination value itself, which is an encoded DestinationData
      structure, depending on the value of "type".

   Note:  This structure encodes a type, length, value.  The length
      field specifies the length of the DestinationData values, which
      allows the addition of new DestinationTypes.  This allows an
      implementation which does not understand a given DestinationType
      to skip over it.

   A DestinationData can be one of three types:






Jennings, et al.        Expires January 12, 2009               [Page 45]

Internet-Draft                   RELOAD                        July 2008



   peer
      A Node-ID.

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

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

6.2.2.2.  Route Logging

   The route logging feature provides diagnostic information about the
   path taken by the message so far and in this manner it is similar in
   function to 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 or reject the request.
   The order of the route log entry elements in the message is
   determined by the order of the peers were traversed along the path.
   The first route log entry corresponds to the peer at the first hop
   along the path, and each subsequent entry corresponds to the peer at
   the next hop along the path.  If the ROUTE-LOG flag is set, the route
   log entries in the request MUST be copied to the response or the
   request rejected.  If, and only if, the ROUTE-LOG-RESPONSE flag is
   set in a request, the ROUTE-LOG flag MUST be set in the response.

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

   The route log is defined as follows:













Jennings, et al.        Expires January 12, 2009               [Page 46]

Internet-Draft                   RELOAD                        July 2008


       enum { (255) } RouteLogExtensionType;

       struct {
         RouteLogExtensionType     type;
         uint16                    length;

         select (type){
           /* Extension values go here */
         } extension;
       } RouteLogExtension;

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

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

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


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

   Each RouteLogEntry consists of the following values:


   version
      A textual representation of the software version

   transport
      The transport type, currently either "tcp_tls" or "udp_dtls".

   id
      The Node-ID of the peer.








Jennings, et al.        Expires January 12, 2009               [Page 47]

Internet-Draft                   RELOAD                        July 2008


   uptime
      The uptime of the peer in seconds.

   address
      The address and port of the peer.

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

   extensions
      Extensions, if any.

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


   type
      The type of the extension.

   length
      The length of the rest of the structure.

   extension
      The extension value.

6.2.2.3.  Forwarding Options

   The Forwarding header can be extended with forwarding header options,
   which are a series of ForwardingOptions structures:

       enum { (255) } ForwardingOptionsType;

       struct {
         ForwardingOptionsType     type;
         uint8                     flags;
         uint16                    length;
         select (type) {
           /* Option values go here */
         } option;
       } ForwardingOption;


   Each ForwardingOption consists of the following values:





Jennings, et al.        Expires January 12, 2009               [Page 48]

Internet-Draft                   RELOAD                        July 2008



   type
      The type of the option.

   length
      The length of the rest of the structure.

   flags
      Three flags are defined FORWARD_CRITICAL(0x01),
      DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04).  These flags
      MUST not be set in a response.  If the FORWARD_CRITICAL flag is
      set, any node that would forward the message but does not
      understand this options MUST reject the request with an 757 error
      resonse.  If the DESTINATION_CRITICAL flag is set, any node
      generates a response to the message but does not understand the
      forwarding option MUST reject the request with an 757 error
      resonse.  If the RESPONSE_COPY flag is set, any node generating a
      response MUST copy the option from the request to the response and
      clear the RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL
      flags.

   option
      The option value.

6.2.3.  Message Contents Format

   The second major part of a RELOAD message is the contents part, which
   is defined by MessageContents:

          struct {
            MessageCode            message_code;
            opaque                 payload<0..2^24-1>;
          } MessageContents;


   The contents of this structure are as follows:

   message_code
      This indicates the message that is being sent.  The code space is
      broken up as follows.

      0  Reserved

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



Jennings, et al.        Expires January 12, 2009               [Page 49]

Internet-Draft                   RELOAD                        July 2008



      0xffff  Error

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

6.2.3.1.  Response Codes and Response Errors

   A peer processing a request returns its status in the message_code
   field.  If the request was a success, then the message code is the
   response code that matches the request (i.e., the next code up).  The
   response payload is then as defined in the request/response
   descriptions.

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

   When the message code is 0xffff, the payload MUST be an
   ErrorResponse.

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


   The contents of this structure are as follows:


   error_code
      A numeric error code indicating the error that occurred.

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








Jennings, et al.        Expires January 12, 2009               [Page 50]

Internet-Draft                   RELOAD                        July 2008


   error_info
      Payload specific error information.  This MUST be empty (zero
      length) except as specified below.

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


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

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

   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, overlay algorithm, or hash algorithm.
      [[Open Issue:  What is the best error number and reason phrase to
      use?]]

   757 (Unsupported Forwarding Option)  A peer receiving the request
      with a forwarnding options flaged as critical but the peer does
      not support this option.  See section Section 6.2.2.3.  [[Open
      Issue:  What is the best error number and reason phrase to use?]]

6.2.4.  Signature

   The third part of a RELOAD message is the signature, represented by a
   Signature structure.  The message signature is computed over the
   payload and parts of forwarding header.  The p