idnits 2.17.1 draft-wood-tsvwg-saratoga-11.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with multicast IPv4 addresses in the document. If these are generic example addresses, they should be changed to use the 233.252.0.x range defined in RFC 5771 == There are 1 instance of lines with non-RFC3849-compliant IPv6 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The exact meaning of the all-uppercase expression 'MAY NOT' is not defined in RFC 2119. If it is intended as a requirements expression, it should be rewritten using one of the combinations defined in RFC 2119; otherwise it should not be all-uppercase. == The expression 'MAY NOT', while looking like RFC 2119 requirements text, is not defined in RFC 2119, and should not be used. Consider using 'MUST NOT' instead (if that is what you mean). Found 'MAY NOT' in this paragraph: In accordance with the UDP Guidelines [RFC5405], congestion control MUST be supported if Saratoga is being used across the public Internet, and SHOULD be supported in environments where links are shared by traffic flows. Congestion control MAY NOT be supported across private, single-flow links engineered for performance: Saratoga's primary use case. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (March 26, 2012) is 4413 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 3309 (Obsoleted by RFC 4960) == Outdated reference: A later version (-14) exists of draft-wood-dtnrg-saratoga-10 -- Obsolete informational reference (is this intentional?): RFC 5405 (Obsoleted by RFC 8085) Summary: 1 error (**), 0 flaws (~~), 5 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group L. Wood 3 Internet-Draft Surrey alumni 4 Intended status: Experimental W. Eddy 5 Expires: September 27, 2012 MTI Systems 6 C. Smith 7 Vallona 8 W. Ivancic 9 NASA 10 C. Jackson 11 SSTL 12 March 26, 2012 14 Saratoga: A Scalable Data Transfer Protocol 15 draft-wood-tsvwg-saratoga-11 17 Abstract 19 This document specifies the Saratoga transfer protocol. Saratoga was 20 originally developed to transfer remote-sensing imagery efficiently 21 from a low-Earth-orbiting satellite constellation, but is useful for 22 many other scenarios, including ad-hoc peer-to-peer communications, 23 delay-tolerant networking, and grid computing. Saratoga is a simple, 24 lightweight, content dissemination protocol that builds on UDP, and 25 optionally uses UDP-Lite. Saratoga is intended for use when moving 26 files or streaming data between peers which may have permanent, 27 sporadic or intermittent connectivity, and is capable of transferring 28 very large amounts of data reliably under adverse conditions. The 29 Saratoga protocol is designed to cope with highly asymmetric link or 30 path capacity between peers, and can support fully-unidirectional 31 data transfer if required. In scenarios with dedicated links, 32 Saratoga focuses on high link utilization to make the most of limited 33 connectivity times, while standard congestion control mechanisms can 34 be implemented for operation over shared links. Loss recovery is 35 implemented via a simple negative-ack ARQ mechanism. The protocol 36 specified in this document is considered to be appropriate for 37 experimental use on private IP networks. 39 Status of this Memo 41 This Internet-Draft is submitted to IETF in full conformance with the 42 provisions of BCP 78 and BCP 79. This document may not be modified, 43 and derivative works of it may not be created, except to format it 44 for publication as an RFC and to translate it into languages other 45 than English. 47 Internet-Drafts are working documents of the Internet Engineering 48 Task Force (IETF). Note that other groups may also distribute 49 working documents as Internet-Drafts. The list of current Internet- 50 Drafts is at http://datatracker.ietf.org/drafts/current/. 52 Internet-Drafts are draft documents valid for a maximum of six months 53 and may be updated, replaced, or obsoleted by other documents at any 54 time. It is inappropriate to use Internet-Drafts as reference 55 material or to cite them other than as "work in progress." 57 This Internet-Draft will expire on September 27, 2012. 59 Copyright Notice 61 Copyright (c) 2012 IETF Trust and the persons identified as the 62 document authors. All rights reserved. 64 This document is subject to BCP 78 and the IETF Trust's Legal 65 Provisions Relating to IETF Documents 66 (http://trustee.ietf.org/license-info) in effect on the date of 67 publication of this document. Please review these documents 68 carefully, as they describe your rights and restrictions with respect 69 to this document. Code Components extracted from this document must 70 include Simplified BSD License text as described in Section 4.e of 71 the Trust Legal Provisions and are provided without warranty as 72 described in the Simplified BSD License. 74 Table of Contents 76 1. Background and Introduction . . . . . . . . . . . . . . . . . 4 77 2. Overview of Saratoga File Transfer . . . . . . . . . . . . . . 6 78 3. Optional Parts of Saratoga . . . . . . . . . . . . . . . . . . 11 79 3.1. Optional but useful functions in Saratoga . . . . . . . . 11 80 3.2. Optional congestion control . . . . . . . . . . . . . . . 12 81 3.3. Optional functionality requiring other protocols . . . . . 12 82 4. Packet Types . . . . . . . . . . . . . . . . . . . . . . . . . 13 83 4.1. BEACON . . . . . . . . . . . . . . . . . . . . . . . . . . 16 84 4.2. REQUEST . . . . . . . . . . . . . . . . . . . . . . . . . 20 85 4.3. METADATA . . . . . . . . . . . . . . . . . . . . . . . . . 24 86 4.4. DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 87 4.5. STATUS . . . . . . . . . . . . . . . . . . . . . . . . . . 32 88 5. The Directory Entry . . . . . . . . . . . . . . . . . . . . . 39 89 6. Behaviour of a Saratoga Peer . . . . . . . . . . . . . . . . . 42 90 6.1. Saratoga Transactions . . . . . . . . . . . . . . . . . . 42 91 6.2. Beacons . . . . . . . . . . . . . . . . . . . . . . . . . 45 92 6.3. Upper-Layer Interface . . . . . . . . . . . . . . . . . . 46 93 6.4. Inactivity Timer . . . . . . . . . . . . . . . . . . . . . 46 94 7. Mailing list . . . . . . . . . . . . . . . . . . . . . . . . . 47 95 8. Security Considerations . . . . . . . . . . . . . . . . . . . 47 96 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 48 97 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 48 98 11. A Note on Naming . . . . . . . . . . . . . . . . . . . . . . . 49 99 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 49 100 12.1. Normative References . . . . . . . . . . . . . . . . . . . 49 101 12.2. Informative References . . . . . . . . . . . . . . . . . . 49 102 Appendix A. Timestamp/Nonce field considerations . . . . . . . . 51 103 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 52 105 1. Background and Introduction 107 Saratoga is a file transfer and content dissemination protocol 108 capable of efficiently sending both small and very large files as 109 well as streaming continuous content. Saratoga was originally 110 designed for the purpose of large file transfer from small low-Earth- 111 orbit satellites. It has been used in daily operations since 2004 to 112 move mission imaging data files of the order of several hundred 113 megabytes each from the Disaster Monitoring Constellation (DMC) 114 remote-sensing satellites to ground stations. 116 The DMC satellites, built at the University of Surrey by Surrey 117 Satellite Technology Ltd (SSTL), all use IP for payload 118 communications and delivery of Earth imagery. At the time of this 119 writing, in December 2011, nine DMC satellites have been launched 120 into orbit since 2003, six of those are currently operational in 121 orbit, and three more are planned. The DMC satellites use Saratoga 122 to provide Earth imagery under the aegis of the International Charter 123 on Space and Major Disasters. A pass of connectivity between a 124 satellite and ground station offers an 8-12 minute time window in 125 which to transfer imagery files using a minimum of an 8.1 Mbps 126 downlink and a 9.6 kbps uplink. The latest operational DMC 127 satellites have faster downlinks, capable of 20, 40, 80, 105 or 201 128 Mbps. Newer satellites are expected to use downlinks to 400 Mbps, 129 without significant increases in uplink rates. This high degree of 130 asymmetry, with the need to fully utilize the available downlink 131 capacity to move the volume of data required within the limited time 132 available, motivates much of Saratoga's design. 134 Further details on how these DMC satellites use IP to communicate 135 with the ground and the terrestrial Internet are discussed elsewhere 136 [Hogie05][Wood07a]. Saratoga is also being implemented for use in 137 high-speed private ground networks supporting radio astronomy sensors 138 [Wood11]. 140 Store-and-forward delivery relies on reliable hop-by-hop transfers of 141 files, removing the need for the final receiver to talk to the 142 original sender across long delays and allowing for the possibility 143 that an end-to-end path may never exist between sender and receiver 144 at any given time. Breaking an end-to-end path into multiple hops 145 allows data to be transferred as quickly as possible across each 146 link; congestion on a longer Internet path is then not detrimental to 147 the transfer rate on a space downlink. Use of store-and-forward hop- 148 by-hop delivery is typical of scenarios in space exploration for both 149 near-Earth and deep-space missions, and useful for other scenarios, 150 such as underwater networking, ad-hoc sensor networks, and some 151 message-ferrying relay scenarios. Saratoga is intended to be useful 152 for relaying data in these scenarios, and can optionally also be used 153 to carry the Bundle Protocol "bundles" that are proposed for use in 154 Delay and Disruption-Tolerant Networking (DTN) by the IRTF DTN 155 Research Group [RFC5050]. This has been tested from orbit using the 156 UK-DMC satellite [Ivancic10]. How Saratoga can optionally function 157 as a "bundle convergence layer" alongside a DTN bundle agent is 158 specified in a companion document [I-D.wood-dtnrg-saratoga]. 160 Saratoga contains a Selective Negative Acknowledgement (SNACK) 161 'holestofill' mechanism to provide reliable retransmission of data. 162 This is intended to correct losses of corrupted link-layer frames due 163 to channel noise over a space link. Packet losses in the DMC are due 164 to corruption introducing non-recoverable errors in the frame. The 165 DMC design uses point-to-point links and scheduling of applications 166 in order, so that the link is dedicated to one application transfer 167 at a time, meaning that packet loss cannot be due to congestion when 168 applications compete for link capacity simultaneously. In other 169 wireless environments that may be shared by many nodes and 170 applications, allocation of channel resources to nodes becomes a MAC- 171 layer function. Forward Error Coding (FEC) to get the most reliable 172 transmission through a channel is best left near the physical layer 173 so that it can be tailored for the channel. Use of FEC complements 174 Saratoga's transport-level negative-acknowledgement approach to 175 provide a reliable ARQ mechanism [RFC3366]. 177 Saratoga is scalable in that it is capable of efficiently 178 transferring small or large files, by choosing a width of file offset 179 descriptor appropriate for the filesize, and advertising accepted 180 offset descriptor sizes. 16-bit, 32-bit, 64-bit and 128-bit 181 descriptors can be selected, for maximum file sizes of 64KiB-1 (<64 182 kilobytes), 4GiB-1 (<4 gigabytes), 16EiB-1 (<16 exabytes) and 256 183 EiEiB-1 (<256 exa-exabytes) respectively. 185 Earth imaging files currently transferred by Saratoga are mostly up 186 to a few gigabytes in size. Some implementations do transfer more 187 than 4 GiB in size, and so require offset descriptors larger than 32 188 bits. We believe that supporting a 128-bit descriptor can satisfy 189 all future needs, but we expect current implementations to only 190 support up to 32-bit or 64-bit descriptors, depending on their 191 application needs. The 16-bit descriptor is useful for small 192 messages, including messages from 8-bit devices, and is always 193 supported. The 128-bit descriptor can be used for moving very large 194 files stored on a 128-bit filesystem, such as on OpenSolaris ZFS. 196 As a UDP-based protocol, Saratoga can be used with either IPv4 or 197 IPv6. Compatibility between Saratoga and the wide variety of links 198 that can already carry IP traffic is assured. 200 High link utilization is important during periods of limited 201 connectivity. Given that Saratoga was originally developed for 202 scheduled peer-to-peer communications over dedicated links in private 203 networks, where each application has the entire link for the duration 204 of its transfer, many Saratoga implementations deliberately lack any 205 form of congestion control and send at line rate to maximise 206 throughput and link utilisation in their limited, carefully 207 controlled, environments. In accordance with UDP Guidelines 208 [RFC5405] for protocols able to traverse the public Internet, newer 209 implementations may perform TCP-Friendly Rate Control (TFRC) 210 [RFC5348] or other congestion control mechanisms. This is described 211 further in [wood-tsvwg-saratoga-congestion-control]. 213 Saratoga was originally implemented as outlined in [Jackson04], but 214 the specification given here differs substantially, as we have added 215 a number of features while cleaning up the initial Saratoga 216 specification. The original Saratoga code uses a version number of 217 0, while code that implements this version of the protocol advertises 218 a version number of 1. Further discussion of the history and 219 development of Saratoga is given in [Wood07b]. 221 This document contains an overview of the transfer process and 222 transactions using Saratoga in Section 2, followed by a formal 223 definition of the packet types used by Saratoga in Section 4, and the 224 details of the various protocol mechanisms in Section 6. 226 Here, Saratoga transaction types are labelled with underscores around 227 lowercase names (such as a "_get_" transaction), while Saratoga 228 packet types are labelled in all capitals (such as a "REQUEST" 229 packet) in order to distinguish between the two. 231 The remainder of this specification uses 'file' as a shorthand for 232 'binary object', which may be a DTN bundle, or other type of data. 233 This specification uses 'file' when also discussing streaming of data 234 of indeterminate length. Saratoga uses unsigned integers in its 235 fields, and does not use signed types. 237 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 238 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 239 document are to be interpreted as described in RFC 2119. [RFC2119] 241 2. Overview of Saratoga File Transfer 243 Saratoga is a peer-to-peer protocol in the sense that multiple files 244 may be transferred in both directions simultaneously between two 245 communicating Saratoga peers, and there is not intended to be a 246 strict client-to-server relationship. 248 Saratoga nodes can act as simple file servers. Saratoga supports 249 several types of operations on files including "pull" downloads, 250 "push" uploads, directory listing, and deletion requests. Each 251 operation is handled as a distinct "transaction" between the peers. 253 Saratoga nodes MAY advertise their presence, capabilities, and 254 desires by sending BEACON packets. These BEACONs are sent to either 255 a reserved, unforwardable, multicast address when using IPv4, or a 256 link-local all-Saratoga-peers multicast address when using IPv6. A 257 BEACON might also be unicast to another known node as a sort of 258 "keepalive". Saratoga nodes may dynamically discover other Saratoga 259 nodes, either through listening for BEACONs, through pre- 260 configuration, via some other trigger from a user, lower-layer 261 protocol, or another process. The BEACON is useful in many 262 situations, such as ad-hoc networking, as a simple, explicit, 263 confirmation that another node is present; a BEACON is not required 264 in order to begin a Saratoga transaction. BEACONs have been used by 265 the DMC satellites to indicate to ground stations that a link has 266 become functional, a solid-state data recorder is online, and the 267 software is ready to transfer any requested files. 269 A Saratoga transaction begins with either a _get_, _put_, _getdir_, 270 or _delete_ transaction REQUEST packet corresponding to a desired 271 download, upload, directory listing, or deletion operation. _put_ 272 transactions may instead begin directly with METADATA and DATA, 273 without an initial REQUEST/OKAY STATUS exchange; these are known as 274 'blind puts'. The most common envisioned transaction is the _get_, 275 which begins with a single Saratoga REQUEST packet sent from the peer 276 wishing to receive the file, to the peer who currently has the file. 277 If the transaction is rejected, then a brief STATUS packet that 278 conveys rejection is generated. If the file-serving peer accepts the 279 transaction, an OKAY STATUS can be optional; the peer can immediately 280 generate and send a more useful descriptive METADATA packet, along 281 with some number of DATA packets constituting the requested file. 283 These DATA packets are finished by (and can intermittently include) a 284 DATA packet with a flag bit set that demands the file-receiver send a 285 reception report in the form of a STATUS packet. The STATUS packet 286 can include 'holestofill' Selective Negative Acknowledgement (SNACK) 287 information listing spans of octets within the file that have not yet 288 been received, as well as whether or not the METADATA packet was 289 received. Based on the information in this STATUS packet, the file- 290 sender can begin a cycle of selective retransmissions of missing DATA 291 packets, until it sees a STATUS packet that acknowledges total 292 reception of all file data. 294 In the example scenario in Figure 1, a _get_ request is granted. The 295 reliable file delivery experiences loss of a single DATA packet due 296 to channel-induced errors. 298 File-Receiver File-Sender 300 GET REQUEST ---------------------> 301 (indicates acceptance) <------- STATUS 302 <------- METADATA 303 <---------------------- DATA #1 304 STATUS -----------------> (voluntarily sent at start) 305 (lost) <------ DATA #2 306 <---------------------- DATA #3 (bit set 307 requesting STATUS) 308 STATUS -----------------> 309 (indicating that range in DATA #2 was lost) 310 <----------------------- DATA #2 (bit set 311 requesting STATUS) 312 STATUS -----------------> 313 (complete file and METADATA received) 315 Figure 1: Example _get_ transaction sequence 317 A _put_ is similar to _get_, although once the OKAY STATUS is 318 received, DATA is sent from the peer that originated the _put_ 319 request. A 'blind _put_' does not require an REQUEST and OKAY STATUS 320 to be exchanged before sending DATA packets, and is efficient for 321 long-delay or unidirectional links. 323 A _getdir_ request proceeds similarly, though the DATA transfer 324 contains a directory record with one or more directory entries, 325 described later, rather than a given file's bytes. _getdir_ is the 326 only request to also apply to directories, where one or more 327 directory entries for individual files is received. 329 The STATUS and DATA packets are allowed to be sent at any time within 330 the scope of a transaction, in order for the file-sending node to 331 optimize buffer management and transmission order. For example, if 332 the file-receiver already has the first part of a file from a 333 previous disrupted transfer, it may send a STATUS at the beginning of 334 the transaction indicating that it has the first part of the file, 335 and so only needs the last part of the file. Thus, efficient 336 recovery from interrupted sessions between peers becomes possible, 337 similar to ranged FTP and HTTP requests. (Note that METADATA with a 338 checksum is useful to verify that the parts are of the same file and 339 that the file is reassembled correctly.) 341 The Saratoga 'blind _put_' transaction is initiated by the file- 342 sender sending an optional METADATA packet followed by immediate DATA 343 packets, without requiring a REQUEST or waiting for a STATUS 344 response. This can be considered an "optimistic" mode of protocol 345 operation, as it assumes the implicit transaction request will be 346 granted. If the sender of a PUT request sees a STATUS packet 347 indicating that the request was declined, it MUST stop sending any 348 DATA packets within that transaction immediately. Since this type of 349 _put_ is open-loop for some period of time, it should not be used in 350 scenarios where congestion is a valid concern; in these cases, the 351 file-sender should wait on its METADATA to be acknowledged by a 352 STATUS before sending DATA packets within the transaction. 354 Figure 2 illustrates the sequence of packets in an example _put_ 355 transaction, beginning directly with METADATA and DATA as in a blind 356 put, where the second DATA packet is lost. Other than the way that 357 it is initiated, the mechanics of data delivery of a blind _put_ 358 transaction are similar to a _get_ transaction. 360 File-Sender File-Receiver 362 METADATA ----------------> 363 DATA #1 ----------------> 364 (transfer accepted) <---------- STATUS 365 DATA #2 ---> (lost) 366 DATA #3 (bit set ------------> 367 requesting STATUS) 368 (DATA #2 lost) <---------- STATUS 369 DATA #2 (bit set ------------> 370 requesting STATUS) 371 (transfer complete) <---------- STATUS 373 Figure 2: Example PUT transaction sequence 375 In deep-space scenarios, the large propagation delays and round-trip 376 times involved discourage use of ping-pong packet exchanges (such as 377 TCP's SYN/ACK) for starting transactions, and unidirectional 378 transfers via these optimistic 'blind _put_s' are desirable. Blind 379 _puts_ are the only mode of transfer suitable for unidirectional 380 links. Senders sending on unidirectional links SHOULD send a copy of 381 the METADATA in advance of DATA packets, and MAY resend METADATA at 382 intervals. 384 The _delete_ transactions are simple single packet requests that 385 trigger a STATUS packet with a status code that indicates whether the 386 file was deleted or not. If the file is not able to be deleted for 387 some reason, this reason can be conveyed in the Status field of the 388 STATUS packet. 390 A _get_ REQUEST packet that does not specify a filename (i.e. the 391 request contains a zero-length File Path field) is specially defined 392 to be a request for any chosen file that the peer wishes to send it. 393 This 'blind _get_' allows a Saratoga peer to request any files that 394 the other Saratoga peer has ready for it, without prior knowledge of 395 the directory listing, and without requiring the ability to examine 396 files or decode remote file names/paths for meaningful information 397 such as final destination. 399 If a file is larger than Saratoga can be expected to transfer during 400 a time-limited contact, there are at least two feasible options: 402 (1) The application can use proactive fragmentation to create 403 multiple smaller-sized files. Saratoga can transfer some number of 404 these smaller files fully during a contact. 406 (2) To avoid file fragmentation, a Saratoga file-receiver can retain 407 a partially-transferred file and request transfer of the unreceived 408 bytes during a later contact. This uses a STATUS packet to make 409 clear how much of the file has been successfully received and where 410 transfer should be resumed from, and relies on use of METADATA to 411 identify the file. On resumption of a transfer, the new METADATA 412 (including file length, file timestamps, and possibly a file 413 checksum) MUST match that of the previous METADATA in order to re- 414 establish the transfer. Otherwise, the file-receiver MUST assume 415 that the file has changed and purge the DATA payload received during 416 previous contacts. 418 Like the BEACON packets, a _put_ or a response to a _get_ MAY be sent 419 to the dedicated IPv4 Saratoga multicast address (allocated to 420 224.0.0.108) or the dedicated IPv6 link-local multicast address 421 (allocated to FF02:0:0:0:0:0:0:6C) for multiple file-receivers on the 422 link to hear. This is at the discretion of the file-sender, if it 423 believes that there is interest from multiple receivers. In-progress 424 DATA transfers MAY also be moved seamlessly from unicast to multicast 425 if the file-sender learns during a transfer, from receipt of further 426 unicast _get_ REQUEST packets, that multiple nodes are interested in 427 the file. The associated METADATA packet is multicast when this 428 transition takes place, and is then repeated periodically while the 429 DATA stream is being sent, to inform newly-arrived listeners about 430 the file being multicast. Acknowledgements MUST NOT be demanded by 431 multicast DATA packets, to prevent ack implosion at the file-sender, 432 and instead status SNACK information is aggregated and sent 433 voluntarily by all file-receivers. File-receivers respond to 434 multicast DATA with multicast STATUS packets. File-receivers SHOULD 435 introduce a short random delay before sending a multicast STATUS 436 packet, to prevent ack implosion after a channel-induced loss, and 437 MUST listen for STATUS packets from others, to avoid duplicating fill 438 requests. The file-sender SHOULD repeat any initial unicast portion 439 of the transfer as multicast last of all, and may repeat and cycle 440 through multicast of the file several times while file-receivers 441 express interest via STATUS or _get_ packets. Once in multicast and 442 with METADATA being repeated periodically, new file-receivers do not 443 need to send individual REQUEST packets. If a transfer has been 444 started using UDP-Lite and new receivers indicate UDP-only 445 capability, multicast transfers MUST switch to using UDP to 446 accommodate them. 448 3. Optional Parts of Saratoga 450 Implementing support for some parts of Saratoga is optional. These 451 parts are grouped into three sections, namely useful capabilities in 452 Saratoga that are likely to be supported by implementations, 453 congestion control that is needed in shared networks and across the 454 public Internet, and functionality requiring other protocols that is 455 less likely to be supported. 457 3.1. Optional but useful functions in Saratoga 459 These are useful capabilities in Saratoga that implementations SHOULD 460 support, but may not, depending on scenarios: 462 - sending and parsing BEACONs. 464 - sending and parsing METADATA. However, sending and receiving 465 METADATA is considered extremely useful, is strongly recommended, and 466 SHOULD be done. 468 - streaming data, including real-time streaming of content of unknown 469 length. This streaming can be unreliable (without resend requests) 470 or reliable (with resend requests). Session protocols such as http 471 expect reliable streaming. Although Saratoga data delivery is 472 inherently one-way, where a stream of DATA packets elicits a stream 473 of STATUS packets, bidirectional duplex communication can be 474 established by using two Saratoga transfers flowing in opposite 475 directions. 477 - multicast DATA transfers, if judged useful for the environment in 478 which Saratoga is deployed, when multiple receivers are participating 479 and are receiving the same file or stream. 481 - sending and parsing STATUS messages, which are expected for 482 bidirectional communication, but cannot be sent on and are not 483 required for sending over unidirectional links. 485 - sending and responding to packet timestamps in DATA and STATUS 486 packets. These timestamps are useful for streaming and for giving a 487 file-sender an indication of path latency for rate control. There is 488 no need for a file-receiver to understand the format used for these 489 timestamps for it to be able to receive them from and reflect them 490 back to the file-sender. 492 - support for descriptor sizes greater than 16 bits, for handling 493 small files, is optional, as is support for descriptor sizes greater 494 than 32 bits, and support for descriptor sizes greater than 64 bits. 495 If a decriptor size is implemented, all sizes below that size MUST be 496 implemented. 498 3.2. Optional congestion control 500 Saratoga can be implemented to perform congestion control at the 501 sender, based on feedback from acknowledgement STATUS packets 502 [wood-tsvwg-saratoga-congestion-control], or have the sender 503 configured to use simple open-loop rate control to only use a fixed 504 amount of link capacity. Congestion control is expected to be 505 undesirable for many of Saratoga's use cases and expected 506 environmental conditions in private networks, where sending as 507 quickly as possible or simple rate control at a fixed output speed 508 are considered useful. 510 In accordance with the UDP Guidelines [RFC5405], congestion control 511 MUST be supported if Saratoga is being used across the public 512 Internet, and SHOULD be supported in environments where links are 513 shared by traffic flows. Congestion control MAY NOT be supported 514 across private, single-flow links engineered for performance: 515 Saratoga's primary use case. 517 3.3. Optional functionality requiring other protocols 519 The functionality listed here is useful in rare cases, but requires 520 use of other, optional, protocols. This functionality MAY be 521 supported by Saratoga implementations: 523 - support for working with the Bundle Protocol for Delay-Tolerant 524 Networking. Saratoga can optionally also be used to carry the Bundle 525 Protocol "bundles" that is proposed for use in Delay and Disruption- 526 Tolerant Networking (DTN) by the IRTF DTN Research Group [RFC5050]. 527 The bundle agent acts as an application driving Saratoga. Use of a 528 filesystem is expected. This approach has been tested from orbit 529 using the UK-DMC satellite [Ivancic10]. How Saratoga can optionally 530 function as a "bundle convergence layer" alongside a DTN bundle agent 531 is specified in a companion document [I-D.wood-dtnrg-saratoga]. 533 - transfers permitting some errors in content delivered, using UDP- 534 Lite [RFC3828]. These can be useful for decreasing delivery time 535 over unreliable channels, especially for unidirectional links, or in 536 decreasing computational overhead for the UDP Lite checksum. Error 537 tolerance requires that lower-layer frames permit delivery of 538 unreliable data to be really useful. 540 If a file contains separate parts that require reliable transmission 541 without errors or that can tolerate errors in delivered content, 542 proactive fragmentation can be used to split the file into separate 543 reliable and unreliable files that can be transferred separately, 544 using UDP or UDP-Lite. 546 If parts of a file require reliability but the rest can be sent by 547 unreliable transfer, the file-sender can use its knowledge of the 548 internal file structure and vary DATA packet size so that the 549 reliable parts always start after the offset field and are covered by 550 the UDP-Lite checksum. 552 A file that permits unreliable delivery can be transferred onwards 553 using UDP. If the current sender does not understand the internal 554 file format to be able to decide what parts must be protected with 555 payload checksum coverage, the current sender or receiver does not 556 support UDP-Lite, or the current protocol stack only implements 557 error-free frame delivery below the UDP layer, then the file MAY be 558 delivered using UDP. 560 4. Packet Types 562 Saratoga is defined for use with UDP over either IPv4 or IPv6 563 [RFC0768]. UDP checksums, which are mandatory with IPv6, MUST be 564 used with IPv4. Within either version of IP datagram, a Saratoga 565 packet appears as a typical UDP header followed by an octet 566 indicating how the remainder of the packet is to be interpreted: 568 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 569 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 570 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 571 | UDP source port | UDP destination port | 572 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 573 | UDP length | UDP checksum | 574 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 575 |Vers |Pckt Type| other Saratoga fields ... // 576 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+// 578 Saratoga data transfers can also be carried out using UDP-Lite 579 [RFC3828]. If Saratoga can be carried over UDP-Lite, the 580 implementation MUST also support UDP. All packet types except DATA 581 MUST be sent using UDP with checksums turned on. For reliable 582 transfers, DATA packets are sent using UDP with checksums turned on. 583 For files where unreliable transfer has been indicated as desired and 584 possible, the sender MAY send DATA packets unreliably over UDP-Lite, 585 where UDP-Lite protects only the Saratoga headers and parts of the 586 file that must be transmitted reliably. 588 The three-bit Saratoga version field ("Ver") identifies the version 589 of the Saratoga protocol that the packet conforms to. The value 001 590 should be used in this field for implementations conforming to the 591 specification in this document, which specifies version 1 of 592 Saratoga. The value 000 was used in earlier implementations, prior 593 to the formal specification and public submission of the protocol 594 design, and is incompatible with version 001 in many respects. 596 The five-bit Saratoga "Packet Type" field indicates how the remainder 597 of the packet is intended to be decoded and processed: 599 +---+----------+----------------------------------------------------+ 600 | # | Type | Use | 601 +---+----------+----------------------------------------------------+ 602 | 0 | BEACON | Beacon packet indicating peer status. | 603 | 1 | REQUEST | Commands peer to start a transfer. | 604 | 2 | METADATA | Carries file transfer metadata. | 605 | 3 | DATA | Carries octets of file data. | 606 | 4 | STATUS | responds to REQUEST or DATA. Can signal list of | 607 | | | unreceived data to sender during a transfer. | 608 +---+----------+----------------------------------------------------+ 610 Several of these packet types include a Flags field, for which only 611 some of the bits have defined meanings and usages in this document. 612 Other, undefined, bits may be reserved for future use. Following the 613 principle of being conservative in what you send and liberal in what 614 you accept, a packet sender MUST set any undefined bits to zero, and 615 a packet recipient MUST NOT rely on these undefined bits being zero 616 on reception. 618 The specific formats for the different types of packets are given in 619 this section. Some packet types contain file offset descriptor 620 fields, which contain unsigned integers. The lengths of the offset 621 descriptors are fixed within a transfer, but vary between file 622 transfers. The size is set for each particular transfer, depending 623 on the choice of offset descriptor width made in the METADATA packet, 624 which in turn depends on the size of file being transferred. 626 In this document, all of the packet structure figures illustrating a 627 packet format assume 32-bit lengths for these offset descriptor 628 fields, and indicate the transfer-dependent length of the fields by 629 using a "(descriptor)" designation within the [field] in all packet 630 diagrams. That is: 632 The example 32-bit descriptors shown in all diagrams here 634 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 635 [ (descriptor) ] 636 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 638 are suitable for files of up to 4GiB - 1 octets in length, and may be 639 replaced in a file transfer by descriptors using a different length, 640 depending on the size of file to be transferred: 642 16-bit descriptor for short files of up to 64KB - 1 octets in size 643 (MUST be supported) 645 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 646 [ (descriptor) ] 647 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 649 64-bit descriptor for longer files of up to 16EiB - 1 octets in size 650 (optional) 652 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 653 [ (descriptor) / 654 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 655 / (descriptor, continued) ] 656 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 658 128-bit descriptor for very long files of up to 256 EiEiB - 1 octets 659 in size (optional) 661 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 662 [ (descriptor) / 663 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 664 / (descriptor, continued) / 665 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 666 / (descriptor, continued) / 667 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 668 / (descriptor, continued) ] 669 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 671 Descriptors are used for the descriptor size less one octet, e.g. 16- 672 bit for files up to 64KB - 1 octets in size, before switching to the 673 larger descriptor, e.g. using the 32-bit descriptor for a 64KB file 674 and larger. 676 For offset descriptors and types of content being transferred, the 677 related flag bits in BEACON and REQUEST indicate capabilities, while 678 in METADATA and DATA those flag bits are used slightly differently, 679 to indicate the content being transferred. 681 Saratoga packets are intended to fit within link MTUs to avoid the 682 inefficiencies and overheads of lower-layer fragmentation. A 683 Saratoga implementation itself does not perform any form of MTU 684 discovery, but is assumed to be configured with knowledge of usable 685 maximum IP MTUs for the link interfaces it uses. 687 4.1. BEACON 689 BEACON packets may be multicast periodically by nodes willing to act 690 as Saratoga peers, or unicast to individual peers to indicate 691 properties for that peer. Some implementations have sent BEACONS 692 every 100 milliseconds, but this rate is arbitrary, and should be 693 chosen to be appropriate for the environment and implementation. 695 The main purpose for sending BEACONs is to announce the presence of 696 the node to potential peers (e.g. satellites, ground stations) to 697 provide automatic service discovery, and also to confirm the activity 698 or presence of the peer. 700 The Endpoint Identifier (EID) in the BEACON serves to uniquely 701 identify the Saratoga peer. Whenever the Saratoga peer begins using 702 a new IP address, it SHOULD issue a BEACON on it and repeat the 703 BEACON periodically, to enable listeners to associate the IP address 704 with the EID and the peer. 706 Format 708 0 1 2 3 709 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 710 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 711 |0 0 1| Type | Flags | 712 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 713 [[ Available free space (optional) ]] 714 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 715 | Endpoint identifier... // 716 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+// 718 where 719 +------------+------------------------------------------------------+ 720 | Field | Description | 721 +------------+------------------------------------------------------+ 722 | Type | 0 | 723 | Flags | convey whether or not the peer is ready to | 724 | | send/receive, what the maximum supported file size | 725 | | range and descriptor is, and whether and how free | 726 | | space is indicated. | 727 | Available | This optional field can be used to indicate the | 728 | free space | current free space available for storage. | 729 | Endpoint | This can be used to uniquely identify the sending | 730 | identifier | Saratoga peer, or the administrative node that the | 731 | | BEACON-sender is associated with. If Saratoga is | 732 | | being used with a bundle agent, a bundle endpoint ID | 733 | | (EID) can be used here. | 734 +------------+------------------------------------------------------+ 736 The Flags field is used to provide some additional information about 737 the peer. The first two octets of the Flags field is currently in 738 use. The later octet is for future use, and MUST be set to zero. 740 The two highest-order bits (bits 8 and 9 above) indicate the maximum 741 supported file size parameters that the peer's Saratoga 742 implementation permits. Other Saratoga packet types contain 743 variable-length fields that convey file sizes or offsets into a file 744 -- the file offset descriptors. These descriptors may be 16-bit, 32- 745 bit, 64-bit, or 128-bit in length, depending on the size of the file 746 being transferred and/or the integer types supported by the sending 747 peer. The indicated bounds for the possible values of these bits are 748 summarized below: 750 +-------+-------+-------------------------+-------------------+ 751 | Bit 8 | Bit 9 | Supported Field Sizes | Maximum File Size | 752 +-------+-------+-------------------------+-------------------+ 753 | 0 | 0 | 16 bits | 2^16 - 1 octets. | 754 | 0 | 1 | 16 or 32 bits | 2^32 - 1 octets. | 755 | 1 | 0 | 16, 32, or 64 bits | 2^64 - 1 octets. | 756 | 1 | 1 | 16, 32, 64, or 128 bits | 2^128 - 1 octets. | 757 +-------+-------+-------------------------+-------------------+ 759 If a Saratoga peer advertises it is capable of receiving a certain 760 size of file, then it MUST also be capable of receiving files sent 761 using smaller descriptor values. This avoids overhead on small 762 files, while increasing interoperability between peers. 764 It is likely when sending unbounded streams that a larger offset 765 descriptor field size will be preferred to minimise problems with 766 offset sequence numbers wrapping. Protecting against sequence number 767 wrapping is discussed in the STATUS section. 769 +-----+-------+-----------------------------------------------------+ 770 | Bit | Value | Meaning | 771 +-----+-------+-----------------------------------------------------+ 772 | 10 | 0 | not able to pass bundles to a local bundle agent; | 773 | | | handles files only. | 774 | 10 | 1 | handles files, but can also pass marked bundles to | 775 | | | a local bundle agent. | 776 +-----+-------+-----------------------------------------------------+ 778 Bit 10 is reserved for DTN bundle agent use, indicating whether the 779 sender is capable of handling bundles via a local bundle agent. This 780 is described in [I-D.wood-dtnrg-saratoga]. 782 +-----+-------+--------------------------------------+ 783 | Bit | Value | Meaning | 784 +-----+-------+--------------------------------------+ 785 | 11 | 0 | not capable of supporting streaming. | 786 | 11 | 1 | capable of supporting streaming. | 787 +-----+-------+--------------------------------------+ 789 Bit 11 is used to indicate whether the sender is capable of sending 790 and receiving continuous streams. 792 +--------+--------+------------------------------------------------+ 793 | Bit 12 | Bit 13 | Capability and willingness to send files | 794 +--------+--------+------------------------------------------------+ 795 | 0 | 0 | cannot send files at all. | 796 | 0 | 1 | invalid. | 797 | 1 | 0 | capable of sending, but not willing right now. | 798 | 1 | 1 | capable of and willing to send files. | 799 +--------+--------+------------------------------------------------+ 801 +-------+-------+---------------------------------------------------+ 802 | Bit | Bit | Capability and willingness to receive files | 803 | 14 | 15 | | 804 +-------+-------+---------------------------------------------------+ 805 | 0 | 0 | cannot receive files at all. | 806 | 0 | 1 | invalid. | 807 | 1 | 0 | capable of receiving, but unwilling. Will reject | 808 | | | METADATA or DATA packets. | 809 | 1 | 1 | capable of and willing to receive files. | 810 +-------+-------+---------------------------------------------------+ 812 Also in the Flags field, bits 12 and 14 act as capability bits, while 813 bits 13 and 15 augment those flags with bits indicating current 814 willingness to use the capability. 816 Bits 12 and 13 deal with sending, while bits 14 and 15 deal with 817 receiving. If bit 12 is set, then the peer has the capability to 818 send files. If bit 14 is set, then the peer has the capability to 819 receive files. Bits 13 and 15 indicate willingness to send and 820 receive files, respectively. 822 A peer that is able to act as a file-sender MUST set the capability 823 bit 12 in all BEACONs that it sends, regardless of whether it is 824 willing to send any particular files to a particular peer at a 825 particular time. Bit 13 indicates the current presence of data to 826 send and a willingness to send it in general, in order to augment the 827 capability advertised by bit 12. 829 If bit 14 is set, then the peer is capable of acting as a receiver, 830 although it still might not currently be ready or willing to receive 831 files (for instance, it may be low on free storage). This bit MUST 832 be set in any BEACON packets sent by nodes capable of acting as file- 833 receivers. Bit 15 augments this by expresses a current general 834 willingness to receive and accept files. 836 +-----+-------+-----------------------------------------------------+ 837 | Bit | Value | Meaning | 838 +-----+-------+-----------------------------------------------------+ 839 | 16 | 0 | supports DATA transfers over UDP only. | 840 | 16 | 1 | supports DATA transfers over both UDP and UDP-Lite. | 841 +-----+-------+-----------------------------------------------------+ 843 Bit 16 is used to indicate whether the sender is capable of sending 844 and receiving unreliable transfers via UDP-Lite. 846 +-----+-------+-----------------------------------------------------+ 847 | Bit | Value | Meaning | 848 +-----+-------+-----------------------------------------------------+ 849 | 17 | 0 | available free space is not advertised in this | 850 | | | BEACON. | 851 | 17 | 1 | available free space is advertised in this BEACON. | 852 +-----+-------+-----------------------------------------------------+ 854 Bit 17 is used to indicate whether the sender is indicating how much 855 free space is indicated in an optional field in this BEACON packet. 856 If bit 17 is set, then bits 18 and 19 are used to indicate the size 857 in bits of the optional free-space-size field. If bit 17 is not set, 858 then bits 18 and 19 are zero. 860 +--------+--------+--------------------------+ 861 | Bit 18 | Bit 19 | Size of free space field | 862 +--------+--------+--------------------------+ 863 | 0 | 0 | 16 bits. | 864 | 0 | 1 | 32 bits. | 865 | 1 | 0 | 64 bits. | 866 | 1 | 1 | 128 bits. | 867 +--------+--------+--------------------------+ 869 The free space field size can vary as indicated by a varying-size 870 field indicated in bits 18 and 19 of the flags field. Unlike other 871 offset descriptor use where the value in the descriptor indicates a 872 byte or octet position for retransmission, or gives a file size in 873 bytes, this particular field indicates the available free space in 874 KILOBYTES (KiB, multiples of 1024 octets), rather than octets. 875 (Kilobytes are used as storage can be in local memory.) Available 876 free space is rounded down to the nearest KiB, so advertising zero 877 means that less than 1KiB is free and available. Advertising the 878 maximum size possible in the field means that more free space than 879 that is available. While this field is intended to be scalable, it 880 is expected that 32 bits (up to 4TiB) will be most common in use. 882 A BEACON unicast to an individual peer MAY choose to indicate the 883 free space available for use by that particular peer, and MAY 884 indicate capabilities only available to that particular peer, 885 overriding or supplementing the properties advertised to all local 886 peers by multicast BEACONs. 888 Any type of host identifier can be used in the endpoint identifier 889 field, as long as it is a reasonably unique string within the range 890 of operational deployment. This field encompasses the remainder of 891 the packet, and might contain non-UTF-8 and/or null characters. 893 4.2. REQUEST 895 A REQUEST packet is an explicit command to perform either a _put_, 896 _get_, _getdir_, or _delete_ transaction. 898 Format 900 0 1 2 3 901 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 902 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 903 |0 0 1| Type | Flags | Request Type | 904 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 905 | Id | 906 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 907 | variable-length File Path ... / 908 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 909 / / 910 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 911 / | null byte | / 912 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 913 / variable-length Authentication Field (optional) | 914 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 916 where 918 +---------+---------------------------------------------------------+ 919 | Field | Description | 920 +---------+---------------------------------------------------------+ 921 | Type | 1 | 922 | Flags | provide additional information about the requested | 923 | | file/operation; see table below for definition. | 924 | Request | identifies the type of request being made; see table | 925 | Type | further below for request values. | 926 | Id | uniquely identifies the transaction between two peers. | 927 | File | the path of the requested file/directory following the | 928 | Path | rules described below. | 929 +---------+---------------------------------------------------------+ 931 The Id that is used during transactions serves to uniquely associate 932 a given packet with a particular transaction. This enables multiple 933 simultaneous data transfer or request/status transactions between two 934 peers, with each peer deciding how to multiplex and prioritise the 935 parallel flows it sends. The Id for a transaction is selected by the 936 initiator so as to not conflict with any other in-progress or recent 937 transactions with the same host. This Id should be unique and 938 generated using properties of the file, which will remain constant 939 across a host reboot. The 3-tuple of both host identifiers and a 940 carefully-generated transaction Id field can be used to uniquely 941 index a particular transaction's state. 943 In the Flags field, the bits labelled 8 and 9 in the figure above 944 indicate the maximum supported file length fields that the peer can 945 handle, and are interpreted exactly as the bits 8 and 9 in the BEACON 946 packet described above. Bits 12 and 13, and 14 and 15, indicate 947 capability and willingness to send and receive files, as described 948 above. Making a _get_ request would require that the requester is 949 capable and willing to receive files. The remaining defined 950 individual bits are as summarised as follows: 952 +-----+-------+-----------------------------------------------------+ 953 | Bit | Value | Meaning | 954 +-----+-------+-----------------------------------------------------+ 955 | 10 | 0 | The requester cannot handle bundles locally. | 956 | 10 | 1 | The requester can handle bundles. | 957 | 11 | 0 | The requester cannot receive streams. | 958 | 11 | 1 | The requester is also able to receive streams. | 959 | 16 | 0 | The requester is able to receive DATA over UDP | 960 | | | only. | 961 | 16 | 1 | The requester is also able to receive DATA over | 962 | | | UDP-Lite. | 963 +-----+-------+-----------------------------------------------------+ 965 The Request Type field is an octet that contains a value indicated 966 the type of request being made. Possible values are: 968 +-------+-----------------------------------------------------------+ 969 | Value | Meaning | 970 +-------+-----------------------------------------------------------+ 971 | 0 | No action is to be taken; similar to a BEACON. | 972 | 1 | A _get_ transaction is requested. The File Path field | 973 | | holds the name of the file to be sent. | 974 | 2 | A _put_ transaction is requested. The File Path field | 975 | | suggests the name of the file that will be delivered only | 976 | | after an OK STATUS is received from the file receiver. | 977 | 3 | A _get_ transaction is requested, and once received | 978 | | successfully, the original copy should be deleted. The | 979 | | File Path field holds the name of the file to be sent. | 980 | | (This get+delete is known as a 'take'.) | 981 | 4 | A _put_ transaction is requested, and once sent | 982 | | successfully, the original copy will be deleted. The | 983 | | File Path field holds the name of the file to be sent. | 984 | | (This put+delete is known as a 'give'.) | 985 | 5 | A _delete_ transaction is requested, and the File Path | 986 | | field specifies the name of the file to be deleted. | 987 | 6 | A _getdir_ transaction is requested. The File Path field | 988 | | holds the name of the directory or file on which the | 989 | | directory record is created. | 990 +-------+-----------------------------------------------------------+ 992 The File Path portion of a _get_ packet is a null-terminated UTF-8 993 encoded string [RFC3629] that represents the path and base file name 994 on the file-sender of the file (or directory) that the file-receiver 995 wishes to perform the _get_, _getdir_, or _delete_ operation on. 996 Implementations SHOULD only send as many octets of File Path as are 997 needed for carrying this string, although some implementations MAY 998 choose to send a fixed-size File Path field in all REQUEST packets 999 that is filled with null octets after the last UTF-8 encoded octet of 1000 the path. A maximum of 1024 octets for this field, and for the File 1001 Path fields in other Saratoga packet types, is used to limit the 1002 total packet size to within a single IPv6 minimum MTU (minus some 1003 padding for network layer headers), and thus avoid the need for 1004 fragmentation. The 1024-octet maximum applies after UTF-8 encoding 1005 and null termination. 1007 As in the standard Internet File Transfer Protocol (FTP) [RFC0959], 1008 for path separators, Saratoga allows the local naming convention on 1009 the peers to be used. There are security implications to processing 1010 these strings without some intelligent filtering and checking on the 1011 filesystem items they refer to, as discussed in the Security 1012 Considerations section later within this document. 1014 If the File Path field is empty, i.e. is a null-terminated zero- 1015 length string one octet long, then this indicates that the file- 1016 receiver is ready to receive any file that the file-sender would like 1017 to send it, rather than requesting a particular file. This allows 1018 the file-sender to determine the order and selection of files that it 1019 would like to forward to the receiver in more of a "push" manner. Of 1020 course, file retrieval could also follow a "pull" manner, with the 1021 file-receiving host requesting specific files from the file-sender. 1022 This may be desirable at times if the file-receiver is low on storage 1023 space, or other resources. The file-receiver could also use the 1024 Saratoga _getdir_ transaction results in order to select small files, 1025 or make other optimizations, such as using its local knowledge of 1026 contact times to pick files of a size likely to be able to be 1027 delivered completely. File transfer through pushing sender-selected 1028 files implements delivery prioritization decisions made solely at the 1029 Saratoga file-sending node. File transfer through pulling specific 1030 receiver-selected files implements prioritization involving more 1031 participation from the Saratoga file-receiver. This is how Saratoga 1032 implements Quality of Service (QoS). 1034 The null-terminated File Path string MAY be followed by an optional 1035 Authentication Field that can be used to validate the REQUEST packet. 1036 Any value in the Authentication Field is the result of a computation 1037 of packet contents that SHOULD include, at a minimum, source and 1038 destination IP addresses and port numbers and packet length in a 1039 'pseudo-header', as well as the content of all Saratoga fields from 1040 Version to File Path, excluding the predictable null-termination 1041 octet. This Authentication Field can be used to allow the REQUEST 1042 receiver to discriminate between other peers, and permit and deny 1043 various REQUEST actions as appropriate. The format of this field is 1044 unspecified for local use. 1046 Combined get+delete (take) and put+delete (give) requests should only 1047 have the delete carried out once the deleting peer is certain that 1048 the file-receiver has a good copy of the file. This may require the 1049 file receiver to verify checksums before sending a final STATUS 1050 message acknowledging successful delivery of the final DATA segment, 1051 or aborting the transfer if the checksum fails. If the transfer 1052 fails and an error STATUS is sent for any reason, the file should not 1053 be deleted. 1055 REQUEST packets may be sent multicast, to learn about all listening 1056 nodes. A multicast _get_ request for a file that elicits multiple 1057 METADATA or DATA responses should be followed by unicast STATUS 1058 packets with status errors cancelling all but one of the proposed 1059 transfers. File timestamps in the Directory Entry can be used to 1060 select the most recent version of an offered file, and the host to 1061 fetch it from. 1063 If the receiver already has the file at the expected file path and is 1064 requesting an update to that file, REQUEST can be sent after a 1065 METADATA advertising that file, to allow the sender to determine 1066 whether a replacement for the file should be sent. 1068 Delete requests are ignored for files currently being transferred. 1070 4.3. METADATA 1072 METADATA packets are sent as part of a data transfer transaction 1073 (_get_, _getdir_, and _put_). A METADATA packet says how large the 1074 file is and what its name is, as well as what size of file offset 1075 descriptor is chosen for the session. METADATA packets are optional. 1076 They are normally sent at the start of a DATA transfer, but may be 1077 repeated if requested. 1079 Format 1081 0 1 2 3 1082 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1083 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1084 |0 0 1| Type | Flags |Sumleng|Sumtype| 1085 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1086 | Id | 1087 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1088 | / 1089 / / 1090 / example error-detection checksum (128-bit MD5 shown) / 1091 / / 1092 / | 1093 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1094 | / 1095 / single Directory Entry describing file / 1096 / (variable length) / 1097 / // 1098 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-// 1100 where 1102 +-----------+-------------------------------------------------------+ 1103 | Field | Description | 1104 +-----------+-------------------------------------------------------+ 1105 | Type | 2 | 1106 | Flags | indicate additional boolean metadata about a file. | 1107 | Sumleng | indicates the length of a checksum, as a multiple of | 1108 | | 32 bits. | 1109 | Sumtype | indicates whether a checksum is present after the Id, | 1110 | | and what type it is. | 1111 | Id | identifies the transaction that this packet | 1112 | | describes. | 1113 | Checksum | an example included checksum covering file contents. | 1114 | Directory | describes file system information about the file, | 1115 | Entry | including file length, file timestamps, etc.; the | 1116 | | format is specified in Section 5. | 1117 +-----------+-------------------------------------------------------+ 1119 The first octet of the Flags field is currently specified for use. 1120 The later two octets are reserved for future use, and MUST be set to 1121 zero. 1123 In the Flags field, the bits labelled 8 and 9 in the figure above 1124 indicate the exact size of the offset descriptor fields used in this 1125 particular packet and are interpreted exactly as the bits 8 and 9 in 1126 the BEACON packet described above. The value of these bits 1127 determines the size of the File Length field in the current packet, 1128 as well as indicating the size of the offset fields used in DATA and 1129 STATUS packets within the session that will follow this packet. 1131 +--------+--------+-------------------------------------------------+ 1132 | Bit 10 | Bit 11 | Type of transfer | 1133 +--------+--------+-------------------------------------------------+ 1134 | 0 | 0 | a file is being sent. | 1135 | 0 | 1 | the file being sent should be interpreted as a | 1136 | | | Directory Record. | 1137 | 1 | 0 | a bundle is being sent. | 1138 | 1 | 1 | an indefinite-length stream is being sent. | 1139 +--------+--------+-------------------------------------------------+ 1141 Also inside the Flags field, bits 10 and 11 indicate what is being 1142 transferred - a file, special directory record file that contains one 1143 or more directory entries, bundle, or stream. The value 01 indicates 1144 that the METADATA and DATA packets are being generated in response to 1145 a _getdir_ REQUEST, and that the assembled DATA contents should be 1146 interpreted as a Directory Record containing directory entries, as 1147 defined in Section 5. 1149 +-----+-------+-----------------------------------------------------+ 1150 | Bit | Value | Meaning | 1151 +-----+-------+-----------------------------------------------------+ 1152 | 12 | 0 | This transfer is in progress. | 1153 | 12 | 1 | This transfer is no longer in progress, and has | 1154 | | | been terminated. | 1155 +-----+-------+-----------------------------------------------------+ 1157 Bit 12 indicates whether the transfer is in progress, or has been 1158 terminated by the sender. It is normally set to 1 only when METADATA 1159 is resent to indicate that a stream transfer has been ended. 1161 +--------+----------------------------------------------------------+ 1162 | Bit 13 | Use | 1163 +--------+----------------------------------------------------------+ 1164 | 0 | This file's content MUST be delivered reliably without | 1165 | | errors using UDP. | 1166 | 1 | This file's content MAY be delivered unreliably, or | 1167 | | partly unreliably, where errors are tolerated, using | 1168 | | UDP-Lite. | 1169 +--------+----------------------------------------------------------+ 1171 Bit 13 indicates whether the file must be sent reliably or can be 1172 sent at least partly unreliably, using UDP-Lite. This flag SHOULD 1173 only be set if the originator of the file knows that at least some of 1174 the file content is suitable for sending unreliably and is robust to 1175 errors. This flag reflects a property of the file itself. This flag 1176 may still be set if the immediate file-receiver is only capable of 1177 UDP delivery, on the assumption that this preference will be 1178 preserved for later transfers where UDP-Lite transfers may be taken 1179 advantage of by senders with knowledge of the internal file 1180 structure. The file-sender may know that the receiver is capable of 1181 handling UDP-Lite, either from a _get_ REQUEST, from exchange of 1182 BEACONs, or a-priori. 1184 The high four bits of the Flags field, bits 28-31, are used to 1185 indicate if an error-detection checksum has been included in the 1186 METADATA for the file to be transferred. Here, bits 0000 indicate 1187 that no checksum is present, with the implicit assumption that the 1188 application will do its own end-to-end check. Other values indicate 1189 the type of checksum to use. The choice of checksum depends on the 1190 available computing power and the length of the file to be 1191 checksummed. Longer files require stronger checksums to ensure 1192 error-free delivery. The checksum of the file to be transferred is 1193 carried as shown, with a fixed-length field before the varying-length 1194 File Length and File Name information fields. 1196 Assigned values for the checksum type field are: 1198 +-----------+-------------------------------------------------------+ 1199 | Value | Use | 1200 | (0-15) | | 1201 +-----------+-------------------------------------------------------+ 1202 | 0 | No checksum is provided. | 1203 | 1 | 32-bit CRC32 checksum, suitable for small files. | 1204 | 2 | 128-bit MD5 checksum, suitable for larger files. | 1205 | 3 | 160-bit SHA-1 checksum, suitable for larger files but | 1206 | | slower to process than MD5. | 1207 +-----------+-------------------------------------------------------+ 1209 The length of the checksum cannot be inferred from the checksum type 1210 field, particularly for unknown checksum types. The next-highest 1211 four bits of the 32-bit word holding the Flags, bits 24-27, indicate 1212 the length of the checksum bit field, as a multiple of 32 bits. 1214 +----------------------+--------------------------------------+ 1215 | Example Value (0-15) | Use | 1216 +----------------------+--------------------------------------+ 1217 | 0 | No checksum is provided. | 1218 | 1 | 32-bit checksum field, e.g. CRC32. | 1219 | 4 | 128-bit checksum field, e.g. MD5. | 1220 | 5 | 160-bit checksum field, e.g. SHA-1. | 1221 +----------------------+--------------------------------------+ 1223 For a 32-bit CRC, the length field holds 1 and the type field holds 1224 1. For MD5, the length field holds 4 and the type field holds 2. 1225 For SHA-1, the length field holds 5 and the type field holds 3. 1227 It is expected that higher values will be allocated to new and 1228 stronger checksums able to better protect larger files. These 1229 checksums can be expected to be longer, with larger checksum length 1230 fields. 1232 A checksum SHOULD be included for files being transferred. The 1233 checksum SHOULD be as strong as possible. Streaming of an 1234 indefinite-length stream MUST set the checksum type field to zero. 1236 It is expected that a minimum of the MD5 checksum will be used, 1237 unless the Saratoga implementation is used exclusively for small 1238 transfers at the low end of the 16-bit file descriptor range, such as 1239 on low-performing hardware, where the weaker CRC-32c checksum can 1240 suffice. 1242 The CRC32 checksum is computed as described for the CRC-32c algorithm 1243 given in [RFC3309]. 1245 The MD5 Sum field is generated via the MD5 algorithm [RFC1321], 1246 computed over the entire contents of the file being transferred. The 1247 file-receiver can compute the MD5 result over the reassembled 1248 Saratoga DATA packet contents, and compare this to the METADATA's MD5 1249 Sum field in order to gain confidence that there were no undetected 1250 protocol errors or UDP checksum weaknesses encountered during the 1251 transfer. Although MD5 is known to be less than optimal for security 1252 uses, it remains excellent for non-security use in error detection 1253 (as is done here in Saratoga), and has better performance 1254 implications than cryptographically-stronger alternatives given the 1255 limited available processing of many use cases [RFC6151]. 1257 Checksums may be privately keyed for local use, to allow transmission 1258 of authenticated or encrypted files delivered in DATA packets. This 1259 has limitations, discussed further in Section 8 at end. 1261 Use of the checksum to ensure that a file has been correctly relayed 1262 to the receiving node is important. A provided checksum MUST be 1263 checked against the received data file. If checksum verification 1264 fails, either due to corruption or due to the receiving node not 1265 having the right key for a keyed checksum), the file MUST be 1266 discarded. If the file is to be relayed onwards later to another 1267 Saratoga peer, the metadata, including the checksum, MUST be retained 1268 with the file and SHOULD be retransmitted onwards unchanged with the 1269 file for end-to-end coverage. If it is necessary to recompute the 1270 checksum or encrypted data for the new peer, either because a 1271 different key is in use or the existing checksum algorithm is not 1272 supported, the new checksum MUST be computed before the old checksum 1273 is verified, to ensure overlapping checksum coverage and detect 1274 errors introduced in file storage. 1276 METADATA can be used as an indication to update copies of files. If 1277 the METADATA is in response to a _get_ REQUEST including a file 1278 record, and the record information for the held file matches what the 1279 requester already has, as has been indicated by a previously-received 1280 METADATA advertisement from the requester, then only the METADATA is 1281 sent repeating this information and verifying that the file is up to 1282 date. If the record information does not match and a newer file can 1283 be supplied, the METADATA begins a transfer with following DATA 1284 packets to update the file. 1286 4.4. DATA 1288 A series of DATA packets form the main part of a data transfer 1289 transaction (_get_, _put_, or _getdir_). The payloads constitute the 1290 actual file data being transferred. 1292 Format 1294 0 1 2 3 1295 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1296 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1297 |0 0 1| Type | Flags | 1298 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1299 | Id | 1300 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1301 | / 1302 / Timestamp/nonce information (optional) / 1303 / / 1304 / | 1305 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1306 [ Offset (descriptor) ] 1307 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1308 | Payload data... // 1309 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-// 1311 where 1312 +-----------------+-------------------------------------------------+ 1313 | Field | Description | 1314 +-----------------+-------------------------------------------------+ 1315 | Type | 3 | 1316 | Flags | are described below. | 1317 | Id | identifies the transaction to which this packet | 1318 | | belongs. | 1319 | Timestamp/nonce | is an optional 128-bit field providing timing | 1320 | | or identification information unique to this | 1321 | | packet. See Appendix A for details. | 1322 | Offset | the offset in octets to the location where the | 1323 | | first byte of this packet's payload is to be | 1324 | | written. | 1325 +-----------------+-------------------------------------------------+ 1327 The DATA packet has a minimum size of ten octets, using sixteen-bit 1328 descriptors and no timestamps. 1330 DATA packets are normally checked by the UDP checksum to prevent 1331 errors in either the header or the payload content. However, for 1332 transfers that can tolerate content errors, DATA packets MAY be sent 1333 using UDP-Lite. If UDP-Lite is used, the file-sender must know that 1334 the file-receiver is capable of handling UDP-Lite, and the file 1335 contents to be transferred should be resilient to errors. The UDP- 1336 Lite checksum MUST protect the Saratoga headers, up to and including 1337 the offset descriptor, and MAY protect more of each packet's payload, 1338 depending on the file-sender's knowledge of the internal structure of 1339 the file and the file's reliability requirements. 1341 +-------+-------+--------------------------------------------------+ 1342 | Bit 8 | Bit 9 | Type of transfer | 1343 +-------+-------+--------------------------------------------------+ 1344 | 0 | 0 | 16-bit descriptors are in use in this transfer. | 1345 | 0 | 1 | 32-bit descriptors are in use in this transfer. | 1346 | 1 | 0 | 64-bit descriptors are in use in this transfer. | 1347 | 1 | 1 | 128-bit descriptors are in use in this transfer. | 1348 +-------+-------+--------------------------------------------------+ 1350 Flag bits 8 and 9 are set to indicate the size of the offset 1351 descriptor as described for BEACON and METADATA packets, so that each 1352 DATA packet is self-describing. This allows the DATA packet to be 1353 used to construct a file even when an initial METADATA is lost and 1354 must be resent. The flag values for bits 8 and 9 MUST be the same as 1355 indicated in any expected METADATA packet. 1357 +--------+--------+-------------------------------------------------+ 1358 | Bit 10 | Bit 11 | Type of transfer | 1359 +--------+--------+-------------------------------------------------+ 1360 | 0 | 0 | a file is being sent. | 1361 | 0 | 1 | the file being sent should be interpreted as a | 1362 | | | directory record. | 1363 | 1 | 0 | a bundle is being sent. | 1364 | 1 | 1 | an indefinite-length stream is being sent. | 1365 +--------+--------+-------------------------------------------------+ 1367 Also inside the Flags field, bits 10 and 11 indicate what is being 1368 transferred - a file, special file that contains a Directory Records, 1369 bundle, or stream. The value 01 indicates that the METADATA and DATA 1370 packets are being generated in response to a _getdir_ REQUEST, and 1371 that the assembled DATA contents should be interpreted as a Directory 1372 Record containing directory entries, as defined in Section 5. The 1373 flag values for bits 10 and 11 MUST be the same as indicated in the 1374 initial METADATA packet. 1376 +-----+-------+-----------------------------------------------------+ 1377 | Bit | Value | Meaning | 1378 +-----+-------+-----------------------------------------------------+ 1379 | 12 | 0 | This packet does not include an optional | 1380 | | | timestamp/nonce field. | 1381 | 12 | 1 | This packet includes an optional timestamp/nonce | 1382 | | | field. | 1383 +-----+-------+-----------------------------------------------------+ 1385 Flag bit 12 indicates that an optional packet timestamp/nonce is 1386 carried in the packet before the offset field. This packet 1387 timestamp/nonce field is always sixteen octets (128 bits) long. 1388 Timestamps can be useful to the sender even when the receiver does 1389 not understand them, as the receiver can simply echo any provided 1390 timestamps back, as specified for STATUS packets, to allow the sender 1391 to monitor flow conditions. Packet timestamps are particularly 1392 useful when streaming. Packet timestamps are discussed further in 1393 Appendix A. 1395 +-----+-------+-------------------------------+ 1396 | Bit | Value | Meaning | 1397 +-----+-------+-------------------------------+ 1398 | 15 | 0 | No response is requested. | 1399 | 15 | 1 | A STATUS packet is requested. | 1400 +-----+-------+-------------------------------+ 1402 Within the Flags field, if bit 15 of the packet is set, the file- 1403 receiver is expected to immediately generate a STATUS packet to 1404 provide the file-sender with up-to-date information regarding the 1405 status of the file transfer. This flag is set carefully and rarely. 1406 This flag may be set periodically, but infrequently. Asymmetric 1407 links with constrained backchannels can only carry a limited amount 1408 of STATUS packets before ack congestion becomes a problem. This flag 1409 SHOULD NOT be set if an unreliable stream is being transferred, or if 1410 multicast is in use. This flag SHOULD be set periodically for 1411 reliable file transfers, or reliable streaming. The file-receiver 1412 MUST respond to the flag by generating a STATUS packet, unless it 1413 knows that doing so will lead to local congestion, in which case it 1414 may choose to send a later voluntary STATUS message. 1416 +-----+-------+----------------------------------+ 1417 | Bit | Value | Meaning | 1418 +-----+-------+----------------------------------+ 1419 | 16 | 0 | Normal use. | 1420 | 16 | 1 | The EOD End of Data flag is set. | 1421 +-----+-------+----------------------------------+ 1423 The End of Data flag is set in DATA packets carrying the last byte of 1424 a transfer. This is particularly useful for streams and for Saratoga 1425 implementations that do not support METADATA. 1427 Immediately following the DATA header is the payload, which consumes 1428 the remainder of the packet and whose length is implicitly defined by 1429 the end of the packet. The payload octets are directly formed from 1430 the continuous octets starting at the specified Offset in the file 1431 being transferred. No special coding is performed. A zero-octet 1432 payload length is allowable, and a single DATA packet indicating zero 1433 payload, consisting only of a header with the EOD flag set, may be 1434 useful to simply elicit a STATUS response from the receiver. 1436 The length of the Offset fields used within all DATA packets for a 1437 given transaction MUST be consistent with the length indicated by 1438 bits 8 and 9 of any accompanying METADATA packet. If the METADATA 1439 packet has not yet been received, a file-receiver SHOULD request it 1440 via a STATUS packet, and MAY choose to enqueue received DATA packets 1441 for later processing after the METADATA arrives. 1443 4.5. STATUS 1445 The STATUS packet type is the single acknowledgement method that is 1446 used for feedback from a Saratoga receiver to a Saratoga sender to 1447 indicate transaction progress, both as a response to a REQUEST, and 1448 as a response to a DATA packet when demanded or volunteered. 1450 When responding to a DATA packet, the STATUS packet MAY, as needed, 1451 include selective acknowledgement (SNACK) 'hole' information to 1452 enable transmission (usually re-transmission) of specific sets of 1453 octets within the current transaction (called "holes"). This 1454 'holestofill' information can be used to clean up losses (or indicate 1455 no losses) at the end of, or during, a transaction, or to efficiently 1456 resume a transfer that was interrupted in a previous transaction. 1458 Format 1460 0 1 2 3 1461 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1462 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1463 |0 0 1| Type | Flags | Status | 1464 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1465 | Id | 1466 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1467 | / 1468 / Timestamp/nonce information (optional) / 1469 / / 1470 / | 1471 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1472 [ Progress Indicator (descriptor) ] 1473 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1474 [ In-Response-To (descriptor) ] 1475 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1476 | (possibly, several Hole fields) / 1477 / ... / 1478 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1480 where 1482 +----------------+--------------------------------------------------+ 1483 | Field | Description | 1484 +----------------+--------------------------------------------------+ 1485 | Type | 4 | 1486 | Flags | are defined below. | 1487 | Id | identifies the transaction that this packet | 1488 | | belongs to. | 1489 | Status | a value of 00 indicates the transfer is | 1490 | | sucessfully proceeding. All other values are | 1491 | | errors terminating the transfer, explained | 1492 | | below. | 1493 | Zero-Pad | an octet fixed at 00 to allow later fields to be | 1494 | | conveniently aligned for processing. | 1495 | Timestamp | an optional fixed 128-bit field, that is only | 1496 | (optional) | present and used to return a packet timestamp if | 1497 | | the timestamp flag is set. If the STATUS packet | 1498 | | is voluntary and the voluntary flag is set, this | 1499 | | should repeat the timestamp of the DATA packet | 1500 | | containing the highest offset seen. If the | 1501 | | STATUS packet is in response to a mandatory | 1502 | | request, this will repeat the timestamp of the | 1503 | | requesting DATA packet. The file-sender may use | 1504 | | these timestamps to estimate latency. Packet | 1505 | | timestamps are particularly useful when | 1506 | | streaming. There are special considerations for | 1507 | | streaming, to protect against the ambiguity of | 1508 | | wrapped offset descriptor sequence numbers, | 1509 | | discussed below. Packet timestamps are | 1510 | | discussed further in Appendix A. | 1511 | Progress | the offset of the lowest-numbered octet of the | 1512 | Indicator | file not yet received, and expected. | 1513 | (descriptor) | | 1514 | In-Response-To | the offset of the octet following the DATA | 1515 | (descriptor) | packet that generated this STATUS packet, or the | 1516 | | offset of the next expected octet following the | 1517 | | highest DATA packet seen if this STATUS is | 1518 | | generated voluntarily and the voluntary flag is | 1519 | | set. | 1520 | Holes | indications of offset ranges of missing data, | 1521 | | defined below. | 1522 +----------------+--------------------------------------------------+ 1524 The STATUS packet has a minimum size of twelve octets, using sixteen- 1525 bit descriptors, a progress indicator but no Hole fields, and no 1526 timestamps. The progress indicator is always zero when responding to 1527 requests that may initiate a transfer. 1529 The Id field is needed to associate the STATUS packet with the 1530 transaction that it refers to. 1532 The Progress Indicator and In-Response-To fields mark the 'left edge' 1533 and 'right edge' of the incomplete working area where holes are being 1534 filled in. If there are no holes, these fields will hold the same 1535 value. At the start of a transfer, both fields begin by expecting 1536 octet zero. When a transfer has completed successfully, these fields 1537 will contain the length of the file. 1539 Flags bits 8 and 9 are set to indicate the size of the offset 1540 descriptor as described for BEACON and METADATA packets, so that each 1541 STATUS packet is self-describing. The flag values here MUST be the 1542 same as indicated in the initial METADATA and DATA packets. 1544 Other bits in the Flags field are defined as: 1546 +-----+-------+---------------------------------------------------+ 1547 | Bit | Value | Meaning | 1548 +-----+-------+---------------------------------------------------+ 1549 | 12 | 0 | This packet does not include a timestamp field. | 1550 | 12 | 1 | This packet includes an optional timestamp field. | 1551 +-----+-------+---------------------------------------------------+ 1553 Flag bit 12 indicates that an optional sixteen-byte packet timestamp/ 1554 nonce field is carried in the packet before the Progress Indicator 1555 descriptor, as discussed for the DATA packet format. Packet 1556 timestamps are discussed further in Appendix A. 1558 +-----+-------+----------------------------------------+ 1559 | Bit | Value | Meaning | 1560 +-----+-------+----------------------------------------+ 1561 | 13 | 0 | file's METADATA has been received. | 1562 | 13 | 1 | file's METADATA has not been received. | 1563 +-----+-------+----------------------------------------+ 1565 If bit 13 of a STATUS packet has been set to indicate that the 1566 METADATA has not yet been received, then the METADATA should be 1567 resent. This flag should normally be clear. 1569 A receiver SHOULD tolerate lost METADATA that is later resent, but 1570 MAY insist on receiving METADATA at the start of a transfer. This is 1571 done by responding to early DATA packets with a voluntary STATUS 1572 packet that sets this flag bit, reports a status error code 10, sets 1573 the Progress Indicator field to zero, and does not include 1574 HOLESTOFILL information. 1576 +-----+-------+-----------------------------------------------------+ 1577 | Bit | Value | Meaning | 1578 +-----+-------+-----------------------------------------------------+ 1579 | 14 | 0 | this packet contains the complete current set of | 1580 | | | holes at the file-receiver. | 1581 | 14 | 1 | this packet contains incomplete hole-state; holes | 1582 | | | shown in this packet should supplement other | 1583 | | | incomplete hole-state known to the file-sender. | 1584 +-----+-------+-----------------------------------------------------+ 1586 Bit 14 of a 'holestofill' STATUS packet is only set when there are 1587 too many holes to fit within a single STATUS packet due to MTU 1588 limitations. This causes the hole list to be spread out over 1589 multiple STATUS packets, each of which conveys distinct sets of 1590 holes. This could occur, for instance, in a large file _put_ 1591 scenario with a long-delay feedback loop and poor physical layer 1592 conditions. These multiple STATUS packets will share In-Response-To 1593 information. When losses are light and/or hole reporting and repair 1594 is relatively frequent, all holes should easily fit within a single 1595 STATUS packet, and this flag will be clear. Bit 14 should normally 1596 be clear. 1598 In some rare cases of high loss, there may be too many holes in the 1599 received data to convey within a single STATUS's size, which is 1600 limited by the link MTU size. In this case, multiple STATUS packets 1601 may be generated, and Flags bit 14 should be set on each STATUS 1602 packet accordingly, to indicate that each packet holds incomplete 1603 results. The complete group of STATUS packets, each containing 1604 incomplete information, will share common In-Response-To information 1605 to distinguish them from any earlier groups. 1607 +-----+-------+-----------------------------------------------+ 1608 | Bit | Value | Meaning | 1609 +-----+-------+-----------------------------------------------+ 1610 | 15 | 0 | This STATUS was requested by the file-sender. | 1611 | 15 | 1 | This STATUS is sent voluntarily. | 1612 +-----+-------+-----------------------------------------------+ 1614 Flag bit 15 indicates whether the STATUS is sent voluntarily or due 1615 to a request by the sender. It affects content of the In-Response-To 1616 timestamp and descriptor fields. 1618 In the case of a transfer proceeding normally, immediately following 1619 the STATUS packet header shown above, is a set of "Hole" definitions 1620 indicating any lost packets. Each Hole definition is a pair of 1621 unsigned integers. For a 32-bit offset descriptor, each Hole 1622 definition consists of two four-octet unsigned integers: 1624 Hole Definition Format 1626 0 1 2 3 1627 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1628 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1629 [ offset to start of hole (descriptor) ] 1630 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1631 [ offset to end of hole (descriptor) ] 1632 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1634 The start of the hole means the offset of the first unreceived byte 1635 in that hole. The end of the hole means the last unreceived byte in 1636 that hole. 1638 For 16-bit descriptors, each Hole definition holds two two-octet 1639 unsigned integers, while Hole definitions for 64- and 128-bit 1640 descriptors require two eight- and two sixteen-octet unsigned 1641 integers respectively. 1643 Holes MUST be listed in order, lowest values first. 1645 Since each Hole definition takes up eight octets when 32-bit offset 1646 lengths are used, we expect that well over 100 such definitions can 1647 fit in a single STATUS packet, given the IPv6 minimum MTU. (There 1648 may be cases where there is a very constrained backchannel compared 1649 to the forward channel streaming DATA packets. For these cases, 1650 implementations might deliberately request large holes that span a 1651 number of smaller holes and intermediate areas where DATA has already 1652 been received, so that previously-received DATA is deliberately 1653 resent. This aggregation of separate holes keeps the backchannel 1654 STATUS packet size down to avoid backchannel congestion.) 1656 A 'voluntary' STATUS can be sent at the start of each transaction. 1657 This indicates that the receiver is ready to receive the file, or 1658 indicates an error or rejection code, described below. A STATUS 1659 indicating a successfully established transfer has a Progress 1660 Indicator of zero and an In-Response-To field of zero. 1662 On receiving a STATUS packet, the sender SHOULD prioritize sending 1663 the necessary data to fill those holes, in order to advance the 1664 Progress Indicator at the receiver. 1666 The sender infers a completely-received transfer from the reported 1667 receiver window position. In the final STATUS packet sent by the 1668 receiver once the file to be transferred has been completely 1669 received, bit 14 MUST be 0 (indicating a complete set of holes in 1670 this packet), there MUST NOT be any holestofill offset pairs 1671 indicating holes, the In-Response-To and Progress Indicator fields 1672 contain the length of the file (i.e. point to the next octet after 1673 the file), and the voluntary flag MUST be set. This 'completed' 1674 STATUS may be repeated, depending on subsequent sender behaviour, 1675 while internal state about the transfer remains available to the 1676 receiver. 1678 Because METADATA is optional in implementations, the file receiver 1679 may not know the length of a file if METADATA is never sent. The 1680 sender MUST set the EOD End of Data flag in each DATA packet that 1681 sends the last byte of the file, and SHOULD request a STATUS 1682 acknowledgement when the EOD flag is set. If METADATA has been sent 1683 and the EOD comes earlier than a previously reported length of a 1684 file, an unspecified error 0x01, as described below, is returned in 1685 the STATUS message responding to that DATA packet and EOD flag. If a 1686 stream is being marked EOD, the receiver acknowledges this with a 1687 Success 0x00 code. 1689 In the case of an error causing a transfer to be aborted, the Status 1690 field holds a code that can be used to explain the cause of the error 1691 to the other peer. A zero value indicates that there have been no 1692 significant errors (this is called a "success STATUS" within this 1693 document), while any non-zero value means the transaction should be 1694 aborted (this is called a "failure STATUS"). 1696 +----------------+--------------------------------------------------+ 1697 | Error Code | Meaning | 1698 | Status Value | | 1699 +----------------+--------------------------------------------------+ 1700 | 0x00 | Success, No Errors. | 1701 | 0x01 | Unspecified Error. | 1702 | 0x02 | Unable to send file due to resource constraints. | 1703 | 0x03 | Unable to receive file due to resource | 1704 | | constraints. | 1705 | 0x04 | File not found. | 1706 | 0x05 | Access Denied. | 1707 | 0x06 | Unknown Id field for transaction. | 1708 | 0x07 | Did not delete file. | 1709 | 0x08 | File length is longer than receiver can support. | 1710 | 0x09 | File offset descriptors do not match expected | 1711 | | use or file length. | 1712 | 0x0A | Unsupported Saratoga packet type received. | 1713 | 0x0B | Unsupported Request Type received. | 1714 | 0x0C | REQUEST is now terminated due to an internal | 1715 | | timeout. | 1716 | 0x0D | DATA flag bits describing transfer have changed | 1717 | | unexpectedly. | 1718 | 0x0E | Receiver is no longer interested in receiving | 1719 | | this file. | 1720 | 0x0F | File is in use. | 1721 | 0x10 | METADATA required before transfer can be | 1722 | | accepted. | 1723 | 0x11 | A STATUS error message has been received | 1724 | | unexpectedly, so REQUEST is terminated. | 1725 +----------------+--------------------------------------------------+ 1727 The recipient of a failure STATUS MUST NOT try to process the 1728 Progress Indicator, In-Response-To, or Hole offsets, because, in some 1729 types of error conditions, the packet's sender may not have any way 1730 of setting them to the right length for the transaction. 1732 When sending an indefinite-length stream, the possibility of offset 1733 sequence numbers wrapping back to zero must be considered. This can 1734 be protected against by using large offsets, and by the stream 1735 receiver. The receiver MUST separate out holes before the offset 1736 wraps to zero from holes after the wrap, and send Hole definitions in 1737 different STATUS packets, with Flag 14 set to mark them as 1738 incomplete. Any Hole straddling a sequence wrap MUST be broken into 1739 two separate Holes, with the second Hole starting at zero. The 1740 timestamps in STATUS packets carrying any pre-wrap holes should be 1741 earlier than the timestamp in later packets, and should repeat the 1742 timestamp of the last DATA packet seen for that offset sequence 1743 before the following wrap to zero occurred. Receivers indicate that 1744 they no longer wish to receive streams by sending Status Code 0C. 1746 5. The Directory Entry 1748 Directory Entries have two uses within Saratoga: 1750 1. Within a METADATA packet, a Directory Entry is used to give 1751 information about the file being transferred, in order to 1752 facilitate proper reassembly of the file and to help the file- 1753 receiver understand how recently the file may have been created 1754 or modified. 1756 2. When a peer requests a directory record via a _getdir_ REQUEST, 1757 the other peer generates a file containing a series of one or 1758 more concatenated Directory Entry records, and transfers this 1759 file as it would transfer the response to a normal _get_ REQUEST, 1760 sending the records together within DATA packets. This file may 1761 be either temporary or within-memory and not actually a part of 1762 the host's file system itself. 1764 Directory Entry Format 1766 0 1 2 3 1767 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1768 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1769 |1| Properties [ Size (descriptor) ] 1770 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1771 | File modification time (using year 2000 epoch) | 1772 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1773 | File creation time (using year 2000 epoch) | 1774 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1775 | / 1776 + / 1777 / / 1778 / File Path (max 1024 octets,variable length) / 1779 / ... // 1780 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-// 1782 where 1783 +------------+------------------------------------------------------+ 1784 | field | description | 1785 +------------+------------------------------------------------------+ 1786 | Properties | if set, bit 7 of this field indicates that the entry | 1787 | | corresponds to a directory. Bit 6, if set, | 1788 | | indicates that the file is "special". A special | 1789 | | file may not be directly transferable as it | 1790 | | corresponds to a symbolic link, a named pipe, a | 1791 | | device node, or some other "special" filesystem | 1792 | | object. A file-sender may simply choose not to | 1793 | | include these types of files in the results of a | 1794 | | _getdir_ request. Bits 8 and 9 are flags that | 1795 | | indicate the width of the following descriptor field | 1796 | | that gives file size. Bit 10 indicates that the | 1797 | | file is to be handled by Saratoga as a bundle, and | 1798 | | passed to a bundle agent. | 1799 | Size | the size of each file or directory in octets. This | 1800 | | is a descriptor, varying as needed in each entry for | 1801 | | the size of the file. For convenience in the | 1802 | | figure, it is shown here as a 16-bit descriptor for | 1803 | | a small file. | 1804 | Mtime | a timestamp showing when the file or directory was | 1805 | | modified. | 1806 | Ctime | a timestamp of the last status change for this file | 1807 | | or directory. | 1808 | File Path | contains the file's name relative within the | 1809 | | requested path of the _getdir_ transaction, a | 1810 | | maximum of 1024-octet UTF-8 string, which is | 1811 | | null-terminated to indicate its end. The File Path | 1812 | | may contain additional null padding in the null | 1813 | | termination to allow Directory Entries to each be | 1814 | | allocated a fixed amount of space or to place an | 1815 | | integer number of Directory Entries in each DATA | 1816 | | packet for debugging purposes. | 1817 +------------+------------------------------------------------------+ 1819 The first bit of the Directory Entry is always 1, to indicate the 1820 start of the record and the end of any padding from previous 1821 Directory Entries. 1823 +-------+-------+---------------------+ 1824 | Bit 6 | Bit 7 | Properties conveyed | 1825 +-------+-------+---------------------+ 1826 | 0 | 0 | normal file. | 1827 | 0 | 1 | normal directory. | 1828 | 1 | 0 | special file. | 1829 | 1 | 1 | special directory. | 1830 +-------+-------+---------------------+ 1832 Streams listed in a directory should be marked as special. If a 1833 stream is being transferred, its size is unknown -- otherwise it 1834 would be a file. The size property of a Directory Entry for a stream 1835 is therefore expected to be zero. 1837 +-------+-------+-------------------------------------------------+ 1838 | Bit 8 | Bit 9 | Properties conveyed | 1839 +-------+-------+-------------------------------------------------+ 1840 | 0 | 0 | File size is indicated in a 16-bit descriptor. | 1841 | 0 | 1 | File size is indicated in a 32-bit descriptor. | 1842 | 1 | 0 | File size is indicated in a 64-bit descriptor. | 1843 | 1 | 1 | File size is indicated in a 128-bit descriptor. | 1844 +-------+-------+-------------------------------------------------+ 1846 Flag bits 8 and 9 of Properties are descriptor size flags, with 1847 similar meaning as elsewhere, describing the size of the File Size 1848 descriptor that follows the Properties field. When a single 1849 Directory Entry appears in the METADATA packet, these flags SHOULD 1850 match flag bits 8 and 9 in the METADATA header. (A smaller 1851 descriptor size may be indicated in the Directory Entry when doing 1852 test transfers of small files using large descriptors.) 1854 +--------+------------------------------------+ 1855 | Bit 10 | Properties conveyed | 1856 +--------+------------------------------------+ 1857 | 0 | File really is a file. | 1858 | 1 | File is to be treated as a bundle. | 1859 +--------+------------------------------------+ 1861 Bit 10 of Directory Entry Properties is a bundle flag, as indicated 1862 in and matching the METADATA header. Use of Saratoga with bundles is 1863 discussed further in [I-D.wood-dtnrg-saratoga]. 1865 +--------+----------------------------------------------------------+ 1866 | Bit 13 | Use | 1867 +--------+----------------------------------------------------------+ 1868 | 0 | This file's content MUST be delivered reliably without | 1869 | | errors using UDP. | 1870 | 1 | This file's content MAY be delivered unreliably, or | 1871 | | partly unreliably, where errors are tolerated, using | 1872 | | UDP-Lite. | 1873 +--------+----------------------------------------------------------+ 1875 Bit 13 indicates whether the file must be sent reliably or can be 1876 sent at least partly unreliably, using UDP-Lite. This matches 1877 METADATA flag use. 1879 Undefined or unused flag bits of the Properties field default to 1880 zero. Bit 0 is always 1, to indicate the start of a Directory Entry. 1881 In general, bits 1-7 of Properties are for matters related to the 1882 sender's filesystem, while bits 8-15 are for matters related to 1883 transport over Saratoga. 1885 It may be reasonable that files are visible in Directory Entries only 1886 when they can be transferred to the requester - this may depend on 1887 e.g. having appropriate access permissions or being able to handle 1888 large filesizes. But requesters only capable of handling small files 1889 MUST be able to skip through large descriptors for large file sizes. 1890 Directory sizes are not calculated or sent, and a Size of 0 is given 1891 instead for directories, which are considered zero-length files. 1893 The "epoch" format used in file creation and modification timestamps 1894 in directory entries indicates the unsigned number of seconds since 1895 the start of January 1, 2000 in UTC. The times MUST include all leap 1896 seconds. Using unsigned 32-bit values means that these time fields 1897 will not wrap until after the year 2136. 1899 Converting from unix CTime/MTime holding a time past January 1, 2000 1900 but with the traditional 1970 epoch means subtracting the fixed value 1901 of 946 684 822 seconds, which includes the 22 leap seconds that were 1902 added to UTC between 1 January 1970 and 1 January 2000. A unix time 1903 before 2000 is rounded to January 1, 2000. 1905 A file-receiver should preserve the timestamp information received in 1906 the METADATA for its own copy of the file, to allow newer versions of 1907 files to propagate and supercede older versions. 1909 6. Behaviour of a Saratoga Peer 1911 This section describes some details of Saratoga implementations and 1912 uses the RFC 2119 standards language to describe which portions are 1913 needed for interoperability. 1915 6.1. Saratoga Transactions 1917 Following are descriptions of the packet exchanges between two peers 1918 for each type of transaction. Exchanges rely on use of the Id field 1919 to match responses to requests, as described earlier in Section 4.2. 1921 6.1.1. The _get_ Transaction 1923 1. A peer (the file-receiver) sends a REQUEST packet to its peer 1924 (the file-sender). The Flags bits are set to indicate that this 1925 is not a _delete_ request, nor does the File Path indicate a 1926 directory. Each _get_ transaction corresponds to a single file, 1927 and fetching multiple files requires sending multiple REQUEST 1928 packets and using multiple different transaction Ids so that 1929 responses can be differentiated and matched to REQUESTs based on 1930 the Id field. If a specific file is being requested, then its 1931 name is filled into the File Path field, otherwise it is left 1932 null and the file-sender will send a file of its choice. 1934 2. If the _get_ request is rejected, then a STATUS packet containing 1935 an error code in the Status field is sent and the transaction is 1936 terminated. This STATUS packet MUST be sent to reject and 1937 terminate the transaction. The error code MAY make use of the 1938 "Unspecified Error" value for security reasons. Some REQUESTs 1939 might also be rejected for specifying files that are too large to 1940 have their lengths encoded within the maximum integer field width 1941 advertised by bits 8 and 9 of the REQUEST. 1943 3. If the _get_ request is accepted, then a STATUS packet MAY be 1944 sent with an error code of 00 and an In-Response-To field of 1945 zero, to indicate acceptance. Sending other packets (METADATA or 1946 DATA) also indicates acceptance. The file-sender SHOULD generate 1947 and send a METADATA packet. The sender MUST send the contents of 1948 the file or stream as a series of DATA packets. In the absence 1949 of STATUS packets being requested from the receiver, if the file- 1950 sender believes it has finished sending the file and is not on a 1951 unidirectional link, it MUST send the last DATA packet with the 1952 Flags bit set requesting a STATUS response from the file- 1953 receiver. The last DATA packet MUST always have its End of Data 1954 (EOD) bit set. This can be followed by empty DATA packets with 1955 the Flags bits set with EOD and requesting a STATUS until either 1956 a STATUS packet is received, or the inactivity timer expires. 1957 All of the DATA packets MUST use field widths for the file offset 1958 descriptor fields that match what the Flags of the METADATA 1959 packet specified. Some arbitrarily selected DATA packets may 1960 have the Flags bit set that requests a STATUS packet. The file- 1961 receiver MAY voluntarily send STATUS packets at other times, 1962 where the In-Response-To field MUST set to zero. The file- 1963 receiver SHOULD voluntarily send a STATUS packet in response to 1964 the first DATA packet. 1966 4. As the file-receiver takes in the DATA packets, it writes them 1967 into the file locally. The file-receiver keeps track of missing 1968 data in a hole list. Periodically the file sender will set the 1969 ack flag bit in a DATA packet and request a STATUS packet from 1970 the file-receiver. The STATUS packet can include a copy of this 1971 hole list if there are holes. File-receivers MUST send a STATUS 1972 packet immediately in response to receiving a DATA packet with 1973 the Flags bit set requesting a STATUS. 1975 5. If the file-sender receives a STATUS packet with a non-zero 1976 number of holes, it re-fetches the file data at the specified 1977 offsets and re-transmits it. If the METADATA packet requires 1978 retransmission, this is indicated by a bit in the STATUS packet, 1979 and the METADATA packet is retransmitted. The file-sender MUST 1980 retransmit data from any holes reported by the file-receiver 1981 before proceeding further with new DATA packets. 1983 6. When the file-receiver has fully received the file data and the 1984 METADATA packet, then it sends a STATUS packet indicating that 1985 the transaction is complete, and it terminates the transaction 1986 locally, although it MUST persist in responding to any further 1987 DATA packets received from the file-sender with 'completed' 1988 STATUSes, as described in Section 4.5, for some reasonable amount 1989 of time. Starting a timer on sending a completed STATUS and 1990 resetting it whenever a received DATA/sent 'completed' STATUS 1991 transaction takes place, then removing all session state on timer 1992 expiry, is one approach to this. 1994 Given that there may be a high degree of asymmetry in link bandwidth 1995 between the file-sender and file-receiver, the STATUS packets should 1996 be carefully generated so as to not congest the feedback path. This 1997 means that both a file-sender should be cautious in setting the DATA 1998 Flags bit requesting STATUSes, and also that a file-receiver should 1999 be cautious in gratuitously generating STATUS packets of its own 2000 volition. When sending on known unidirectional links, a file-sender 2001 cannot reasonably expect to receive STATUS packets, so should never 2002 request them. 2004 6.1.2. The _getdir_ Transaction 2006 A _getdir_ transaction to obtain a Directory Record proceeds through 2007 the same states as the _get_ transaction. Rather than transferring 2008 the contents of a file from the file-receiver to the file-sender, a 2009 set of records representing the contents of a directory are 2010 transferred as a file. These records can be parsed and dealt with by 2011 the file-receiver as desired. There is no requirement that a 2012 Saratoga peer send the full contents of a directory listing; a peer 2013 may filter the results to only those entries that are actually 2014 accessible to the requesting peer. 2016 Any file system entries that would normally be contained in the 2017 directory records, but that have sizes greater than the receiver has 2018 indicated that it can support in its BEACON, MUST be filtered out. 2020 6.1.3. The _delete_ Transaction 2022 1. A peer sends a REQUEST packet with the bit set indicating that it 2023 is a deletion request and the path to be deleted is filled into 2024 the File Path field. The File Path MUST be filled in for 2025 _delete_ transactions, unlike for _get_ transactions. 2027 2. The other peer replies with a feedback STATUS packet whose Id 2028 matches the Id field of the _delete_ REQUEST. This STATUS has a 2029 Status code that indicates that the file is not currently present 2030 on the filesystem (indicated by the 00 Status field in a success 2031 STATUS), or whether some error occurred (indicated by the non- 2032 zero Status field in a failure STATUS). This STATUS packet MUST 2033 have no Holes and 16-bit width zero-valued Progress Indicator and 2034 In-Response-To fields. 2036 If a request is received to delete a file that is already deleted, a 2037 STATUS with Status code 00 and other fields as described above is 2038 sent back in acknowledgement. This response indicates that the 2039 indicated file is not present, not the exact action sequence that led 2040 to a not-present file. This idempotent behaviour ensures that loss 2041 of STATUS acknowledgements and repeated _delete_ requests are handled 2042 properly. 2044 6.1.4. The _put_ Transaction 2046 A _put_ transaction proceeds as a _get_ does, except the file-sender 2047 and file-receiver roles are exchanged between peers. In a _put_ a 2048 PUT REQUEST is sent. 2050 However, in a 'blind _put_', no REQUEST packet is ever sent. The 2051 file-sending end senses that the transaction is in progress when it 2052 receives METADATA or DATA packets for which it has no knowledge of 2053 the Id field. 2055 If the file-receiver decides that it will store and handle the _put_ 2056 request (at least provisionally), then it MUST send a voluntary (ie, 2057 not requested) success STATUS packet to the file-sender. Otherwise, 2058 it sends a failure STATUS packet. After sending a failure STATUS 2059 packet, it may ignore future packets with the same Id field from the 2060 file-sender, but it should, at a low rate, periodically regenerate 2061 the failure STATUS packet if the flow of packets does not stop. 2063 6.2. Beacons 2065 Sending BEACON packets is not required in any of the transactions 2066 discussed in this specification, but optional BEACONs can provide 2067 useful information in many situations. If a node periodically 2068 generates BEACON packets, then it should do so at a low rate which 2069 does not significantly affect in-progress data transfers. 2071 A node that supports multiple versions of Saratoga (e.g. version 1 2072 from this specification along with the older version 0), MAY send 2073 multiple BEACON packets showing different version numbers. The 2074 version number in a single BEACON should not be used to infer the 2075 larger set of protocol versions that a peer is compatible with. 2076 Similarly, a node capable of communicating via IPv4 and IPv6 MAY send 2077 separate BEACONs via both protocols, or MAY only send BEACONs on its 2078 preferred protocol. 2080 If a node receives BEACONs from a peer, then it SHOULD NOT attempt to 2081 start any _get_, _getdir_, or _delete_ transactions with that peer if 2082 bit 14 is not set in the latest received BEACONs. Likewise, if 2083 received BEACONs from a peer do not have bit 15 set, then _put_ 2084 transactions SHOULD NOT be attempted to that peer. Unlike the 2085 capabilities bits which prevent certain types of transactions from 2086 being attempted, the willingness bits are advisory, and transactions 2087 MAY be attempted even if the node is not advertising a willingness, 2088 as long as it advertises a capability. This avoids waiting for a 2089 willingness indication across long-delay links. 2091 6.3. Upper-Layer Interface 2093 No particular application interface functionality is required in 2094 implementations of this specification. The means and degree of 2095 access to Saratoga configuration settings, and transaction control 2096 that is offered to upper layers and applications, are completely 2097 implementation-dependent. In general, it is expected that upper 2098 layers (or users) can set timeout values for transaction requests and 2099 for inactivity periods during the transaction, on a per-peer or per- 2100 transaction basis, but in some implementations where the Saratoga 2101 code is restricted to run only over certain interfaces with well- 2102 understood operational latency bounds, then these timers MAY be hard- 2103 coded. 2105 6.4. Inactivity Timer 2107 In order to determine the liveliness of a transaction, Saratoga nodes 2108 may implement an inactivity timer for each peer they are expecting to 2109 see packets from. For each packet received from a peer, its 2110 associated inactivity timer is reset. If no packets are received for 2111 some amount of time, and the inactivity timer expires, this serves as 2112 a signal to the node that it should abort (and optionally retry) any 2113 sessions that were in progress with the peer. Information from the 2114 link interface (i.e. link down) can override this timer for point-to- 2115 point links. 2117 The actual length of time that the inactivity timer runs for is a 2118 matter of both implementation and deployment situation. Relatively 2119 short timers (on the order of several round-trip times) allow nodes 2120 to quickly react to loss of contact, while longer timers allow for 2121 transaction robustness in the presence of transient link problems. 2122 This document deliberately does not specify a particular inactivity 2123 timer value nor any rules for setting the inactivity timer, because 2124 the protocol is intended to be used in both long- and short-delay 2125 regimes. 2127 Specifically, the inactivity timer is started on sending REQUEST or 2128 STATUS packets. When sending packets not expected to elicit 2129 responses (BEACON, METADATA, or DATA without acknowledgement 2130 requests), there is no point to starting the local inactivity timer. 2132 For normal file transfers, there are simple rules for handling 2133 expiration of the inactivity timer during a _get_ or _put_ 2134 transaction. Once the timer expires, the file-sender SHOULD 2135 terminate the transaction state and cease to send DATA or METADATA 2136 packets. The file-receiver SHOULD stop sending STATUS packets, and 2137 MAY choose to store the file in some cache location so that the 2138 transfer can be recovered. This is possible by waiting for an 2139 opportunity to re-attempt the transaction and immediately sending a 2140 STATUS that only lists the parts of the file not yet received if the 2141 transaction is granted. In any case, a partially-received file MUST 2142 NOT be handled in any way that would allow another application to 2143 think it is complete. 2145 The file-sender may implement more complex timers to allow rate-based 2146 pacing or simple congestion control using information provided in 2147 STATUS packets, but such possible timers and their effects are 2148 deliberately not specified here. 2150 7. Mailing list 2152 There is a mailing list for discussion of Saratoga and its 2153 implementations. Contact Lloyd Wood for details. 2155 8. Security Considerations 2157 The design of Saratoga provides limited, deliberately lightweight, 2158 services for authentication of session requests, and for 2159 authentication or encryption of data files via keyed metadata 2160 checksums. This document does not specify privacy or access control 2161 for data files transferred. Privacy, access, authentication and 2162 encryption issues may be addressed within an implementation or 2163 deployment in several ways that do not affect the file transfer 2164 protocol itself. As examples, IPSec may be used to protect Saratoga 2165 implementations from forged packets, to provide privacy, or to 2166 authenticate the identity of a peer. Other implementation-specific 2167 or configuration-specific mechanisms and policies might also be 2168 employed for authentication and authorization of requests. 2169 Protection of file data and meta-data can also be provided by a 2170 higher-level file encryption facility. If IPsec is not required, use 2171 of encryption before the file is given to Saratoga is preferable. 2172 Basic security practices like not accepting paths with "..", not 2173 following symbolic links, and using a chroot() system call, among 2174 others, should also be considered within an implementation. 2176 Note that Saratoga is intended for single-hop transfers between 2177 peers. A METADATA checksum using a previously shared key can be used 2178 to decrypt or authenticate delivered DATA files. Saratoga can only 2179 provide payload encryption across a single Saratoga transfer, not 2180 end-to-end across concatenated separate hop-by-hop transfers through 2181 untrusted peers, as checksum verification of file integrity is 2182 required at each node. End-to-end data encryption, if required, MUST 2183 be implemented by the application using Saratoga. 2185 9. IANA Considerations 2187 IANA has allocated port 7542 (tcp/udp) for use by Saratoga. 2189 saratoga 7542/tcp Saratoga Transfer Protocol 2190 saratoga 7542/udp Saratoga Transfer Protocol 2192 IANA has allocated a dedicated IPv4 all-hosts multicast address 2193 (224.0.0.108) and a dedicated IPv6 link-local multicast addresses 2194 (FF02:0:0:0:0:0:0:6c) for use by Saratoga. 2196 10. Acknowledgements 2198 Developing and deploying the on-orbit IP-based infrastructure of the 2199 Disaster Monitoring Constellation, in which Saratoga has proven 2200 useful, has taken the efforts of hundreds of people over more than a 2201 decade. We thank them all. 2203 We thank James H. McKim as an early contributor to Saratoga 2204 implementations and specifications, while working for RSIS 2205 Information Systems at NASA Glenn. We regard Jim as an author of 2206 this document, but are prevented by the boilerplate five-author limit 2207 from naming him earlier. 2209 We thank Stewart Bryant, Dale Mellor, Cathryn Peoples, Kerrin Pine, 2210 Abu Zafar Shahriar and Dave Stewart for their review comments. 2212 Work on this document at NASA's Glenn Research Center was funded by 2213 NASA's Earth Science Technology Office (ESTO). 2215 11. A Note on Naming 2217 Saratoga is named for the USS Saratoga (CV-3), the aircraft carrier 2218 sunk at Bikini Atoll that is now a popular diving site. 2220 12. References 2222 12.1. Normative References 2224 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 2225 August 1980. 2227 [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, 2228 April 1992. 2230 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2231 Requirement Levels", BCP 14, RFC 2119, March 1997. 2233 [RFC3309] Stone, J., Stewart, R., and D. Otis, "Stream Control 2234 Transmission Protocol (SCTP) Checksum Change", RFC 3309, 2235 September 2002. 2237 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 2238 10646", STD 63, RFC 3629, November 2003. 2240 12.2. Informative References 2242 [Hogie05] Hogie, K., Criscuolo, E., and R. Parise, "Using Standard 2243 Internet Protocols and Applications in Space", Computer 2244 Networks, Special Issue on Interplanetary Internet, vol. 2245 47, no. 5, pp. 603-650, April 2005. 2247 [I-D.wood-dtnrg-saratoga] 2248 Wood, L., McKim, J., Eddy, W., Ivancic, W., and C. 2249 Jackson, "Using Saratoga with a Bundle Agent as a 2250 Convergence Layer for Delay-Tolerant Networking", 2251 draft-wood-dtnrg-saratoga-10 (work in progress) , 2252 March 2012. 2254 [Ivancic10] 2255 Ivancic, W., Eddy, W., Stewart, D., Wood, L., Northam, J., 2256 and C. Jackson, "Experience with delay-tolerant networking 2257 from orbit", International Journal of Satellite 2258 Communications and Networking, Special Issue on best 2259 papers of the Fourth Advanced Satellite Mobile Systems 2260 Conference (ASMS 2008), vol. 28, issues 5-6, pp. 335-351, 2261 September-December 2010. 2263 [Jackson04] 2264 Jackson, C., "Saratoga File Transfer Protocol", Surrey 2265 Satellite Technology Ltd internal technical document , 2266 2004. 2268 [RFC0959] Postel, J. and J. Reynolds, "File Transfer Protocol", 2269 STD 9, RFC 959, October 1985. 2271 [RFC3366] Fairhurst, G. and L. Wood, "Advice to link designers on 2272 link Automatic Repeat reQuest (ARQ)", BCP 62, RFC 3366, 2273 August 2002. 2275 [RFC3828] Larzon, L-A., Degermark, M., Pink, S., Jonsson, L-E., and 2276 G. Fairhurst, "The Lightweight User Datagram Protocol 2277 (UDP-Lite)", RFC 3828, July 2004. 2279 [RFC5050] Scott, K. and S. Burleigh, "Bundle Protocol 2280 Specification", RFC 5050, November 2007. 2282 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 2283 Friendly Rate Control (TFRC): Protocol Specification", 2284 RFC 5348, September 2008. 2286 [RFC5405] Eggert, L. and G. Fairhurst, "Unicast UDP Usage Guidelines 2287 for Application Designers", BCP 145, RFC 5405, 2288 November 2008. 2290 [RFC6151] Turner, S. and L. Chen, "Updated Security Considerations 2291 for the MD5 Message-Digest and the HMAC-MD5 Algorithms", 2292 RFC 6151, March 2011. 2294 [Wood07a] Wood, L., Ivancic, W., Hodgson, D., Miller, E., Conner, 2295 B., Lynch, S., Jackson, C., da Silva Curiel, A., Cooke, 2296 D., Shell, D., Walke, J., and D. Stewart, "Using Internet 2297 Nodes and Routers Onboard Satellites", International 2298 Journal of Satellite Communications and 2299 Networking, Special Issue on Space Networks, vol. 25, no. 2300 2, pp. 195-216, March/April 2007. 2302 [Wood07b] Wood, L., Eddy, W., Ivancic, W., Miller, E., McKim, J., 2303 and C. Jackson, "Saratoga: a Delay-Tolerant Networking 2304 convergence layer with efficient link utilization", 2305 International Workshop on Satellite and Space 2306 Communications (IWSSC '07) Salzburg, September 2007. 2308 [Wood11] Wood, L., Smith, C., Eddy, W., Ivancic, W., and C. 2309 Jackson, "Taking Saratoga from space-based ground sensors 2310 to ground-based space sensors", IEEE Aerospace 2311 Conference Big Sky, Montana, March 2011. 2313 [wood-tsvwg-saratoga-congestion-control] 2314 Wood, L., Eddy, W., and W. Ivancic, "Congestion control 2315 for the Saratoga protocol", 2316 draft-wood-tsvwg-saratoga-congestion-control-01 (work in 2317 progress) , March 2012. 2319 Appendix A. Timestamp/Nonce field considerations 2321 Timestamps are useful in DATA packets when the time that the packet 2322 or its payload was generated is of importance; this can be necessary 2323 when streaming sensor data recorded and packetized in real time. The 2324 format of the optional timestamp, whose presence is indicated by a 2325 flag bit, is implementation-dependent within the available fixed- 2326 length 128-bit field. How the contents of this timestamp field are 2327 used and interpreted depends on local needs and conventions and the 2328 local implementation. 2330 However, one simple suggested format for timestamps is to begin with 2331 a POSIX time_t representation of time, in network byte order. This 2332 is either a 32-bit or 64-bit signed integer representing the number 2333 of seconds since 1970. The remainder of this field can be used 2334 either for a representation of elapsed time within the current 2335 second, if that level of accuracy is required, or as a nonce field 2336 uniquely identifying the packet or including other information. Any 2337 locally-meaningful flags identifying a type of timestamp or timebase 2338 can be included before the end of the field. Unused parts of this 2339 field MUST be set to zero. 2341 There are many different representations of timestamps and timebases, 2342 and this draft is too short to cover them in detail. One suggested 2343 flag representation of different timestamp fields is to use the least 2344 significant bits at the end of the timestamp/nonce field as: 2346 +---------+---------------------------------------------------------+ 2347 | Status | Meaning | 2348 | Value | | 2349 +---------+---------------------------------------------------------+ 2350 | 00 | No flags set, local interpretation of field. | 2351 | 01 | 32-bit timestamp at start of field indicating whole | 2352 | | seconds from epoch. | 2353 | 02 | 64-bit timestamp at start of field indicating whole | 2354 | | seconds elapsed from epoch. | 2355 | 03 | 32-bit timestamp, as in 01, followed by 32-bit | 2356 | | timestamp indicating fraction of the second elapsed. | 2357 | 04 | 64-bit timestamp, as in 02, followed by 32-bit | 2358 | | timestamp indicating fraction of the second elapsed. | 2359 +---------+---------------------------------------------------------+ 2361 Other values may indicate specific epochs or timebases, as local 2362 requirements dictate. There are many ways to define and use time 2363 usefully. 2365 Echoing timestamps back to the file-sender is also useful for 2366 tracking flow conditions. This does not require the echoing receiver 2367 to understand the timestamp format or values in use. The use of 2368 timestamp values may assist in developing algorithms for flow control 2369 (including TCP-Friendly Rate Control 2370 [wood-tsvwg-saratoga-congestion-control]) or other purposes. 2371 Timestamp values provide a useful mechanism for Saratoga peers to 2372 measure path and round-trip latency. 2374 Authors' Addresses 2376 Lloyd Wood 2377 University of Surrey alumni 2378 Sydney, New South Wales 2379 Australia 2381 Email: L.Wood@society.surrey.ac.uk 2382 Wesley M. Eddy 2383 MTI Systems 2384 MS 500-ASRC 2385 NASA Glenn Research Center 2386 21000 Brookpark Road 2387 Cleveland, OH 44135 2388 USA 2390 Phone: +1-216-433-6682 2391 Email: wes@mti-systems.com 2393 Charles Smith 2394 Vallona Networks 2395 7 Wattle Crescent 2396 Phegans Bay, New South Wales 2256 2397 Australia 2399 Phone: +61-404-05-8974 2400 Email: charlesetsmith@me.com 2402 Will Ivancic 2403 NASA Glenn Research Center 2404 21000 Brookpark Road, MS 54-5 2405 Cleveland, OH 44135 2406 USA 2408 Phone: +1-216-433-3494 2409 Email: William.D.Ivancic@grc.nasa.gov 2411 Chris Jackson 2412 Surrey Satellite Technology Ltd 2413 Tycho House 2414 Surrey Space Centre 2415 20 Stephenson Road 2416 Guildford, Surrey GU2 7YE 2417 United Kingdom 2419 Phone: +44-1483-803803 2420 Email: C.Jackson@sstl.co.uk