idnits 2.17.1 draft-wood-tsvwg-saratoga-12.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 (October 6, 2012) is 4219 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: April 9, 2013 MTI Systems 6 C. Smith 7 Vallona 8 W. Ivancic 9 NASA 10 C. Jackson 11 SSTL 12 October 6, 2012 14 Saratoga: A Scalable Data Transfer Protocol 15 draft-wood-tsvwg-saratoga-12 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 April 9, 2013. 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 orbiting satellites. It has been used in daily operations since 2004 112 to 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 September 2012, 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 link 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 of disk space), 4GiB-1 (<4 Gigabytes), 16EiB-1 (<16 183 Exabytes) and 256 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 METADATA. However, sending and receiving METADATA is 465 considered extremely useful, is strongly recommended, and SHOULD be 466 done. A METADATA that is received MUST be parsed. 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 descriptor size is implemented, all sizes below that size MUST 496 be 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 MUST 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 64KiB - 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 does not itself 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 reserved for future use, and MUST be set to 739 zero. 741 The two highest-order bits (bits 8 and 9 above) indicate the maximum 742 supported file size parameters that the peer's Saratoga 743 implementation permits. Other Saratoga packet types contain 744 variable-length fields that convey file sizes or offsets into a file 745 -- the file offset descriptors. These descriptors may be 16-bit, 32- 746 bit, 64-bit, or 128-bit in length, depending on the size of the file 747 being transferred and/or the integer types supported by the sending 748 peer. The indicated bounds for the possible values of these bits are 749 summarized below: 751 +-------+-------+-------------------------+-------------------+ 752 | Bit 8 | Bit 9 | Supported Field Sizes | Maximum File Size | 753 +-------+-------+-------------------------+-------------------+ 754 | 0 | 0 | 16 bits | 2^16 - 1 octets. | 755 | 0 | 1 | 16 or 32 bits | 2^32 - 1 octets. | 756 | 1 | 0 | 16, 32, or 64 bits | 2^64 - 1 octets. | 757 | 1 | 1 | 16, 32, 64, or 128 bits | 2^128 - 1 octets. | 758 +-------+-------+-------------------------+-------------------+ 760 If a Saratoga peer advertises it is capable of receiving a certain 761 size of file, then it MUST also be capable of receiving files sent 762 using smaller descriptor values. This avoids overhead on small 763 files, while increasing interoperability between peers. 765 It is likely when sending unbounded streams that a larger offset 766 descriptor field size will be preferred to minimise problems with 767 offset sequence numbers wrapping. Protecting against sequence number 768 wrapping is discussed in the STATUS section. 770 +-----+-------+-----------------------------------------------------+ 771 | Bit | Value | Meaning | 772 +-----+-------+-----------------------------------------------------+ 773 | 10 | 0 | not able to pass bundles to a local bundle agent; | 774 | | | handles files only. | 775 | 10 | 1 | handles files, but can also pass marked bundles to | 776 | | | a local bundle agent. | 777 +-----+-------+-----------------------------------------------------+ 779 Bit 10 is reserved for DTN bundle agent use, indicating whether the 780 sender is capable of handling bundles via a local bundle agent. This 781 is described in [I-D.wood-dtnrg-saratoga]. 783 +-----+-------+--------------------------------------+ 784 | Bit | Value | Meaning | 785 +-----+-------+--------------------------------------+ 786 | 11 | 0 | not capable of supporting streaming. | 787 | 11 | 1 | capable of supporting streaming. | 788 +-----+-------+--------------------------------------+ 790 Bit 11 is used to indicate whether the sender is capable of sending 791 and receiving continuous streams. 793 +--------+--------+------------------------------------------------+ 794 | Bit 12 | Bit 13 | Capability and willingness to send files | 795 +--------+--------+------------------------------------------------+ 796 | 0 | 0 | cannot send files at all. | 797 | 0 | 1 | invalid. | 798 | 1 | 0 | capable of sending, but not willing right now. | 799 | 1 | 1 | capable of and willing to send files. | 800 +--------+--------+------------------------------------------------+ 802 +-------+-------+---------------------------------------------------+ 803 | Bit | Bit | Capability and willingness to receive files | 804 | 14 | 15 | | 805 +-------+-------+---------------------------------------------------+ 806 | 0 | 0 | cannot receive files at all. | 807 | 0 | 1 | invalid. | 808 | 1 | 0 | capable of receiving, but unwilling. Will reject | 809 | | | METADATA or DATA packets. | 810 | 1 | 1 | capable of and willing to receive files. | 811 +-------+-------+---------------------------------------------------+ 813 Also in the Flags field, bits 12 and 14 act as capability bits, while 814 bits 13 and 15 augment those flags with bits indicating current 815 willingness to use the capability. 817 Bits 12 and 13 deal with sending, while bits 14 and 15 deal with 818 receiving. If bit 12 is set, then the peer has the capability to 819 send files. If bit 14 is set, then the peer has the capability to 820 receive files. Bits 13 and 15 indicate willingness to send and 821 receive files, respectively. 823 A peer that is able to act as a file-sender MUST set the capability 824 bit 12 in all BEACONs that it sends, regardless of whether it is 825 willing to send any particular files to a particular peer at a 826 particular time. Bit 13 indicates the current presence of data to 827 send and a willingness to send it in general, in order to augment the 828 capability advertised by bit 12. 830 If bit 14 is set, then the peer is capable of acting as a receiver, 831 although it still might not currently be ready or willing to receive 832 files (for instance, it may be low on free storage). This bit MUST 833 be set in any BEACON packets sent by nodes capable of acting as file- 834 receivers. Bit 15 augments this by expresses a current general 835 willingness to receive and accept files. 837 +-----+-------+-----------------------------------------------------+ 838 | Bit | Value | Meaning | 839 +-----+-------+-----------------------------------------------------+ 840 | 16 | 0 | supports DATA transfers over UDP only. | 841 | 16 | 1 | supports DATA transfers over both UDP and UDP-Lite. | 842 +-----+-------+-----------------------------------------------------+ 844 Bit 16 is used to indicate whether the sender is capable of sending 845 and receiving unreliable transfers via UDP-Lite. 847 +-----+-------+-----------------------------------------------------+ 848 | Bit | Value | Meaning | 849 +-----+-------+-----------------------------------------------------+ 850 | 17 | 0 | available free space is not advertised in this | 851 | | | BEACON. | 852 | 17 | 1 | available free space is advertised in this BEACON. | 853 +-----+-------+-----------------------------------------------------+ 855 Bit 17 is used to indicate whether the sender includes an optional 856 field in this BEACON packet that tells how much free space is 857 available. If bit 17 is set, then bits 18 and 19 are used to 858 indicate the size in bits of the optional free-space-size field. If 859 bit 17 is not set, then bits 18 and 19 are zero. 861 +--------+--------+--------------------------+ 862 | Bit 18 | Bit 19 | Size of free space field | 863 +--------+--------+--------------------------+ 864 | 0 | 0 | 16 bits. | 865 | 0 | 1 | 32 bits. | 866 | 1 | 0 | 64 bits. | 867 | 1 | 1 | 128 bits. | 868 +--------+--------+--------------------------+ 870 The free space field size can vary as indicated by a varying-size 871 field indicated in bits 18 and 19 of the flags field. Unlike other 872 offset descriptor use where the value in the descriptor indicates a 873 byte or octet position for retransmission, or gives a file size in 874 bytes, this particular field indicates the available free space in 875 KIBIBYTES (KiB, multiples of 1024 octets), rather than octets. 876 Available free space is rounded down to the nearest KiB, so 877 advertising zero means that less than 1KiB is free and available. 878 Advertising the maximum size possible in the field means that more 879 free space than that is available. While this field is intended to 880 be scalable, it is expected that 32 bits (up to 4TiB) will be most 881 common in use. 883 A BEACON unicast to an individual peer MAY choose to indicate the 884 free space available for use by that particular peer, and MAY 885 indicate capabilities only available to that particular peer, 886 overriding or supplementing the properties advertised to all local 887 peers by multicast BEACONs. 889 Any type of host identifier can be used in the endpoint identifier 890 field, as long as it is a reasonably unique string within the range 891 of operational deployment. This field encompasses the remainder of 892 the packet, and might contain non-UTF-8 and/or null characters. 894 4.2. REQUEST 896 A REQUEST packet is an explicit command to perform either a _put_, 897 _get_, _getdir_, or _delete_ transaction. 899 Format 901 0 1 2 3 902 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 903 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 904 |0 0 1| Type | Flags | Request Type | 905 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 906 | Id | 907 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 908 | variable-length File Path ... / 909 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 910 / / 911 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 912 / | null byte | / 913 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 914 / variable-length Authentication Field (optional) | 915 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 917 where 919 +---------+---------------------------------------------------------+ 920 | Field | Description | 921 +---------+---------------------------------------------------------+ 922 | Type | 1 | 923 | Flags | provide additional information about the requested | 924 | | file/operation; see table below for definition. | 925 | Request | identifies the type of request being made; see table | 926 | Type | further below for request values. | 927 | Id | uniquely identifies the transaction between two peers. | 928 | File | the path of the requested file/directory following the | 929 | Path | rules described below. | 930 +---------+---------------------------------------------------------+ 932 The Id that is used during transactions serves to uniquely associate 933 a given packet with a particular transaction. This enables multiple 934 simultaneous data transfer or request/status transactions between two 935 peers, with each peer deciding how to multiplex and prioritise the 936 parallel flows it sends. The Id for a transaction is selected by the 937 initiator so as to not conflict with any other in-progress or recent 938 transactions with the same host. This Id should be unique and 939 generated using properties of the file, which will remain constant 940 across a host reboot. The 3-tuple of both host identifiers and a 941 carefully-generated transaction Id field can be used to uniquely 942 index a particular transaction's state. 944 In the Flags field, the bits labelled 8 and 9 in the figure above 945 indicate the maximum supported file length fields that the peer can 946 handle, and are interpreted exactly as the bits 8 and 9 in the BEACON 947 packet described above. Bits 12 and 13, and 14 and 15, indicate 948 capability and willingness to send and receive files, as described 949 above. Making a _get_ request would require that the requester is 950 capable and willing to receive files. The remaining defined 951 individual bits are as summarised as follows: 953 +-----+-------+-----------------------------------------------------+ 954 | Bit | Value | Meaning | 955 +-----+-------+-----------------------------------------------------+ 956 | 10 | 0 | The requester cannot handle bundles locally. | 957 | 10 | 1 | The requester can handle bundles. | 958 | 11 | 0 | The requester cannot receive streams. | 959 | 11 | 1 | The requester is also able to receive streams. | 960 | 16 | 0 | The requester is able to receive DATA over UDP | 961 | | | only. | 962 | 16 | 1 | The requester is also able to receive DATA over | 963 | | | UDP-Lite. | 964 +-----+-------+-----------------------------------------------------+ 966 The Request Type field is an octet that contains a value indicated 967 the type of request being made. Possible values are: 969 +-------+-----------------------------------------------------------+ 970 | Value | Meaning | 971 +-------+-----------------------------------------------------------+ 972 | 0 | No action is to be taken; similar to a BEACON. | 973 | 1 | A _get_ transaction is requested. The File Path field | 974 | | holds the name of the file to be sent. | 975 | 2 | A _put_ transaction is requested. The File Path field | 976 | | suggests the name of the file that will be delivered only | 977 | | after an OK STATUS is received from the file receiver. | 978 | 3 | A _get_ transaction is requested, and once received | 979 | | successfully, the original copy should be deleted. The | 980 | | File Path field holds the name of the file to be sent. | 981 | | (This get+delete is known as a 'take'.) | 982 | 4 | A _put_ transaction is requested, and once sent | 983 | | successfully, the original copy will be deleted. The | 984 | | File Path field holds the name of the file to be sent. | 985 | | (This put+delete is known as a 'give'.) | 986 | 5 | A _delete_ transaction is requested, and the File Path | 987 | | field specifies the name of the file to be deleted. | 988 | 6 | A _getdir_ transaction is requested. The File Path field | 989 | | holds the name of the directory or file on which the | 990 | | directory record is created. | 991 +-------+-----------------------------------------------------------+ 993 The File Path portion of a _get_ packet is a null-terminated UTF-8 994 encoded string [RFC3629] that represents the path and base file name 995 on the file-sender of the file (or directory) that the file-receiver 996 wishes to perform the _get_, _getdir_, or _delete_ operation on. 997 Implementations SHOULD only send as many octets of File Path as are 998 needed for carrying this string, although some implementations MAY 999 choose to send a fixed-size File Path field in all REQUEST packets 1000 that is filled with null octets after the last UTF-8 encoded octet of 1001 the path. A maximum of 1024 octets for this field, and for the File 1002 Path fields in other Saratoga packet types, is used to limit the 1003 total packet size to within a single IPv6 minimum MTU (minus some 1004 padding for network layer headers), and thus avoid the need for 1005 fragmentation. The 1024-octet maximum applies after UTF-8 encoding 1006 and null termination. 1008 As in the standard Internet File Transfer Protocol (FTP) [RFC0959], 1009 for path separators, Saratoga allows the local naming convention on 1010 the peers to be used. There are security implications to processing 1011 these strings without some intelligent filtering and checking on the 1012 filesystem items they refer to. See also the Security Considerations 1013 section later within this document. 1015 If the File Path field is empty, i.e. is a null-terminated zero- 1016 length string one octet long, then this indicates that the file- 1017 receiver is ready to receive any file that the file-sender would like 1018 to send it, rather than requesting a particular file. This allows 1019 the file-sender to determine the order and selection of files that it 1020 would like to forward to the receiver in more of a "push" manner. Of 1021 course, file retrieval could also follow a "pull" manner, with the 1022 file-receiving host requesting specific files from the file-sender. 1023 This may be desirable at times if the file-receiver is low on storage 1024 space, or other resources. The file-receiver could also use the 1025 Saratoga _getdir_ transaction results in order to select small files, 1026 or make other optimizations, such as using its local knowledge of 1027 contact times to pick files of a size likely to be able to be 1028 delivered completely. File transfer through pushing sender-selected 1029 files implements delivery prioritization decisions made solely at the 1030 Saratoga file-sending node. File transfer through pulling specific 1031 receiver-selected files implements prioritization involving more 1032 participation from the Saratoga file-receiver. This is how Saratoga 1033 implements Quality of Service (QoS). 1035 The null-terminated File Path string MAY be followed by an optional 1036 Authentication Field that can be used to validate the REQUEST packet. 1037 Any value in the Authentication Field is the result of a computation 1038 of packet contents that SHOULD include, at a minimum, source and 1039 destination IP addresses and port numbers and packet length in a 1040 'pseudo-header', as well as the content of all Saratoga fields from 1041 Version to File Path, excluding the predictable null-termination 1042 octet. This Authentication Field can be used to allow the REQUEST 1043 receiver to discriminate between other peers, and permit and deny 1044 various REQUEST actions as appropriate. The format of this field is 1045 unspecified for local use. 1047 Combined get+delete (take) and put+delete (give) requests should only 1048 have the delete carried out once the deleting peer is certain that 1049 the file-receiver has a good copy of the file. This may require the 1050 file receiver to verify checksums before sending a final STATUS 1051 message acknowledging successful delivery of the final DATA segment, 1052 or aborting the transfer if the checksum fails. If the transfer 1053 fails and an error STATUS is sent for any reason, the file should not 1054 be deleted. 1056 REQUEST packets may be sent multicast, to learn about all listening 1057 nodes. A multicast _get_ request for a file that elicits multiple 1058 METADATA or DATA responses should be followed by unicast STATUS 1059 packets with status errors cancelling all but one of the proposed 1060 transfers. File timestamps in the Directory Entry can be used to 1061 select the most recent version of an offered file, and the host to 1062 fetch it from. 1064 If the receiver already has the file at the expected file path and is 1065 requesting an update to that file, REQUEST can be sent after a 1066 METADATA advertising that file, to allow the sender to determine 1067 whether a replacement for the file should be sent. 1069 Delete requests are ignored for files currently being transferred. 1071 4.3. METADATA 1073 METADATA packets are sent as part of a data transfer transaction 1074 (_get_, _getdir_, and _put_). A METADATA packet says how large the 1075 file is and what its name is, as well as what size of file offset 1076 descriptor is chosen for the session. METADATA packets are optional, 1077 but SHOULD be sent. A METADATA packet that is received MUST be 1078 parsed. A METADATA packet is normally sent at the start of a DATA 1079 transfer, but can be repeated throughout the transfer.. 1081 Format 1083 0 1 2 3 1084 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 1085 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1086 |0 0 1| Type | Flags |Sumleng|Sumtype| 1087 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1088 | Id | 1089 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1090 | / 1091 / / 1092 / example error-detection checksum (128-bit MD5 shown) / 1093 / / 1094 / | 1095 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1096 | / 1097 / single Directory Entry describing file / 1098 / (variable length) / 1099 / // 1100 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-// 1102 where 1104 +-----------+-------------------------------------------------------+ 1105 | Field | Description | 1106 +-----------+-------------------------------------------------------+ 1107 | Type | 2 | 1108 | Flags | indicate additional boolean metadata about a file. | 1109 | Sumleng | indicates the length of a checksum, as a multiple of | 1110 | | 32 bits. | 1111 | Sumtype | indicates whether a checksum is present after the Id, | 1112 | | and what type it is. | 1113 | Id | identifies the transaction that this packet | 1114 | | describes. | 1115 | Checksum | an example included checksum covering file contents. | 1116 | Directory | describes file system information about the file, | 1117 | Entry | including file length, file timestamps, etc.; the | 1118 | | format is specified in Section 5. | 1119 +-----------+-------------------------------------------------------+ 1121 The first octet of the Flags field is currently specified for use. 1122 The later two octets are reserved for future use, and MUST be set to 1123 zero. 1125 In the Flags field, the bits labelled 8 and 9 in the figure above 1126 indicate the exact size of the offset descriptor fields used in this 1127 particular packet and are interpreted exactly as the bits 8 and 9 in 1128 the BEACON packet described above. The value of these bits 1129 determines the size of the File Length field in the current packet, 1130 as well as indicating the size of the offset fields used in DATA and 1131 STATUS packets within the session that will follow this packet. 1133 +--------+--------+-------------------------------------------------+ 1134 | Bit 10 | Bit 11 | Type of transfer | 1135 +--------+--------+-------------------------------------------------+ 1136 | 0 | 0 | a file is being sent. | 1137 | 0 | 1 | the file being sent should be interpreted as a | 1138 | | | Directory Record. | 1139 | 1 | 0 | a bundle is being sent. | 1140 | 1 | 1 | an indefinite-length stream is being sent. | 1141 +--------+--------+-------------------------------------------------+ 1143 Also inside the Flags field, bits 10 and 11 indicate what is being 1144 transferred - a file, special directory record file that contains one 1145 or more directory entries, bundle, or stream. The value 01 indicates 1146 that the METADATA and DATA packets are being generated in response to 1147 a _getdir_ REQUEST, and that the assembled DATA contents should be 1148 interpreted as a Directory Record containing directory entries, as 1149 defined in Section 5. 1151 +-----+-------+-----------------------------------------------------+ 1152 | Bit | Value | Meaning | 1153 +-----+-------+-----------------------------------------------------+ 1154 | 12 | 0 | This transfer is in progress. | 1155 | 12 | 1 | This transfer is no longer in progress, and has | 1156 | | | been terminated. | 1157 +-----+-------+-----------------------------------------------------+ 1159 Bit 12 indicates whether the transfer is in progress, or has been 1160 terminated by the sender. It is normally set to 1 only when METADATA 1161 is resent to indicate that a stream transfer has been ended. 1163 +--------+----------------------------------------------------------+ 1164 | Bit 13 | Use | 1165 +--------+----------------------------------------------------------+ 1166 | 0 | This file's content MUST be delivered reliably without | 1167 | | errors using UDP. | 1168 | 1 | This file's content MAY be delivered unreliably, or | 1169 | | partly unreliably, where errors are tolerated, using | 1170 | | UDP-Lite. | 1171 +--------+----------------------------------------------------------+ 1173 Bit 13 indicates whether the file must be sent reliably or can be 1174 sent at least partly unreliably, using UDP-Lite. This flag SHOULD 1175 only be set if the originator of the file knows that at least some of 1176 the file content is suitable for sending unreliably and is robust to 1177 errors. This flag reflects a property of the file itself. This flag 1178 may still be set if the immediate file-receiver is only capable of 1179 UDP delivery, on the assumption that this preference will be 1180 preserved for later transfers where UDP-Lite transfers may be taken 1181 advantage of by senders with knowledge of the internal file 1182 structure. The file-sender may know that the receiver is capable of 1183 handling UDP-Lite, either from a _get_ REQUEST, from exchange of 1184 BEACONs, or a-priori. 1186 The high four bits of the Flags field, bits 28-31, are used to 1187 indicate if an error-detection checksum has been included in the 1188 METADATA for the file to be transferred. Here, bits 0000 indicate 1189 that no checksum is present, with the implicit assumption that the 1190 application will do its own end-to-end check. Other values indicate 1191 the type of checksum to use. The choice of checksum depends on the 1192 available computing power and the length of the file to be 1193 checksummed. Longer files require stronger checksums to ensure 1194 error-free delivery. The checksum of the file to be transferred is 1195 carried as shown, with a fixed-length field before the varying-length 1196 File Length and File Name information fields. 1198 Assigned values for the checksum type field are: 1200 +-----------+-------------------------------------------------------+ 1201 | Value | Use | 1202 | (0-15) | | 1203 +-----------+-------------------------------------------------------+ 1204 | 0 | No checksum is provided. | 1205 | 1 | 32-bit CRC32 checksum, suitable for small files. | 1206 | 2 | 128-bit MD5 checksum, suitable for larger files. | 1207 | 3 | 160-bit SHA-1 checksum, suitable for larger files but | 1208 | | slower to process than MD5. | 1209 +-----------+-------------------------------------------------------+ 1211 The length of the checksum cannot be inferred from the checksum type 1212 field, particularly for unknown checksum types. The next-highest 1213 four bits of the 32-bit word holding the Flags, bits 24-27, indicate 1214 the length of the checksum bit field, as a multiple of 32 bits. 1216 +----------------------+--------------------------------------+ 1217 | Example Value (0-15) | Use | 1218 +----------------------+--------------------------------------+ 1219 | 0 | No checksum is provided. | 1220 | 1 | 32-bit checksum field, e.g. CRC32. | 1221 | 4 | 128-bit checksum field, e.g. MD5. | 1222 | 5 | 160-bit checksum field, e.g. SHA-1. | 1223 +----------------------+--------------------------------------+ 1225 For a 32-bit CRC, the length field holds 1 and the type field holds 1226 1. For MD5, the length field holds 4 and the type field holds 2. 1227 For SHA-1, the length field holds 5 and the type field holds 3. 1229 It is expected that higher values will be allocated to new and 1230 stronger checksums able to better protect larger files. These 1231 checksums can be expected to be longer, with larger checksum length 1232 fields. 1234 A checksum SHOULD be included for files being transferred. The 1235 checksum SHOULD be as strong as possible. Streaming of an 1236 indefinite-length stream MUST set the checksum type field to zero. 1238 It is expected that a minimum of the MD5 checksum will be used, 1239 unless the Saratoga implementation is used exclusively for small 1240 transfers at the low end of the 16-bit file descriptor range, such as 1241 on low-performing hardware, where the weaker CRC-32c checksum can 1242 suffice. 1244 The CRC32 checksum is computed as described for the CRC-32c algorithm 1245 given in [RFC3309]. 1247 The MD5 Sum field is generated via the MD5 algorithm [RFC1321], 1248 computed over the entire contents of the file being transferred. The 1249 file-receiver can compute the MD5 result over the reassembled 1250 Saratoga DATA packet contents, and compare this to the METADATA's MD5 1251 Sum field in order to gain confidence that there were no undetected 1252 protocol errors or UDP checksum weaknesses encountered during the 1253 transfer. Although MD5 is known to be less than optimal for security 1254 uses, it remains excellent for non-security use in error detection 1255 (as is done here in Saratoga), and has better performance 1256 implications than cryptographically-stronger alternatives given the 1257 limited available processing of many use cases [RFC6151]. 1259 Checksums may be privately keyed for local use, to allow transmission 1260 of authenticated or encrypted files delivered in DATA packets. This 1261 has limitations, discussed further in Section 8 at end. 1263 Use of the checksum to ensure that a file has been correctly relayed 1264 to the receiving node is important. A provided checksum MUST be 1265 checked against the received data file. If checksum verification 1266 fails, either due to corruption or due to the receiving node not 1267 having the right key for a keyed checksum), the file MUST be 1268 discarded. If the file is to be relayed onwards later to another 1269 Saratoga peer, the metadata, including the checksum, MUST be retained 1270 with the file and SHOULD be retransmitted onwards unchanged with the 1271 file for end-to-end coverage. If it is necessary to recompute the 1272 checksum or encrypted data for the new peer, either because a 1273 different key is in use or the existing checksum algorithm is not 1274 supported, the new checksum MUST be computed before the old checksum 1275 is verified, to ensure overlapping checksum coverage and detect 1276 errors introduced in file storage. 1278 METADATA can be used as an indication to update copies of files. If 1279 the METADATA is in response to a _get_ REQUEST including a file 1280 record, and the record information for the held file matches what the 1281 requester already has, as has been indicated by a previously-received 1282 METADATA advertisement from the requester, then only the METADATA is 1283 sent repeating this information and verifying that the file is up to 1284 date. If the record information does not match and a newer file can 1285 be supplied, the METADATA begins a transfer with following DATA 1286 packets to update the file. 1288 4.4. DATA 1290 A series of DATA packets form the main part of a data transfer 1291 transaction (_get_, _put_, or _getdir_). The payloads constitute the 1292 actual file data being transferred. 1294 Format 1296 0 1 2 3 1297 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 1298 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1299 |0 0 1| Type | Flags | 1300 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1301 | Id | 1302 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1303 | / 1304 / Timestamp/nonce information (optional) / 1305 / / 1306 / | 1307 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1308 [ Offset (descriptor) ] 1309 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1310 | Payload data... // 1311 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-// 1313 where 1314 +-----------------+-------------------------------------------------+ 1315 | Field | Description | 1316 +-----------------+-------------------------------------------------+ 1317 | Type | 3 | 1318 | Flags | are described below. | 1319 | Id | identifies the transaction to which this packet | 1320 | | belongs. | 1321 | Timestamp/nonce | is an optional 128-bit field providing timing | 1322 | | or identification information unique to this | 1323 | | packet. See Appendix A for details. | 1324 | Offset | the offset in octets to the location where the | 1325 | | first byte of this packet's payload is to be | 1326 | | written. | 1327 +-----------------+-------------------------------------------------+ 1329 The DATA packet has a minimum size of ten octets, using sixteen-bit 1330 descriptors and no timestamps. 1332 DATA packets are normally checked by the UDP checksum to prevent 1333 errors in either the header or the payload content. However, for 1334 transfers that can tolerate content errors, DATA packets MAY be sent 1335 using UDP-Lite. If UDP-Lite is used, the file-sender must know that 1336 the file-receiver is capable of handling UDP-Lite, and the file 1337 contents to be transferred should be resilient to errors. The UDP- 1338 Lite checksum MUST protect the Saratoga headers, up to and including 1339 the offset descriptor, and MAY protect more of each packet's payload, 1340 depending on the file-sender's knowledge of the internal structure of 1341 the file and the file's reliability requirements. 1343 +-------+-------+--------------------------------------------------+ 1344 | Bit 8 | Bit 9 | Type of transfer | 1345 +-------+-------+--------------------------------------------------+ 1346 | 0 | 0 | 16-bit descriptors are in use in this transfer. | 1347 | 0 | 1 | 32-bit descriptors are in use in this transfer. | 1348 | 1 | 0 | 64-bit descriptors are in use in this transfer. | 1349 | 1 | 1 | 128-bit descriptors are in use in this transfer. | 1350 +-------+-------+--------------------------------------------------+ 1352 Flag bits 8 and 9 are set to indicate the size of the offset 1353 descriptor as described for BEACON and METADATA packets, so that each 1354 DATA packet is self-describing. This allows the DATA packet to be 1355 used to construct a file even when an initial METADATA is lost and 1356 must be resent. The flag values for bits 8 and 9 MUST be the same as 1357 indicated in any expected METADATA packet. 1359 +--------+--------+-------------------------------------------------+ 1360 | Bit 10 | Bit 11 | Type of transfer | 1361 +--------+--------+-------------------------------------------------+ 1362 | 0 | 0 | a file is being sent. | 1363 | 0 | 1 | the file being sent should be interpreted as a | 1364 | | | directory record. | 1365 | 1 | 0 | a bundle is being sent. | 1366 | 1 | 1 | an indefinite-length stream is being sent. | 1367 +--------+--------+-------------------------------------------------+ 1369 Also inside the Flags field, bits 10 and 11 indicate what is being 1370 transferred - a file, special file that contains a Directory Records, 1371 bundle, or stream. The value 01 indicates that the METADATA and DATA 1372 packets are being generated in response to a _getdir_ REQUEST, and 1373 that the assembled DATA contents should be interpreted as a Directory 1374 Record containing directory entries, as defined in Section 5. The 1375 flag values for bits 10 and 11 MUST be the same as indicated in the 1376 initial METADATA packet. 1378 +-----+-------+-----------------------------------------------------+ 1379 | Bit | Value | Meaning | 1380 +-----+-------+-----------------------------------------------------+ 1381 | 12 | 0 | This packet does not include an optional | 1382 | | | timestamp/nonce field. | 1383 | 12 | 1 | This packet includes an optional timestamp/nonce | 1384 | | | field. | 1385 +-----+-------+-----------------------------------------------------+ 1387 Flag bit 12 indicates that an optional packet timestamp/nonce is 1388 carried in the packet before the offset field. This packet 1389 timestamp/nonce field is always sixteen octets (128 bits) long. 1390 Timestamps can be useful to the sender even when the receiver does 1391 not understand them, as the receiver can simply echo any provided 1392 timestamps back, as specified for STATUS packets, to allow the sender 1393 to monitor flow conditions. Packet timestamps are particularly 1394 useful when streaming. Packet timestamps are discussed further in 1395 Appendix A. 1397 +-----+-------+-------------------------------+ 1398 | Bit | Value | Meaning | 1399 +-----+-------+-------------------------------+ 1400 | 15 | 0 | No response is requested. | 1401 | 15 | 1 | A STATUS packet is requested. | 1402 +-----+-------+-------------------------------+ 1404 Within the Flags field, if bit 15 of the packet is set, the file- 1405 receiver is expected to immediately generate a STATUS packet to 1406 provide the file-sender with up-to-date information regarding the 1407 status of the file transfer. This flag is set carefully and rarely. 1408 This flag may be set periodically, but infrequently. Asymmetric 1409 links with constrained backchannels can only carry a limited amount 1410 of STATUS packets before ack congestion becomes a problem. This flag 1411 SHOULD NOT be set if an unreliable stream is being transferred, or if 1412 multicast is in use. This flag SHOULD be set periodically for 1413 reliable file transfers, or reliable streaming. The file-receiver 1414 MUST respond to the flag by generating a STATUS packet, unless it 1415 knows that doing so will lead to local congestion, in which case it 1416 may choose to send a later voluntary STATUS message. 1418 +-----+-------+----------------------------------+ 1419 | Bit | Value | Meaning | 1420 +-----+-------+----------------------------------+ 1421 | 16 | 0 | Normal use. | 1422 | 16 | 1 | The EOD End of Data flag is set. | 1423 +-----+-------+----------------------------------+ 1425 The End of Data flag is set in DATA packets carrying the last byte of 1426 a transfer. This is particularly useful for streams and for the rare 1427 Saratoga implementations that do not send or receive METADATA. 1429 Immediately following the DATA header is the payload, which consumes 1430 the remainder of the packet and whose length is implicitly defined by 1431 the end of the packet. The payload octets are directly formed from 1432 the continuous octets starting at the specified Offset in the file 1433 being transferred. No special coding is performed. A zero-octet 1434 payload length is allowable, and a single DATA packet indicating zero 1435 payload, consisting only of a header with the EOD flag set, may be 1436 useful to simply elicit a STATUS response from the receiver. 1438 The length of the Offset fields used within all DATA packets for a 1439 given transaction MUST be consistent with the length indicated by 1440 bits 8 and 9 of any accompanying METADATA packet. If the METADATA 1441 packet has not yet been received, a file-receiver that supports 1442 METADATA MUST indicate that it has not been received via a STATUS 1443 packet, and MAY choose to enqueue received DATA packets for later 1444 processing after the METADATA arrives. 1446 4.5. STATUS 1448 The STATUS packet type is the single acknowledgement method that is 1449 used for feedback from a Saratoga receiver to a Saratoga sender to 1450 indicate transaction progress, both as a response to a REQUEST, and 1451 as a response to a DATA packet when demanded or volunteered. 1453 When responding to a DATA packet, the STATUS packet MAY, as needed, 1454 include selective acknowledgement (SNACK) 'hole' information to 1455 enable transmission (usually re-transmission) of specific sets of 1456 octets within the current transaction (called "holes"). This 1457 'holestofill' information can be used to clean up losses (or indicate 1458 no losses) at the end of, or during, a transaction, or to efficiently 1459 resume a transfer that was interrupted in a previous transaction. 1461 Format 1463 0 1 2 3 1464 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 1465 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1466 |0 0 1| Type | Flags | Status | 1467 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1468 | Id | 1469 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1470 | / 1471 / Timestamp/nonce information (optional) / 1472 / / 1473 / | 1474 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1475 [ Progress Indicator (descriptor) ] 1476 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1477 [ In-Response-To (descriptor) ] 1478 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1479 | (possibly, several Hole fields) / 1480 / ... / 1481 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1483 where 1485 +----------------+--------------------------------------------------+ 1486 | Field | Description | 1487 +----------------+--------------------------------------------------+ 1488 | Type | 4 | 1489 | Flags | are defined below. | 1490 | Id | identifies the transaction that this packet | 1491 | | belongs to. | 1492 | Status | a value of 00 indicates the transfer is | 1493 | | sucessfully proceeding. All other values are | 1494 | | errors terminating the transfer, explained | 1495 | | below. | 1496 | Zero-Pad | an octet fixed at 00 to allow later fields to be | 1497 | | conveniently aligned for processing. | 1498 | Timestamp | an optional fixed 128-bit field, that is only | 1499 | (optional) | present and used to return a packet timestamp if | 1500 | | the timestamp flag is set. If the STATUS packet | 1501 | | is voluntary and the voluntary flag is set, this | 1502 | | should repeat the timestamp of the DATA packet | 1503 | | containing the highest offset seen. If the | 1504 | | STATUS packet is in response to a mandatory | 1505 | | request, this will repeat the timestamp of the | 1506 | | requesting DATA packet. The file-sender may use | 1507 | | these timestamps to estimate latency. Packet | 1508 | | timestamps are particularly useful when | 1509 | | streaming. There are special considerations for | 1510 | | streaming, discussed further below, to protect | 1511 | | against the ambiguity of wrapped offset | 1512 | | descriptor sequence numbers. Packet timestamps | 1513 | | are discussed further in Appendix A. | 1514 | Progress | the offset of the lowest-numbered octet of the | 1515 | Indicator | file not yet received, and expected. | 1516 | (descriptor) | | 1517 | In-Response-To | the offset of the octet following the DATA | 1518 | (descriptor) | packet that generated this STATUS packet, or the | 1519 | | offset of the next expected octet following the | 1520 | | highest DATA packet seen if this STATUS is | 1521 | | generated voluntarily and the voluntary flag is | 1522 | | set. | 1523 | Holes | indications of offset ranges of missing data, | 1524 | | defined below. | 1525 +----------------+--------------------------------------------------+ 1527 The STATUS packet has a minimum size of twelve octets, using sixteen- 1528 bit descriptors, a progress indicator but no Hole fields, and no 1529 timestamps. The progress indicator is always zero when responding to 1530 requests that may initiate a transfer. 1532 The Id field is needed to associate the STATUS packet with the 1533 transaction that it refers to. 1535 The Progress Indicator and In-Response-To fields mark the 'left edge' 1536 and 'right edge' of the incomplete working area where holes are being 1537 filled in. If there are no holes, these fields will hold the same 1538 value. At the start of a transfer, both fields begin by expecting 1539 octet zero. When a transfer has completed successfully, these fields 1540 will contain the length of the file. 1542 Flags bits 8 and 9 are set to indicate the size of the offset 1543 descriptor as described for BEACON and METADATA packets, so that each 1544 STATUS packet is self-describing. The flag values here MUST be the 1545 same as indicated in the initial METADATA and DATA packets. 1547 Other bits in the Flags field are defined as: 1549 +-----+-------+---------------------------------------------------+ 1550 | Bit | Value | Meaning | 1551 +-----+-------+---------------------------------------------------+ 1552 | 12 | 0 | This packet does not include a timestamp field. | 1553 | 12 | 1 | This packet includes an optional timestamp field. | 1554 +-----+-------+---------------------------------------------------+ 1556 Flag bit 12 indicates that an optional sixteen-byte packet timestamp/ 1557 nonce field is carried in the packet before the Progress Indicator 1558 descriptor, as discussed for the DATA packet format. Packet 1559 timestamps are discussed further in Appendix A. 1561 +-----+-------+----------------------------------------+ 1562 | Bit | Value | Meaning | 1563 +-----+-------+----------------------------------------+ 1564 | 13 | 0 | file's METADATA has been received. | 1565 | 13 | 1 | file's METADATA has not been received. | 1566 +-----+-------+----------------------------------------+ 1568 If bit 13 of a STATUS packet has been set to indicate that the 1569 METADATA has not yet been received, then any METADATA SHOULD be 1570 resent. This flag should normally be clear. 1572 A receiver SHOULD tolerate lost METADATA that is later resent, but 1573 MAY insist on receiving METADATA at the start of a transfer. This is 1574 done by responding to early DATA packets with a voluntary STATUS 1575 packet that sets this flag bit, reports a status error code 10, sets 1576 the Progress Indicator field to zero, and does not include 1577 HOLESTOFILL information. 1579 +-----+-------+-----------------------------------------------------+ 1580 | Bit | Value | Meaning | 1581 +-----+-------+-----------------------------------------------------+ 1582 | 14 | 0 | this packet contains the complete current set of | 1583 | | | holes at the file-receiver. | 1584 | 14 | 1 | this packet contains incomplete hole-state; holes | 1585 | | | shown in this packet should supplement other | 1586 | | | incomplete hole-state known to the file-sender. | 1587 +-----+-------+-----------------------------------------------------+ 1589 Bit 14 of a 'holestofill' STATUS packet is only set when there are 1590 too many holes to fit within a single STATUS packet due to MTU 1591 limitations. This causes the hole list to be spread out over 1592 multiple STATUS packets, each of which conveys distinct sets of 1593 holes. This could occur, for instance, in a large file _put_ 1594 scenario with a long-delay feedback loop and poor physical layer 1595 conditions. These multiple STATUS packets will share In-Response-To 1596 information. When losses are light and/or hole reporting and repair 1597 is relatively frequent, all holes should easily fit within a single 1598 STATUS packet, and this flag will be clear. Bit 14 should normally 1599 be clear. 1601 In some rare cases of high loss, there may be too many holes in the 1602 received data to convey within a single STATUS's size, which is 1603 limited by the link MTU size. In this case, multiple STATUS packets 1604 may be generated, and Flags bit 14 should be set on each STATUS 1605 packet accordingly, to indicate that each packet holds incomplete 1606 results. The complete group of STATUS packets, each containing 1607 incomplete information, will share common In-Response-To information 1608 to distinguish them from any earlier groups. 1610 +-----+-------+-----------------------------------------------+ 1611 | Bit | Value | Meaning | 1612 +-----+-------+-----------------------------------------------+ 1613 | 15 | 0 | This STATUS was requested by the file-sender. | 1614 | 15 | 1 | This STATUS is sent voluntarily. | 1615 +-----+-------+-----------------------------------------------+ 1617 Flag bit 15 indicates whether the STATUS is sent voluntarily or due 1618 to a request by the sender. It affects content of the In-Response-To 1619 timestamp and descriptor fields. 1621 In the case of a transfer proceeding normally, immediately following 1622 the STATUS packet header shown above, is a set of "Hole" definitions 1623 indicating any lost packets. Each Hole definition is a pair of 1624 unsigned integers. For a 32-bit offset descriptor, each Hole 1625 definition consists of two four-octet unsigned integers: 1627 Hole Definition Format 1629 0 1 2 3 1630 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 1631 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1632 [ offset to start of hole (descriptor) ] 1633 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1634 [ offset to end of hole (descriptor) ] 1635 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1637 The start of the hole means the offset of the first unreceived byte 1638 in that hole. The end of the hole means the last unreceived byte in 1639 that hole. 1641 For 16-bit descriptors, each Hole definition holds two two-octet 1642 unsigned integers, while Hole definitions for 64- and 128-bit 1643 descriptors require two eight- and two sixteen-octet unsigned 1644 integers respectively. 1646 Holes MUST be listed in order, lowest values first. 1648 Since each Hole definition takes up eight octets when 32-bit offset 1649 lengths are used, we expect that well over 100 such definitions can 1650 fit in a single STATUS packet, given the IPv6 minimum MTU. (There 1651 may be cases where there is a very constrained backchannel compared 1652 to the forward channel streaming DATA packets. For these cases, 1653 implementations might deliberately request large holes that span a 1654 number of smaller holes and intermediate areas where DATA has already 1655 been received, so that previously-received DATA is deliberately 1656 resent. This aggregation of separate holes keeps the backchannel 1657 STATUS packet size down to avoid backchannel congestion.) 1659 A 'voluntary' STATUS can be sent at the start of each transaction. 1660 This indicates that the receiver is ready to receive the file, or 1661 indicates an error or rejection code, described below. A STATUS 1662 indicating a successfully established transfer has a Progress 1663 Indicator of zero and an In-Response-To field of zero. 1665 On receiving a STATUS packet, the sender SHOULD prioritize sending 1666 the necessary data to fill those holes, in order to advance the 1667 Progress Indicator at the receiver. 1669 The sender infers a completely-received transfer from the reported 1670 receiver window position. In the final STATUS packet sent by the 1671 receiver once the file to be transferred has been completely 1672 received, bit 14 MUST be 0 (indicating a complete set of holes in 1673 this packet), there MUST NOT be any holestofill offset pairs 1674 indicating holes, the In-Response-To and Progress Indicator fields 1675 contain the length of the file (i.e. point to the next octet after 1676 the file), and the voluntary flag MUST be set. This 'completed' 1677 STATUS may be repeated, depending on subsequent sender behaviour, 1678 while internal state about the transfer remains available to the 1679 receiver. 1681 Because METADATA not mandatory for implementations, the file receiver 1682 may not know the length of a file if METADATA is never sent. The 1683 sender MUST set the EOD End of Data flag in each DATA packet that 1684 sends the last byte of the file, and SHOULD request a STATUS 1685 acknowledgement when the EOD flag is set. If METADATA has been sent 1686 and the EOD comes earlier than a previously reported length of a 1687 file, an unspecified error 0x01, as described below, is returned in 1688 the STATUS message responding to that DATA packet and EOD flag. If a 1689 stream is being marked EOD, the receiver acknowledges this with a 1690 Success 0x00 code. 1692 In the case of an error causing a transfer to be aborted, the Status 1693 field holds a code that can be used to explain the cause of the error 1694 to the other peer. A zero value indicates that there have been no 1695 significant errors (this is called a "success STATUS" within this 1696 document), while any non-zero value means the transaction should be 1697 aborted (this is called a "failure STATUS"). 1699 +----------------+--------------------------------------------------+ 1700 | Error Code | Meaning | 1701 | Status Value | | 1702 +----------------+--------------------------------------------------+ 1703 | 0x00 | Success, No Errors. | 1704 | 0x01 | Unspecified Error. | 1705 | 0x02 | Unable to send file due to resource constraints. | 1706 | 0x03 | Unable to receive file due to resource | 1707 | | constraints. | 1708 | 0x04 | File not found. | 1709 | 0x05 | Access Denied. | 1710 | 0x06 | Unknown Id field for transaction. | 1711 | 0x07 | Did not delete file. | 1712 | 0x08 | File length is longer than receiver can support. | 1713 | 0x09 | File offset descriptors do not match expected | 1714 | | use or file length. | 1715 | 0x0A | Unsupported Saratoga packet type received. | 1716 | 0x0B | Unsupported Request Type received. | 1717 | 0x0C | REQUEST is now terminated due to an internal | 1718 | | timeout. | 1719 | 0x0D | DATA flag bits describing transfer have changed | 1720 | | unexpectedly. | 1721 | 0x0E | Receiver is no longer interested in receiving | 1722 | | this file. | 1723 | 0x0F | File is in use. | 1724 | 0x10 | METADATA required before transfer can be | 1725 | | accepted. | 1726 | 0x11 | A STATUS error message has been received | 1727 | | unexpectedly, so REQUEST is terminated. | 1728 +----------------+--------------------------------------------------+ 1730 The recipient of a failure STATUS MUST NOT try to process the 1731 Progress Indicator, In-Response-To, or Hole offsets, because, in some 1732 types of error conditions, the packet's sender may not have any way 1733 of setting them to the right length for the transaction. 1735 When sending an indefinite-length stream, the possibility of offset 1736 sequence numbers wrapping back to zero must be considered. This can 1737 be protected against by using large offsets, and by the stream 1738 receiver. The receiver MUST separate out holes before the offset 1739 wraps to zero from holes after the wrap, and send Hole definitions in 1740 different STATUS packets, with Flag 14 set to mark them as 1741 incomplete. Any Hole straddling a sequence wrap MUST be broken into 1742 two separate Holes, with the second Hole starting at zero. The 1743 timestamps in STATUS packets carrying any pre-wrap holes should be 1744 earlier than the timestamp in later packets, and should repeat the 1745 timestamp of the last DATA packet seen for that offset sequence 1746 before the following wrap to zero occurred. Receivers indicate that 1747 they no longer wish to receive streams by sending Status Code 0C. 1749 5. The Directory Entry 1751 Directory Entries have two uses within Saratoga: 1753 1. Within a METADATA packet, a Directory Entry is used to give 1754 information about the file being transferred, in order to 1755 facilitate proper reassembly of the file and to help the file- 1756 receiver understand how recently the file may have been created 1757 or modified. 1759 2. When a peer requests a directory record via a _getdir_ REQUEST, 1760 the other peer generates a file containing a series of one or 1761 more concatenated Directory Entry records, and transfers this 1762 file as it would transfer the response to a normal _get_ REQUEST, 1763 sending the records together within DATA packets. This file may 1764 be either temporary or within-memory and not actually a part of 1765 the host's file system itself. 1767 Directory Entry Format 1769 0 1 2 3 1770 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 1771 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1772 |1| Properties [ Size (descriptor) ] 1773 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1774 | File modification time (using year 2000 epoch) | 1775 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1776 | File creation time (using year 2000 epoch) | 1777 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1778 | / 1779 + / 1780 / / 1781 / File Path (max 1024 octets,variable length) / 1782 / ... // 1783 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-// 1785 where 1786 +------------+------------------------------------------------------+ 1787 | field | description | 1788 +------------+------------------------------------------------------+ 1789 | Properties | if set, bit 7 of this field indicates that the entry | 1790 | | corresponds to a directory. Bit 6, if set, | 1791 | | indicates that the file is "special". A special | 1792 | | file may not be directly transferable as it | 1793 | | corresponds to a symbolic link, a named pipe, a | 1794 | | device node, or some other "special" filesystem | 1795 | | object. A file-sender may simply choose not to | 1796 | | include these types of files in the results of a | 1797 | | _getdir_ request. Bits 8 and 9 are flags that | 1798 | | indicate the width of the following descriptor field | 1799 | | that gives file size. Bit 10 indicates that the | 1800 | | file is to be handled by Saratoga as a bundle, and | 1801 | | passed to a bundle agent. | 1802 | Size | the size of each file or directory in octets. This | 1803 | | is a descriptor, varying as needed in each entry for | 1804 | | the size of the file. For convenience in the | 1805 | | figure, it is shown here as a 16-bit descriptor for | 1806 | | a small file. | 1807 | Mtime | a timestamp showing when the file or directory was | 1808 | | modified. | 1809 | Ctime | a timestamp of the last status change for this file | 1810 | | or directory. | 1811 | File Path | contains the file's name relative within the | 1812 | | requested path of the _getdir_ transaction, a | 1813 | | maximum of 1024-octet UTF-8 string, which is | 1814 | | null-terminated to indicate its end. The File Path | 1815 | | may contain additional null padding in the null | 1816 | | termination to allow Directory Entries to each be | 1817 | | allocated a fixed amount of space or to place an | 1818 | | integer number of Directory Entries in each DATA | 1819 | | packet for debugging purposes. | 1820 +------------+------------------------------------------------------+ 1822 The first bit of the Directory Entry is always 1, to indicate the 1823 start of the record and the end of any padding from previous 1824 Directory Entries. 1826 +-------+-------+---------------------+ 1827 | Bit 6 | Bit 7 | Properties conveyed | 1828 +-------+-------+---------------------+ 1829 | 0 | 0 | normal file. | 1830 | 0 | 1 | normal directory. | 1831 | 1 | 0 | special file. | 1832 | 1 | 1 | special directory. | 1833 +-------+-------+---------------------+ 1835 Streams listed in a directory should be marked as special. If a 1836 stream is being transferred, its size is unknown -- otherwise it 1837 would be a file. The size property of a Directory Entry for a stream 1838 is therefore expected to be zero. 1840 +-------+-------+-------------------------------------------------+ 1841 | Bit 8 | Bit 9 | Properties conveyed | 1842 +-------+-------+-------------------------------------------------+ 1843 | 0 | 0 | File size is indicated in a 16-bit descriptor. | 1844 | 0 | 1 | File size is indicated in a 32-bit descriptor. | 1845 | 1 | 0 | File size is indicated in a 64-bit descriptor. | 1846 | 1 | 1 | File size is indicated in a 128-bit descriptor. | 1847 +-------+-------+-------------------------------------------------+ 1849 Flag bits 8 and 9 of Properties are descriptor size flags, with 1850 similar meaning as before, describing the size of the File Size 1851 descriptor that follows the Properties field. When a single 1852 Directory Entry appears in the METADATA packet, these flags SHOULD 1853 match flag bits 8 and 9 in the METADATA header. (A smaller 1854 descriptor size may be indicated in the Directory Entry when doing 1855 test transfers of small files using large descriptors.) 1857 +--------+------------------------------------+ 1858 | Bit 10 | Properties conveyed | 1859 +--------+------------------------------------+ 1860 | 0 | File really is a file. | 1861 | 1 | File is to be treated as a bundle. | 1862 +--------+------------------------------------+ 1864 Bit 10 of Directory Entry Properties is a bundle flag, as indicated 1865 in and matching the METADATA header. Use of Saratoga with bundles is 1866 discussed further in [I-D.wood-dtnrg-saratoga]. 1868 +--------+----------------------------------------------------------+ 1869 | Bit 13 | Use | 1870 +--------+----------------------------------------------------------+ 1871 | 0 | This file's content MUST be delivered reliably without | 1872 | | errors using UDP. | 1873 | 1 | This file's content MAY be delivered unreliably, or | 1874 | | partly unreliably, where errors are tolerated, using | 1875 | | UDP-Lite. | 1876 +--------+----------------------------------------------------------+ 1878 Bit 13 indicates whether the file must be sent reliably or can be 1879 sent at least partly unreliably, using UDP-Lite. This matches 1880 METADATA flag use. 1882 Undefined or unused flag bits of the Properties field default to 1883 zero. Bit 0 is always 1, to indicate the start of a Directory Entry. 1884 In general, bits 1-7 of Properties are for matters related to the 1885 sender's filesystem, while bits 8-15 are for matters related to 1886 transport over Saratoga. 1888 It may be reasonable that files are visible in Directory Entries only 1889 when they can be transferred to the requester - this may depend on 1890 e.g. having appropriate access permissions or being able to handle 1891 large filesizes. But requesters only capable of handling small files 1892 MUST be able to skip through large descriptors for large file sizes. 1893 Directory sizes are not calculated or sent, and a Size of 0 is given 1894 instead for directories, which are considered zero-length files. 1896 The "epoch" format used in file creation and modification timestamps 1897 in directory entries indicates the unsigned number of seconds since 1898 the start of January 1, 2000 in UTC. The times MUST include all leap 1899 seconds. Using unsigned 32-bit values means that these time fields 1900 will not wrap until after the year 2136. 1902 Converting from unix CTime/MTime holding a time past January 1, 2000 1903 but with the traditional 1970 epoch means subtracting the fixed value 1904 of 946 684 822 seconds, which includes the 22 leap seconds that were 1905 added to UTC between 1 January 1970 and 1 January 2000. A unix time 1906 before 2000 is rounded to January 1, 2000. 1908 A file-receiver should preserve the timestamp information received in 1909 the METADATA for its own copy of the file, to allow newer versions of 1910 files to propagate and supercede older versions. 1912 6. Behaviour of a Saratoga Peer 1914 This section describes some details of Saratoga implementations and 1915 uses the RFC 2119 standards language to describe which portions are 1916 needed for interoperability. 1918 6.1. Saratoga Transactions 1920 Following are descriptions of the packet exchanges between two peers 1921 for each type of transaction. Exchanges rely on use of the Id field 1922 to match responses to requests, as described earlier in Section 4.2. 1924 6.1.1. The _get_ Transaction 1926 1. A peer (the file-receiver) sends a REQUEST packet to its peer 1927 (the file-sender). The Flags bits are set to indicate that this 1928 is not a _delete_ request, nor does the File Path indicate a 1929 directory. Each _get_ transaction corresponds to a single file, 1930 and fetching multiple files requires sending multiple REQUEST 1931 packets and using multiple different transaction Ids so that 1932 responses can be differentiated and matched to REQUESTs based on 1933 the Id field. If a specific file is being requested, then its 1934 name is filled into the File Path field, otherwise it is left 1935 null and the file-sender will send a file of its choice. 1937 2. If the _get_ request is rejected, then a STATUS packet containing 1938 an error code in the Status field is sent and the transaction is 1939 terminated. This STATUS packet MUST be sent to reject and 1940 terminate the transaction. The error code MAY make use of the 1941 "Unspecified Error" value for security reasons. Some REQUESTs 1942 might also be rejected for specifying files that are too large to 1943 have their lengths encoded within the maximum integer field width 1944 advertised by bits 8 and 9 of the REQUEST. 1946 3. If the _get_ request is accepted, then a STATUS packet MAY be 1947 sent with an error code of 00 and an In-Response-To field of 1948 zero, to indicate acceptance. Sending other packets (METADATA or 1949 DATA) also indicates acceptance. The file-sender SHOULD generate 1950 and send a METADATA packet. A METADATA packet that is received 1951 MUST be parsed. The sender MUST send the contents of the file or 1952 stream as a series of DATA packets. In the absence of STATUS 1953 packets being requested from the receiver, if the file-sender 1954 believes it has finished sending the file and is not on a 1955 unidirectional link, it MUST send the last DATA packet with the 1956 Flags bit set requesting a STATUS response from the file- 1957 receiver. The last DATA packet MUST always have its End of Data 1958 (EOD) bit set. This can be followed by empty DATA packets with 1959 the Flags bits set with EOD and requesting a STATUS until either 1960 a STATUS packet is received, or the inactivity timer expires. 1961 All of the DATA packets MUST use field widths for the file offset 1962 descriptor fields that match what the Flags of the METADATA 1963 packet specified. Some arbitrarily selected DATA packets may 1964 have the Flags bit set that requests a STATUS packet. The file- 1965 receiver MAY voluntarily send STATUS packets at other times, 1966 where the In-Response-To field MUST set to zero. The file- 1967 receiver SHOULD voluntarily send a STATUS packet in response to 1968 the first DATA packet. 1970 4. As the file-receiver takes in the DATA packets, it writes them 1971 into the file locally. The file-receiver keeps track of missing 1972 data in a hole list. Periodically the file sender will set the 1973 ack flag bit in a DATA packet and request a STATUS packet from 1974 the file-receiver. The STATUS packet can include a copy of this 1975 hole list if there are holes. File-receivers MUST send a STATUS 1976 packet immediately in response to receiving a DATA packet with 1977 the Flags bit set requesting a STATUS. 1979 5. If the file-sender receives a STATUS packet with a non-zero 1980 number of holes, it re-fetches the file data at the specified 1981 offsets and re-transmits it. If the METADATA packet has not been 1982 received, this is indicated by a bit in the STATUS packet, and 1983 the METADATA packet can be retransmitted. The file-sender MUST 1984 retransmit data from any holes reported by the file-receiver 1985 before proceeding further with new DATA packets. 1987 6. When the file-receiver has fully received the file data and any 1988 METADATA packet, then it sends a STATUS packet indicating that 1989 the transaction is complete, and it terminates the transaction 1990 locally, although it MUST persist in responding to any further 1991 DATA packets received from the file-sender with 'completed' 1992 STATUSes, as described in Section 4.5, for some reasonable amount 1993 of time. Starting a timer on sending a completed STATUS and 1994 resetting it whenever a received DATA/sent 'completed' STATUS 1995 transaction takes place, then removing all session state on timer 1996 expiry, is one approach to this. 1998 Given that there may be a high degree of asymmetry in link bandwidth 1999 between the file-sender and file-receiver, the STATUS packets should 2000 be carefully generated so as to not congest the feedback path. This 2001 means that both a file-sender should be cautious in setting the DATA 2002 Flags bit requesting STATUSes, and also that a file-receiver should 2003 be cautious in gratuitously generating STATUS packets of its own 2004 volition. When sending on known unidirectional links, a file-sender 2005 cannot reasonably expect to receive STATUS packets, so should never 2006 request them. 2008 6.1.2. The _getdir_ Transaction 2010 A _getdir_ transaction to obtain a Directory Record proceeds through 2011 the same states as the _get_ transaction. Rather than transferring 2012 the contents of a file from the file-receiver to the file-sender, a 2013 set of records representing the contents of a directory are 2014 transferred as a file. These records can be parsed and dealt with by 2015 the file-receiver as desired. There is no requirement that a 2016 Saratoga peer send the full contents of a directory listing; a peer 2017 may filter the results to only those entries that are actually 2018 accessible to the requesting peer. 2020 Any file system entries that would normally be contained in the 2021 directory records, but that have sizes greater than the receiver has 2022 indicated that it can support in its BEACON, MUST be filtered out. 2024 6.1.3. The _delete_ Transaction 2026 1. A peer sends a REQUEST packet with the bit set indicating that it 2027 is a deletion request and the path to be deleted is filled into 2028 the File Path field. The File Path MUST be filled in for 2029 _delete_ transactions, unlike for _get_ transactions. 2031 2. The other peer replies with a feedback STATUS packet whose Id 2032 matches the Id field of the _delete_ REQUEST. This STATUS has a 2033 Status code that indicates that the file is not currently present 2034 on the filesystem (indicated by the 00 Status field in a success 2035 STATUS), or whether some error occurred (indicated by the non- 2036 zero Status field in a failure STATUS). This STATUS packet MUST 2037 have no Holes and 16-bit width zero-valued Progress Indicator and 2038 In-Response-To fields. 2040 If a request is received to delete a file that is already deleted, a 2041 STATUS with Status code 00 and other fields as described above is 2042 sent back in acknowledgement. This response indicates that the 2043 indicated file is not present, not the exact action sequence that led 2044 to a not-present file. This idempotent behaviour ensures that loss 2045 of STATUS acknowledgements and repeated _delete_ requests are handled 2046 properly. 2048 6.1.4. The _put_ Transaction 2050 A _put_ transaction proceeds as a _get_ does, except the file-sender 2051 and file-receiver roles are exchanged between peers. In a _put_ a 2052 PUT REQUEST is sent. 2054 However, in a 'blind _put_', no REQUEST packet is ever sent. The 2055 file-sending end senses that the transaction is in progress when it 2056 receives METADATA or DATA packets for which it has no knowledge of 2057 the Id field. 2059 If the file-receiver decides that it will store and handle the _put_ 2060 request (at least provisionally), then it MUST send a voluntary (ie, 2061 not requested) success STATUS packet to the file-sender. Otherwise, 2062 it sends a failure STATUS packet. After sending a failure STATUS 2063 packet, it may ignore future packets with the same Id field from the 2064 file-sender, but it should, at a low rate, periodically regenerate 2065 the failure STATUS packet if the flow of packets does not stop. 2067 6.2. Beacons 2069 Sending BEACON packets is not required in any of the transactions 2070 discussed in this specification, but optional BEACONs can provide 2071 useful information in many situations. If a node periodically 2072 generates BEACON packets, then it should do so at a low rate which 2073 does not significantly affect in-progress data transfers. 2075 A node that supports multiple versions of Saratoga (e.g. version 1 2076 from this specification along with the older version 0), MAY send 2077 multiple BEACON packets showing different version numbers. The 2078 version number in a single BEACON should not be used to infer the 2079 larger set of protocol versions that a peer is compatible with. 2080 Similarly, a node capable of communicating via IPv4 and IPv6 MAY send 2081 separate BEACONs via both protocols, or MAY only send BEACONs on its 2082 preferred protocol. 2084 If a node receives BEACONs from a peer, then it SHOULD NOT attempt to 2085 start any _get_, _getdir_, or _delete_ transactions with that peer if 2086 bit 14 is not set in the latest received BEACONs. Likewise, if 2087 received BEACONs from a peer do not have bit 15 set, then _put_ 2088 transactions SHOULD NOT be attempted to that peer. Unlike the 2089 capabilities bits which prevent certain types of transactions from 2090 being attempted, the willingness bits are advisory, and transactions 2091 MAY be attempted even if the node is not advertising a willingness, 2092 as long as it advertises a capability. This avoids waiting for a 2093 willingness indication across long-delay links. 2095 6.3. Upper-Layer Interface 2097 No particular application interface functionality is required in 2098 implementations of this specification. The means and degree of 2099 access to Saratoga configuration settings, and transaction control 2100 that is offered to upper layers and applications, are completely 2101 implementation-dependent. In general, it is expected that upper 2102 layers (or users) can set timeout values for transaction requests and 2103 for inactivity periods during the transaction, on a per-peer or per- 2104 transaction basis, but in some implementations where the Saratoga 2105 code is restricted to run only over certain interfaces with well- 2106 understood operational latency bounds, then these timers MAY be hard- 2107 coded. 2109 6.4. Inactivity Timer 2111 In order to determine the liveliness of a transaction, Saratoga nodes 2112 may implement an inactivity timer for each peer they are expecting to 2113 see packets from. For each packet received from a peer, its 2114 associated inactivity timer is reset. If no packets are received for 2115 some amount of time, and the inactivity timer expires, this serves as 2116 a signal to the node that it should abort (and optionally retry) any 2117 sessions that were in progress with the peer. Information from the 2118 link interface (i.e. link down) can override this timer for point-to- 2119 point links. 2121 The actual length of time that the inactivity timer runs for is a 2122 matter of both implementation and deployment situation. Relatively 2123 short timers (on the order of several round-trip times) allow nodes 2124 to quickly react to loss of contact, while longer timers allow for 2125 transaction robustness in the presence of transient link problems. 2126 This document deliberately does not specify a particular inactivity 2127 timer value nor any rules for setting the inactivity timer, because 2128 the protocol is intended to be used in both long- and short-delay 2129 regimes. 2131 Specifically, the inactivity timer is started on sending REQUEST or 2132 STATUS packets. When sending packets not expected to elicit 2133 responses (BEACON, METADATA, or DATA without acknowledgement 2134 requests), there is no point to starting the local inactivity timer. 2136 For normal file transfers, there are simple rules for handling 2137 expiration of the inactivity timer during a _get_ or _put_ 2138 transaction. Once the timer expires, the file-sender SHOULD 2139 terminate the transaction state and cease to send DATA or METADATA 2140 packets. The file-receiver SHOULD stop sending STATUS packets, and 2141 MAY choose to store the file in some cache location so that the 2142 transfer can be recovered. This is possible by waiting for an 2143 opportunity to re-attempt the transaction and immediately sending a 2144 STATUS that only lists the parts of the file not yet received if the 2145 transaction is granted. In any case, a partially-received file MUST 2146 NOT be handled in any way that would allow another application to 2147 think it is complete. 2149 The file-sender may implement more complex timers to allow rate-based 2150 pacing or simple congestion control using information provided in 2151 STATUS packets, but such possible timers and their effects are 2152 deliberately not specified here. 2154 7. Mailing list 2156 There is a mailing list for discussion of Saratoga and its 2157 implementations. Contact Lloyd Wood for details. 2159 8. Security Considerations 2161 The design of Saratoga provides limited, deliberately lightweight, 2162 services for authentication of session requests, and for 2163 authentication or encryption of data files via keyed metadata 2164 checksums. This document does not specify privacy or access control 2165 for data files transferred. Privacy, access, authentication and 2166 encryption issues may be addressed within an implementation or 2167 deployment in several ways that do not affect the file transfer 2168 protocol itself. As examples, IPSec may be used to protect Saratoga 2169 implementations from forged packets, to provide privacy, or to 2170 authenticate the identity of a peer. Other implementation-specific 2171 or configuration-specific mechanisms and policies might also be 2172 employed for authentication and authorization of requests. 2173 Protection of file data and meta-data can also be provided by a 2174 higher-level file encryption facility. If IPsec is not required, use 2175 of encryption before the file is given to Saratoga is preferable. 2176 Basic security practices like not accepting paths with "..", not 2177 following symbolic links, and using a chroot() system call, among 2178 others, should also be considered within an implementation. 2180 Note that Saratoga is intended for single-hop transfers between 2181 peers. A METADATA checksum using a previously shared key can be used 2182 to decrypt or authenticate delivered DATA files. Saratoga can only 2183 provide payload encryption across a single Saratoga transfer, not 2184 end-to-end across concatenated separate hop-by-hop transfers through 2185 untrusted peers, as checksum verification of file integrity is 2186 required at each node. End-to-end data encryption, if required, MUST 2187 be implemented by the application using Saratoga. 2189 9. IANA Considerations 2191 IANA has allocated port 7542 (tcp/udp) for use by Saratoga. 2193 saratoga 7542/tcp Saratoga Transfer Protocol 2194 saratoga 7542/udp Saratoga Transfer Protocol 2196 IANA has allocated a dedicated IPv4 all-hosts multicast address 2197 (224.0.0.108) and a dedicated IPv6 link-local multicast addresses 2198 (FF02:0:0:0:0:0:0:6c) for use by Saratoga. 2200 10. Acknowledgements 2202 Developing and deploying the on-orbit IP-based infrastructure of the 2203 Disaster Monitoring Constellation, in which Saratoga has proven 2204 useful, has taken the efforts of hundreds of people over more than a 2205 decade. We thank them all. 2207 We thank James H. McKim as an early contributor to Saratoga 2208 implementations and specifications, while working for RSIS 2209 Information Systems at NASA Glenn. We regard Jim as an author of 2210 this document, but are prevented by the boilerplate five-author limit 2211 from naming him earlier. 2213 We thank Stewart Bryant, Dale Mellor, Cathryn Peoples, Kerrin Pine, 2214 Abu Zafar Shahriar and Dave Stewart for their review comments. 2216 Work on this specification at NASA's Glenn Research Center was funded 2217 by NASA's Earth Science Technology Office (ESTO). 2219 11. A Note on Naming 2221 Saratoga is named for the USS Saratoga (CV-3), the aircraft carrier 2222 sunk at Bikini Atoll that is now a popular diving site. 2224 12. References 2226 12.1. Normative References 2228 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 2229 August 1980. 2231 [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, 2232 April 1992. 2234 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2235 Requirement Levels", BCP 14, RFC 2119, March 1997. 2237 [RFC3309] Stone, J., Stewart, R., and D. Otis, "Stream Control 2238 Transmission Protocol (SCTP) Checksum Change", RFC 3309, 2239 September 2002. 2241 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 2242 10646", STD 63, RFC 3629, November 2003. 2244 12.2. Informative References 2246 [Hogie05] Hogie, K., Criscuolo, E., and R. Parise, "Using Standard 2247 Internet Protocols and Applications in Space", Computer 2248 Networks, Special Issue on Interplanetary Internet, vol. 2249 47, no. 5, pp. 603-650, April 2005. 2251 [I-D.wood-dtnrg-saratoga] 2252 Wood, L., McKim, J., Eddy, W., Ivancic, W., and C. 2253 Jackson, "Using Saratoga with a Bundle Agent as a 2254 Convergence Layer for Delay-Tolerant Networking", 2255 draft-wood-dtnrg-saratoga-10 (work in progress) , 2256 October 2012. 2258 [Ivancic10] 2259 Ivancic, W., Eddy, W., Stewart, D., Wood, L., Northam, J., 2260 and C. Jackson, "Experience with delay-tolerant networking 2261 from orbit", International Journal of Satellite 2262 Communications and Networking, Special Issue on best 2263 papers of the Fourth Advanced Satellite Mobile Systems 2264 Conference (ASMS 2008), vol. 28, issues 5-6, pp. 335-351, 2265 September-December 2010. 2267 [Jackson04] 2268 Jackson, C., "Saratoga File Transfer Protocol", Surrey 2269 Satellite Technology Ltd internal technical document , 2270 2004. 2272 [RFC0959] Postel, J. and J. Reynolds, "File Transfer Protocol", 2273 STD 9, RFC 959, October 1985. 2275 [RFC3366] Fairhurst, G. and L. Wood, "Advice to link designers on 2276 link Automatic Repeat reQuest (ARQ)", BCP 62, RFC 3366, 2277 August 2002. 2279 [RFC3828] Larzon, L-A., Degermark, M., Pink, S., Jonsson, L-E., and 2280 G. Fairhurst, "The Lightweight User Datagram Protocol 2281 (UDP-Lite)", RFC 3828, July 2004. 2283 [RFC5050] Scott, K. and S. Burleigh, "Bundle Protocol 2284 Specification", RFC 5050, November 2007. 2286 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 2287 Friendly Rate Control (TFRC): Protocol Specification", 2288 RFC 5348, September 2008. 2290 [RFC5405] Eggert, L. and G. Fairhurst, "Unicast UDP Usage Guidelines 2291 for Application Designers", BCP 145, RFC 5405, 2292 November 2008. 2294 [RFC6151] Turner, S. and L. Chen, "Updated Security Considerations 2295 for the MD5 Message-Digest and the HMAC-MD5 Algorithms", 2296 RFC 6151, March 2011. 2298 [Wood07a] Wood, L., Ivancic, W., Hodgson, D., Miller, E., Conner, 2299 B., Lynch, S., Jackson, C., da Silva Curiel, A., Cooke, 2300 D., Shell, D., Walke, J., and D. Stewart, "Using Internet 2301 Nodes and Routers Onboard Satellites", International 2302 Journal of Satellite Communications and 2303 Networking, Special Issue on Space Networks, vol. 25, no. 2304 2, pp. 195-216, March/April 2007. 2306 [Wood07b] Wood, L., Eddy, W., Ivancic, W., Miller, E., McKim, J., 2307 and C. Jackson, "Saratoga: a Delay-Tolerant Networking 2308 convergence layer with efficient link utilization", 2309 International Workshop on Satellite and Space 2310 Communications (IWSSC '07) Salzburg, September 2007. 2312 [Wood11] Wood, L., Smith, C., Eddy, W., Ivancic, W., and C. 2313 Jackson, "Taking Saratoga from space-based ground sensors 2314 to ground-based space sensors", IEEE Aerospace 2315 Conference Big Sky, Montana, March 2011. 2317 [wood-tsvwg-saratoga-congestion-control] 2318 Wood, L., Eddy, W., and W. Ivancic, "Congestion control 2319 for the Saratoga protocol", 2320 draft-wood-tsvwg-saratoga-congestion-control-02 (work in 2321 progress) , October 2012. 2323 Appendix A. Timestamp/Nonce field considerations 2325 Timestamps are useful in DATA packets when the time that the packet 2326 or its payload was generated is of importance; this can be necessary 2327 when streaming sensor data recorded and packetized in real time. The 2328 format of the optional timestamp, whose presence is indicated by a 2329 flag bit, is implementation-dependent within the available fixed- 2330 length 128-bit field. How the contents of this timestamp field are 2331 used and interpreted depends on local needs and conventions and the 2332 local implementation. 2334 However, one simple suggested format for timestamps is to begin with 2335 a POSIX time_t representation of time, in network byte order. This 2336 is either a 32-bit or 64-bit signed integer representing the number 2337 of seconds since 1970. The remainder of this field can be used 2338 either for a representation of elapsed time within the current 2339 second, if that level of accuracy is required, or as a nonce field 2340 uniquely identifying the packet or including other information. Any 2341 locally-meaningful flags identifying a type of timestamp or timebase 2342 can be included before the end of the field. Unused parts of this 2343 field MUST be set to zero. 2345 There are many different representations of timestamps and timebases, 2346 and this draft is too short to cover them in detail. One suggested 2347 flag representation of different timestamp fields is to use the least 2348 significant bits at the end of the timestamp/nonce field as: 2350 +---------+---------------------------------------------------------+ 2351 | Status | Meaning | 2352 | Value | | 2353 +---------+---------------------------------------------------------+ 2354 | 00 | No flags set, local interpretation of field. | 2355 | 01 | 32-bit timestamp at start of field indicating whole | 2356 | | seconds from epoch. | 2357 | 02 | 64-bit timestamp at start of field indicating whole | 2358 | | seconds elapsed from epoch. | 2359 | 03 | 32-bit timestamp, as in 01, followed by 32-bit | 2360 | | timestamp indicating fraction of the second elapsed. | 2361 | 04 | 64-bit timestamp, as in 02, followed by 32-bit | 2362 | | timestamp indicating fraction of the second elapsed. | 2363 +---------+---------------------------------------------------------+ 2365 Other values may indicate specific epochs or timebases, as local 2366 requirements dictate. There are many ways to define and use time 2367 usefully. 2369 Echoing timestamps back to the file-sender is also useful for 2370 tracking flow conditions. This does not require the echoing receiver 2371 to understand the timestamp format or values in use. The use of 2372 timestamp values may assist in developing algorithms for flow control 2373 (including TCP-Friendly Rate Control 2374 [wood-tsvwg-saratoga-congestion-control]) or other purposes. 2375 Timestamp values provide a useful mechanism for Saratoga peers to 2376 measure path and round-trip latency. 2378 Authors' Addresses 2380 Lloyd Wood 2381 University of Surrey alumni 2382 Sydney, New South Wales 2383 Australia 2385 Email: L.Wood@society.surrey.ac.uk 2386 Wesley M. Eddy 2387 MTI Systems 2388 MS 500-ASRC 2389 NASA Glenn Research Center 2390 21000 Brookpark Road 2391 Cleveland, OH 44135 2392 USA 2394 Phone: +1-216-433-6682 2395 Email: wes@mti-systems.com 2397 Charles Smith 2398 Vallona Networks 2399 7 Wattle Crescent 2400 Phegans Bay, New South Wales 2256 2401 Australia 2403 Phone: +61-404-05-8974 2404 Email: charlesetsmith@me.com 2406 Will Ivancic 2407 NASA Glenn Research Center 2408 21000 Brookpark Road, MS 54-5 2409 Cleveland, OH 44135 2410 USA 2412 Phone: +1-216-433-3494 2413 Email: William.D.Ivancic@grc.nasa.gov 2415 Chris Jackson 2416 Surrey Satellite Technology Ltd 2417 Tycho House 2418 Surrey Space Centre 2419 20 Stephenson Road 2420 Guildford, Surrey GU2 7YE 2421 United Kingdom 2423 Phone: +44-1483-803803 2424 Email: C.Jackson@sstl.co.uk